Added background colour again
Added wxTextCtrl methods Removed Imlib -> Recompile git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b926666447
commit
a81258bee4
42
TODO.txt
42
TODO.txt
@ -1,42 +0,0 @@
|
||||
********************* TODO list for wxWindows 2 ******************************
|
||||
|
||||
=============================== common ========================================
|
||||
|
||||
wxSocket, wxTCP etc..
|
||||
|
||||
wxMultiMedia
|
||||
|
||||
=============================== generic ======================================
|
||||
|
||||
wxTreeCtrl keyboard handling
|
||||
wxTreeCtrl icon support
|
||||
|
||||
wxListCtrl icon support in list mode
|
||||
|
||||
================================ MSW ==========================================
|
||||
|
||||
Consistent keyboard interface and focus behaviour
|
||||
currently, the focus is lost all the time (after a MessageBox, for example)
|
||||
and sometimes TABbing through controls doesn't work
|
||||
|
||||
================================ GTK ==========================================
|
||||
|
||||
Add support Set colour/baclgroundcolour in GTK widgets
|
||||
Correct tab navigation (seems to be a GTK feature)
|
||||
Finish DnD
|
||||
Add Clipboard
|
||||
Help system (not sure about this one)
|
||||
Show accelerator in menus
|
||||
More controls with bitmaps
|
||||
Speed up bitmap saving
|
||||
Add wxBitmapHandler
|
||||
Fix printing of bitmaps
|
||||
Implement wxRadioBox layout
|
||||
Finish wxTextCtrl
|
||||
Finish native wxTreeCtrl
|
||||
Implement wxPalette
|
||||
Implement wxDirDialog
|
||||
Support cooperation between Qt and wxWindows
|
||||
Fix toolbar tips
|
||||
TrueType support (just kidding)
|
||||
|
41
docs/gtk/todo.txt
Normal file
41
docs/gtk/todo.txt
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
-------------------- High priority ---------------------
|
||||
|
||||
wxTreeCtrl
|
||||
-> Keyboard handling, icon support and new API.
|
||||
|
||||
wxListCtrl
|
||||
-> Icon support in list mode.
|
||||
|
||||
Finish DnD
|
||||
-> Only decoding filelist and visual feedback missing
|
||||
|
||||
wxClipboard
|
||||
-> Urg.
|
||||
|
||||
wxHelpController
|
||||
-> Karsten ?
|
||||
|
||||
Implement wxRadioBox layout
|
||||
-> I'm so lazy.
|
||||
|
||||
Fix printing of bitmaps
|
||||
-> No idea. Postponed.
|
||||
|
||||
Add support SetForegroundColour in GTK widgets
|
||||
-> On the way.
|
||||
|
||||
-------------------- Low priority ---------------------
|
||||
|
||||
Implement wxPalette
|
||||
-> I never understood that. Postponed.
|
||||
|
||||
Implement wxDirDialog
|
||||
-> Not heard of. Postponed.
|
||||
|
||||
Show accelerator in menus
|
||||
-> Changed in GTK 1.1.X. Postponed.
|
||||
|
||||
Correct tab navigation
|
||||
-> seems to be broken in GTK. Postponed.
|
||||
|
@ -61,6 +61,7 @@ class wxButton: public wxControl
|
||||
void Enable( bool enable );
|
||||
void SetFont( const wxFont &font );
|
||||
void SetBackgroundColour( const wxColour &colour );
|
||||
void SetForegroundColour( const wxColour &colour );
|
||||
};
|
||||
|
||||
#endif // __GTKBUTTONH__
|
||||
|
@ -143,6 +143,8 @@ public:
|
||||
virtual void AddChild(wxWindow *child);
|
||||
virtual void SetConstraintSizes(bool recurse);
|
||||
virtual bool DoPhase(int phase);
|
||||
virtual void SetFont( const wxFont &font );
|
||||
virtual void SetBackgroundColour( const wxColour &colour );
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
|
@ -67,13 +67,12 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
bool IsModified() const { return m_modified; }
|
||||
void SetModified() { m_modified = TRUE; }
|
||||
void DiscardEdits() { m_modified = FALSE; }
|
||||
/*
|
||||
wxString GetLineText( long lineNo ) const;
|
||||
void OnDropFiles( wxDropFilesEvent &event );
|
||||
long PositionToXY( long pos, long *x, long *y ) const;
|
||||
long XYToPosition( long x, long y );
|
||||
int GetNumberOfLines();
|
||||
*/
|
||||
long XYToPosition( long x, long y ) const;
|
||||
int GetLineLength(long lineNo) const;
|
||||
int GetNumberOfLines() const;
|
||||
virtual void SetInsertionPoint( long pos );
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual void SetEditable( bool editable );
|
||||
|
@ -243,6 +243,7 @@ public:
|
||||
bool HasVMT();
|
||||
virtual void ImplementSetSize();
|
||||
virtual void ImplementSetPosition();
|
||||
GtkStyle *GetWidgetStyle();
|
||||
|
||||
wxWindow *m_parent;
|
||||
wxList m_children;
|
||||
@ -274,11 +275,11 @@ public:
|
||||
bool m_needParent;
|
||||
bool m_hasScrolling;
|
||||
bool m_isScrolling;
|
||||
bool m_hasOwnStyle;
|
||||
bool m_hasVMT;
|
||||
bool m_sizeSet;
|
||||
bool m_resizing;
|
||||
GdkGC *m_scrollGC;
|
||||
GtkStyle *m_widgetStyle;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -61,6 +61,7 @@ class wxButton: public wxControl
|
||||
void Enable( bool enable );
|
||||
void SetFont( const wxFont &font );
|
||||
void SetBackgroundColour( const wxColour &colour );
|
||||
void SetForegroundColour( const wxColour &colour );
|
||||
};
|
||||
|
||||
#endif // __GTKBUTTONH__
|
||||
|
@ -143,6 +143,8 @@ public:
|
||||
virtual void AddChild(wxWindow *child);
|
||||
virtual void SetConstraintSizes(bool recurse);
|
||||
virtual bool DoPhase(int phase);
|
||||
virtual void SetFont( const wxFont &font );
|
||||
virtual void SetBackgroundColour( const wxColour &colour );
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
|
@ -67,13 +67,12 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
bool IsModified() const { return m_modified; }
|
||||
void SetModified() { m_modified = TRUE; }
|
||||
void DiscardEdits() { m_modified = FALSE; }
|
||||
/*
|
||||
wxString GetLineText( long lineNo ) const;
|
||||
void OnDropFiles( wxDropFilesEvent &event );
|
||||
long PositionToXY( long pos, long *x, long *y ) const;
|
||||
long XYToPosition( long x, long y );
|
||||
int GetNumberOfLines();
|
||||
*/
|
||||
long XYToPosition( long x, long y ) const;
|
||||
int GetLineLength(long lineNo) const;
|
||||
int GetNumberOfLines() const;
|
||||
virtual void SetInsertionPoint( long pos );
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual void SetEditable( bool editable );
|
||||
|
@ -243,6 +243,7 @@ public:
|
||||
bool HasVMT();
|
||||
virtual void ImplementSetSize();
|
||||
virtual void ImplementSetPosition();
|
||||
GtkStyle *GetWidgetStyle();
|
||||
|
||||
wxWindow *m_parent;
|
||||
wxList m_children;
|
||||
@ -274,11 +275,11 @@ public:
|
||||
bool m_needParent;
|
||||
bool m_hasScrolling;
|
||||
bool m_isScrolling;
|
||||
bool m_hasOwnStyle;
|
||||
bool m_hasVMT;
|
||||
bool m_sizeSet;
|
||||
bool m_resizing;
|
||||
GdkGC *m_scrollGC;
|
||||
GtkStyle *m_widgetStyle;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
0x0 0x0 0x0
|
||||
0xff 0xff 0xff
|
||||
0xdd 0xdd 0xdd
|
||||
0xbb 0xbb 0xbb
|
||||
0x99 0x99 0x99
|
||||
0x77 0x77 0x77
|
||||
0x55 0x55 0x55
|
||||
0x33 0x33 0x33
|
||||
0x88 0x0 0x0
|
||||
0xcc 0x0 0x0
|
||||
0xff 0x0 0x0
|
||||
0xff 0x44 0x0
|
||||
0xff 0x88 0x0
|
||||
0xff 0xcc 0x0
|
||||
0xff 0xff 0x0
|
||||
0xcc 0xcc 0x0
|
||||
0x88 0x88 0x0
|
||||
0x60 0x60 0x0
|
||||
0x0 0x43 0x0
|
||||
0x0 0x7f 0x0
|
||||
0x0 0xcc 0x0
|
||||
0x0 0xff 0x0
|
||||
0x0 0x44 0x44
|
||||
0x0 0x88 0x88
|
||||
0x0 0xff 0xff
|
||||
0x0 0x0 0x44
|
||||
0x0 0x0 0x88
|
||||
0x0 0x0 0xff
|
||||
0xff 0xcc 0x97
|
||||
0xef 0xb1 0x7b
|
||||
0xdf 0x98 0x5f
|
||||
0xbf 0x87 0x56
|
||||
0x9f 0x6b 0x42
|
||||
0x7f 0x57 0x26
|
||||
0x5f 0x39 0xc
|
||||
0x3f 0x1c 0x0
|
||||
0x21 0x0 0x0
|
||||
0x0 0x43 0x87
|
||||
0x2d 0x70 0xaf
|
||||
0x5a 0x9e 0xd7
|
||||
0x87 0xcc 0xff
|
||||
0xff 0xe0 0xba
|
||||
0x21 0x43 0xf
|
||||
0x3d 0x5d 0x25
|
||||
0x59 0x78 0x3a
|
||||
0x75 0x93 0x4f
|
||||
0x91 0xae 0x64
|
||||
0xad 0xc8 0x7a
|
||||
0xf0 0xa8 0xef
|
||||
0xd0 0x88 0xd0
|
||||
0xaf 0x66 0xaf
|
||||
0x8e 0x44 0x8e
|
||||
0x6d 0x22 0x6d
|
||||
0x4b 0x0 0x4b
|
||||
0xff 0xc0 0xbc
|
||||
0xff 0x93 0x91
|
||||
0xff 0x66 0x67
|
||||
0xd8 0xf2 0xbf
|
||||
0xff 0xc9 0x68
|
||||
0xff 0x96 0x67
|
||||
0xa5 0x60 0xff
|
||||
0x51 0xff 0x99
|
||||
0x3f 0xa5 0x63
|
||||
0x98 0x90 0x67
|
@ -1,99 +0,0 @@
|
||||
################################
|
||||
# Config file for Imlib #
|
||||
################################
|
||||
|
||||
# The file that contains palette entries for a global palette for all Imlib
|
||||
# based programs.
|
||||
# options: full path to palette file
|
||||
PaletteFile /etc/im_palette.pal
|
||||
# This defines if when the display is greater than 8 bit, that it still remaps
|
||||
# the images to the palette defined, rather than using "perfect" rendering
|
||||
# options: yes/no
|
||||
PaletteOverride no
|
||||
# If remapping to the palette, whether to use Floyd-Steinberg dithering. Saying
|
||||
# yes will slow things down though.
|
||||
# options: yes/no
|
||||
Dither yes
|
||||
# when remapping to the palette, saying fast will reduce accuracy, but improve
|
||||
# speed quite considerably
|
||||
# options: fast/slow
|
||||
Remap fast
|
||||
# This turns on dithering for 15/16 bpp. This makes smooth gradients look much
|
||||
# smoother - in fact almost perfect. You will find it nigh impossible to tell
|
||||
# the difference between 15/16bpp dithered and 24bpp. Unless you have extra
|
||||
# CPU to burn, its not recommended, unless you are a image quality freak, and
|
||||
# you insist on maximum quality in 15/16bpp. It does slow things down. It
|
||||
# would be best to leave it off and let the applications themselves allow
|
||||
# you to select it for certain purposes only.
|
||||
HighQuality off
|
||||
# This option if specified off will force MIT-SHM off, otherwise will allow
|
||||
# Imlib to work it out itself.
|
||||
Mit-Shm on
|
||||
# This will turn shared pixmaps on or off (off forces off, on lets imlib
|
||||
# work it out). This is yet another speedup. leave it on unless it doesn't
|
||||
# work.. then turn it off.
|
||||
SharedPixmaps off
|
||||
# This speeds up rendering considerably, but may not work on your hardware
|
||||
# due to it bypassing a few layers and byte-twiddling the rendered image data
|
||||
# manually, and due to endianess, bit-ordering or RGB ordering it may screw up
|
||||
# and not work, so try it.. if things work great!, if not, wait until a
|
||||
# renderer for your situation is written, or write one yourself and donate
|
||||
# it. It's easy to do, just look at rend.c
|
||||
FastRender on
|
||||
# This is in fact a workaround due to Solaris's shared memory theories.
|
||||
# This specifies the maximum size of a shared memory chunk in bytes. If an
|
||||
# image is larger that this in bytes for the video mode you're in, imlib will
|
||||
# not use MIT-SHM. if you comment this out, imlib will use as much memory as
|
||||
# necessary to render the image.
|
||||
# Shm_Max_Size 1000000
|
||||
# This turns Image loading (24) bit caching on or off. HIGHLY suggested to be
|
||||
# turned ON!
|
||||
Image_Cache on
|
||||
# Image cache size in bytes. As with any cache, the more, the better. If you
|
||||
# load the same image more than once. Imlib will used a previously loaded
|
||||
# copy, and if its freed, the Image_Cache_Size amount of bytes of image data
|
||||
# are kept even after being freed, in case the same image is loaded again soon
|
||||
# afterwards. Neat eh?
|
||||
Image_Cache_Size 4000000
|
||||
# This turns the pixmap caching system on or off. If on, only well-behaved
|
||||
# programs that conform to the specs for using Imlib will exhibit the
|
||||
# behavior as expected. It is suggested to leave this on, as it will boost
|
||||
# performance considerably, speed-wise and memory-wise. The reason apps need
|
||||
# to be well-behaved is so that they don't go drawing on, and XFreePixmap'ing
|
||||
# these pixmaps themselves, because this will trample all over the cache
|
||||
# and give very horrid effects, or even make the apps crash with segfaults or
|
||||
# Xlib errors.
|
||||
Pixmap_Cache on
|
||||
# Pixmap cache is in **-> BITS <-**... the end result is APPROXIMATELY
|
||||
# 10000000 bits of pixmap make your Xserver grow by 1Mb of RAM (VERY rough).
|
||||
# As with any cache, the more, the better. The more you have, the less likely
|
||||
# it is that you will get cache misses and so performance on scaling the same
|
||||
# image to commonly used sizes (ie if 3 or 4 sizes of the same image are used)
|
||||
# will be lightning fast, in fact in some tests I did, in 16bpp up to 38 times
|
||||
# as fast, and in 8bpp (with dithering on) up to 105 times faster!!! (these
|
||||
# are nominal figures obtained on my machine. these are MAXIMUM speedup
|
||||
# results. Results may vary on other machines and according to the way
|
||||
# programs are written and use Imlib)
|
||||
Pixmap_Cache_Size 40000000
|
||||
# This FORCES Imlib to use the hexadecimal visual id stated here if it is
|
||||
# defined in the imrc. This bypasses Imlib's routines that hunt for the best
|
||||
# visual. You can obtain a list of visual ID's using the xdpyinfo command.
|
||||
# You should only need this if Imlib doesn't pick the correct visual or you
|
||||
# have strange hardware/Xserver combinations.
|
||||
#ForceVisualID 22
|
||||
# This allows Imlib to fall back on Imagemagick and/or NETPBM
|
||||
# utilities if it can't load the file.
|
||||
Fallback on
|
||||
# Default Gamma, Brightness and Contrast stuff....
|
||||
Gamma 1.0
|
||||
Brightness 1.0
|
||||
Contrast 1.0
|
||||
Red_Gamma 1.0
|
||||
Red_Brightness 1.0
|
||||
Red_Contrast 1.0
|
||||
Green_Gamma 1.0
|
||||
Green_Brightness 1.0
|
||||
Green_Contrast 1.0
|
||||
Blue_Gamma 1.0
|
||||
Blue_Brightness 1.0
|
||||
Blue_Contrast 1.0
|
@ -213,6 +213,8 @@ END_EVENT_TABLE()
|
||||
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
|
||||
{
|
||||
SetBackgroundColour("cadet blue");
|
||||
|
||||
m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE );
|
||||
m_text->SetBackgroundColour("wheat");
|
||||
|
||||
@ -258,7 +260,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
imagelist-> Add( wxBitmap( radio_xpm ));
|
||||
#endif
|
||||
|
||||
wxButton *button = (wxButton*)NULL;
|
||||
|
||||
m_notebook->SetImageList(imagelist);
|
||||
m_notebook->SetBackgroundColour("cadet blue");
|
||||
|
||||
wxPanel *panel = new wxPanel(m_notebook);
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
@ -269,13 +274,15 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
(void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||
button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||
button->SetForegroundColour( "red" );
|
||||
(void)new wxCheckBox( panel, ID_LISTBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
||||
m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 4, choices );
|
||||
m_choice->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
||||
@ -309,6 +316,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
panel = new wxPanel(m_notebook);
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 4, choices );
|
||||
m_radio->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(180,130), wxSize(140,30) );
|
||||
|
@ -1,26 +0,0 @@
|
||||
Audit status of gdk_imlib so far:
|
||||
|
||||
cache.c appears clean
|
||||
globals.c appears clean
|
||||
|
||||
load.c:
|
||||
JPEG, PNG, GIF and TIFF loaders seem safe but the underlying
|
||||
yet libraries have not been checked
|
||||
Helper stuff should now be safe.
|
||||
|
||||
misc.c
|
||||
The obvious screwups have been remedied with the usual
|
||||
length checking sscanfs and snprintfs.
|
||||
Rewrote a little of the parsing code to avoid future problems.
|
||||
|
||||
rend.c
|
||||
Appears ok
|
||||
|
||||
save.c
|
||||
Some stuff has been fixed. The helpers should be safe but
|
||||
are incomplete
|
||||
|
||||
utils.c
|
||||
Ok this seems clean now. There's a few FIXME's but they are
|
||||
either new features (helper needs %Q) or bogus but non fatal
|
||||
stuff
|
@ -1 +0,0 @@
|
||||
Rasterdude :-) <raster@redhat.com>
|
@ -1,481 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
@ -1,74 +0,0 @@
|
||||
1998-05-07 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* save.c (gdk_imlib_save_image): Replaces `snprintf' with
|
||||
`g_snprintf' calls.
|
||||
* utils.c (gdk_imlib_create_image_from_data): Likewise.
|
||||
|
||||
Tue May 5 15:11:59 1998 Radek Doulik <gis@academy.cas.cz>
|
||||
|
||||
* replaced snprintf calls with g_snprintf ones, so it
|
||||
compiles now on SunOS
|
||||
|
||||
Sat Apr 11 12:30:13 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* utils.c: fixed yet one more SIGFPE on alpha
|
||||
|
||||
Fri Mar 20 00:02:43 1998 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* gdk_imlib.h: Replaced `()' with `(void)'.
|
||||
|
||||
Sun Mar 15 12:34:45 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* Makefile.am (INCLUDES): Added GTK_CFLAGS
|
||||
|
||||
1998-02-25 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Makefile.am (DEFS): Define `SYSTEM_IMRC' too.
|
||||
|
||||
1998-02-25 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* misc.c (gdk_imlib_copy_image): The drawable passed to gdk_gc_new
|
||||
should be the dest drawable, not the base imlib window. This
|
||||
caused BadMatches all over the place (especially in copy_mask).
|
||||
(gdk_imlib_copy_mask): Likewise.
|
||||
|
||||
1998-02-24 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Makefile.am (DEFS): New var. Moved stuff from CFLAGS.
|
||||
(INCLUDES): New var.
|
||||
|
||||
1998-02-24 Mark Galassi <rosalia@cygnus.com>
|
||||
|
||||
* Makefile.am (libgdk_imlib_la_SOURCES):
|
||||
(lib_LTLIBRARIES): changed gdk_imlib to use the libtool+automake
|
||||
formalisms.
|
||||
|
||||
* load.c (gdk_imlib_load_image): changed JPEG_PATH to DJPEG_PROG
|
||||
and removed %s/djpeg, sine DJPEG_PROG is the full program path.
|
||||
|
||||
1998-02-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* Makefile.in (install): Make directory for config files.
|
||||
|
||||
* configure.in: Fixed ENL_LIB_SUPPORT function for non-existing libraries.
|
||||
|
||||
1998-02-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* misc.c (gdk_imlib_init): I create a colormap specific to the
|
||||
visual the base_window will be using. This fixes BadMatch errors
|
||||
on machines with multiple visual/depth combinations.
|
||||
|
||||
1998-02-17 The Rasterman <raster@redhat.com>
|
||||
|
||||
* misc.c (gdk_imlib_init) Fixed visual stuff slightly, and Colormap
|
||||
creation (so it only does so if the visual for the default and the
|
||||
chosen visual mismatch), added function calls to retrieve Imlib's
|
||||
visual and Colormap, plus endianess fixes for network displaying.
|
||||
|
||||
1998-02-17 The Rasterman <raster@redhat.com>
|
||||
|
||||
added system imrc config return function
|
||||
|
||||
1998-02-18 The Rasterman <raster@redhat.com>
|
||||
|
||||
Fixed load.c - missed a not (!) in an if clause
|
@ -1,29 +0,0 @@
|
||||
-------------------------------------------------------------------------------
|
||||
I M L I B
|
||||
1.4
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This software is Copyright (C) 1998 By The Rasterman (Carsten Haitzler). I
|
||||
accept no responsability for anythign this software may or may not do to
|
||||
your system - you use it completely at your own risk. This software comes
|
||||
under the LGPL and GPL licences. The library itself is LGPL (all software in
|
||||
Imlib and gdk_imlib directories) see the COPYING and COPYING.LIB files for
|
||||
full legal details.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
If you have picked up a net release of imlib you should be able to
|
||||
just follow the instructions in the INSTALL file.
|
||||
|
||||
If you are using imlib out of the CVS repository, then you need to
|
||||
have some extra tools installed, and the configuration process is
|
||||
lengthier. the HACKING file has all the details for building from a
|
||||
CVS checkout.
|
||||
|
||||
Imlib will run MARKEDLY better if you get certain libraries. Notably,
|
||||
libjpeg, libpng, libtiff and libgif. For more information please go look at:
|
||||
|
||||
http://www.labs.redhat.com/imlib/
|
||||
|
||||
This will give links to everything you need or may want for Imlib's optimal
|
||||
functionality.
|
@ -1,496 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "../gdk_imlib/gdk_imlib.h"
|
||||
#include "../gdk_imlib/gdk_imlib_private.h"
|
||||
|
||||
/* uncomment this to compile imlib's cahce with pixmap accounting output */
|
||||
/*#define PIXMAP_ACCOUNTING */
|
||||
|
||||
void
|
||||
gdirty_pixmaps(GdkImlibImage * im)
|
||||
{
|
||||
struct pixmap_cache *ptr;
|
||||
|
||||
ptr = id->cache.pixmap;
|
||||
while (ptr)
|
||||
{
|
||||
if ((ptr->im == im) && ((!ptr->file) || (!strcmp(im->filename, ptr->file))))
|
||||
ptr->dirty = 1;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdirty_images(GdkImlibImage * im)
|
||||
{
|
||||
struct image_cache *ptr;
|
||||
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
if ((!strcmp(im->filename, ptr->file)) && (im == ptr->im))
|
||||
{
|
||||
ptr->dirty = 1;
|
||||
return;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfind_pixmap(GdkImlibImage * im, int width, int height, GdkPixmap ** pmap, GdkBitmap ** mask)
|
||||
{
|
||||
struct pixmap_cache *ptr;
|
||||
|
||||
ptr = id->cache.pixmap;
|
||||
while (ptr)
|
||||
{
|
||||
if ((ptr->im == im) && (ptr->width == width) && (ptr->height == height) &&
|
||||
((!ptr->file) || (!strcmp(im->filename, ptr->file))) &&
|
||||
(!ptr->dirty))
|
||||
{
|
||||
if (ptr->refnum > 0)
|
||||
ptr->refnum++;
|
||||
else
|
||||
{
|
||||
ptr->refnum++;
|
||||
id->cache.num_pixmap++;
|
||||
if (ptr->pmap)
|
||||
id->cache.used_pixmap -= width * height * id->x.depth;
|
||||
if (ptr->shape_mask)
|
||||
id->cache.used_pixmap -= width * height;
|
||||
if (id->cache.used_pixmap < 0)
|
||||
{
|
||||
id->cache.used_pixmap = 0;
|
||||
fprintf(stderr, "IMLIB: uhoh.. caching problems.... meep meep\n");
|
||||
}
|
||||
}
|
||||
if (ptr->prev)
|
||||
{
|
||||
ptr->prev->next = ptr->next;
|
||||
if (ptr->next)
|
||||
ptr->next->prev = ptr->prev;
|
||||
ptr->next = id->cache.pixmap;
|
||||
ptr->next->prev = ptr;
|
||||
id->cache.pixmap = ptr;
|
||||
ptr->prev = NULL;
|
||||
}
|
||||
*pmap = ptr->pmap;
|
||||
*mask = ptr->shape_mask;
|
||||
return;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
*pmap = NULL;
|
||||
*mask = NULL;
|
||||
}
|
||||
|
||||
GdkImlibImage *
|
||||
gfind_image(char *file)
|
||||
{
|
||||
struct image_cache *ptr;
|
||||
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
if ((!strcmp(file, ptr->file)) && (!ptr->dirty))
|
||||
{
|
||||
if (ptr->refnum)
|
||||
ptr->refnum++;
|
||||
else
|
||||
{
|
||||
ptr->refnum++;
|
||||
id->cache.num_image++;
|
||||
id->cache.used_image -= ptr->im->rgb_width * ptr->im->rgb_height * 3;
|
||||
if (id->cache.used_image < 0)
|
||||
{
|
||||
id->cache.used_image = 0;
|
||||
fprintf(stderr, "IMLIB: uhoh.. caching problems.... meep meep\n");
|
||||
}
|
||||
}
|
||||
if (ptr->prev)
|
||||
{
|
||||
ptr->prev->next = ptr->next;
|
||||
if (ptr->next)
|
||||
ptr->next->prev = ptr->prev;
|
||||
ptr->next = id->cache.image;
|
||||
ptr->next->prev = ptr;
|
||||
id->cache.image = ptr;
|
||||
ptr->prev = NULL;
|
||||
}
|
||||
return ptr->im;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gfree_pixmappmap(GdkPixmap * pmap)
|
||||
{
|
||||
struct pixmap_cache *ptr;
|
||||
|
||||
ptr = id->cache.pixmap;
|
||||
while (ptr)
|
||||
{
|
||||
if ((ptr->pmap == pmap) || (ptr->shape_mask == pmap))
|
||||
{
|
||||
if (ptr->shape_mask == pmap)
|
||||
return;
|
||||
if (ptr->refnum > 0)
|
||||
{
|
||||
ptr->refnum--;
|
||||
if (ptr->refnum == 0)
|
||||
{
|
||||
id->cache.num_pixmap--;
|
||||
if (ptr->pmap)
|
||||
id->cache.used_pixmap += ptr->width * ptr->height * id->x.depth;
|
||||
if (ptr->shape_mask)
|
||||
id->cache.used_pixmap += ptr->width * ptr->height;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
gdk_pixmap_unref(pmap);
|
||||
}
|
||||
|
||||
void
|
||||
gfree_image(GdkImlibImage * im)
|
||||
{
|
||||
struct image_cache *ptr;
|
||||
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
if (im == ptr->im)
|
||||
{
|
||||
if (ptr->refnum)
|
||||
{
|
||||
ptr->refnum--;
|
||||
if (!ptr->refnum)
|
||||
{
|
||||
id->cache.num_image--;
|
||||
id->cache.used_image += ptr->im->rgb_width * ptr->im->rgb_height * 3;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
gnullify_image(im);
|
||||
}
|
||||
|
||||
void
|
||||
gflush_image(GdkImlibImage * im)
|
||||
{
|
||||
if (im)
|
||||
im->cache = 0;
|
||||
}
|
||||
|
||||
void
|
||||
gadd_image(GdkImlibImage * im, char *file)
|
||||
{
|
||||
struct image_cache *ptr;
|
||||
struct image_cache *n;
|
||||
|
||||
if ((!im) || (!file))
|
||||
return;
|
||||
ptr = id->cache.image;
|
||||
n = malloc(sizeof(struct image_cache));
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
n->prev = NULL;
|
||||
n->next = ptr;
|
||||
n->file = malloc(strlen(file) + 1);
|
||||
if (!n->file)
|
||||
{
|
||||
free(n);
|
||||
return;
|
||||
}
|
||||
strcpy(n->file, file);
|
||||
n->im = im;
|
||||
n->refnum = 1;
|
||||
n->dirty = 0;
|
||||
if (n->next)
|
||||
n->next->prev = n;
|
||||
id->cache.image = n;
|
||||
id->cache.num_image++;
|
||||
}
|
||||
|
||||
void
|
||||
gadd_pixmap(GdkImlibImage * im, int width, int height, XImage * xim, XImage * sxim)
|
||||
{
|
||||
struct pixmap_cache *ptr;
|
||||
struct pixmap_cache *n;
|
||||
|
||||
if (!im)
|
||||
return;
|
||||
ptr = id->cache.pixmap;
|
||||
n = malloc(sizeof(struct pixmap_cache));
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
n->prev = NULL;
|
||||
n->next = ptr;
|
||||
n->im = im;
|
||||
if (im->filename)
|
||||
{
|
||||
n->file = malloc(strlen(im->filename) + 1);
|
||||
if (n->file)
|
||||
strcpy(n->file, im->filename);
|
||||
}
|
||||
else
|
||||
n->file = NULL;
|
||||
n->refnum = 1;
|
||||
n->dirty = 0;
|
||||
n->width = width;
|
||||
n->height = height;
|
||||
n->pmap = im->pixmap;
|
||||
n->shape_mask = im->shape_mask;
|
||||
n->xim = xim;
|
||||
n->sxim = sxim;
|
||||
if (n->next)
|
||||
n->next->prev = n;
|
||||
id->cache.pixmap = n;
|
||||
id->cache.num_pixmap++;
|
||||
}
|
||||
|
||||
void
|
||||
gclean_caches()
|
||||
{
|
||||
{
|
||||
struct image_cache *ptr = NULL;
|
||||
struct image_cache *pptr = NULL;
|
||||
struct image_cache *last = NULL;
|
||||
int newlast;
|
||||
|
||||
/* find the back of the list */
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
/* remove all images that are tagged non-cachable, and have 0 */
|
||||
/* references , even if the cache has spare room. */
|
||||
while (ptr)
|
||||
{
|
||||
if (!ptr->refnum)
|
||||
{
|
||||
if (!ptr->im->cache)
|
||||
{
|
||||
if (ptr == last)
|
||||
newlast = 1;
|
||||
id->cache.used_image -= ptr->im->rgb_width * ptr->im->rgb_height * 3;
|
||||
gnullify_image(ptr->im);
|
||||
if (pptr)
|
||||
ptr = pptr->prev;
|
||||
if (ptr->prev)
|
||||
ptr->prev->next = ptr->next;
|
||||
else
|
||||
id->cache.image = ptr->next;
|
||||
if (ptr->next)
|
||||
ptr->next->prev = ptr->prev;
|
||||
if (ptr->file)
|
||||
free(ptr->file);
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
if (ptr)
|
||||
ptr = ptr->prev;
|
||||
if (newlast)
|
||||
{
|
||||
last = NULL;
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
}
|
||||
}
|
||||
/* find the back of the list */
|
||||
ptr = id->cache.image;
|
||||
last = NULL;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
/* while the amount of data in the cache is greater than the set */
|
||||
/* amount, delete the last entry (last used) from the unreferenced */
|
||||
/* cached 24-bit images */
|
||||
while (id->cache.used_image > id->cache.size_image)
|
||||
{
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->refnum < 1)
|
||||
{
|
||||
if (ptr == last)
|
||||
newlast = 1;
|
||||
id->cache.used_image -= ptr->im->rgb_width * ptr->im->rgb_height * 3;
|
||||
gnullify_image(ptr->im);
|
||||
if (ptr->prev)
|
||||
ptr->prev->next = ptr->next;
|
||||
else
|
||||
id->cache.image = ptr->next;
|
||||
if (ptr->next)
|
||||
ptr->next->prev = ptr->prev;
|
||||
if (ptr->file)
|
||||
free(ptr->file);
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
break;
|
||||
}
|
||||
if (ptr)
|
||||
ptr = ptr->prev;
|
||||
}
|
||||
if (newlast)
|
||||
{
|
||||
last = NULL;
|
||||
ptr = id->cache.image;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
}
|
||||
if (!ptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
struct pixmap_cache *ptr;
|
||||
struct pixmap_cache *last;
|
||||
int newlast;
|
||||
|
||||
#ifdef PIXMAP_ACCOUNTING
|
||||
int total, total2, num, num2;
|
||||
|
||||
printf("--------- Pixmap cashe zise %i / %i with %i pixmaps referenced\n",
|
||||
id->cache.used_pixmap, id->cache.size_pixmap,
|
||||
id->cache.num_pixmap);
|
||||
ptr = id->cache.pixmap;
|
||||
total = 0;
|
||||
total2 = 0;
|
||||
num = 0;
|
||||
num2 = 0;
|
||||
while (ptr)
|
||||
{
|
||||
printf("Pmap for file %s REFNUM %3i SIZE %4ix%4i PMAP %8x MASK %8x\n",
|
||||
ptr->file, ptr->refnum, ptr->width, ptr->height, ptr->pmap,
|
||||
ptr->shape_mask);
|
||||
if (ptr->refnum > 0)
|
||||
{
|
||||
total += (ptr->width * ptr->height * id->x.depth);
|
||||
if (ptr->shape_mask)
|
||||
total += (ptr->width * ptr->height);
|
||||
num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
total2 += (ptr->width * ptr->height * id->x.depth);
|
||||
if (ptr->shape_mask)
|
||||
total2 += (ptr->width * ptr->height);
|
||||
num2++;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
printf("Accounting Data:\n");
|
||||
printf("*** total pixmap's in cache %i with %i pixmaps\n",
|
||||
total, num);
|
||||
printf("*** total unreffed pixmap's in cache %i with %i pixmaps\n\n",
|
||||
total2, num2);
|
||||
#endif
|
||||
/* find the back of the list */
|
||||
ptr = id->cache.pixmap;
|
||||
last = NULL;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
/* while the amount of data in the cache is greater than the set */
|
||||
/* amount, delete the last entry (last used) from the unreferenced */
|
||||
/* cached pixmaps */
|
||||
while (id->cache.used_pixmap > id->cache.size_pixmap)
|
||||
{
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->refnum < 1)
|
||||
{
|
||||
if (ptr == last)
|
||||
newlast = 1;
|
||||
if (ptr->pmap)
|
||||
id->cache.used_pixmap -= ptr->width * ptr->height * id->x.depth;
|
||||
if (ptr->shape_mask)
|
||||
id->cache.used_pixmap -= ptr->width * ptr->height;
|
||||
if (ptr->pmap)
|
||||
gdk_pixmap_unref(ptr->pmap);
|
||||
if (ptr->shape_mask)
|
||||
gdk_pixmap_unref(ptr->shape_mask);
|
||||
if (ptr->xim)
|
||||
XDestroyImage(ptr->xim);
|
||||
if (ptr->sxim)
|
||||
XDestroyImage(ptr->sxim);
|
||||
if (ptr->prev)
|
||||
ptr->prev->next = ptr->next;
|
||||
else
|
||||
id->cache.pixmap = ptr->next;
|
||||
if (ptr->next)
|
||||
ptr->next->prev = ptr->prev;
|
||||
if (ptr->file)
|
||||
free(ptr->file);
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
break;
|
||||
}
|
||||
if (ptr)
|
||||
ptr = ptr->prev;
|
||||
}
|
||||
if (newlast)
|
||||
{
|
||||
last = NULL;
|
||||
ptr = id->cache.pixmap;
|
||||
while (ptr)
|
||||
{
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
newlast = 0;
|
||||
ptr = last;
|
||||
}
|
||||
if (!ptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnullify_image(GdkImlibImage * im)
|
||||
{
|
||||
if (!im)
|
||||
return;
|
||||
if (im->rgb_data)
|
||||
free(im->rgb_data);
|
||||
if (im->alpha_data)
|
||||
free(im->alpha_data);
|
||||
if (im->pixmap)
|
||||
gfree_pixmappmap(im->pixmap);
|
||||
if (im->filename)
|
||||
free(im->filename);
|
||||
free(im);
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "../gdk_imlib/gdk_imlib.h"
|
||||
#include "../gdk_imlib/gdk_imlib_private.h"
|
||||
|
||||
void
|
||||
g_PaletteAlloc(int num, int *cols)
|
||||
{
|
||||
XColor xcl;
|
||||
int i;
|
||||
int r, g, b;
|
||||
|
||||
if (id->palette)
|
||||
free(id->palette);
|
||||
id->palette = malloc(sizeof(GdkImlibColor) * num);
|
||||
if (id->palette_orig)
|
||||
free(id->palette_orig);
|
||||
id->palette_orig = malloc(sizeof(GdkImlibColor) * num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
r = cols[(i * 3) + 0];
|
||||
g = cols[(i * 3) + 1];
|
||||
b = cols[(i * 3) + 2];
|
||||
xcl.red = (unsigned short)((r << 8) | (r));
|
||||
xcl.green = (unsigned short)((g << 8) | (g));
|
||||
xcl.blue = (unsigned short)((b << 8) | (b));
|
||||
xcl.flags = DoRed | DoGreen | DoBlue;
|
||||
XAllocColor(id->x.disp, id->x.root_cmap, &xcl);
|
||||
id->palette[i].r = xcl.red >> 8;
|
||||
id->palette[i].g = xcl.green >> 8;
|
||||
id->palette[i].b = xcl.blue >> 8;
|
||||
id->palette[i].pixel = xcl.pixel;
|
||||
id->palette_orig[i].r = r;
|
||||
id->palette_orig[i].g = g;
|
||||
id->palette_orig[i].b = b;
|
||||
id->palette_orig[i].pixel = xcl.pixel;
|
||||
}
|
||||
id->num_colors = num;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_imlib_load_colors(char *file)
|
||||
{
|
||||
FILE *f;
|
||||
char s[256];
|
||||
int i;
|
||||
int pal[768];
|
||||
int r, g, b;
|
||||
int rr, gg, bb;
|
||||
|
||||
f = fopen(file, "r");
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr, "GImLib ERROR: Cannot find palette file %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
i = 0;
|
||||
while (fgets(s, 256, f))
|
||||
{
|
||||
if (s[0] == '0')
|
||||
{
|
||||
sscanf(s, "%x %x %x", &r, &g, &b);
|
||||
if (r < 0)
|
||||
r = 0;
|
||||
if (r > 255)
|
||||
r = 255;
|
||||
if (g < 0)
|
||||
g = 0;
|
||||
if (g > 255)
|
||||
g = 255;
|
||||
if (b < 0)
|
||||
b = 0;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
pal[i++] = r;
|
||||
pal[i++] = g;
|
||||
pal[i++] = b;
|
||||
}
|
||||
if (i >= 768)
|
||||
break;
|
||||
}
|
||||
fclose(f);
|
||||
g_PaletteAlloc((i / 3), pal);
|
||||
if (id->fast_rgb)
|
||||
free(id->fast_rgb);
|
||||
id->fast_rgb = malloc(sizeof(int) * 32 * 32 * 32);
|
||||
|
||||
for (r = 0; r < 32; r++)
|
||||
{
|
||||
for (g = 0; g < 32; g++)
|
||||
{
|
||||
for (b = 0; b < 32; b++)
|
||||
{
|
||||
rr = (r << 3) | (r >> 2);
|
||||
gg = (g << 3) | (g >> 2);
|
||||
bb = (b << 3) | (b >> 2);
|
||||
INDEX_RGB(r, g, b) = gindex_best_color_match(&rr, &gg, &bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_imlib_free_colors()
|
||||
{
|
||||
int i;
|
||||
unsigned long pixels[256];
|
||||
|
||||
for (i = 0; i < id->num_colors; i++)
|
||||
pixels[i] = id->palette[i].pixel;
|
||||
XFreeColors(id->x.disp, id->x.root_cmap, pixels, id->num_colors, 0);
|
||||
id->num_colors = 0;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
@ -1,78 +0,0 @@
|
||||
|
||||
#ifndef __GDK_IMLIB_H__
|
||||
#define __GDK_IMLIB_H__
|
||||
|
||||
/* we need this funny include path, because the working directory when */
|
||||
/* including this might actually be ../gdk/ instead of . */
|
||||
#include "../gdk_imlib/gdk_imlib_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void gdk_imlib_init(void);
|
||||
void gdk_imlib_init_params(GdkImlibInitParams * p);
|
||||
gint gdk_imlib_get_render_type(void);
|
||||
void gdk_imlib_set_render_type(gint rend_type);
|
||||
gint gdk_imlib_load_colors(char *file);
|
||||
GdkImlibImage *gdk_imlib_load_image(char *file);
|
||||
gint gdk_imlib_best_color_match(gint * r, gint * g, gint * b);
|
||||
gint gdk_imlib_render(GdkImlibImage * image, gint width, gint height);
|
||||
GdkPixmap *gdk_imlib_copy_image(GdkImlibImage * image);
|
||||
GdkBitmap *gdk_imlib_copy_mask(GdkImlibImage * image);
|
||||
GdkPixmap *gdk_imlib_move_image(GdkImlibImage * image);
|
||||
GdkBitmap *gdk_imlib_move_mask(GdkImlibImage * image);
|
||||
void gdk_imlib_destroy_image(GdkImlibImage * image);
|
||||
void gdk_imlib_kill_image(GdkImlibImage * image);
|
||||
void gdk_imlib_free_colors(void);
|
||||
void gdk_imlib_free_pixmap(GdkPixmap * pixmap);
|
||||
void gdk_imlib_free_bitmap(GdkBitmap * bitmap);
|
||||
void gdk_imlib_get_image_border(GdkImlibImage * image, GdkImlibBorder * border);
|
||||
void gdk_imlib_set_image_border(GdkImlibImage * image, GdkImlibBorder * border);
|
||||
void gdk_imlib_get_image_shape(GdkImlibImage * image, GdkImlibColor * color);
|
||||
void gdk_imlib_set_image_shape(GdkImlibImage * image, GdkImlibColor * color);
|
||||
gint gdk_imlib_save_image_to_eim(GdkImlibImage * image, char *file);
|
||||
gint gdk_imlib_add_image_to_eim(GdkImlibImage * image, char *file);
|
||||
gint gdk_imlib_save_image_to_ppm(GdkImlibImage * image, char *file);
|
||||
gint gdk_imlib_load_file_to_pixmap(char *filename, GdkPixmap ** pmap, GdkBitmap ** mask);
|
||||
void gdk_imlib_set_image_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_set_image_red_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_set_image_green_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_set_image_blue_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_get_image_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_get_image_red_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_get_image_green_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_get_image_blue_modifier(GdkImlibImage * im, GdkImlibColorModifier * mod);
|
||||
void gdk_imlib_set_image_red_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_set_image_green_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_set_image_blue_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_get_image_red_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_get_image_green_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_get_image_blue_curve(GdkImlibImage * im, unsigned char *mod);
|
||||
void gdk_imlib_apply_modifiers_to_rgb(GdkImlibImage * im);
|
||||
void gdk_imlib_changed_image(GdkImlibImage * im);
|
||||
void gdk_imlib_apply_image(GdkImlibImage * im, GdkWindow * p);
|
||||
void gdk_imlib_paste_image(GdkImlibImage * im, GdkWindow * p, gint x, gint y, gint w, gint h);
|
||||
void gdk_imlib_paste_image_border(GdkImlibImage * im, GdkWindow * p, gint x, gint y, gint w, gint h);
|
||||
void gdk_imlib_flip_image_horizontal(GdkImlibImage * im);
|
||||
void gdk_imlib_flip_image_vertical(GdkImlibImage * im);
|
||||
void gdk_imlib_rotate_image(GdkImlibImage * im, gint d);
|
||||
GdkImlibImage *gdk_imlib_create_image_from_data(unsigned char *data, unsigned char *alpha, gint w, gint h);
|
||||
GdkImlibImage *gdk_imlib_clone_image(GdkImlibImage * im);
|
||||
GdkImlibImage *gdk_imlib_clone_scaled_image(GdkImlibImage * im, int w, int h);
|
||||
gint gdk_imlib_get_fallback(void);
|
||||
void gdk_imlib_set_fallback(gint fallback);
|
||||
GdkVisual *gdk_imlib_get_visual(void);
|
||||
GdkColormap *gdk_imlib_get_colormap(void);
|
||||
gchar *gdk_imlib_get_sysconfig(void);
|
||||
GdkImlibImage *gdk_imlib_create_image_from_xpm_data(char **data);
|
||||
gint gdk_imlib_data_to_pixmap(char **data, GdkPixmap ** pmap, GdkBitmap ** mask);
|
||||
void gdk_imlib_crop_image(GdkImlibImage * im, gint x, gint y, gint w, gint h);
|
||||
gint gdk_imlib_save_image(GdkImlibImage * im, char *file, GdkImlibSaveInfo * info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
@ -1,226 +0,0 @@
|
||||
#ifdef _HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#elif _HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef CONVERT_PATH
|
||||
#define CONVERT_PATH "/usr/X11/bin"
|
||||
#endif
|
||||
|
||||
#ifndef NETPBM_PATH
|
||||
#define NETPBM_PATH "/usr/local/bin"
|
||||
#endif
|
||||
|
||||
#ifndef CJPEG_PROG
|
||||
#define CJPEG_PROG "/usr/bin/cjpeg"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#elif _HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#ifdef HAVE_LIBJPEG
|
||||
#include <jpeglib.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBPNG
|
||||
#include <../png/png.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#include <tiffio.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBGIF
|
||||
#include <gif_lib.h>
|
||||
#endif
|
||||
|
||||
#define BYTE_ORD_24_RGB 0
|
||||
#define BYTE_ORD_24_RBG 1
|
||||
#define BYTE_ORD_24_BRG 2
|
||||
#define BYTE_ORD_24_BGR 3
|
||||
#define BYTE_ORD_24_GRB 4
|
||||
#define BYTE_ORD_24_GBR 5
|
||||
|
||||
struct image_cache
|
||||
{
|
||||
gchar *file;
|
||||
GdkImlibImage *im;
|
||||
gint refnum;
|
||||
gchar dirty;
|
||||
struct image_cache *prev;
|
||||
struct image_cache *next;
|
||||
};
|
||||
|
||||
struct pixmap_cache
|
||||
{
|
||||
GdkImlibImage *im;
|
||||
gchar *file;
|
||||
gchar dirty;
|
||||
gint width, height;
|
||||
GdkPixmap *pmap;
|
||||
GdkBitmap *shape_mask;
|
||||
XImage *xim, *sxim;
|
||||
gint refnum;
|
||||
struct pixmap_cache *prev;
|
||||
struct pixmap_cache *next;
|
||||
};
|
||||
|
||||
typedef struct _xdata
|
||||
{
|
||||
Display *disp;
|
||||
gint screen;
|
||||
Window root;
|
||||
Visual *visual;
|
||||
gint depth;
|
||||
gint render_depth;
|
||||
Colormap root_cmap;
|
||||
gchar shm;
|
||||
gchar shmp;
|
||||
gint shm_event;
|
||||
XImage *last_xim;
|
||||
XImage *last_sxim;
|
||||
XShmSegmentInfo last_shminfo;
|
||||
XShmSegmentInfo last_sshminfo;
|
||||
Window base_window;
|
||||
GdkWindow *gdk_win;
|
||||
GdkColormap *gdk_cmap;
|
||||
}
|
||||
Xdata;
|
||||
|
||||
typedef struct _imlibdata
|
||||
{
|
||||
gint num_colors;
|
||||
GdkImlibColor *palette;
|
||||
GdkImlibColor *palette_orig;
|
||||
unsigned char *fast_rgb;
|
||||
gint *fast_err;
|
||||
gint *fast_erg;
|
||||
gint *fast_erb;
|
||||
gint render_type;
|
||||
gint max_shm;
|
||||
Xdata x;
|
||||
gint byte_order;
|
||||
struct _cache
|
||||
{
|
||||
gchar on_image;
|
||||
gint size_image;
|
||||
gint num_image;
|
||||
gint used_image;
|
||||
struct image_cache *image;
|
||||
gchar on_pixmap;
|
||||
gint size_pixmap;
|
||||
gint num_pixmap;
|
||||
gint used_pixmap;
|
||||
struct pixmap_cache *pixmap;
|
||||
}
|
||||
cache;
|
||||
gchar fastrend;
|
||||
gchar hiq;
|
||||
GdkImlibColorModifier mod, rmod, gmod, bmod;
|
||||
unsigned char rmap[256], gmap[256], bmap[256];
|
||||
gchar fallback;
|
||||
gchar ordered_dither;
|
||||
}
|
||||
ImlibData;
|
||||
|
||||
extern ImlibData *id;
|
||||
|
||||
gint gindex_best_color_match(gint * r, gint * g, gint * b);
|
||||
|
||||
void gdirty_pixmaps(GdkImlibImage * im);
|
||||
void gdirty_images(GdkImlibImage * im);
|
||||
void gfind_pixmap(GdkImlibImage * im, int width, int height, GdkPixmap ** pmap, GdkBitmap ** mask);
|
||||
GdkImlibImage *gfind_image(char *file);
|
||||
void gfree_pixmappmap(GdkPixmap * pmap);
|
||||
void gfree_image(GdkImlibImage * im);
|
||||
void gflush_image(GdkImlibImage * im);
|
||||
void gadd_image(GdkImlibImage * im, char *file);
|
||||
void gadd_pixmap(GdkImlibImage * im, int width, int height, XImage * xim, XImage * sxim);
|
||||
void gclean_caches();
|
||||
void gnullify_image(GdkImlibImage * im);
|
||||
|
||||
/* char *g_SplitID(char *file); */
|
||||
char *g_GetExtension(char *file);
|
||||
|
||||
#ifdef HAVE_LIBJPEG
|
||||
unsigned char *g_LoadJPEG(FILE * f, int *w, int *h);
|
||||
|
||||
#endif /* HAVE_LIBJPEG */
|
||||
#ifdef HAVE_LIBPNG
|
||||
unsigned char *g_LoadPNG(FILE * f, int *w, int *h, int *t);
|
||||
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#ifdef HAVE_LIBTIFF
|
||||
unsigned char *g_LoadTIFF(char *f, int *w, int *h, int *t);
|
||||
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#ifdef HAVE_LIBGIF
|
||||
unsigned char *g_LoadGIF(char *f, int *w, int *h, int *t);
|
||||
|
||||
#endif /* HAVE_LIBGIF */
|
||||
unsigned char *g_LoadXPM(char *f, int *w, int *h, int *t);
|
||||
unsigned char *g_LoadPPM(FILE * f, int *w, int *h);
|
||||
|
||||
/*
|
||||
static int gispnm(char *file);
|
||||
static int gisjpeg(char *file);
|
||||
static int gispng(char *file);
|
||||
static int gistiff(char *file);
|
||||
static int giseim(char *file);
|
||||
static int gisgif(char *file);
|
||||
static int gisxpm(char *file);
|
||||
*/
|
||||
|
||||
GdkPixmap *gdk_imlib_pixmap_foreign_new(gint width, gint height, gint depth, Pixmap pmap);
|
||||
|
||||
void gcalc_map_tables(GdkImlibImage * im);
|
||||
|
||||
void g_PaletteAlloc(int num, int *cols);
|
||||
|
||||
FILE *open_helper(const char *, const char *, const char *);
|
||||
int close_helper(FILE *);
|
||||
|
||||
#define INDEX_RGB(r,g,b) id->fast_rgb[(r<<10)|(g<<5)|(b)]
|
||||
#define COLOR_INDEX(i) id->palette[i].pixel
|
||||
#define COLOR_RGB(r,g,b) id->palette[INDEX_RGB(r,g,b)].pixel
|
||||
#define ERROR_RED(rr,i) rr-id->palette[i].r;
|
||||
#define ERROR_GRN(gg,i) gg-id->palette[i].g;
|
||||
#define ERROR_BLU(bb,i) bb-id->palette[i].b;
|
||||
|
||||
#define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
|
||||
ter=&(Der1[Dex]);\
|
||||
(*ter)+=(Der*7)>>4;ter++;\
|
||||
(*ter)+=(Deg*7)>>4;ter++;\
|
||||
(*ter)+=(Deb*7)>>4;\
|
||||
ter=&(Der2[Dex-6]);\
|
||||
(*ter)+=(Der*3)>>4;ter++;\
|
||||
(*ter)+=(Deg*3)>>4;ter++;\
|
||||
(*ter)+=(Deb*3)>>4;ter++;\
|
||||
(*ter)+=(Der*5)>>4;ter++;\
|
||||
(*ter)+=(Deg*5)>>4;ter++;\
|
||||
(*ter)+=(Deb*5)>>4;ter++;\
|
||||
(*ter)+=Der>>4;ter++;\
|
||||
(*ter)+=Deg>>4;ter++;\
|
||||
(*ter)+=Deb>>4;
|
@ -1,101 +0,0 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifndef SYSTEM_IMRC
|
||||
#define SYSTEM_IMRC "/etc/imrc"
|
||||
#endif /* endef SYSTEM_IMRC */
|
||||
|
||||
typedef struct _GdkImlibBorder
|
||||
{
|
||||
gint left, right;
|
||||
gint top, bottom;
|
||||
}
|
||||
GdkImlibBorder;
|
||||
|
||||
typedef struct _GdkImlibColor
|
||||
{
|
||||
gint r, g, b;
|
||||
gint pixel;
|
||||
}
|
||||
GdkImlibColor;
|
||||
|
||||
typedef struct _GdkImlibColorModifier
|
||||
{
|
||||
gint gamma;
|
||||
gint brightness;
|
||||
gint contrast;
|
||||
}
|
||||
GdkImlibColorModifier;
|
||||
|
||||
typedef struct _GdkImlibImage
|
||||
{
|
||||
gint rgb_width, rgb_height;
|
||||
unsigned char *rgb_data;
|
||||
unsigned char *alpha_data;
|
||||
gchar *filename;
|
||||
/* the below information is private */
|
||||
gint width, height;
|
||||
GdkImlibColor shape_color;
|
||||
GdkImlibBorder border;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *shape_mask;
|
||||
gchar cache;
|
||||
GdkImlibColorModifier mod, rmod, gmod, bmod;
|
||||
unsigned char rmap[256], gmap[256], bmap[256];
|
||||
}
|
||||
GdkImlibImage;
|
||||
|
||||
typedef struct _GdkImlibSaveInfo
|
||||
{
|
||||
int quality;
|
||||
int scaling;
|
||||
int xjustification;
|
||||
int yjustification;
|
||||
int page_size;
|
||||
char color;
|
||||
}
|
||||
GdkImlibSaveInfo;
|
||||
|
||||
typedef struct _GdkImlibInitParams
|
||||
{
|
||||
int flags;
|
||||
int visualid;
|
||||
char *palettefile;
|
||||
char sharedmem;
|
||||
char sharedpixmaps;
|
||||
char paletteoverride;
|
||||
char remap;
|
||||
char fastrender;
|
||||
char hiquality;
|
||||
char dither;
|
||||
int imagecachesize;
|
||||
int pixmapcachesize;
|
||||
}
|
||||
GdkImlibInitParams;
|
||||
|
||||
#define PARAMS_VISUALID 1<<0
|
||||
#define PARAMS_PALETTEFILE 1<<1
|
||||
#define PARAMS_SHAREDMEM 1<<2
|
||||
#define PARAMS_SHAREDPIXMAPS 1<<3
|
||||
#define PARAMS_PALETTEOVERRIDE 1<<4
|
||||
#define PARAMS_REMAP 1<<5
|
||||
#define PARAMS_FASTRENDER 1<<6
|
||||
#define PARAMS_HIQUALITY 1<<7
|
||||
#define PARAMS_DITHER 1<<8
|
||||
#define PARAMS_IMAGECACHESIZE 1<<9
|
||||
#define PARAMS_PIXMAPCACHESIZE 1<<10
|
||||
|
||||
#define PAGE_SIZE_EXECUTIVE 0
|
||||
#define PAGE_SIZE_LETTER 1
|
||||
#define PAGE_SIZE_LEGAL 2
|
||||
#define PAGE_SIZE_A4 3
|
||||
#define PAGE_SIZE_A3 4
|
||||
#define PAGE_SIZE_A5 5
|
||||
#define PAGE_SIZE_FOLIO 6
|
||||
|
||||
#define RT_PLAIN_PALETTE 0
|
||||
#define RT_PLAIN_PALETTE_FAST 1
|
||||
#define RT_DITHER_PALETTE 2
|
||||
#define RT_DITHER_PALETTE_FAST 3
|
||||
#define RT_PLAIN_TRUECOL 4
|
||||
/* a special high-quality renderer for people with 15 and 16bpp that dithers */
|
||||
#define RT_DITHER_TRUECOL 5
|
@ -1,6 +0,0 @@
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "../gdk_imlib/gdk_imlib.h"
|
||||
#include "../gdk_imlib/gdk_imlib_private.h"
|
||||
|
||||
ImlibData *id;
|
1498
src/gdk_imlib/load.c
1498
src/gdk_imlib/load.c
File diff suppressed because it is too large
Load Diff
1165
src/gdk_imlib/misc.c
1165
src/gdk_imlib/misc.c
File diff suppressed because it is too large
Load Diff
6170
src/gdk_imlib/rend.c
6170
src/gdk_imlib/rend.c
File diff suppressed because it is too large
Load Diff
@ -1,538 +0,0 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "../gdk_imlib/config.h"
|
||||
|
||||
#include "../gdk_imlib/gdk_imlib.h"
|
||||
#include "../gdk_imlib/gdk_imlib_private.h"
|
||||
|
||||
gint
|
||||
gdk_imlib_save_image(GdkImlibImage * im, char *file, GdkImlibSaveInfo * info)
|
||||
{
|
||||
char *ext;
|
||||
char cmd[10240];
|
||||
FILE *f;
|
||||
GdkImlibSaveInfo defaults;
|
||||
|
||||
if (!im || !file)
|
||||
return 0;
|
||||
|
||||
defaults.quality = 208;
|
||||
defaults.scaling = 1024;
|
||||
defaults.xjustification = 512;
|
||||
defaults.yjustification = 512;
|
||||
defaults.page_size = PAGE_SIZE_LETTER;
|
||||
defaults.color = 1;
|
||||
|
||||
if (!info)
|
||||
info = &defaults;
|
||||
ext = g_GetExtension(file);
|
||||
|
||||
if ((!strcasecmp(ext, "ppm")) || (!strcasecmp(ext, "pnm")))
|
||||
{
|
||||
f = fopen(file, "wb");
|
||||
if (f)
|
||||
{
|
||||
if (!fprintf(f, "P6\n# Created by Imlib\n%i %i\n255\n", im->rgb_width, im->rgb_height))
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
if (!fwrite(im->rgb_data, 1, (im->rgb_width * im->rgb_height * 3), f))
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(ext, "pgm"))
|
||||
{
|
||||
int x, y;
|
||||
unsigned char *ptr, val;
|
||||
int v;
|
||||
|
||||
f = fopen(file, "wb");
|
||||
if (f)
|
||||
{
|
||||
if (!fprintf(f, "P5\n# Created by Imlib\n%i %i\n255\n", im->rgb_width, im->rgb_height))
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
ptr = im->rgb_data;
|
||||
for (y = 0; y < im->rgb_height; y++)
|
||||
{
|
||||
for (x = 0; x < im->rgb_width; x++)
|
||||
{
|
||||
v = (int)(*ptr++);
|
||||
v += (int)(*ptr++);
|
||||
v += (int)(*ptr++);
|
||||
val = (unsigned char)(v / 3);
|
||||
if (!fwrite(&val, 1, 1, f))
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(ext, "ps"))
|
||||
{
|
||||
int bx, by, bxx, byy;
|
||||
int w, h;
|
||||
int sx = 0, sy = 0;
|
||||
int tx = 35, ty = 35;
|
||||
int x, y;
|
||||
unsigned char *ptr;
|
||||
int v;
|
||||
|
||||
f = fopen(file, "wb");
|
||||
|
||||
if (f == NULL)
|
||||
return 0;
|
||||
|
||||
w = im->rgb_width;
|
||||
h = im->rgb_height;
|
||||
|
||||
switch (info->page_size)
|
||||
{
|
||||
case PAGE_SIZE_EXECUTIVE:
|
||||
sx = 540;
|
||||
sy = 720;
|
||||
break;
|
||||
case PAGE_SIZE_LETTER:
|
||||
sx = 612;
|
||||
sy = 792;
|
||||
break;
|
||||
case PAGE_SIZE_LEGAL:
|
||||
sx = 612;
|
||||
sy = 1008;
|
||||
break;
|
||||
case PAGE_SIZE_A4:
|
||||
sx = 595;
|
||||
sy = 842;
|
||||
break;
|
||||
case PAGE_SIZE_A3:
|
||||
sx = 842;
|
||||
sy = 1190;
|
||||
break;
|
||||
case PAGE_SIZE_A5:
|
||||
sx = 420;
|
||||
sy = 595;
|
||||
break;
|
||||
case PAGE_SIZE_FOLIO:
|
||||
sx = 612;
|
||||
sy = 936;
|
||||
break;
|
||||
}
|
||||
bxx = ((sx - (tx * 2)) * info->scaling) >> 10;
|
||||
byy = ((h * bxx / w) * info->scaling) >> 10;
|
||||
if ((((sy - (ty * 2)) * info->scaling) >> 10) < byy)
|
||||
{
|
||||
byy = ((sy - (ty * 2)) * info->scaling) >> 10;
|
||||
bxx = ((w * byy / h) * info->scaling) >> 10;
|
||||
}
|
||||
bx = tx + ((((sx - (tx * 2)) - bxx) * info->xjustification) >> 10);
|
||||
by = ty + ((((sy - (ty * 2)) - byy) * info->yjustification) >> 10);
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%%!PS-Adobe-2.0 EPSF-2.0\n");
|
||||
fprintf(f, "%%%%Title: %s\n", file);
|
||||
fprintf(f, "%%%%Creator: Imlib by The Rasterman\n");
|
||||
fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", bx, by, bxx, byy);
|
||||
fprintf(f, "%%%%Pages: 1\n");
|
||||
fprintf(f, "%%%%DocumentFonts:\n");
|
||||
fprintf(f, "%%%%EndComments\n");
|
||||
fprintf(f, "%%%%EndProlog\n");
|
||||
fprintf(f, "%%%%Page: 1 1\n");
|
||||
fprintf(f, "/origstate save def\n");
|
||||
fprintf(f, "20 dict begin\n");
|
||||
if (info->color)
|
||||
{
|
||||
fprintf(f, "/pix %i string def\n", w * 3);
|
||||
fprintf(f, "/grays %i string def\n", w);
|
||||
fprintf(f, "/npixls 0 def\n");
|
||||
fprintf(f, "/rgbindx 0 def\n");
|
||||
fprintf(f, "%i %i translate\n", bx, by);
|
||||
fprintf(f, "%i %i scale\n", bxx, byy);
|
||||
fprintf(f,
|
||||
"/colorimage where\n"
|
||||
"{ pop }\n"
|
||||
"{\n"
|
||||
"/colortogray {\n"
|
||||
"/rgbdata exch store\n"
|
||||
"rgbdata length 3 idiv\n"
|
||||
"/npixls exch store\n"
|
||||
"/rgbindx 0 store\n"
|
||||
"0 1 npixls 1 sub {\n"
|
||||
"grays exch\n"
|
||||
"rgbdata rgbindx get 20 mul\n"
|
||||
"rgbdata rgbindx 1 add get 32 mul\n"
|
||||
"rgbdata rgbindx 2 add get 12 mul\n"
|
||||
"add add 64 idiv\n"
|
||||
"put\n"
|
||||
"/rgbindx rgbindx 3 add store\n"
|
||||
"} for\n"
|
||||
"grays 0 npixls getinterval\n"
|
||||
"} bind def\n"
|
||||
"/mergeprocs {\n"
|
||||
"dup length\n"
|
||||
"3 -1 roll\n"
|
||||
"dup\n"
|
||||
"length\n"
|
||||
"dup\n"
|
||||
"5 1 roll\n"
|
||||
"3 -1 roll\n"
|
||||
"add\n"
|
||||
"array cvx\n"
|
||||
"dup\n"
|
||||
"3 -1 roll\n"
|
||||
"0 exch\n"
|
||||
"putinterval\n"
|
||||
"dup\n"
|
||||
"4 2 roll\n"
|
||||
"putinterval\n"
|
||||
"} bind def\n"
|
||||
"/colorimage {\n"
|
||||
"pop pop\n"
|
||||
"{colortogray} mergeprocs\n"
|
||||
"image\n"
|
||||
"} bind def\n"
|
||||
"} ifelse\n");
|
||||
fprintf(f, "%i %i 8\n", w, h);
|
||||
fprintf(f, "[%i 0 0 -%i 0 %i]\n", w, h, h);
|
||||
fprintf(f, "{currentfile pix readhexstring pop}\n");
|
||||
fprintf(f, "false 3 colorimage\n");
|
||||
fprintf(f, "\n");
|
||||
ptr = im->rgb_data;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
v = (int)(*ptr++);
|
||||
if (v < 0x10)
|
||||
fprintf(f, "0%x", v);
|
||||
else
|
||||
fprintf(f, "%x", v);
|
||||
v = (int)(*ptr++);
|
||||
if (v < 0x10)
|
||||
fprintf(f, "0%x", v);
|
||||
else
|
||||
fprintf(f, "%x", v);
|
||||
v = (int)(*ptr++);
|
||||
if (v < 0x10)
|
||||
fprintf(f, "0%x", v);
|
||||
else
|
||||
fprintf(f, "%x", v);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(f, "/pix %i string def\n", w);
|
||||
fprintf(f, "/grays %i string def\n", w);
|
||||
fprintf(f, "/npixls 0 def\n");
|
||||
fprintf(f, "/rgbindx 0 def\n");
|
||||
fprintf(f, "%i %i translate\n", bx, by);
|
||||
fprintf(f, "%i %i scale\n", bxx, byy);
|
||||
fprintf(f, "%i %i 8\n", w, h);
|
||||
fprintf(f, "[%i 0 0 -%i 0 %i]\n", w, h, h);
|
||||
fprintf(f, "{currentfile pix readhexstring pop}\n");
|
||||
fprintf(f, "image\n");
|
||||
fprintf(f, "\n");
|
||||
ptr = im->rgb_data;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
v = (int)(*ptr++);
|
||||
v += (int)(*ptr++);
|
||||
v += (int)(*ptr++);
|
||||
v /= 3;
|
||||
if (v < 0x10)
|
||||
fprintf(f, "0%x", v);
|
||||
else
|
||||
fprintf(f, "%x", v);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "showpage\n");
|
||||
fprintf(f, "end\n");
|
||||
fprintf(f, "origstate restore\n");
|
||||
fprintf(f, "%%%%Trailer\n");
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((!strcasecmp(ext, "jpeg")) || (!strcasecmp(ext, "jpg")))
|
||||
{
|
||||
#ifdef HAVE_LIBJPEG
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
JSAMPROW row_pointer[1];
|
||||
int row_stride;
|
||||
int y;
|
||||
|
||||
f = fopen(file, "wb");
|
||||
if (f)
|
||||
{
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_compress(&cinfo);
|
||||
jpeg_stdio_dest(&cinfo, f);
|
||||
cinfo.image_width = im->rgb_width;
|
||||
cinfo.image_height = im->rgb_height;
|
||||
cinfo.input_components = 3;
|
||||
cinfo.in_color_space = JCS_RGB;
|
||||
jpeg_set_defaults(&cinfo);
|
||||
jpeg_set_quality(&cinfo, (100 * info->quality) >> 8, TRUE);
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
row_stride = cinfo.image_width * 3;
|
||||
while (cinfo.next_scanline < cinfo.image_height)
|
||||
{
|
||||
row_pointer[0] = im->rgb_data + (cinfo.next_scanline * row_stride);
|
||||
jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
}
|
||||
jpeg_finish_compress(&cinfo);
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp(ext, "png"))
|
||||
{
|
||||
#ifdef HAVE_LIBPNG
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
unsigned char *data, *ptr;
|
||||
int x, y;
|
||||
png_bytep row_ptr;
|
||||
png_color_8 sig_bit;
|
||||
|
||||
f = fopen(file, "wb");
|
||||
if (f)
|
||||
{
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
{
|
||||
fclose(f);
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
return 0;
|
||||
}
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
{
|
||||
fclose(f);
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
return 0;
|
||||
}
|
||||
png_init_io(png_ptr, f);
|
||||
png_set_IHDR(png_ptr, info_ptr, im->rgb_width, im->rgb_height, 8,
|
||||
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
sig_bit.red = 8;
|
||||
sig_bit.green = 8;
|
||||
sig_bit.blue = 8;
|
||||
sig_bit.alpha = 8;
|
||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
png_set_shift(png_ptr, &sig_bit);
|
||||
png_set_packing(png_ptr);
|
||||
data = malloc(im->rgb_width * 4);
|
||||
if (!data)
|
||||
{
|
||||
fclose(f);
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
return 0;
|
||||
}
|
||||
for (y = 0; y < im->rgb_height; y++)
|
||||
{
|
||||
ptr = im->rgb_data + (y * im->rgb_width * 3);
|
||||
for (x = 0; x < im->rgb_width; x++)
|
||||
{
|
||||
data[(x << 2) + 0] = *ptr++;
|
||||
data[(x << 2) + 1] = *ptr++;
|
||||
data[(x << 2) + 2] = *ptr++;
|
||||
if ((data[(x << 2) + 0] == im->shape_color.r) &&
|
||||
(data[(x << 2) + 1] == im->shape_color.g) &&
|
||||
(data[(x << 2) + 2] == im->shape_color.b))
|
||||
data[(x << 2) + 3] = 0;
|
||||
else
|
||||
data[(x << 2) + 3] = 255;
|
||||
}
|
||||
row_ptr = data;
|
||||
png_write_rows(png_ptr, &row_ptr, 1);
|
||||
}
|
||||
free(data);
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if ((!strcasecmp(ext, "tiff")) || (!strcasecmp(ext, "tif")))
|
||||
{
|
||||
#ifdef HAVE_LIBTIFF
|
||||
TIFF *tif;
|
||||
unsigned char *ptr, *data;
|
||||
int x, y;
|
||||
int w;
|
||||
|
||||
tif = TIFFOpen(file, "w");
|
||||
if (tif)
|
||||
{
|
||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, im->rgb_width);
|
||||
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, im->rgb_height);
|
||||
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
|
||||
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
|
||||
{
|
||||
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
w = TIFFScanlineSize(tif);
|
||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
|
||||
TIFFDefaultStripSize(tif, -1));
|
||||
for (y = 0; y < im->rgb_height; y++)
|
||||
{
|
||||
data = im->rgb_data + (y * im->rgb_width * 3);
|
||||
TIFFWriteScanline(tif, data, y, 0);
|
||||
}
|
||||
}
|
||||
TIFFClose(tif);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (id->fallback)
|
||||
{
|
||||
f = open_helper("%C/convert pnm:- %s", file, "wb");
|
||||
if (f)
|
||||
{
|
||||
if (!fprintf(f, "P6\n# Created by Imlib\n%i %i\n255\n", im->rgb_width, im->rgb_height))
|
||||
{
|
||||
close_helper(f);
|
||||
return 0;
|
||||
}
|
||||
if (!fwrite(im->rgb_data, 1, (im->rgb_width * im->rgb_height * 3), f))
|
||||
{
|
||||
close_helper(f);
|
||||
return 0;
|
||||
}
|
||||
if (close_helper(f))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcasecmp(ext, "jpeg"))
|
||||
g_snprintf(cmd, sizeof(cmd), "%%H -quality %i -progressive -outfile %%s", 100 * info->quality / 256);
|
||||
else if (!strcasecmp(ext, "jpg"))
|
||||
g_snprintf(cmd, sizeof(cmd), "%%H -quality %i -progressive -outfile %%s", 100 * info->quality / 256);
|
||||
else if (!strcasecmp(ext, "bmp"))
|
||||
strcpy(cmd, "%Q %N/ppmtobmp >%s");
|
||||
else if (!strcasecmp(ext, "gif"))
|
||||
strcpy(cmd, "%Q %N/ppmtogif -interlace >%s");
|
||||
else if (!strcasecmp(ext, "ilbm"))
|
||||
strcpy(cmd, "%N/ppmtoilbm -24if -hires -lace -compress >%s");
|
||||
else if (!strcasecmp(ext, "ilb"))
|
||||
strcpy(cmd, "%N/ppmtoilbm -24if -hires -lace -compress >%s");
|
||||
else if (!strcasecmp(ext, "iff"))
|
||||
strcpy(cmd, "%N/ppmtoilbm -24if -hires -lace -compress >%s");
|
||||
else if (!strcasecmp(ext, "icr"))
|
||||
strcpy(cmd, "%N/ppmtoicr >%s");
|
||||
else if (!strcasecmp(ext, "map"))
|
||||
strcpy(cmd, "%N/ppmtomap >%s");
|
||||
else if (!strcasecmp(ext, "mit"))
|
||||
strcpy(cmd, "%N/ppmtomitsu -sharpness 4 >%s");
|
||||
else if (!strcasecmp(ext, "mitsu"))
|
||||
strcpy(cmd, "%N/ppmtomitsu -sharpness 4 >%s");
|
||||
else if (!strcasecmp(ext, "pcx"))
|
||||
strcpy(cmd, "%N/ppmtopcx -24bit -packed >%s");
|
||||
else if (!strcasecmp(ext, "pgm"))
|
||||
strcpy(cmd, "%N/ppmtopgm >%s");
|
||||
else if (!strcasecmp(ext, "pi1"))
|
||||
strcpy(cmd, "%N/ppmtopi1 >%s");
|
||||
else if (!strcasecmp(ext, "pic"))
|
||||
strcpy(cmd, "%Q %N/ppmtopict >%s");
|
||||
else if (!strcasecmp(ext, "pict"))
|
||||
strcpy(cmd, "%Q %N/ppmtopict >%s");
|
||||
else if (!strcasecmp(ext, "pj"))
|
||||
strcpy(cmd, "%N/ppmtopj >%s");
|
||||
else if (!strcasecmp(ext, "pjxl"))
|
||||
strcpy(cmd, "%N/ppmtopjxl >%s");
|
||||
else if (!strcasecmp(ext, "puz"))
|
||||
strcpy(cmd, "%N/ppmtopuzz >%s");
|
||||
else if (!strcasecmp(ext, "puzz"))
|
||||
strcpy(cmd, "%N/ppmtopuzz >%s");
|
||||
else if (!strcasecmp(ext, "rgb3"))
|
||||
strcpy(cmd, "%N/ppmtorgb3 >%s");
|
||||
else if (!strcasecmp(ext, "six"))
|
||||
strcpy(cmd, "%N/ppmtosixel >%s");
|
||||
else if (!strcasecmp(ext, "sixel"))
|
||||
strcpy(cmd, "%N/ppmtosizel >%s");
|
||||
else if (!strcasecmp(ext, "tga"))
|
||||
strcpy(cmd, "%N/ppmtotga -rgb >%s");
|
||||
else if (!strcasecmp(ext, "targa"))
|
||||
strcpy(cmd, "%N/ppmtotga -rgb >%s");
|
||||
else if (!strcasecmp(ext, "uil"))
|
||||
strcpy(cmd, "%N/ppmtouil >%s");
|
||||
else if (!strcasecmp(ext, "xpm"))
|
||||
strcpy(cmd, "%Q %N/ppmtoxpm >%s");
|
||||
else if (!strcasecmp(ext, "yuv"))
|
||||
strcpy(cmd, "%N/ppmtoyuv >%s");
|
||||
else if (!strcasecmp(ext, "png"))
|
||||
strcpy(cmd, "%N/pnmtopng >%s");
|
||||
else if (!strcasecmp(ext, "ps"))
|
||||
strcpy(cmd, "%N/pnmtops -center -scale 100 >%s");
|
||||
else if (!strcasecmp(ext, "rast"))
|
||||
strcpy(cmd, "%N/pnmtorast -rle >%s");
|
||||
else if (!strcasecmp(ext, "ras"))
|
||||
strcpy(cmd, "%N/pnmtorast -rle >%s");
|
||||
else if (!strcasecmp(ext, "sgi"))
|
||||
strcpy(cmd, "%N/pnmtosgi >%s");
|
||||
else if (!strcasecmp(ext, "sir"))
|
||||
strcpy(cmd, "%N/pnmtosir >%s");
|
||||
else if (!strcasecmp(ext, "tif"))
|
||||
strcpy(cmd, "%N/pnmtotiff -lzw >%s");
|
||||
else if (!strcasecmp(ext, "tiff"))
|
||||
strcpy(cmd, "%N/pnmtotiff -lzw >%s");
|
||||
else if (!strcasecmp(ext, "xwd"))
|
||||
strcpy(cmd, "%N/pnmtoxwd >%s");
|
||||
else
|
||||
ext = "";
|
||||
if (ext[0])
|
||||
{
|
||||
f = open_helper(cmd, file, "wb");
|
||||
if (f)
|
||||
{
|
||||
if (!fprintf(f, "P6\n# Created by Imlib\n%i %i\n255\n", im->rgb_width, im->rgb_height))
|
||||
{
|
||||
close_helper(f);
|
||||
return 0;
|
||||
}
|
||||
if (!fwrite(im->rgb_data, 1, (im->rgb_width * im->rgb_height * 3), f))
|
||||
{
|
||||
close_helper(f);
|
||||
return 0;
|
||||
}
|
||||
if (close_helper(f))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -112,24 +112,28 @@ void wxButton::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxButton::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid button" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxButton::SetForegroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid button" );
|
||||
|
||||
wxControl::SetForegroundColour( colour );
|
||||
|
||||
if (!m_foregroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -119,23 +119,17 @@ void wxCheckBox::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxCheckBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -102,18 +102,10 @@ void wxChoice::Append( const wxString &item )
|
||||
gtk_widget_realize( menu_item );
|
||||
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
|
||||
GtkBin *bin = GTK_BIN( menu_item );
|
||||
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET( bin ),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( menu_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN(menu_item)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
||||
@ -282,9 +274,7 @@ void wxChoice::SetFont( const wxFont &font )
|
||||
if (bin->child) label = bin->child;
|
||||
if (!label) label = GTK_BUTTON(m_widget)->child;
|
||||
|
||||
gtk_widget_set_style( label,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( label, GetWidgetStyle() );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -292,24 +282,21 @@ void wxChoice::SetFont( const wxFont &font )
|
||||
|
||||
void wxChoice::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid choice" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET( menu_shell ), gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
|
||||
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_WIDGET( child->data ), gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
@ -135,15 +135,10 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( list_item );
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(bin),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( list_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
@ -449,21 +444,16 @@ void wxComboBox::SetFont( const wxFont &font )
|
||||
|
||||
wxWindow::SetFont( font );
|
||||
|
||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
|
||||
|
||||
gtk_widget_set_style( entry,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
|
||||
GList *child = GTK_LIST(list)->children;
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
GtkBin *bin = (GtkBin*) child->data;
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( bin->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -482,34 +472,23 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
||||
|
||||
void wxComboBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
m_backgroundColour = colour;
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
|
||||
}
|
||||
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
// gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->button, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->list, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
|
||||
|
||||
GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children;
|
||||
while (child)
|
||||
{
|
||||
GtkWidget *item = GTK_WIDGET(child->data);
|
||||
gtk_widget_set_style( item, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: dialog.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: dnd.cpp
|
||||
// Purpose: wxDropTarget class
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: filedlg.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: font.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: frame.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: gauge.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Name: gdiobj.cpp
|
||||
// Purpose: wxGDIObject class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: icon.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -141,12 +141,10 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( list_item );
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( list_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
@ -473,9 +471,7 @@ void wxListBox::SetFont( const wxFont &font )
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -483,30 +479,24 @@ void wxListBox::SetFont( const wxFont &font )
|
||||
|
||||
void wxListBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
return;
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET(m_list),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
// gtk_widget_set_style( GTK_WIDGET(m_list), m_widgetStyle );
|
||||
|
||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||
gdk_window_clear( window );
|
||||
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||
// gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: mdi.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: menu.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: notebook.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -150,6 +150,8 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
int wxNotebook::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
|
||||
|
||||
if (m_pages.Number() == 0) return -1;
|
||||
|
||||
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
|
||||
@ -182,6 +184,8 @@ int wxNotebook::GetRowCount() const
|
||||
|
||||
wxString wxNotebook::GetPageText( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (nb_page)
|
||||
return nb_page->m_text;
|
||||
@ -191,6 +195,8 @@ wxString wxNotebook::GetPageText( int page ) const
|
||||
|
||||
int wxNotebook::GetPageImage( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, 0, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (nb_page)
|
||||
return nb_page->m_image;
|
||||
@ -200,6 +206,8 @@ int wxNotebook::GetPageImage( int page ) const
|
||||
|
||||
wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxNotebookPage*)NULL, "invalid notebook" );
|
||||
|
||||
wxNotebookPage *nb_page = (wxNotebookPage *) NULL;
|
||||
|
||||
wxNode *node = m_pages.First();
|
||||
@ -218,6 +226,8 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
||||
|
||||
int wxNotebook::SetSelection( int page )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
|
||||
|
||||
int selOld = GetSelection();
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
|
||||
@ -241,6 +251,8 @@ int wxNotebook::SetSelection( int page )
|
||||
|
||||
void wxNotebook::AdvanceSelection( bool bForward )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
int sel = GetSelection();
|
||||
int max = GetPageCount();
|
||||
|
||||
@ -257,6 +269,8 @@ void wxNotebook::SetImageList( wxImageList* imageList )
|
||||
|
||||
bool wxNotebook::SetPageText( int page, const wxString &text )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
|
||||
if (!nb_page) return FALSE;
|
||||
@ -289,6 +303,8 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
|
||||
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
wxNode *page_node = m_pages.First();
|
||||
while (page_node)
|
||||
{
|
||||
@ -331,6 +347,8 @@ bool wxNotebook::DeletePage( int page )
|
||||
bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
||||
bool bSelect, int imageId)
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
// we've created the notebook page in AddChild(). Now we just have to set
|
||||
// the caption for the page and set the others parameters.
|
||||
|
||||
@ -384,6 +402,8 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
||||
|
||||
wxWindow *wxNotebook::GetPage( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (!nb_page)
|
||||
return (wxWindow *) NULL;
|
||||
@ -393,6 +413,8 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
||||
|
||||
void wxNotebook::AddChild( wxWindow *win )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
m_children.Append(win);
|
||||
|
||||
wxNotebookPage *page = new wxNotebookPage();
|
||||
@ -434,6 +456,26 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetFont( const wxFont &font )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxNotebook::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxNotebookEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: pen.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -397,14 +397,14 @@ void wxRadioBox::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
|
||||
gtk_widget_set_style( button->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
@ -412,22 +412,20 @@ void wxRadioBox::SetFont( const wxFont &font )
|
||||
|
||||
void wxRadioBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_widget_set_style( button,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( button, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
|
@ -106,23 +106,17 @@ void wxRadioButton::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxRadioButton::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: statbmp.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: statbox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: stattext.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -15,6 +15,10 @@
|
||||
#include "wx/utils.h"
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "changed"
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -152,11 +156,15 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
|
||||
wxString wxTextCtrl::GetValue() const
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
|
||||
|
||||
wxString tmp;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
tmp = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
tmp = text;
|
||||
g_free( text );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,45 +209,189 @@ void wxTextCtrl::WriteText( const wxString &text )
|
||||
}
|
||||
}
|
||||
|
||||
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
|
||||
bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::LoadFile not implemented" );
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
if (!wxFileExists(file)) return FALSE;
|
||||
|
||||
Clear();
|
||||
|
||||
FILE *fp = NULL;
|
||||
struct stat statb;
|
||||
|
||||
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
|
||||
!(fp = fopen ((char*) (const char*) file, "r")))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gint len = statb.st_size;
|
||||
char *text;
|
||||
if (!(text = (char*)malloc ((unsigned) (len + 1))))
|
||||
{
|
||||
fclose (fp);
|
||||
return FALSE;
|
||||
}
|
||||
if (fread (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
text[len] = 0;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_entry_set_text( GTK_ENTRY(m_text), text );
|
||||
}
|
||||
|
||||
free (text);
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
|
||||
bool wxTextCtrl::SaveFile( const wxString &file )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::SaveFile not implemented" );
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
if (file == "") return FALSE;
|
||||
|
||||
FILE *fp;
|
||||
|
||||
return FALSE;
|
||||
if (!(fp = fopen ((char*) (const char*) file, "w")))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *text = NULL;
|
||||
gint len = 0;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
}
|
||||
else
|
||||
{
|
||||
text = gtk_entry_get_text( GTK_ENTRY(m_text) );
|
||||
}
|
||||
|
||||
if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
// Did not write whole file
|
||||
}
|
||||
|
||||
// Make sure newline terminates the file
|
||||
if (text[len - 1] != '\n')
|
||||
fputc ('\n', fp);
|
||||
|
||||
fclose (fp);
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE) g_free( text );
|
||||
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
wxString wxTextCtrl::GetLineText( long lineNo ) const
|
||||
{
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
|
||||
if (text)
|
||||
{
|
||||
wxString buf("");
|
||||
long i;
|
||||
int currentLine = 0;
|
||||
for (i = 0; currentLine != lineNo && text[i]; i++ )
|
||||
if (text[i] == '\n')
|
||||
currentLine++;
|
||||
// Now get the text
|
||||
int j;
|
||||
for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
|
||||
buf += text[i];
|
||||
|
||||
g_free( text );
|
||||
return buf;
|
||||
}
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lineNo == 0) return GetValue();
|
||||
return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::GetLineText( lineNo ) not implemented" );
|
||||
}
|
||||
|
||||
long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
|
||||
long wxTextCtrl::PositionToXY( long WXUNUSED(pos), long *WXUNUSED(x), long *WXUNUSED(y) ) const
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::XYToPosition not implemented" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTextCtrl::XYToPosition( long x, long y )
|
||||
long wxTextCtrl::XYToPosition( long WXUNUSED(x), long WXUNUSED(y) ) const
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::XYToPosition not implemented" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines()
|
||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||
{
|
||||
wxString str = GetLineText (lineNo);
|
||||
return (int) str.Length();
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines() const
|
||||
{
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
|
||||
if (text)
|
||||
{
|
||||
int currentLine = 0;
|
||||
for (int i = 0; i < len; i++ )
|
||||
if (text[i] == '\n')
|
||||
currentLine++;
|
||||
|
||||
g_free( text );
|
||||
return currentLine;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
void wxTextCtrl::SetInsertionPoint( long pos )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
int tmp = (int) pos;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
gtk_text_set_point( GTK_TEXT(m_text), tmp );
|
||||
@ -469,31 +621,17 @@ void wxTextCtrl::SetFont( const wxFont &font )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
if (((wxFont*)&font)->Ok())
|
||||
m_font = font;
|
||||
else
|
||||
m_font = *wxSWISS_FONT;
|
||||
wxControl::SetFont( font );
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_text );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
|
||||
}
|
||||
|
||||
gdk_font_unref( style->font );
|
||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||
|
||||
gtk_widget_set_style( m_text, style );
|
||||
// doesn't work
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
m_backgroundColour = colour;
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
@ -505,18 +643,7 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style( m_text );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
|
||||
}
|
||||
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_text->window ) );
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
|
||||
gtk_widget_set_style( m_text, style );
|
||||
gtk_widget_set_style( m_text, m_widgetStyle );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: timer.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,7 @@
|
||||
// Name: utils.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -138,7 +138,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
if (gdk_event->count > 0) return;
|
||||
|
||||
/*
|
||||
printf( "OnExpose from " );
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
@ -912,8 +912,8 @@ wxWindow::wxWindow()
|
||||
m_isEnabled = TRUE;
|
||||
m_pDropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_hasOwnStyle = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
}
|
||||
|
||||
bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
@ -1032,6 +1032,8 @@ wxWindow::~wxWindow()
|
||||
|
||||
DestroyChildren();
|
||||
|
||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||
|
||||
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
||||
|
||||
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
|
||||
@ -1112,8 +1114,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_pDropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
m_hasOwnStyle = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -1964,18 +1966,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( style );
|
||||
}
|
||||
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1986,7 +1986,28 @@ wxColour wxWindow::GetForegroundColour() const
|
||||
|
||||
void wxWindow::SetForegroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||
|
||||
m_foregroundColour = colour;
|
||||
if (!m_foregroundColour.Ok()) return;
|
||||
|
||||
if (!m_wxwindow)
|
||||
{
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle *wxWindow::GetWidgetStyle()
|
||||
{
|
||||
if (!m_widgetStyle)
|
||||
m_widgetStyle =
|
||||
gtk_style_copy(
|
||||
gtk_widget_get_style( m_widget ) );
|
||||
return m_widgetStyle;
|
||||
}
|
||||
|
||||
bool wxWindow::Validate()
|
||||
@ -2149,17 +2170,9 @@ void wxWindow::SetFont( const wxFont &font )
|
||||
else
|
||||
m_font = *wxSWISS_FONT;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( style );
|
||||
}
|
||||
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
gdk_font_unref( style->font );
|
||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
}
|
||||
|
||||
wxFont *wxWindow::GetFont()
|
||||
|
@ -112,24 +112,28 @@ void wxButton::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxButton::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid button" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxButton::SetForegroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid button" );
|
||||
|
||||
wxControl::SetForegroundColour( colour );
|
||||
|
||||
if (!m_foregroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -119,23 +119,17 @@ void wxCheckBox::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxCheckBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -102,18 +102,10 @@ void wxChoice::Append( const wxString &item )
|
||||
gtk_widget_realize( menu_item );
|
||||
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
|
||||
GtkBin *bin = GTK_BIN( menu_item );
|
||||
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET( bin ),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( menu_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN(menu_item)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
||||
@ -282,9 +274,7 @@ void wxChoice::SetFont( const wxFont &font )
|
||||
if (bin->child) label = bin->child;
|
||||
if (!label) label = GTK_BUTTON(m_widget)->child;
|
||||
|
||||
gtk_widget_set_style( label,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( label, GetWidgetStyle() );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -292,24 +282,21 @@ void wxChoice::SetFont( const wxFont &font )
|
||||
|
||||
void wxChoice::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid choice" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET( menu_shell ), gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
|
||||
|
||||
GList *child = menu_shell->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_WIDGET( child->data ), gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
@ -135,15 +135,10 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( list_item );
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(bin),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( list_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
@ -449,21 +444,16 @@ void wxComboBox::SetFont( const wxFont &font )
|
||||
|
||||
wxWindow::SetFont( font );
|
||||
|
||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
|
||||
|
||||
gtk_widget_set_style( entry,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
|
||||
GList *child = GTK_LIST(list)->children;
|
||||
GList *child = list->children;
|
||||
while (child)
|
||||
{
|
||||
GtkBin *bin = (GtkBin*) child->data;
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( bin->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -482,34 +472,23 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
||||
|
||||
void wxComboBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
m_backgroundColour = colour;
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
|
||||
}
|
||||
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
// gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->button, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->list, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
|
||||
|
||||
GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children;
|
||||
while (child)
|
||||
{
|
||||
GtkWidget *item = GTK_WIDGET(child->data);
|
||||
gtk_widget_set_style( item, gtk_style_ref( style ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: dialog.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: dnd.cpp
|
||||
// Purpose: wxDropTarget class
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: filedlg.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: font.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: frame.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: gauge.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Name: gdiobj.cpp
|
||||
// Purpose: wxGDIObject class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: icon.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -141,12 +141,10 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_hasOwnStyle)
|
||||
if (m_widgetStyle)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( list_item );
|
||||
gtk_widget_set_style( bin->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( list_item, m_widgetStyle );
|
||||
gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
@ -473,9 +471,7 @@ void wxListBox::SetFont( const wxFont &font )
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
@ -483,30 +479,24 @@ void wxListBox::SetFont( const wxFont &font )
|
||||
|
||||
void wxListBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
return;
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_WIDGET(m_list),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
// gtk_widget_set_style( GTK_WIDGET(m_list), m_widgetStyle );
|
||||
|
||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||
gdk_window_clear( window );
|
||||
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data),
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
|
||||
gtk_widget_set_style( GTK_BIN(child->data)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||
// gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
|
||||
|
||||
child = child->next;
|
||||
}
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: mdi.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: menu.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: notebook.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -150,6 +150,8 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
int wxNotebook::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
|
||||
|
||||
if (m_pages.Number() == 0) return -1;
|
||||
|
||||
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
|
||||
@ -182,6 +184,8 @@ int wxNotebook::GetRowCount() const
|
||||
|
||||
wxString wxNotebook::GetPageText( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (nb_page)
|
||||
return nb_page->m_text;
|
||||
@ -191,6 +195,8 @@ wxString wxNotebook::GetPageText( int page ) const
|
||||
|
||||
int wxNotebook::GetPageImage( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, 0, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (nb_page)
|
||||
return nb_page->m_image;
|
||||
@ -200,6 +206,8 @@ int wxNotebook::GetPageImage( int page ) const
|
||||
|
||||
wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxNotebookPage*)NULL, "invalid notebook" );
|
||||
|
||||
wxNotebookPage *nb_page = (wxNotebookPage *) NULL;
|
||||
|
||||
wxNode *node = m_pages.First();
|
||||
@ -218,6 +226,8 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
||||
|
||||
int wxNotebook::SetSelection( int page )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid notebook" );
|
||||
|
||||
int selOld = GetSelection();
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
|
||||
@ -241,6 +251,8 @@ int wxNotebook::SetSelection( int page )
|
||||
|
||||
void wxNotebook::AdvanceSelection( bool bForward )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
int sel = GetSelection();
|
||||
int max = GetPageCount();
|
||||
|
||||
@ -257,6 +269,8 @@ void wxNotebook::SetImageList( wxImageList* imageList )
|
||||
|
||||
bool wxNotebook::SetPageText( int page, const wxString &text )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
|
||||
if (!nb_page) return FALSE;
|
||||
@ -289,6 +303,8 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
|
||||
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
wxNode *page_node = m_pages.First();
|
||||
while (page_node)
|
||||
{
|
||||
@ -331,6 +347,8 @@ bool wxNotebook::DeletePage( int page )
|
||||
bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
||||
bool bSelect, int imageId)
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||
|
||||
// we've created the notebook page in AddChild(). Now we just have to set
|
||||
// the caption for the page and set the others parameters.
|
||||
|
||||
@ -384,6 +402,8 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
||||
|
||||
wxWindow *wxNotebook::GetPage( int page ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );
|
||||
|
||||
wxNotebookPage* nb_page = GetNotebookPage(page);
|
||||
if (!nb_page)
|
||||
return (wxWindow *) NULL;
|
||||
@ -393,6 +413,8 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
||||
|
||||
void wxNotebook::AddChild( wxWindow *win )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
m_children.Append(win);
|
||||
|
||||
wxNotebookPage *page = new wxNotebookPage();
|
||||
@ -434,6 +456,26 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetFont( const wxFont &font )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxNotebook::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid notebook" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxNotebookEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: pen.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -397,14 +397,14 @@ void wxRadioBox::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
|
||||
gtk_widget_set_style( button->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
@ -412,22 +412,20 @@ void wxRadioBox::SetFont( const wxFont &font )
|
||||
|
||||
void wxRadioBox::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_widget_set_style( button,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( button, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
|
@ -106,23 +106,17 @@ void wxRadioButton::SetFont( const wxFont &font )
|
||||
|
||||
wxControl::SetFont( font );
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||
}
|
||||
|
||||
void wxRadioButton::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child,
|
||||
gtk_style_ref(
|
||||
gtk_widget_get_style( m_widget ) ) );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: statbmp.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: statbox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// Name: stattext.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -15,6 +15,10 @@
|
||||
#include "wx/utils.h"
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "changed"
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -152,11 +156,15 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
|
||||
wxString wxTextCtrl::GetValue() const
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
|
||||
|
||||
wxString tmp;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
tmp = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
tmp = text;
|
||||
g_free( text );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,45 +209,189 @@ void wxTextCtrl::WriteText( const wxString &text )
|
||||
}
|
||||
}
|
||||
|
||||
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
|
||||
bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::LoadFile not implemented" );
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
if (!wxFileExists(file)) return FALSE;
|
||||
|
||||
Clear();
|
||||
|
||||
FILE *fp = NULL;
|
||||
struct stat statb;
|
||||
|
||||
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
|
||||
!(fp = fopen ((char*) (const char*) file, "r")))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gint len = statb.st_size;
|
||||
char *text;
|
||||
if (!(text = (char*)malloc ((unsigned) (len + 1))))
|
||||
{
|
||||
fclose (fp);
|
||||
return FALSE;
|
||||
}
|
||||
if (fread (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
text[len] = 0;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_entry_set_text( GTK_ENTRY(m_text), text );
|
||||
}
|
||||
|
||||
free (text);
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
|
||||
bool wxTextCtrl::SaveFile( const wxString &file )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::SaveFile not implemented" );
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
if (file == "") return FALSE;
|
||||
|
||||
FILE *fp;
|
||||
|
||||
return FALSE;
|
||||
if (!(fp = fopen ((char*) (const char*) file, "w")))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *text = NULL;
|
||||
gint len = 0;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
}
|
||||
else
|
||||
{
|
||||
text = gtk_entry_get_text( GTK_ENTRY(m_text) );
|
||||
}
|
||||
|
||||
if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
// Did not write whole file
|
||||
}
|
||||
|
||||
// Make sure newline terminates the file
|
||||
if (text[len - 1] != '\n')
|
||||
fputc ('\n', fp);
|
||||
|
||||
fclose (fp);
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE) g_free( text );
|
||||
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
wxString wxTextCtrl::GetLineText( long lineNo ) const
|
||||
{
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
|
||||
if (text)
|
||||
{
|
||||
wxString buf("");
|
||||
long i;
|
||||
int currentLine = 0;
|
||||
for (i = 0; currentLine != lineNo && text[i]; i++ )
|
||||
if (text[i] == '\n')
|
||||
currentLine++;
|
||||
// Now get the text
|
||||
int j;
|
||||
for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
|
||||
buf += text[i];
|
||||
|
||||
g_free( text );
|
||||
return buf;
|
||||
}
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lineNo == 0) return GetValue();
|
||||
return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::GetLineText( lineNo ) not implemented" );
|
||||
}
|
||||
|
||||
long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
|
||||
long wxTextCtrl::PositionToXY( long WXUNUSED(pos), long *WXUNUSED(x), long *WXUNUSED(y) ) const
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::XYToPosition not implemented" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTextCtrl::XYToPosition( long x, long y )
|
||||
long wxTextCtrl::XYToPosition( long WXUNUSED(x), long WXUNUSED(y) ) const
|
||||
{
|
||||
wxFAIL_MSG( "wxTextCtrl::XYToPosition not implemented" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines()
|
||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||
{
|
||||
wxString str = GetLineText (lineNo);
|
||||
return (int) str.Length();
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines() const
|
||||
{
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
|
||||
|
||||
if (text)
|
||||
{
|
||||
int currentLine = 0;
|
||||
for (int i = 0; i < len; i++ )
|
||||
if (text[i] == '\n')
|
||||
currentLine++;
|
||||
|
||||
g_free( text );
|
||||
return currentLine;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
void wxTextCtrl::SetInsertionPoint( long pos )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
int tmp = (int) pos;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
gtk_text_set_point( GTK_TEXT(m_text), tmp );
|
||||
@ -469,31 +621,17 @@ void wxTextCtrl::SetFont( const wxFont &font )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
if (((wxFont*)&font)->Ok())
|
||||
m_font = font;
|
||||
else
|
||||
m_font = *wxSWISS_FONT;
|
||||
wxControl::SetFont( font );
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_text );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
|
||||
}
|
||||
|
||||
gdk_font_unref( style->font );
|
||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||
|
||||
gtk_widget_set_style( m_text, style );
|
||||
// doesn't work
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
{
|
||||
return;
|
||||
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
m_backgroundColour = colour;
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
@ -505,18 +643,7 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style( m_text );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( gtk_widget_get_style( m_text ) );
|
||||
}
|
||||
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_text->window ) );
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
|
||||
gtk_widget_set_style( m_text, style );
|
||||
gtk_widget_set_style( m_text, m_widgetStyle );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Name: timer.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $id$
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,7 @@
|
||||
// Name: utils.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -138,7 +138,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
if (gdk_event->count > 0) return;
|
||||
|
||||
/*
|
||||
printf( "OnExpose from " );
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
@ -912,8 +912,8 @@ wxWindow::wxWindow()
|
||||
m_isEnabled = TRUE;
|
||||
m_pDropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_hasOwnStyle = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
}
|
||||
|
||||
bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
@ -1032,6 +1032,8 @@ wxWindow::~wxWindow()
|
||||
|
||||
DestroyChildren();
|
||||
|
||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||
|
||||
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
||||
|
||||
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
|
||||
@ -1112,8 +1114,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_pDropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
m_hasOwnStyle = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -1964,18 +1966,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( style );
|
||||
}
|
||||
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1986,7 +1986,28 @@ wxColour wxWindow::GetForegroundColour() const
|
||||
|
||||
void wxWindow::SetForegroundColour( const wxColour &colour )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||
|
||||
m_foregroundColour = colour;
|
||||
if (!m_foregroundColour.Ok()) return;
|
||||
|
||||
if (!m_wxwindow)
|
||||
{
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle *wxWindow::GetWidgetStyle()
|
||||
{
|
||||
if (!m_widgetStyle)
|
||||
m_widgetStyle =
|
||||
gtk_style_copy(
|
||||
gtk_widget_get_style( m_widget ) );
|
||||
return m_widgetStyle;
|
||||
}
|
||||
|
||||
bool wxWindow::Validate()
|
||||
@ -2149,17 +2170,9 @@ void wxWindow::SetFont( const wxFont &font )
|
||||
else
|
||||
m_font = *wxSWISS_FONT;
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style( m_widget );
|
||||
if (!m_hasOwnStyle)
|
||||
{
|
||||
m_hasOwnStyle = TRUE;
|
||||
style = gtk_style_copy( style );
|
||||
}
|
||||
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
gdk_font_unref( style->font );
|
||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||
|
||||
gtk_widget_set_style( m_widget, style );
|
||||
}
|
||||
|
||||
wxFont *wxWindow::GetFont()
|
||||
|
Loading…
Reference in New Issue
Block a user