From bbe0af5b15f8b8e95ed45abc2140fb3a1fac3c87 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 8 Jan 1999 20:33:18 +0000 Subject: [PATCH] minor Configure / makefiles updates Removed mor (egcs) warnings Updated version to 2.0.1 in version.h Several corrections for strict compilers OpenGL updates new wxApp::InitVisual() for overriding in order to set non-default visual (unportable, of course) Added makefiles for DialogEd and Tex2Rtf made wxGTK compile with Tex2Rtf Added BEGIN_DRAG event to tree ctrl Added missing #include to lexel.l (unistd.h) (MSW?) new wxGTK.spec turned one or two more #ifdef into #if git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 3 +- include/wx/generic/treectrl.h | 1 + include/wx/gtk/app.h | 57 ++-- include/wx/gtk/menu.h | 9 +- include/wx/gtk/timer.h | 16 ++ include/wx/gtk/window.h | 6 + include/wx/gtk1/app.h | 57 ++-- include/wx/gtk1/menu.h | 9 +- include/wx/gtk1/timer.h | 16 ++ include/wx/gtk1/window.h | 6 + include/wx/odbc.h | 2 +- include/wx/version.h | 4 +- samples/db/dbtest.h | 4 + src/common/image.cpp | 2 +- src/common/lexer.l | 1 + src/common/socket.cpp | 8 +- src/common/stream.cpp | 7 +- src/generic/fontdlgg.cpp | 12 +- src/generic/helpext.cpp | 4 +- src/generic/treectrl.cpp | 455 +++++++++++++++++--------------- src/gtk/accel.cpp | 7 + src/gtk/app.cpp | 97 ++++--- src/gtk/checklst.cpp | 15 +- src/gtk/combobox.cpp | 2 +- src/gtk/dcps.cpp | 1 - src/gtk/dnd.cpp | 9 +- src/gtk/listbox.cpp | 2 +- src/gtk/menu.cpp | 28 +- src/gtk/minifram.cpp | 1 - src/gtk/notebook.cpp | 2 +- src/gtk/radiobox.cpp | 21 +- src/gtk/region.cpp | 426 +++++++++++++++--------------- src/gtk/textctrl.cpp | 4 +- src/gtk/threadpsx.cpp | 45 ++-- src/gtk/timer.cpp | 45 ++++ src/gtk/utilsgtk.cpp | 84 +++--- src/gtk/utilsres.cpp | 8 +- src/gtk/wave.cpp | 121 +++++---- src/gtk/window.cpp | 9 + src/gtk1/accel.cpp | 7 + src/gtk1/app.cpp | 97 ++++--- src/gtk1/checklst.cpp | 15 +- src/gtk1/combobox.cpp | 2 +- src/gtk1/dcps.cpp | 1 - src/gtk1/dnd.cpp | 9 +- src/gtk1/listbox.cpp | 2 +- src/gtk1/menu.cpp | 28 +- src/gtk1/minifram.cpp | 1 - src/gtk1/notebook.cpp | 2 +- src/gtk1/radiobox.cpp | 21 +- src/gtk1/region.cpp | 426 +++++++++++++++--------------- src/gtk1/textctrl.cpp | 4 +- src/gtk1/threadpsx.cpp | 45 ++-- src/gtk1/timer.cpp | 45 ++++ src/gtk1/utilsgtk.cpp | 84 +++--- src/gtk1/utilsres.cpp | 8 +- src/gtk1/wave.cpp | 121 +++++---- src/gtk1/window.cpp | 9 + src/iodbc/henv.ci | 118 ++++----- src/iodbc/herr.ci | 186 ++++++------- utils/dialoged/Makefile | 1 - utils/dialoged/src/.cvsignore | 4 + utils/dialoged/src/Makefile | 39 ++- utils/dialoged/src/Makefile.in | 26 -- utils/glcanvas/src/Makefile.in | 6 +- utils/glcanvas/src/glcanvas.cpp | 158 ++++++----- wxGTK.spec | 15 +- 67 files changed, 1777 insertions(+), 1309 deletions(-) delete mode 100644 utils/dialoged/Makefile delete mode 100644 utils/dialoged/src/Makefile.in diff --git a/include/wx/defs.h b/include/wx/defs.h index 5195027e10..170cc0e38f 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -976,6 +976,7 @@ typedef void* gpointer; /* Stand-ins for GDK types */ typedef gulong GdkAtom; +typedef struct _GdkVisual GdkVisual; typedef struct _GdkColor GdkColor; typedef struct _GdkColormap GdkColormap; typedef struct _GdkFont GdkFont; @@ -994,9 +995,7 @@ typedef struct _GtkList GtkList; typedef struct _GtkToolbar GtkToolbar; typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebookPage GtkNotebookPage; - #endif - #endif // _WX_DEFS_H_ diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 29acb18cea..cd3c90b8b6 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -456,6 +456,7 @@ protected: wxBrush *m_hilightBrush; wxImageList *m_imageListNormal, *m_imageListState; + int m_dragCount; // the common part of all ctors void Init(); diff --git a/include/wx/gtk/app.h b/include/wx/gtk/app.h index c697207972..4884ccf091 100644 --- a/include/wx/gtk/app.h +++ b/include/wx/gtk/app.h @@ -31,6 +31,9 @@ class wxLog; extern wxApp *wxTheApp; +extern GdkVisual *wxVisualSetByExternal; +extern GdkColormap *wxColormapSetByExternal; + //----------------------------------------------------------------------------- // global functions //----------------------------------------------------------------------------- @@ -55,48 +58,56 @@ class wxApp: public wxEvtHandler public: - wxApp(void); - ~wxApp(void); + wxApp(); + ~wxApp(); static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } - static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; } + static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; } - virtual bool OnInit(void); - virtual bool OnInitGui(void); - virtual int OnRun(void); - virtual int OnExit(void); + /* this may have to be overwritten when special, non-default visuals have + to be set. it is also platform dependent as only X knows about displays + and visuals. by standard, this routine looks at wxVisualSetByExternal + which might have been set in the wxModule code of the OpenGL canvas */ + virtual bool InitVisual(); - wxWindow *GetTopWindow(void); + virtual bool OnInit(); + virtual bool OnInitGui(); + virtual int OnRun(); + virtual int OnExit(); + + wxWindow *GetTopWindow(); void SetTopWindow( wxWindow *win ); - virtual int MainLoop(void); - void ExitMainLoop(void); - bool Initialized(void); - virtual bool Pending(void); - virtual void Dispatch(void); + virtual int MainLoop(); + void ExitMainLoop(); + bool Initialized(); + virtual bool Pending(); + virtual void Dispatch(); inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } - inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; } + inline bool GetWantDebugOutput() { return m_wantDebugOutput; } void OnIdle( wxIdleEvent &event ); - bool SendIdleEvents(void); + bool SendIdleEvents(); bool SendIdleEvents( wxWindow* win ); - inline wxString GetAppName(void) const { + inline wxString GetAppName() const + { if (m_appName != "") return m_appName; else return m_className; } + inline void SetAppName(const wxString& name) { m_appName = name; }; - inline wxString GetClassName(void) const { return m_className; } + inline wxString GetClassName() const { return m_className; } inline void SetClassName(const wxString& name) { m_className = name; } const wxString& GetVendorName() const { return m_vendorName; } void SetVendorName(const wxString& name) { m_vendorName = name; } inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } - inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } + inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; } void SetPrintMode(int WXUNUSED(mode) ) {}; - int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; + int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }; // override this function to create default log target of arbitrary // user-defined classv (default implementation creates a wxLogGui object) @@ -104,11 +115,11 @@ class wxApp: public wxEvtHandler // GTK implementation - static void CommonInit(void); - static void CommonCleanUp(void); + static void CommonInit(); + static void CommonCleanUp(); - bool ProcessIdle(void); - void DeletePendingObjects(void); + bool ProcessIdle(); + void DeletePendingObjects(); bool m_initialized; bool m_exitOnFrameDelete; diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index a4656258ed..78445e7432 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -58,6 +58,13 @@ public: bool Enabled( int id ) const; inline bool IsEnabled(int Id) const { return Enabled(Id); }; inline bool IsChecked(int Id) const { return Checked(Id); }; + + wxString GetLabel( int id ) const; + void SetLabel( int id, const wxString &label ); + + void EnableTop( int pos, bool flag ); + void SetLabelTop( int pos, const wxString& label ); + wxString GetLabelTop( int pos ) const; int GetMenuCount() const { return m_menus.Number(); } wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } @@ -102,7 +109,7 @@ public: bool IsChecked( int id ) const; void SetLabel( int id, const wxString &label ); - wxString GetLabel(int id) const; + wxString GetLabel( int id ) const; // helpstring virtual void SetHelpString(int id, const wxString& helpString); diff --git a/include/wx/gtk/timer.h b/include/wx/gtk/timer.h index 80e302758b..ad3fbc619d 100644 --- a/include/wx/gtk/timer.h +++ b/include/wx/gtk/timer.h @@ -24,6 +24,22 @@ class wxTimer; +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +/* Timer functions (milliseconds) */ +void wxStartTimer(); + +/* Gets time since last wxStartTimer or wxGetElapsedTime */ +long wxGetElapsedTime(bool resetTimer = TRUE); + +/* EXPERIMENTAL: comment this out if it doesn't compile. */ +bool wxGetLocalTime(long *timeZone, int *dstObserved); + +/* Get number of seconds since 00:00:00 GMT, Jan 1st 1970. */ +long wxGetCurrentTime(); + //----------------------------------------------------------------------------- // wxTimer //----------------------------------------------------------------------------- diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 4b3e3d78d7..d26c7214cc 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -32,6 +32,12 @@ extern const char *wxFrameNameStr; extern wxList wxTopLevelWindows; +//----------------------------------------------------------------------------- +// global function +//----------------------------------------------------------------------------- + +wxWindow* wxGetActiveWindow(); + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/include/wx/gtk1/app.h b/include/wx/gtk1/app.h index c697207972..4884ccf091 100644 --- a/include/wx/gtk1/app.h +++ b/include/wx/gtk1/app.h @@ -31,6 +31,9 @@ class wxLog; extern wxApp *wxTheApp; +extern GdkVisual *wxVisualSetByExternal; +extern GdkColormap *wxColormapSetByExternal; + //----------------------------------------------------------------------------- // global functions //----------------------------------------------------------------------------- @@ -55,48 +58,56 @@ class wxApp: public wxEvtHandler public: - wxApp(void); - ~wxApp(void); + wxApp(); + ~wxApp(); static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } - static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; } + static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; } - virtual bool OnInit(void); - virtual bool OnInitGui(void); - virtual int OnRun(void); - virtual int OnExit(void); + /* this may have to be overwritten when special, non-default visuals have + to be set. it is also platform dependent as only X knows about displays + and visuals. by standard, this routine looks at wxVisualSetByExternal + which might have been set in the wxModule code of the OpenGL canvas */ + virtual bool InitVisual(); - wxWindow *GetTopWindow(void); + virtual bool OnInit(); + virtual bool OnInitGui(); + virtual int OnRun(); + virtual int OnExit(); + + wxWindow *GetTopWindow(); void SetTopWindow( wxWindow *win ); - virtual int MainLoop(void); - void ExitMainLoop(void); - bool Initialized(void); - virtual bool Pending(void); - virtual void Dispatch(void); + virtual int MainLoop(); + void ExitMainLoop(); + bool Initialized(); + virtual bool Pending(); + virtual void Dispatch(); inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } - inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; } + inline bool GetWantDebugOutput() { return m_wantDebugOutput; } void OnIdle( wxIdleEvent &event ); - bool SendIdleEvents(void); + bool SendIdleEvents(); bool SendIdleEvents( wxWindow* win ); - inline wxString GetAppName(void) const { + inline wxString GetAppName() const + { if (m_appName != "") return m_appName; else return m_className; } + inline void SetAppName(const wxString& name) { m_appName = name; }; - inline wxString GetClassName(void) const { return m_className; } + inline wxString GetClassName() const { return m_className; } inline void SetClassName(const wxString& name) { m_className = name; } const wxString& GetVendorName() const { return m_vendorName; } void SetVendorName(const wxString& name) { m_vendorName = name; } inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } - inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } + inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; } void SetPrintMode(int WXUNUSED(mode) ) {}; - int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; + int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }; // override this function to create default log target of arbitrary // user-defined classv (default implementation creates a wxLogGui object) @@ -104,11 +115,11 @@ class wxApp: public wxEvtHandler // GTK implementation - static void CommonInit(void); - static void CommonCleanUp(void); + static void CommonInit(); + static void CommonCleanUp(); - bool ProcessIdle(void); - void DeletePendingObjects(void); + bool ProcessIdle(); + void DeletePendingObjects(); bool m_initialized; bool m_exitOnFrameDelete; diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index a4656258ed..78445e7432 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -58,6 +58,13 @@ public: bool Enabled( int id ) const; inline bool IsEnabled(int Id) const { return Enabled(Id); }; inline bool IsChecked(int Id) const { return Checked(Id); }; + + wxString GetLabel( int id ) const; + void SetLabel( int id, const wxString &label ); + + void EnableTop( int pos, bool flag ); + void SetLabelTop( int pos, const wxString& label ); + wxString GetLabelTop( int pos ) const; int GetMenuCount() const { return m_menus.Number(); } wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } @@ -102,7 +109,7 @@ public: bool IsChecked( int id ) const; void SetLabel( int id, const wxString &label ); - wxString GetLabel(int id) const; + wxString GetLabel( int id ) const; // helpstring virtual void SetHelpString(int id, const wxString& helpString); diff --git a/include/wx/gtk1/timer.h b/include/wx/gtk1/timer.h index 80e302758b..ad3fbc619d 100644 --- a/include/wx/gtk1/timer.h +++ b/include/wx/gtk1/timer.h @@ -24,6 +24,22 @@ class wxTimer; +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +/* Timer functions (milliseconds) */ +void wxStartTimer(); + +/* Gets time since last wxStartTimer or wxGetElapsedTime */ +long wxGetElapsedTime(bool resetTimer = TRUE); + +/* EXPERIMENTAL: comment this out if it doesn't compile. */ +bool wxGetLocalTime(long *timeZone, int *dstObserved); + +/* Get number of seconds since 00:00:00 GMT, Jan 1st 1970. */ +long wxGetCurrentTime(); + //----------------------------------------------------------------------------- // wxTimer //----------------------------------------------------------------------------- diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 4b3e3d78d7..d26c7214cc 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -32,6 +32,12 @@ extern const char *wxFrameNameStr; extern wxList wxTopLevelWindows; +//----------------------------------------------------------------------------- +// global function +//----------------------------------------------------------------------------- + +wxWindow* wxGetActiveWindow(); + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/include/wx/odbc.h b/include/wx/odbc.h index b33a2f1407..90fcbaea0c 100644 --- a/include/wx/odbc.h +++ b/include/wx/odbc.h @@ -83,7 +83,7 @@ class WXDLLEXPORT wxDatabase: public wxObject bool err_occured; wxList recordSets; // Record sets: Added by JACS - + public: wxDatabase(void); ~wxDatabase(void); diff --git a/include/wx/version.h b/include/wx/version.h index deafa618a1..07fa7a7293 100644 --- a/include/wx/version.h +++ b/include/wx/version.h @@ -15,8 +15,8 @@ /* Bump-up with each new version */ #define wxMAJOR_VERSION 2 #define wxMINOR_VERSION 0 -#define wxRELEASE_NUMBER 0 -#define wxVERSION_STRING "wxWindows 2.0" +#define wxRELEASE_NUMBER 1 +#define wxVERSION_STRING "wxWindows 2.0.1" #define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER #define wxBETA_NUMBER 17 #define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) diff --git a/samples/db/dbtest.h b/samples/db/dbtest.h index 6689d522ea..d36cd14dec 100644 --- a/samples/db/dbtest.h +++ b/samples/db/dbtest.h @@ -40,7 +40,11 @@ enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER}; class CeditorDlg; class CparameterDlg; +#ifdef __WXGTK__ +const char paramFilename[] = "../database.cfg"; +#else const char paramFilename[] = "database.cfg"; +#endif /* diff --git a/src/common/image.cpp b/src/common/image.cpp index ab86f51944..3138c68f0b 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -854,7 +854,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name ) } /* - * REading the image data + * Reading the image data */ fseek(file, offset, SEEK_SET); data = ptr; diff --git a/src/common/lexer.l b/src/common/lexer.l index 02e95f54a9..bb25277e79 100644 --- a/src/common/lexer.l +++ b/src/common/lexer.l @@ -12,6 +12,7 @@ WORDCHAR [^'\\] * either lex and flex. */ #include +#include /* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) please check, if this is also TRUE under other UNIXes. diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 186a49a22c..0862ac0670 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -510,8 +510,12 @@ void wxSocketBase::Discard() // If what? Who seems to need unsigned int? // BTW uint isn't even defined on wxMSW for VC++ for some reason. Even if it // were, getpeername/getsockname don't take unsigned int*, they take int*. -#if 0 -#define wxSOCKET_INT unsigned int +// +// Under glibc 2.0.7, socketbits.h declares socklen_t to be unsigned int +// and it uses *socklen_t as the 3rd parameter. Robert. + +#ifdef __LINUX__ +#define wxSOCKET_INT socklen_t #else #define wxSOCKET_INT int #endif diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 8754cc7c3a..b7f8f3931d 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -157,7 +157,9 @@ char *wxStreamBuffer::AllocSpaceWBack(size_t needed_size) if (!temp_b) return NULL; m_wback = temp_b; - printf("Buffer(0x%x)->Write: 0x%x, %d\n", this, m_wback, m_wbacksize); + + /* printf("Buffer(0x%x)->Write: 0x%x, %d\n", this, m_wback, m_wbacksize); */ + return (char *)(m_wback+(m_wbacksize-needed_size)); } @@ -165,7 +167,8 @@ size_t wxStreamBuffer::GetWBack(char *buf, size_t bsize) { size_t s_toget = m_wbacksize-m_wbackcur; - printf("Buffer(0x%x): 0x%x, %d\n", this, m_wback, m_wbacksize); + /* printf("Buffer(0x%x): 0x%x, %d\n", this, m_wback, m_wbacksize); */ + if (bsize < s_toget) s_toget = bsize; diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index 191f62517d..5a449ab8f7 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -335,16 +335,20 @@ void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event)) { if (!m_useEvents) return; - int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection()); - int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); - int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); + int fontFamily = 0; /* shut up buggy egcs warnings */ + fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection()); + int fontWeight = 0; + fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); + int fontStyle = 0; + fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); int fontSize = atoi(pointSizeChoice->GetStringSelection()); int fontUnderline = underLineCheckBox->GetValue(); dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0)); if (colourChoice->GetStringSelection() != "") { - wxColour *col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection()); + wxColour *col = (wxColour*) NULL; + col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection()); if (col) { fontData.fontColour = *col; diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 41448949d2..c439ce2934 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -49,7 +49,7 @@ IMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase) wxExtHelpController::wxExtHelpController(void) { - m_MapList = NULL; + m_MapList = (wxList*) NULL; m_BrowserName = WXEXTHELP_DEFAULTBROWSER; m_BrowserIsNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE; m_NumOfEntries = 0; @@ -76,7 +76,7 @@ wxExtHelpController::DeleteList(void) node = m_MapList->First(); } delete m_MapList; - m_MapList = NULL; + m_MapList = (wxList*) NULL; } } diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 203cd8ab32..5bcf080dc8 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -359,6 +359,8 @@ void wxTreeCtrl::Init() m_imageListNormal = m_imageListState = (wxImageList *) NULL; + + m_dragCount = 0; } bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, @@ -926,15 +928,15 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) void wxTreeCtrl::ScrollTo(const wxTreeItemId& WXUNUSED(item)) { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); } wxTextCtrl *wxTreeCtrl::EditLabel( const wxTreeItemId& WXUNUSED(item), wxClassInfo* WXUNUSED(textCtrlClass) ) { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); - return (wxTextCtrl*)NULL; + return (wxTextCtrl*)NULL; } wxTextCtrl *wxTreeCtrl::GetEditControl() const @@ -1031,160 +1033,160 @@ void wxTreeCtrl::AdjustMyScrollbars() void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { - // render bold items in bold - wxFont fontOld; - wxFont fontNew; + /* render bold items in bold */ + wxFont fontOld; + wxFont fontNew; - if ( item->IsBold() ) - { - fontOld = dc.GetFont(); - if (fontOld.Ok()) - { - // @@ is there any better way to make a bold variant of old font? - fontNew = wxFont( fontOld.GetPointSize(), - fontOld.GetFamily(), - fontOld.GetStyle(), - wxBOLD, - fontOld.GetUnderlined()); - dc.SetFont(fontNew); - } - else - { - wxFAIL_MSG("wxDC::GetFont() failed!"); - } - } + if (item->IsBold()) + { + fontOld = dc.GetFont(); + if (fontOld.Ok()) + { + /* @@ is there any better way to make a bold variant of old font? */ + fontNew = wxFont( fontOld.GetPointSize(), + fontOld.GetFamily(), + fontOld.GetStyle(), + wxBOLD, + fontOld.GetUnderlined()); + dc.SetFont(fontNew); + } + else + { + wxFAIL_MSG("wxDC::GetFont() failed!"); + } + } - long text_w = 0; - long text_h = 0; - dc.GetTextExtent( item->GetText(), &text_w, &text_h ); + long text_w = 0; + long text_h = 0; + dc.GetTextExtent( item->GetText(), &text_w, &text_h ); - int image_h = 0; - int image_w = 0; - if ((item->IsExpanded()) && (item->GetSelectedImage() != -1)) - { - m_imageListNormal->GetSize( item->GetSelectedImage(), image_w, image_h ); - image_w += 4; - } - else if (item->GetImage() != -1) - { - m_imageListNormal->GetSize( item->GetImage(), image_w, image_h ); - image_w += 4; - } + int image_h = 0; + int image_w = 0; + if ((item->IsExpanded()) && (item->GetSelectedImage() != -1)) + { + m_imageListNormal->GetSize( item->GetSelectedImage(), image_w, image_h ); + image_w += 4; + } + else if (item->GetImage() != -1) + { + m_imageListNormal->GetSize( item->GetImage(), image_w, image_h ); + image_w += 4; + } - dc.DrawRectangle( item->GetX()-2, item->GetY()-2, image_w+text_w+4, text_h+4 ); + dc.DrawRectangle( item->GetX()-2, item->GetY()-2, image_w+text_w+4, text_h+4 ); - if ((item->IsExpanded()) && (item->GetSelectedImage() != -1)) - { - dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h ); - m_imageListNormal->Draw( item->GetSelectedImage(), dc, - item->GetX(), item->GetY()-1, - wxIMAGELIST_DRAW_TRANSPARENT ); - dc.DestroyClippingRegion(); - } - else if (item->GetImage() != -1) - { - dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h ); - m_imageListNormal->Draw( item->GetImage(), dc, - item->GetX(), item->GetY()-1, - wxIMAGELIST_DRAW_TRANSPARENT ); - dc.DestroyClippingRegion(); - } + if ((item->IsExpanded()) && (item->GetSelectedImage() != -1)) + { + dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h ); + m_imageListNormal->Draw( item->GetSelectedImage(), dc, + item->GetX(), item->GetY()-1, + wxIMAGELIST_DRAW_TRANSPARENT ); + dc.DestroyClippingRegion(); + } + else if (item->GetImage() != -1) + { + dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, text_h ); + m_imageListNormal->Draw( item->GetImage(), dc, + item->GetX(), item->GetY()-1, + wxIMAGELIST_DRAW_TRANSPARENT ); + dc.DestroyClippingRegion(); + } - dc.SetBackgroundMode(wxTRANSPARENT); - dc.DrawText( item->GetText(), image_w + item->GetX(), item->GetY() ); + dc.SetBackgroundMode(wxTRANSPARENT); + dc.DrawText( item->GetText(), image_w + item->GetX(), item->GetY() ); - // restore normal font for bold items - if (fontOld.Ok()) - { - dc.SetFont( fontOld); - } + /* restore normal font for bold items */ + if (fontOld.Ok()) + { + dc.SetFont( fontOld); + } } void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) { - int horizX = level*m_indent; + int horizX = level*m_indent; - item->SetX( horizX+33 ); - item->SetY( y-m_lineHeight/3 ); - item->SetHeight( m_lineHeight ); + item->SetX( horizX+33 ); + item->SetY( y-m_lineHeight/3 ); + item->SetHeight( m_lineHeight ); - item->SetCross( horizX+15, y ); + item->SetCross( horizX+15, y ); - int oldY = y; + int oldY = y; - int exposed_x = dc.LogicalToDeviceX( 0 ); - int exposed_y = dc.LogicalToDeviceY( item->GetY()-2 ); + int exposed_x = dc.LogicalToDeviceX( 0 ); + int exposed_y = dc.LogicalToDeviceY( item->GetY()-2 ); - if (IsExposed( exposed_x, exposed_y, 10000, m_lineHeight+4 )) // 10000 = very much - { - int startX = horizX; - int endX = horizX + 10; - - if (!item->HasChildren()) endX += 20; - - dc.DrawLine( startX, y, endX, y ); - - if (item->HasPlus()) + if (IsExposed( exposed_x, exposed_y, 10000, m_lineHeight+4 )) // 10000 = very much { - dc.DrawLine( horizX+20, y, horizX+30, y ); - dc.SetPen( *wxGREY_PEN ); - dc.SetBrush( *wxWHITE_BRUSH ); - dc.DrawRectangle( horizX+10, y-4, 11, 9 ); - dc.SetPen( *wxBLACK_PEN ); - dc.DrawLine( horizX+13, y, horizX+18, y ); + int startX = horizX; + int endX = horizX + 10; - if (!item->IsExpanded()) - dc.DrawLine( horizX+15, y-2, horizX+15, y+3 ); + if (!item->HasChildren()) endX += 20; + + dc.DrawLine( startX, y, endX, y ); + + if (item->HasPlus()) + { + dc.DrawLine( horizX+20, y, horizX+30, y ); + dc.SetPen( *wxGREY_PEN ); + dc.SetBrush( *wxWHITE_BRUSH ); + dc.DrawRectangle( horizX+10, y-4, 11, 9 ); + dc.SetPen( *wxBLACK_PEN ); + dc.DrawLine( horizX+13, y, horizX+18, y ); + + if (!item->IsExpanded()) + { + dc.DrawLine( horizX+15, y-2, horizX+15, y+3 ); + } + } + + if (item->HasHilight()) + { + dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); + + dc.SetBrush( *m_hilightBrush ); + + if (m_hasFocus) + dc.SetPen( *wxBLACK_PEN ); + else + dc.SetPen( *wxTRANSPARENT_PEN ); + + PaintItem(item, dc); + + dc.SetPen( *wxBLACK_PEN ); + dc.SetTextForeground( *wxBLACK ); + dc.SetBrush( *wxWHITE_BRUSH ); + } + else + { + dc.SetBrush( *wxWHITE_BRUSH ); + dc.SetPen( *wxTRANSPARENT_PEN ); + + PaintItem(item, dc); + + dc.SetPen( *wxBLACK_PEN ); + } } - if (item->HasHilight()) + if (item->IsExpanded()) { - dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); + int semiOldY = y; - dc.SetBrush( *m_hilightBrush ); + wxArrayTreeItems& children = item->GetChildren(); + size_t count = children.Count(); + for ( size_t n = 0; n < count; n++ ) + { + y += m_lineHeight; + semiOldY = y; + PaintLevel( children[n], dc, level+1, y ); + } - if (m_hasFocus) - dc.SetPen( *wxBLACK_PEN ); - else - dc.SetPen( *wxTRANSPARENT_PEN ); - - PaintItem(item, dc); - - dc.SetPen( *wxBLACK_PEN ); - dc.SetTextForeground( *wxBLACK ); - dc.SetBrush( *wxWHITE_BRUSH ); + /* it may happen that the item is expanded but has no items (when you + * delete all its children for example) - don't draw the vertical line + * in this case */ + if (count > 0) dc.DrawLine( horizX+15, oldY+5, horizX+15, semiOldY ); } - else - { - dc.SetBrush( *wxWHITE_BRUSH ); - dc.SetPen( *wxTRANSPARENT_PEN ); - - PaintItem(item, dc); - - dc.SetPen( *wxBLACK_PEN ); - } - } - - if ( item->IsExpanded() ) - { - int semiOldY = y; - - wxArrayTreeItems& children = item->GetChildren(); - size_t count = children.Count(); - for ( size_t n = 0; n < count; n++ ) - { - y += m_lineHeight; - semiOldY = y; - - PaintLevel( children[n], dc, level+1, y ); - } - - // it may happen that the item is expanded but has no items (when you - // delete all its children for example) - don't draw the vertical line - // in this case - if ( count > 0 ) - dc.DrawLine( horizX+15, oldY+5, horizX+15, semiOldY ); - } } // ----------------------------------------------------------------------------- @@ -1211,15 +1213,15 @@ void wxTreeCtrl::OnPaint( wxPaintEvent &WXUNUSED(event) ) void wxTreeCtrl::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) { m_hasFocus = TRUE; - if ( m_current ) - RefreshLine( m_current ); + + if (m_current) RefreshLine( m_current ); } void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) ) { m_hasFocus = FALSE; - if ( m_current ) - RefreshLine( m_current ); + + if (m_current) RefreshLine( m_current ); } void wxTreeCtrl::OnChar( wxKeyEvent &event ) @@ -1363,130 +1365,149 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& WXUNUSED(flags)) { - bool onButton = FALSE; - return m_anchor->HitTest( point, onButton ); + bool onButton = FALSE; + return m_anchor->HitTest( point, onButton ); } void wxTreeCtrl::OnMouse( wxMouseEvent &event ) { - if ( !(event.LeftDown() || event.LeftDClick()) ) - return; + if (!event.LeftIsDown()) m_dragCount = 0; - if ( !m_anchor ) - return; + if ( !(event.LeftDown() || event.LeftDClick() || event.Dragging()) ) return; - wxClientDC dc(this); - PrepareDC(dc); - long x = dc.DeviceToLogicalX( (long)event.GetX() ); - long y = dc.DeviceToLogicalY( (long)event.GetY() ); + if ( !m_anchor ) return; + + wxClientDC dc(this); + PrepareDC(dc); + long x = dc.DeviceToLogicalX( (long)event.GetX() ); + long y = dc.DeviceToLogicalY( (long)event.GetY() ); - bool onButton = FALSE; - wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), onButton ); - if ( item == NULL ) - return; + bool onButton = FALSE; + wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), onButton ); + + if (item == NULL) return; /* we hit the blank area */ - if (!IsSelected(item)) SelectItem(item); + if (event.Dragging()) + { + if (m_dragCount == 2) /* small drag latency (3?) */ + { + m_dragCount = 0; + + wxTreeEvent nevent(wxEVT_COMMAND_TREE_BEGIN_DRAG, GetId()); + nevent.m_item = m_current; + nevent.SetEventObject(this); + GetEventHandler()->ProcessEvent(nevent); + } + else + { + m_dragCount++; + } + return; + } + + if (!IsSelected(item)) SelectItem(item); /* we dont support multiple selections, BTW */ - if ( event.LeftDClick() ) - { - wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); - event.m_item = item; - event.m_code = 0; - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent( event ); - } + if (event.LeftDClick()) + { + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); + event.m_item = item; + event.m_code = 0; + event.SetEventObject( this ); + GetEventHandler()->ProcessEvent( event ); + } - if ( onButton ) - { - Toggle( item ); - } + if (onButton) + { + Toggle( item ); + } } void wxTreeCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) ) { - if (!m_dirty) return; + /* after all changes have been done to the tree control, + * we actually redraw the tree when everything is over */ - m_dirty = FALSE; + if (!m_dirty) return; - CalculatePositions(); + m_dirty = FALSE; - AdjustMyScrollbars(); + CalculatePositions(); + + AdjustMyScrollbars(); } // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, - wxDC &dc, - int level, - int &y ) + +void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ) { - int horizX = level*m_indent; + int horizX = level*m_indent; - item->SetX( horizX+33 ); - item->SetY( y-m_lineHeight/3-2 ); - item->SetHeight( m_lineHeight ); + item->SetX( horizX+33 ); + item->SetY( y-m_lineHeight/3-2 ); + item->SetHeight( m_lineHeight ); - // if ( item->IsExpanded() ) - // return; - if ( !item->IsExpanded() ) // Surely this is correct? JACS - return; + if ( !item->IsExpanded() ) + { + /* we dont need to calculate collapsed branches */ + return; + } - wxArrayTreeItems& children = item->GetChildren(); - size_t count = children.Count(); - for ( size_t n = 0; n < count; n++ ) - { - y += m_lineHeight; - CalculateLevel( children[n], dc, level+1, y ); - } + wxArrayTreeItems& children = item->GetChildren(); + size_t count = children.Count(); + for ( size_t n = 0; n < count; n++ ) + { + y += m_lineHeight; + CalculateLevel( children[n], dc, level+1, y ); /* recurse */ + } } void wxTreeCtrl::CalculatePositions() { - if ( !m_anchor ) - return; + if ( !m_anchor ) return; - wxClientDC dc(this); - PrepareDC( dc ); + wxClientDC dc(this); + PrepareDC( dc ); - dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) ); + dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) ); - dc.SetPen( m_dottedPen ); - m_lineHeight = (int)(dc.GetCharHeight() + 4); + dc.SetPen( m_dottedPen ); + m_lineHeight = (int)(dc.GetCharHeight() + 4); - int y = m_lineHeight / 2 + 2; - CalculateLevel( m_anchor, dc, 0, y ); + int y = m_lineHeight / 2 + 2; + CalculateLevel( m_anchor, dc, 0, y ); /* start recursion */ } void wxTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) { - wxClientDC dc(this); - PrepareDC(dc); + wxClientDC dc(this); + PrepareDC(dc); - int cw = 0; - int ch = 0; - GetClientSize( &cw, &ch ); + int cw = 0; + int ch = 0; + GetClientSize( &cw, &ch ); - wxRect rect; - rect.x = dc.LogicalToDeviceX( 0 ); - rect.width = cw; - rect.y = dc.LogicalToDeviceY( item->GetY() ); - rect.height = ch; + wxRect rect; + rect.x = dc.LogicalToDeviceX( 0 ); + rect.width = cw; + rect.y = dc.LogicalToDeviceY( item->GetY() ); + rect.height = ch; - Refresh( TRUE, &rect ); + Refresh( TRUE, &rect ); - AdjustMyScrollbars(); + AdjustMyScrollbars(); } void wxTreeCtrl::RefreshLine( wxGenericTreeItem *item ) { - wxClientDC dc(this); - PrepareDC( dc ); + wxClientDC dc(this); + PrepareDC( dc ); - wxRect rect; - rect.x = dc.LogicalToDeviceX( item->GetX() - 2 ); - rect.y = dc.LogicalToDeviceY( item->GetY() - 2 ); - rect.width = 1000; - rect.height = dc.GetCharHeight() + 6; - Refresh( TRUE, &rect ); + wxRect rect; + rect.x = dc.LogicalToDeviceX( item->GetX() - 2 ); + rect.y = dc.LogicalToDeviceY( item->GetY() - 2 ); + rect.width = 1000; + rect.height = dc.GetCharHeight() + 6; + + Refresh( TRUE, &rect ); } diff --git a/src/gtk/accel.cpp b/src/gtk/accel.cpp index 3a3d479635..b15ece7379 100644 --- a/src/gtk/accel.cpp +++ b/src/gtk/accel.cpp @@ -15,6 +15,13 @@ #include +#ifdef __WXDEBUG__ +#ifdef NULL +#undef NULL +#endif +#define NULL ((void*)0L) +#endif + //----------------------------------------------------------------------------- // wxAcceleratorTable //----------------------------------------------------------------------------- diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 5e1c0e5755..dec83867a0 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -44,6 +44,9 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; extern wxList wxPendingDelete; extern wxResourceCache *wxTheResourceCache; +GdkVisual *wxVisualSetByExternal = (GdkVisual*) NULL; +GdkColormap *wxColormapSetByExternal = (GdkColormap*) NULL; + unsigned char g_palette[64*3] = { 0x0, 0x0, 0x0, @@ -169,14 +172,60 @@ wxApp::~wxApp(void) gtk_idle_remove( m_idleTag ); } -bool wxApp::OnInit(void) +bool wxApp::InitVisual() { + if (wxVisualSetByExternal) + { + /* this happens in the wxModule code of the OpenGl canvas. + it chooses the best display for OpenGl and stores it + in wxDisplaySetByExternal. we then have to make it the + default for the system */ + + gtk_widget_set_default_visual( wxVisualSetByExternal ); + } + + if (wxColormapSetByExternal) + { + /* OpenGl also gives us a colormap */ + + gtk_widget_set_default_colormap( wxColormapSetByExternal ); + } + else + { + /* this initiates the standard palette as defined by GdkImlib + in the GNOME libraries. it ensures that all GNOME applications + use the same 64 colormap entries on 8-bit displays so you + can use several rather graphics-heavy applications at the + same time */ + + GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); + + for (int i = 0; i < 64; i++) + { + GdkColor col; + col.red = g_palette[i*3 + 0] << 8; + col.green = g_palette[i*3 + 1] << 8; + col.blue = g_palette[i*3 + 2] << 8; + col.pixel = 0; + + gdk_color_alloc( cmap, &col ); + } + + gtk_widget_set_default_colormap( cmap ); + } + return TRUE; } bool wxApp::OnInitGui(void) { m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); + + return TRUE; +} + +bool wxApp::OnInit(void) +{ return TRUE; } @@ -320,12 +369,6 @@ void wxApp::SetTopWindow( wxWindow *win ) void wxApp::CommonInit(void) { - -/* -#if wxUSE_RESOURCES - (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); -#endif -*/ wxSystemSettings::Init(); wxTheFontNameDirectory = new wxFontNameDirectory; @@ -350,14 +393,19 @@ void wxApp::CommonInit(void) void wxApp::CommonCleanUp(void) { - wxDELETE(wxTheColourDatabase); - wxDELETE(wxTheFontNameDirectory); + if (wxTheColourDatabase) delete wxTheColourDatabase; + wxTheColourDatabase = (wxColourDatabase*) NULL; + + if (wxTheFontNameDirectory) delete wxTheFontNameDirectory; + wxTheFontNameDirectory = (wxFontNameDirectory*) NULL; + wxDeleteStockObjects(); #if wxUSE_WX_RESOURCES wxFlushResources(); - wxDELETE(wxTheResourceCache); + if (wxTheResourceCache) delete wxTheResourceCache; + wxTheResourceCache = (wxResourceCache*) NULL; wxCleanUpResourceSystem(); #endif @@ -419,29 +467,14 @@ int wxEntry( int argc, char *argv[] ) gtk_init( &argc, &argv ); - GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); - - for (int i = 0; i < 64; i++) - { - GdkColor col; - col.red = g_palette[i*3 + 0] << 8; - col.green = g_palette[i*3 + 1] << 8; - col.blue = g_palette[i*3 + 2] << 8; - col.pixel = 0; - - gdk_color_alloc( cmap, &col ); - } - - gtk_widget_push_colormap( cmap ); - - gtk_widget_set_default_colormap( cmap ); + wxModule::RegisterModules(); + if (!wxModule::InitializeModules()) return FALSE; + + if (!wxTheApp->InitVisual()) return 0; wxApp::CommonInit(); - wxModule::RegisterModules(); - if (!wxModule::InitializeModules()) return FALSE; - - wxTheApp->OnInitGui(); + if (!wxTheApp->OnInitGui()) return 0; // Here frames insert themselves automatically // into wxTopLevelWindows by getting created @@ -481,11 +514,9 @@ int wxEntry( int argc, char *argv[] ) #endif - wxLog *oldLog = wxLog::SetActiveTarget( NULL ); + wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL ); if (oldLog) delete oldLog; return retValue; } -//----------------------------------------------------------------------------- - diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 1a092196ec..82fb96dc1a 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -27,14 +27,15 @@ wxCheckListBox::wxCheckListBox() : { m_hasCheckBoxes = TRUE; } + wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) + const wxPoint& pos, + const wxSize& size, + int nStrings, + const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name ) { m_hasCheckBoxes = TRUE; wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 45cf031ba1..302a6f5dff 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -255,7 +255,7 @@ void wxComboBox::Delete( int n ) return; } - GList *list = g_list_append( NULL, child->data ); + GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( listbox, list ); g_list_free( list ); diff --git a/src/gtk/dcps.cpp b/src/gtk/dcps.cpp index 8a82f3cb61..710668c98a 100644 --- a/src/gtk/dcps.cpp +++ b/src/gtk/dcps.cpp @@ -14,7 +14,6 @@ #pragma interface #endif - #include "wx/defs.h" #if wxUSE_POSTSCRIPT diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index b419c04ccb..d347412089 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -733,8 +733,8 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) if (!m_data) return (wxDragResult) wxDragNone; - static GtkWidget *drag_icon = NULL; - static GtkWidget *drop_icon = NULL; + static GtkWidget *drag_icon = (GtkWidget*) NULL; + static GtkWidget *drop_icon = (GtkWidget*) NULL; GdkPoint hotspot_1 = {0,-5 }; @@ -872,7 +872,7 @@ void wxDropSource::UnregisterWindow(void) /* * Shaped Windows */ -static GdkWindow *root_win = NULL; +static GdkWindow *root_win = (GdkWindow*) NULL; typedef struct _cursoroffset {gint x,y;} CursorOffset; @@ -895,7 +895,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event) (GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK), - NULL, NULL, 0); + (GdkWindow*)NULL, + (GdkCursor*) NULL, 0); } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index b865dba96d..fb6ef44edc 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -423,7 +423,7 @@ void wxListBox::Delete( int n ) wxCHECK_RET( child, "wrong listbox index" ); - GList *list = g_list_append( NULL, child->data ); + GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( m_list, list ); g_list_free( list ); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index f0c5335454..4696faeb11 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -155,14 +155,38 @@ bool wxMenuBar::Enabled( int id ) const return FALSE; } +wxString wxMenuBar::GetLabel( int id ) const +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->GetText(); + return ""; +} + +void wxMenuBar::SetLabel( int id, const wxString &label ) +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->SetText( label ); +} + +void wxMenuBar::EnableTop( int WXUNUSED(pos), bool WXUNUSED(flag) ) +{ +} + +wxString wxMenuBar::GetLabelTop( int WXUNUSED(pos) ) const +{ + return "menu"; +} + +void wxMenuBar::SetLabelTop( int WXUNUSED(pos), const wxString& WXUNUSED(label) ) +{ +} + //----------------------------------------------------------------------------- // "activate" //----------------------------------------------------------------------------- static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { - wxYield(); - int id = menu->FindMenuIdByMenuItem(widget); /* should find it for normal (not popup) menu */ diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index a5a86f9be6..2407a21cd4 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -17,7 +17,6 @@ #include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" - //----------------------------------------------------------------------------- // "clicked" //----------------------------------------------------------------------------- diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index db83d59ac4..7eee0d5246 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -429,7 +429,7 @@ bool wxNotebook::SetPageImage( int page, int image ) if (image == -1 && nb_page->m_image == -1) return TRUE; /* Case 1): Nothing to do. */ - GtkWidget *pixmapwid = NULL; + GtkWidget *pixmapwid = (GtkWidget*) NULL; if (nb_page->m_image != -1) { diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 9708cf57e0..d0808503e7 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -7,7 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ #pragma implementation "radiobox.h" #endif @@ -148,8 +147,8 @@ void wxRadioBox::OnSize( wxSizeEvent &event ) wxSize wxRadioBox::LayoutItems() { - int x = m_x+7; - int y = m_y+15; + int x = 7; + int y = 15; int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1; @@ -160,7 +159,7 @@ wxSize wxRadioBox::LayoutItems() for (int j = 0; j < m_majorDim; j++) { - y = m_y+15; + y = 15; int max_len = 0; wxNode *node = m_boxes.Nth( j*num_per_major ); @@ -169,10 +168,10 @@ wxSize wxRadioBox::LayoutItems() GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GdkFont *font = m_widget->style->font; - int len = 27+gdk_string_measure( font, label->label ); + int len = 22+gdk_string_measure( font, label->label ); if (len > max_len) max_len = len; - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); y += 22; node = node->Next(); @@ -197,8 +196,8 @@ wxSize wxRadioBox::LayoutItems() x += max_len + 2; } - res.y -= 3; - res.x = x-2; + res.x = x+4; + res.y += 9; } else { @@ -211,7 +210,7 @@ wxSize wxRadioBox::LayoutItems() GtkLabel *label = GTK_LABEL( button->child ); GdkFont *font = m_widget->style->font; - int len = 27+gdk_string_measure( font, label->label ); + int len = 22+gdk_string_measure( font, label->label ); if (len > max) max = len; node = node->Next(); @@ -222,13 +221,13 @@ wxSize wxRadioBox::LayoutItems() { GtkWidget *button = GTK_WIDGET( node->Data() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); x += max; gtk_widget_set_usize( button, max, 20 ); node = node->Next(); } - res.x = x-2; + res.x = x+4; res.y = 42; } diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index a607e5da6c..305967bc7d 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -7,7 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ #pragma implementation "region.h" #endif @@ -17,6 +16,13 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +#ifdef __WXDEBUG__ +#ifdef NULL +#undef NULL +#endif +#define NULL ((void*)0L) +#endif + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- @@ -36,20 +42,20 @@ class wxRegionRefData: public wxObjectRefData wxRegionRefData::wxRegionRefData(void) { - m_region = (GdkRegion *) NULL; + m_region = (GdkRegion *) NULL; } wxRegionRefData::~wxRegionRefData(void) { - if (m_region) gdk_region_destroy( m_region ); + if (m_region) gdk_region_destroy( m_region ); - wxNode *node = m_rects.First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - delete r; - node = node->Next(); - } + wxNode *node = m_rects.First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + delete r; + node = node->Next(); + } } //----------------------------------------------------------------------------- @@ -60,57 +66,57 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject); wxRegion::wxRegion( long x, long y, long w, long h ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); - gdk_region_destroy( reg ); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); + gdk_region_destroy( reg ); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); } wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle rect; - rect.x = topLeft.x; - rect.y = topLeft.y; - rect.width = bottomRight.x - rect.x; - rect.height = bottomRight.y - rect.y; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); - gdk_region_destroy( reg ); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle rect; + rect.x = topLeft.x; + rect.y = topLeft.y; + rect.width = bottomRight.x - rect.x; + rect.height = bottomRight.y - rect.y; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); + gdk_region_destroy( reg ); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); } wxRegion::wxRegion( const wxRect& rect ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle g_rect; - g_rect.x = rect.x; - g_rect.y = rect.y; - g_rect.width = rect.width; - g_rect.height = rect.height; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); - gdk_region_destroy( reg ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle g_rect; + g_rect.x = rect.x; + g_rect.y = rect.y; + g_rect.width = rect.width; + g_rect.height = rect.height; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); + gdk_region_destroy( reg ); - wxNode *node = M_REGIONDATA->m_rects.First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = M_REGIONDATA->m_rects.First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } } wxRegion::wxRegion(void) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + m_refData = new wxRegionRefData(); + M_REGIONDATA->m_region = gdk_region_new(); } wxRegion::~wxRegion(void) @@ -119,241 +125,241 @@ wxRegion::~wxRegion(void) bool wxRegion::operator == ( const wxRegion& region ) { - return m_refData == region.m_refData; + return m_refData == region.m_refData; } bool wxRegion::operator != ( const wxRegion& region ) { - return m_refData != region.m_refData; + return m_refData != region.m_refData; } void wxRegion::Clear(void) { - UnRef(); - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + UnRef(); + m_refData = new wxRegionRefData(); + M_REGIONDATA->m_region = gdk_region_new(); } bool wxRegion::Union( long x, long y, long width, long height ) { - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = height; - GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); - return TRUE; + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); + return TRUE; } bool wxRegion::Union( const wxRect& rect ) { - GdkRectangle g_rect; - g_rect.x = rect.x; - g_rect.y = rect.y; - g_rect.width = rect.width; - g_rect.height = rect.height; - GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); - return TRUE; + GdkRectangle g_rect; + g_rect.x = rect.x; + g_rect.y = rect.y; + g_rect.width = rect.width; + g_rect.height = rect.height; + GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); + return TRUE; } bool wxRegion::Union( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; + GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; - wxNode *node = region.GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = region.GetRectList()->First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } - return TRUE; + return TRUE; } bool wxRegion::Intersect( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Intersect( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Intersect( reg ); + return TRUE; } bool wxRegion::Intersect( const wxRect& rect ) { - wxRegion reg( rect ); - Intersect( reg ); - return TRUE; + wxRegion reg( rect ); + Intersect( reg ); + return TRUE; } bool wxRegion::Intersect( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - return TRUE; + GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + return TRUE; } bool wxRegion::Subtract( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Subtract( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Subtract( reg ); + return TRUE; } bool wxRegion::Subtract( const wxRect& rect ) { - wxRegion reg( rect ); - Subtract( reg ); - return TRUE; + wxRegion reg( rect ); + Subtract( reg ); + return TRUE; } bool wxRegion::Subtract( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - return TRUE; + GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + return TRUE; } bool wxRegion::Xor( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Xor( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Xor( reg ); + return TRUE; } bool wxRegion::Xor( const wxRect& rect ) { - wxRegion reg( rect ); - Xor( reg ); - return TRUE; + wxRegion reg( rect ); + Xor( reg ); + return TRUE; } bool wxRegion::Xor( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; + GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; - wxNode *node = region.GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = region.GetRectList()->First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } - return TRUE; + return TRUE; } void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const { - x = 0; - y = 0; - w = -1; - h = -1; - wxNode *node = GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - if (node == GetRectList()->First()) + x = 0; + y = 0; + w = -1; + h = -1; + wxNode *node = GetRectList()->First(); + while (node) { - x = r->x; - y = r->y; - w = r->width; - h = r->height; + wxRect *r = (wxRect*)node->Data(); + if (node == GetRectList()->First()) + { + x = r->x; + y = r->y; + w = r->width; + h = r->height; + } + else + { + if (r->x < x) + { + x = r->x; + w += x - r->x; + } + if (r->y < y) + { + y = r->y; + h += y - r->y; + } + if (r->width+r->x > x+w) + { + w = r->x + r->width - x; + } + if (r->height+r->y > y+h) + { + h = r->y + r->height - y; + } + } + node = node->Next(); } - else - { - if (r->x < x) - { - x = r->x; - w += x - r->x; - } - if (r->y < y) - { - y = r->y; - h += y - r->y; - } - if (r->width+r->x > x+w) - { - w = r->x + r->width - x; - } - if (r->height+r->y > y+h) - { - h = r->y + r->height - y; - } - } - node = node->Next(); - } } wxRect wxRegion::GetBox(void) const { - long x = 0; - long y = 0; - long w = -1; - long h = -1; - GetBox( x, y, w, h ); - return wxRect( x, y, w, h ); + long x = 0; + long y = 0; + long w = -1; + long h = -1; + GetBox( x, y, w, h ); + return wxRect( x, y, w, h ); } bool wxRegion::Empty(void) const { - return gdk_region_empty( M_REGIONDATA->m_region ); + return gdk_region_empty( M_REGIONDATA->m_region ); } wxRegionContain wxRegion::Contains( long x, long y ) const { - if (gdk_region_point_in( M_REGIONDATA->m_region, x, y )) - return wxInRegion; - else - return wxOutRegion; + if (gdk_region_point_in( M_REGIONDATA->m_region, x, y )) + return wxInRegion; + else + return wxOutRegion; } wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const { - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect ); - switch (res) - { - case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion; - case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion; - case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion; - } - return wxOutRegion; + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect ); + switch (res) + { + case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion; + case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion; + case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion; + } + return wxOutRegion; } wxRegionContain wxRegion::Contains(const wxPoint& pt) const { - return Contains( pt.x, pt.y ); + return Contains( pt.x, pt.y ); } wxRegionContain wxRegion::Contains(const wxRect& rect) const { - return Contains( rect.x, rect.y, rect.width, rect.height ); + return Contains( rect.x, rect.y, rect.width, rect.height ); } GdkRegion *wxRegion::GetRegion(void) const { - return M_REGIONDATA->m_region; + return M_REGIONDATA->m_region; } wxList *wxRegion::GetRectList() const { - return &(M_REGIONDATA->m_rects); + return &(M_REGIONDATA->m_rects); } //----------------------------------------------------------------------------- @@ -364,71 +370,71 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject); wxRegionIterator::wxRegionIterator(void) { - m_current = 0; + m_current = 0; } wxRegionIterator::wxRegionIterator( const wxRegion& region ) { - m_region = region; - m_current = 0; + m_region = region; + m_current = 0; } void wxRegionIterator::Reset( const wxRegion& region ) { - m_region = region; - m_current = 0; + m_region = region; + m_current = 0; } wxRegionIterator::operator bool (void) const { - return m_current < m_region.GetRectList()->Number(); + return m_current < m_region.GetRectList()->Number(); } bool wxRegionIterator::HaveRects(void) const { - return m_current < m_region.GetRectList()->Number(); + return m_current < m_region.GetRectList()->Number(); } void wxRegionIterator::operator ++ (void) { - if (m_current < m_region.GetRectList()->Number()) ++m_current; + if (m_current < m_region.GetRectList()->Number()) ++m_current; } void wxRegionIterator::operator ++ (int) { - if (m_current < m_region.GetRectList()->Number()) ++m_current; + if (m_current < m_region.GetRectList()->Number()) ++m_current; } long wxRegionIterator::GetX(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->x; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->x; } long wxRegionIterator::GetY(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->y; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->y; } long wxRegionIterator::GetW(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->width; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->width; } long wxRegionIterator::GetH(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->height; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->height; } diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 401fd4d460..61c406c6fb 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -303,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file ) Clear(); - FILE *fp = NULL; + FILE *fp = (FILE*) NULL; struct stat statb; if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || @@ -358,7 +358,7 @@ bool wxTextCtrl::SaveFile( const wxString &file ) } else { - char *text = NULL; + char *text = (char*) NULL; gint len = 0; if (m_windowStyle & wxTE_MULTILINE) diff --git a/src/gtk/threadpsx.cpp b/src/gtk/threadpsx.cpp index a6b760b6f4..63dc81b2c9 100644 --- a/src/gtk/threadpsx.cpp +++ b/src/gtk/threadpsx.cpp @@ -64,7 +64,7 @@ public: wxMutex::wxMutex() { p_internal = new wxMutexInternal; - pthread_mutex_init(&(p_internal->p_mutex), NULL); + pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL ); m_locked = 0; } @@ -73,46 +73,54 @@ wxMutex::~wxMutex() if (m_locked > 0) wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); - pthread_mutex_destroy(&(p_internal->p_mutex)); + pthread_mutex_destroy( &(p_internal->p_mutex) ); delete p_internal; } wxMutexError wxMutex::Lock() { - int err; - - err = pthread_mutex_lock(&(p_internal->p_mutex)); + int err = pthread_mutex_lock( &(p_internal->p_mutex) ); if (err == EDEADLK) + { return wxMUTEX_DEAD_LOCK; + } m_locked++; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::TryLock() { - int err; - if (m_locked) + { return wxMUTEX_BUSY; + } - err = pthread_mutex_trylock(&(p_internal->p_mutex)); + int err = pthread_mutex_trylock( &(p_internal->p_mutex) ); switch (err) { case EBUSY: return wxMUTEX_BUSY; } + m_locked++; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::Unlock() { if (m_locked > 0) + { m_locked--; + } else + { return wxMUTEX_UNLOCKED; + } - pthread_mutex_unlock(&(p_internal->p_mutex)); + pthread_mutex_unlock( &(p_internal->p_mutex) ); + return wxMUTEX_NO_ERROR; } @@ -129,37 +137,38 @@ public: wxCondition::wxCondition() { p_internal = new wxConditionInternal; - pthread_cond_init(&(p_internal->p_condition), NULL); + pthread_cond_init( &(p_internal->p_condition), (const pthread_condattr_t *) NULL ); } wxCondition::~wxCondition() { - pthread_cond_destroy(&(p_internal->p_condition)); + pthread_cond_destroy( &(p_internal->p_condition) ); + delete p_internal; } void wxCondition::Wait(wxMutex& mutex) { - pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex)); + pthread_cond_wait( &(p_internal->p_condition), &(mutex.p_internal->p_mutex) ); } bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec) { struct timespec tspec; - tspec.tv_sec = time(NULL)+sec; + tspec.tv_sec = time(0L)+sec; tspec.tv_nsec = nsec; return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT); } void wxCondition::Signal() { - pthread_cond_signal(&(p_internal->p_condition)); + pthread_cond_signal( &(p_internal->p_condition) ); } void wxCondition::Broadcast() { - pthread_cond_broadcast(&(p_internal->p_condition)); + pthread_cond_broadcast( &(p_internal->p_condition) ); } //-------------------------------------------------------------------- @@ -183,7 +192,7 @@ void *wxThreadInternal::PthreadStart(void *ptr) wxThread *thread = (wxThread *)ptr; /* Call the main entry */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL ); void* status = thread->Entry(); thread->Exit(status); @@ -246,9 +255,9 @@ int wxThread::GetPriority() const void wxThread::DeferDestroy(bool on) { if (on) - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, (int*) NULL); else - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL); } wxThreadError wxThread::Destroy() diff --git a/src/gtk/timer.cpp b/src/gtk/timer.cpp index 36aada6e6f..fb74fc13dc 100644 --- a/src/gtk/timer.cpp +++ b/src/gtk/timer.cpp @@ -15,6 +15,51 @@ #include "wx/timer.h" #include "gtk/gtk.h" +/* +#include "glib.h" +*/ + +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +/* +static GTimer *g_timer = (GTimer*) NULL; + +void wxStartTimer() +{ + if (g_timer) + { + g_timer_rest( g_timer ); + } + else + { + g_timer = g_timer_new(); + g_timer_start( g_timer ); + } +} + +long wxGetElapsedTime( bool resetTimer ) +{ + gulong res = 0; + if (g_timer) + { + g_timer_elapsed( g_timer, &res ); + if (resetTimer) g_timer_reset( g_timer ); + } + + return res; +} + +bool wxGetLocalTime( long *timeZone, int *dstObserved ) +{ +} + +long wxGetCurrentTime() +{ +} +*/ + //----------------------------------------------------------------------------- // wxTimer diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index ea023f37e2..28d35e2adc 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -30,13 +30,10 @@ #include #include -#include -#include -#include - #include "glib.h" #include "gdk/gdk.h" #include "gtk/gtk.h" +#include "gtk/gtkfeatures.h" #include "gdk/gdkx.h" #ifdef __SVR4__ @@ -79,12 +76,7 @@ void wxDisplaySize( int *width, int *height ) void wxGetMousePosition( int* x, int* y ) { - Window dumw; - int dumi; - unsigned int dumu; - - XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(), - &dumw,&dumw,x,y,&dumi,&dumi,&dumu ); + gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL ); } bool wxColourDisplay(void) @@ -97,6 +89,14 @@ int wxDisplayDepth(void) return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth; } +int wxGetOsVersion(int *majorVsn, int *minorVsn) +{ + if (majorVsn) *majorVsn = GTK_MAJOR_VERSION; + if (minorVsn) *minorVsn = GTK_MINOR_VERSION; + + return wxGTK; +} + //------------------------------------------------------------------------ // user and home routines //------------------------------------------------------------------------ @@ -124,7 +124,8 @@ char *wxGetUserHome( const wxString &user ) { who = getpwnam(ptr); } - // We now make sure the the user exists! + + /* We now make sure the the user exists! */ if (who == NULL) { who = getpwuid(getuid()); @@ -250,37 +251,37 @@ bool wxDirExists( const wxString& dir ) struct wxEndProcessData { - gint pid, tag; - wxProcess *process; + gint pid, tag; + wxProcess *process; }; static void GTK_EndProcessDetector(gpointer data, gint source, GdkInputCondition WXUNUSED(condition) ) { - wxEndProcessData *proc_data = (wxEndProcessData *)data; - int pid; + wxEndProcessData *proc_data = (wxEndProcessData *)data; + int pid; - pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid); + pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid); - /* wait4 is not part of any standard, use at own risk - * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) - * --- offer@sgi.com */ + /* wait4 is not part of any standard, use at own risk + * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) + * --- offer@sgi.com */ #if !defined(__sgi) - wait4(proc_data->pid, NULL, 0, NULL); + wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL); #else - wait3((int *) NULL, 0, (rusage *) NULL); + wait3((int *) NULL, 0, (rusage *) NULL); #endif - close(source); - gdk_input_remove(proc_data->tag); + close(source); + gdk_input_remove(proc_data->tag); - if (proc_data->process) - proc_data->process->OnTerminate(proc_data->pid); + if (proc_data->process) + proc_data->process->OnTerminate(proc_data->pid); - if (proc_data->pid > 0) - delete proc_data; - else - proc_data->pid = 0; + if (proc_data->pid > 0) + delete proc_data; + else + proc_data->pid = 0; } long wxExecute( char **argv, bool sync, wxProcess *process ) @@ -291,8 +292,9 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) wxCHECK_MSG( *argv, 0, "can't exec empty command" ); /* Create pipes */ - if (pipe(end_proc_detect) == -1) { - wxLogSysError(_("Pipe creation failed")); + if (pipe(end_proc_detect) == -1) + { + wxLogSysError( "Pipe creation failed" ); return 0; } @@ -302,12 +304,13 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) #else pid_t pid = fork(); #endif - if (pid == -1) { - // error - wxLogSysError(_("Fork failed")); + if (pid == -1) + { + wxLogSysError( "Fork failed" ); return 0; } - else if (pid == 0) { + else if (pid == 0) + { // we're in child close(end_proc_detect[0]); // close reading side // These three lines close the open file descriptors to @@ -325,20 +328,23 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) execvp (*argv, argv); #endif // there is no return after successful exec() - wxLogSysError(_("Can't execute '%s'"), *argv); + wxLogSysError( "Can't execute '%s'", *argv); _exit(-1); } - else { + else + { // we're in parent close(end_proc_detect[1]); // close writing side data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ, GTK_EndProcessDetector, (gpointer)data); data->pid = pid; - if (!sync) { + if (!sync) + { data->process = process; } - else { + else + { data->process = (wxProcess *) NULL; data->pid = -(data->pid); diff --git a/src/gtk/utilsres.cpp b/src/gtk/utilsres.cpp index 748d845d37..d14f938bde 100644 --- a/src/gtk/utilsres.cpp +++ b/src/gtk/utilsres.cpp @@ -255,10 +255,14 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, // home directory instead of current directory -- JACS (void)GetIniFile(buffer, file); - wxNode *node = wxTheResourceCache->Find(buffer); + wxNode *node = (wxNode*) NULL; /* suppress egcs warning */ + node = wxTheResourceCache->Find(buffer); if (node) + { database = (XrmDatabase)node->Data(); - else { + } + else + { database = XrmGetFileDatabase(buffer); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); diff --git a/src/gtk/wave.cpp b/src/gtk/wave.cpp index a5255b57b9..2436c23461 100644 --- a/src/gtk/wave.cpp +++ b/src/gtk/wave.cpp @@ -33,6 +33,9 @@ #include "wx/file.h" #include "wx/wave.h" +//----------------------------------------------------------------- +// wxWave +//----------------------------------------------------------------- wxWave::wxWave() : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) @@ -42,101 +45,106 @@ wxWave::wxWave() wxWave::wxWave(const wxString& sFileName, bool isResource) : m_waveLength(0), m_isResource(isResource), m_waveData(NULL) { - Create(sFileName, isResource); + Create(sFileName, isResource); } wxWave::wxWave(int size, const byte* data) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) { - Create(size, data); + Create(size, data); } wxWave::~wxWave() { - Free(); + Free(); } bool wxWave::Create(const wxString& fileName, bool isResource) { - Free(); + Free(); - if (isResource) - { - // todo + if (isResource) + { + // todo + return (m_waveData ? TRUE : FALSE); + } + else + { + m_isResource = FALSE; - return (m_waveData ? TRUE : FALSE); - } - else - { - m_isResource = FALSE; + wxFile fileWave; + if (!fileWave.Open(fileName, wxFile::read)) + { + return FALSE; + } - wxFile fileWave; - if (!fileWave.Open(fileName, wxFile::read)) - return FALSE; - - m_waveLength = (int) fileWave.Length(); + m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; - if (!m_waveData) - return FALSE; + m_waveData = new byte[m_waveLength]; + if (!m_waveData) + { + return FALSE; + } - fileWave.Read(m_waveData, m_waveLength); + fileWave.Read(m_waveData, m_waveLength); - return TRUE; - } + return TRUE; + } } bool wxWave::Create(int size, const byte* data) { - Free(); - m_isResource = FALSE; - m_waveLength=size; - m_waveData = new byte[size]; - if (!m_waveData) - return FALSE; + Free(); + m_isResource = FALSE; + m_waveLength=size; + m_waveData = new byte[size]; + if (!m_waveData) + { + return FALSE; + } - for (int i=0; im_height ); } +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +wxWindow* wxGetActiveWindow() +{ + return g_focusWindow; +} + //----------------------------------------------------------------------------- // wxWindow //----------------------------------------------------------------------------- diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index 3a3d479635..b15ece7379 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -15,6 +15,13 @@ #include +#ifdef __WXDEBUG__ +#ifdef NULL +#undef NULL +#endif +#define NULL ((void*)0L) +#endif + //----------------------------------------------------------------------------- // wxAcceleratorTable //----------------------------------------------------------------------------- diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 5e1c0e5755..dec83867a0 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -44,6 +44,9 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; extern wxList wxPendingDelete; extern wxResourceCache *wxTheResourceCache; +GdkVisual *wxVisualSetByExternal = (GdkVisual*) NULL; +GdkColormap *wxColormapSetByExternal = (GdkColormap*) NULL; + unsigned char g_palette[64*3] = { 0x0, 0x0, 0x0, @@ -169,14 +172,60 @@ wxApp::~wxApp(void) gtk_idle_remove( m_idleTag ); } -bool wxApp::OnInit(void) +bool wxApp::InitVisual() { + if (wxVisualSetByExternal) + { + /* this happens in the wxModule code of the OpenGl canvas. + it chooses the best display for OpenGl and stores it + in wxDisplaySetByExternal. we then have to make it the + default for the system */ + + gtk_widget_set_default_visual( wxVisualSetByExternal ); + } + + if (wxColormapSetByExternal) + { + /* OpenGl also gives us a colormap */ + + gtk_widget_set_default_colormap( wxColormapSetByExternal ); + } + else + { + /* this initiates the standard palette as defined by GdkImlib + in the GNOME libraries. it ensures that all GNOME applications + use the same 64 colormap entries on 8-bit displays so you + can use several rather graphics-heavy applications at the + same time */ + + GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); + + for (int i = 0; i < 64; i++) + { + GdkColor col; + col.red = g_palette[i*3 + 0] << 8; + col.green = g_palette[i*3 + 1] << 8; + col.blue = g_palette[i*3 + 2] << 8; + col.pixel = 0; + + gdk_color_alloc( cmap, &col ); + } + + gtk_widget_set_default_colormap( cmap ); + } + return TRUE; } bool wxApp::OnInitGui(void) { m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); + + return TRUE; +} + +bool wxApp::OnInit(void) +{ return TRUE; } @@ -320,12 +369,6 @@ void wxApp::SetTopWindow( wxWindow *win ) void wxApp::CommonInit(void) { - -/* -#if wxUSE_RESOURCES - (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); -#endif -*/ wxSystemSettings::Init(); wxTheFontNameDirectory = new wxFontNameDirectory; @@ -350,14 +393,19 @@ void wxApp::CommonInit(void) void wxApp::CommonCleanUp(void) { - wxDELETE(wxTheColourDatabase); - wxDELETE(wxTheFontNameDirectory); + if (wxTheColourDatabase) delete wxTheColourDatabase; + wxTheColourDatabase = (wxColourDatabase*) NULL; + + if (wxTheFontNameDirectory) delete wxTheFontNameDirectory; + wxTheFontNameDirectory = (wxFontNameDirectory*) NULL; + wxDeleteStockObjects(); #if wxUSE_WX_RESOURCES wxFlushResources(); - wxDELETE(wxTheResourceCache); + if (wxTheResourceCache) delete wxTheResourceCache; + wxTheResourceCache = (wxResourceCache*) NULL; wxCleanUpResourceSystem(); #endif @@ -419,29 +467,14 @@ int wxEntry( int argc, char *argv[] ) gtk_init( &argc, &argv ); - GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); - - for (int i = 0; i < 64; i++) - { - GdkColor col; - col.red = g_palette[i*3 + 0] << 8; - col.green = g_palette[i*3 + 1] << 8; - col.blue = g_palette[i*3 + 2] << 8; - col.pixel = 0; - - gdk_color_alloc( cmap, &col ); - } - - gtk_widget_push_colormap( cmap ); - - gtk_widget_set_default_colormap( cmap ); + wxModule::RegisterModules(); + if (!wxModule::InitializeModules()) return FALSE; + + if (!wxTheApp->InitVisual()) return 0; wxApp::CommonInit(); - wxModule::RegisterModules(); - if (!wxModule::InitializeModules()) return FALSE; - - wxTheApp->OnInitGui(); + if (!wxTheApp->OnInitGui()) return 0; // Here frames insert themselves automatically // into wxTopLevelWindows by getting created @@ -481,11 +514,9 @@ int wxEntry( int argc, char *argv[] ) #endif - wxLog *oldLog = wxLog::SetActiveTarget( NULL ); + wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL ); if (oldLog) delete oldLog; return retValue; } -//----------------------------------------------------------------------------- - diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index 1a092196ec..82fb96dc1a 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -27,14 +27,15 @@ wxCheckListBox::wxCheckListBox() : { m_hasCheckBoxes = TRUE; } + wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) + const wxPoint& pos, + const wxSize& size, + int nStrings, + const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name ) { m_hasCheckBoxes = TRUE; wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 45cf031ba1..302a6f5dff 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -255,7 +255,7 @@ void wxComboBox::Delete( int n ) return; } - GList *list = g_list_append( NULL, child->data ); + GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( listbox, list ); g_list_free( list ); diff --git a/src/gtk1/dcps.cpp b/src/gtk1/dcps.cpp index 8a82f3cb61..710668c98a 100644 --- a/src/gtk1/dcps.cpp +++ b/src/gtk1/dcps.cpp @@ -14,7 +14,6 @@ #pragma interface #endif - #include "wx/defs.h" #if wxUSE_POSTSCRIPT diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index b419c04ccb..d347412089 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -733,8 +733,8 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) if (!m_data) return (wxDragResult) wxDragNone; - static GtkWidget *drag_icon = NULL; - static GtkWidget *drop_icon = NULL; + static GtkWidget *drag_icon = (GtkWidget*) NULL; + static GtkWidget *drop_icon = (GtkWidget*) NULL; GdkPoint hotspot_1 = {0,-5 }; @@ -872,7 +872,7 @@ void wxDropSource::UnregisterWindow(void) /* * Shaped Windows */ -static GdkWindow *root_win = NULL; +static GdkWindow *root_win = (GdkWindow*) NULL; typedef struct _cursoroffset {gint x,y;} CursorOffset; @@ -895,7 +895,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event) (GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK), - NULL, NULL, 0); + (GdkWindow*)NULL, + (GdkCursor*) NULL, 0); } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index b865dba96d..fb6ef44edc 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -423,7 +423,7 @@ void wxListBox::Delete( int n ) wxCHECK_RET( child, "wrong listbox index" ); - GList *list = g_list_append( NULL, child->data ); + GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( m_list, list ); g_list_free( list ); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index f0c5335454..4696faeb11 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -155,14 +155,38 @@ bool wxMenuBar::Enabled( int id ) const return FALSE; } +wxString wxMenuBar::GetLabel( int id ) const +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->GetText(); + return ""; +} + +void wxMenuBar::SetLabel( int id, const wxString &label ) +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->SetText( label ); +} + +void wxMenuBar::EnableTop( int WXUNUSED(pos), bool WXUNUSED(flag) ) +{ +} + +wxString wxMenuBar::GetLabelTop( int WXUNUSED(pos) ) const +{ + return "menu"; +} + +void wxMenuBar::SetLabelTop( int WXUNUSED(pos), const wxString& WXUNUSED(label) ) +{ +} + //----------------------------------------------------------------------------- // "activate" //----------------------------------------------------------------------------- static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { - wxYield(); - int id = menu->FindMenuIdByMenuItem(widget); /* should find it for normal (not popup) menu */ diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp index a5a86f9be6..2407a21cd4 100644 --- a/src/gtk1/minifram.cpp +++ b/src/gtk1/minifram.cpp @@ -17,7 +17,6 @@ #include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" - //----------------------------------------------------------------------------- // "clicked" //----------------------------------------------------------------------------- diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index db83d59ac4..7eee0d5246 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -429,7 +429,7 @@ bool wxNotebook::SetPageImage( int page, int image ) if (image == -1 && nb_page->m_image == -1) return TRUE; /* Case 1): Nothing to do. */ - GtkWidget *pixmapwid = NULL; + GtkWidget *pixmapwid = (GtkWidget*) NULL; if (nb_page->m_image != -1) { diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 9708cf57e0..d0808503e7 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -7,7 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ #pragma implementation "radiobox.h" #endif @@ -148,8 +147,8 @@ void wxRadioBox::OnSize( wxSizeEvent &event ) wxSize wxRadioBox::LayoutItems() { - int x = m_x+7; - int y = m_y+15; + int x = 7; + int y = 15; int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1; @@ -160,7 +159,7 @@ wxSize wxRadioBox::LayoutItems() for (int j = 0; j < m_majorDim; j++) { - y = m_y+15; + y = 15; int max_len = 0; wxNode *node = m_boxes.Nth( j*num_per_major ); @@ -169,10 +168,10 @@ wxSize wxRadioBox::LayoutItems() GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GdkFont *font = m_widget->style->font; - int len = 27+gdk_string_measure( font, label->label ); + int len = 22+gdk_string_measure( font, label->label ); if (len > max_len) max_len = len; - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); y += 22; node = node->Next(); @@ -197,8 +196,8 @@ wxSize wxRadioBox::LayoutItems() x += max_len + 2; } - res.y -= 3; - res.x = x-2; + res.x = x+4; + res.y += 9; } else { @@ -211,7 +210,7 @@ wxSize wxRadioBox::LayoutItems() GtkLabel *label = GTK_LABEL( button->child ); GdkFont *font = m_widget->style->font; - int len = 27+gdk_string_measure( font, label->label ); + int len = 22+gdk_string_measure( font, label->label ); if (len > max) max = len; node = node->Next(); @@ -222,13 +221,13 @@ wxSize wxRadioBox::LayoutItems() { GtkWidget *button = GTK_WIDGET( node->Data() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); x += max; gtk_widget_set_usize( button, max, 20 ); node = node->Next(); } - res.x = x-2; + res.x = x+4; res.y = 42; } diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index a607e5da6c..305967bc7d 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -7,7 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ #pragma implementation "region.h" #endif @@ -17,6 +16,13 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +#ifdef __WXDEBUG__ +#ifdef NULL +#undef NULL +#endif +#define NULL ((void*)0L) +#endif + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- @@ -36,20 +42,20 @@ class wxRegionRefData: public wxObjectRefData wxRegionRefData::wxRegionRefData(void) { - m_region = (GdkRegion *) NULL; + m_region = (GdkRegion *) NULL; } wxRegionRefData::~wxRegionRefData(void) { - if (m_region) gdk_region_destroy( m_region ); + if (m_region) gdk_region_destroy( m_region ); - wxNode *node = m_rects.First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - delete r; - node = node->Next(); - } + wxNode *node = m_rects.First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + delete r; + node = node->Next(); + } } //----------------------------------------------------------------------------- @@ -60,57 +66,57 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject); wxRegion::wxRegion( long x, long y, long w, long h ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); - gdk_region_destroy( reg ); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); + gdk_region_destroy( reg ); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); } wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle rect; - rect.x = topLeft.x; - rect.y = topLeft.y; - rect.width = bottomRight.x - rect.x; - rect.height = bottomRight.y - rect.y; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); - gdk_region_destroy( reg ); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle rect; + rect.x = topLeft.x; + rect.y = topLeft.y; + rect.width = bottomRight.x - rect.x; + rect.height = bottomRight.y - rect.y; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); + gdk_region_destroy( reg ); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); } wxRegion::wxRegion( const wxRect& rect ) { - m_refData = new wxRegionRefData(); - GdkRegion *reg = gdk_region_new(); - GdkRectangle g_rect; - g_rect.x = rect.x; - g_rect.y = rect.y; - g_rect.width = rect.width; - g_rect.height = rect.height; - M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); - gdk_region_destroy( reg ); + m_refData = new wxRegionRefData(); + GdkRegion *reg = gdk_region_new(); + GdkRectangle g_rect; + g_rect.x = rect.x; + g_rect.y = rect.y; + g_rect.width = rect.width; + g_rect.height = rect.height; + M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); + gdk_region_destroy( reg ); - wxNode *node = M_REGIONDATA->m_rects.First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = M_REGIONDATA->m_rects.First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } } wxRegion::wxRegion(void) { - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + m_refData = new wxRegionRefData(); + M_REGIONDATA->m_region = gdk_region_new(); } wxRegion::~wxRegion(void) @@ -119,241 +125,241 @@ wxRegion::~wxRegion(void) bool wxRegion::operator == ( const wxRegion& region ) { - return m_refData == region.m_refData; + return m_refData == region.m_refData; } bool wxRegion::operator != ( const wxRegion& region ) { - return m_refData != region.m_refData; + return m_refData != region.m_refData; } void wxRegion::Clear(void) { - UnRef(); - m_refData = new wxRegionRefData(); - M_REGIONDATA->m_region = gdk_region_new(); + UnRef(); + m_refData = new wxRegionRefData(); + M_REGIONDATA->m_region = gdk_region_new(); } bool wxRegion::Union( long x, long y, long width, long height ) { - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = height; - GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); - return TRUE; + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); + return TRUE; } bool wxRegion::Union( const wxRect& rect ) { - GdkRectangle g_rect; - g_rect.x = rect.x; - g_rect.y = rect.y; - g_rect.width = rect.width; - g_rect.height = rect.height; - GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); - return TRUE; + GdkRectangle g_rect; + g_rect.x = rect.x; + g_rect.y = rect.y; + g_rect.width = rect.width; + g_rect.height = rect.height; + GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); + return TRUE; } bool wxRegion::Union( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; + GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; - wxNode *node = region.GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = region.GetRectList()->First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } - return TRUE; + return TRUE; } bool wxRegion::Intersect( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Intersect( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Intersect( reg ); + return TRUE; } bool wxRegion::Intersect( const wxRect& rect ) { - wxRegion reg( rect ); - Intersect( reg ); - return TRUE; + wxRegion reg( rect ); + Intersect( reg ); + return TRUE; } bool wxRegion::Intersect( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - return TRUE; + GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + return TRUE; } bool wxRegion::Subtract( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Subtract( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Subtract( reg ); + return TRUE; } bool wxRegion::Subtract( const wxRect& rect ) { - wxRegion reg( rect ); - Subtract( reg ); - return TRUE; + wxRegion reg( rect ); + Subtract( reg ); + return TRUE; } bool wxRegion::Subtract( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; - return TRUE; + GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; + return TRUE; } bool wxRegion::Xor( long x, long y, long width, long height ) { - wxRegion reg( x, y, width, height ); - Xor( reg ); - return TRUE; + wxRegion reg( x, y, width, height ); + Xor( reg ); + return TRUE; } bool wxRegion::Xor( const wxRect& rect ) { - wxRegion reg( rect ); - Xor( reg ); - return TRUE; + wxRegion reg( rect ); + Xor( reg ); + return TRUE; } bool wxRegion::Xor( const wxRegion& region ) { - GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); - gdk_region_destroy( M_REGIONDATA->m_region ); - M_REGIONDATA->m_region = reg; + GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); + gdk_region_destroy( M_REGIONDATA->m_region ); + M_REGIONDATA->m_region = reg; - wxNode *node = region.GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); - node = node->Next(); - } + wxNode *node = region.GetRectList()->First(); + while (node) + { + wxRect *r = (wxRect*)node->Data(); + M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) ); + node = node->Next(); + } - return TRUE; + return TRUE; } void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const { - x = 0; - y = 0; - w = -1; - h = -1; - wxNode *node = GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - if (node == GetRectList()->First()) + x = 0; + y = 0; + w = -1; + h = -1; + wxNode *node = GetRectList()->First(); + while (node) { - x = r->x; - y = r->y; - w = r->width; - h = r->height; + wxRect *r = (wxRect*)node->Data(); + if (node == GetRectList()->First()) + { + x = r->x; + y = r->y; + w = r->width; + h = r->height; + } + else + { + if (r->x < x) + { + x = r->x; + w += x - r->x; + } + if (r->y < y) + { + y = r->y; + h += y - r->y; + } + if (r->width+r->x > x+w) + { + w = r->x + r->width - x; + } + if (r->height+r->y > y+h) + { + h = r->y + r->height - y; + } + } + node = node->Next(); } - else - { - if (r->x < x) - { - x = r->x; - w += x - r->x; - } - if (r->y < y) - { - y = r->y; - h += y - r->y; - } - if (r->width+r->x > x+w) - { - w = r->x + r->width - x; - } - if (r->height+r->y > y+h) - { - h = r->y + r->height - y; - } - } - node = node->Next(); - } } wxRect wxRegion::GetBox(void) const { - long x = 0; - long y = 0; - long w = -1; - long h = -1; - GetBox( x, y, w, h ); - return wxRect( x, y, w, h ); + long x = 0; + long y = 0; + long w = -1; + long h = -1; + GetBox( x, y, w, h ); + return wxRect( x, y, w, h ); } bool wxRegion::Empty(void) const { - return gdk_region_empty( M_REGIONDATA->m_region ); + return gdk_region_empty( M_REGIONDATA->m_region ); } wxRegionContain wxRegion::Contains( long x, long y ) const { - if (gdk_region_point_in( M_REGIONDATA->m_region, x, y )) - return wxInRegion; - else - return wxOutRegion; + if (gdk_region_point_in( M_REGIONDATA->m_region, x, y )) + return wxInRegion; + else + return wxOutRegion; } wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const { - GdkRectangle rect; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect ); - switch (res) - { - case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion; - case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion; - case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion; - } - return wxOutRegion; + GdkRectangle rect; + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect ); + switch (res) + { + case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion; + case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion; + case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion; + } + return wxOutRegion; } wxRegionContain wxRegion::Contains(const wxPoint& pt) const { - return Contains( pt.x, pt.y ); + return Contains( pt.x, pt.y ); } wxRegionContain wxRegion::Contains(const wxRect& rect) const { - return Contains( rect.x, rect.y, rect.width, rect.height ); + return Contains( rect.x, rect.y, rect.width, rect.height ); } GdkRegion *wxRegion::GetRegion(void) const { - return M_REGIONDATA->m_region; + return M_REGIONDATA->m_region; } wxList *wxRegion::GetRectList() const { - return &(M_REGIONDATA->m_rects); + return &(M_REGIONDATA->m_rects); } //----------------------------------------------------------------------------- @@ -364,71 +370,71 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject); wxRegionIterator::wxRegionIterator(void) { - m_current = 0; + m_current = 0; } wxRegionIterator::wxRegionIterator( const wxRegion& region ) { - m_region = region; - m_current = 0; + m_region = region; + m_current = 0; } void wxRegionIterator::Reset( const wxRegion& region ) { - m_region = region; - m_current = 0; + m_region = region; + m_current = 0; } wxRegionIterator::operator bool (void) const { - return m_current < m_region.GetRectList()->Number(); + return m_current < m_region.GetRectList()->Number(); } bool wxRegionIterator::HaveRects(void) const { - return m_current < m_region.GetRectList()->Number(); + return m_current < m_region.GetRectList()->Number(); } void wxRegionIterator::operator ++ (void) { - if (m_current < m_region.GetRectList()->Number()) ++m_current; + if (m_current < m_region.GetRectList()->Number()) ++m_current; } void wxRegionIterator::operator ++ (int) { - if (m_current < m_region.GetRectList()->Number()) ++m_current; + if (m_current < m_region.GetRectList()->Number()) ++m_current; } long wxRegionIterator::GetX(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->x; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->x; } long wxRegionIterator::GetY(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->y; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->y; } long wxRegionIterator::GetW(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->width; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->width; } long wxRegionIterator::GetH(void) const { - wxNode *node = m_region.GetRectList()->Nth( m_current ); - if (!node) return 0; - wxRect *r = (wxRect*)node->Data(); - return r->height; + wxNode *node = m_region.GetRectList()->Nth( m_current ); + if (!node) return 0; + wxRect *r = (wxRect*)node->Data(); + return r->height; } diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 401fd4d460..61c406c6fb 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -303,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file ) Clear(); - FILE *fp = NULL; + FILE *fp = (FILE*) NULL; struct stat statb; if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || @@ -358,7 +358,7 @@ bool wxTextCtrl::SaveFile( const wxString &file ) } else { - char *text = NULL; + char *text = (char*) NULL; gint len = 0; if (m_windowStyle & wxTE_MULTILINE) diff --git a/src/gtk1/threadpsx.cpp b/src/gtk1/threadpsx.cpp index a6b760b6f4..63dc81b2c9 100644 --- a/src/gtk1/threadpsx.cpp +++ b/src/gtk1/threadpsx.cpp @@ -64,7 +64,7 @@ public: wxMutex::wxMutex() { p_internal = new wxMutexInternal; - pthread_mutex_init(&(p_internal->p_mutex), NULL); + pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL ); m_locked = 0; } @@ -73,46 +73,54 @@ wxMutex::~wxMutex() if (m_locked > 0) wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); - pthread_mutex_destroy(&(p_internal->p_mutex)); + pthread_mutex_destroy( &(p_internal->p_mutex) ); delete p_internal; } wxMutexError wxMutex::Lock() { - int err; - - err = pthread_mutex_lock(&(p_internal->p_mutex)); + int err = pthread_mutex_lock( &(p_internal->p_mutex) ); if (err == EDEADLK) + { return wxMUTEX_DEAD_LOCK; + } m_locked++; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::TryLock() { - int err; - if (m_locked) + { return wxMUTEX_BUSY; + } - err = pthread_mutex_trylock(&(p_internal->p_mutex)); + int err = pthread_mutex_trylock( &(p_internal->p_mutex) ); switch (err) { case EBUSY: return wxMUTEX_BUSY; } + m_locked++; + return wxMUTEX_NO_ERROR; } wxMutexError wxMutex::Unlock() { if (m_locked > 0) + { m_locked--; + } else + { return wxMUTEX_UNLOCKED; + } - pthread_mutex_unlock(&(p_internal->p_mutex)); + pthread_mutex_unlock( &(p_internal->p_mutex) ); + return wxMUTEX_NO_ERROR; } @@ -129,37 +137,38 @@ public: wxCondition::wxCondition() { p_internal = new wxConditionInternal; - pthread_cond_init(&(p_internal->p_condition), NULL); + pthread_cond_init( &(p_internal->p_condition), (const pthread_condattr_t *) NULL ); } wxCondition::~wxCondition() { - pthread_cond_destroy(&(p_internal->p_condition)); + pthread_cond_destroy( &(p_internal->p_condition) ); + delete p_internal; } void wxCondition::Wait(wxMutex& mutex) { - pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex)); + pthread_cond_wait( &(p_internal->p_condition), &(mutex.p_internal->p_mutex) ); } bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec) { struct timespec tspec; - tspec.tv_sec = time(NULL)+sec; + tspec.tv_sec = time(0L)+sec; tspec.tv_nsec = nsec; return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT); } void wxCondition::Signal() { - pthread_cond_signal(&(p_internal->p_condition)); + pthread_cond_signal( &(p_internal->p_condition) ); } void wxCondition::Broadcast() { - pthread_cond_broadcast(&(p_internal->p_condition)); + pthread_cond_broadcast( &(p_internal->p_condition) ); } //-------------------------------------------------------------------- @@ -183,7 +192,7 @@ void *wxThreadInternal::PthreadStart(void *ptr) wxThread *thread = (wxThread *)ptr; /* Call the main entry */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL ); void* status = thread->Entry(); thread->Exit(status); @@ -246,9 +255,9 @@ int wxThread::GetPriority() const void wxThread::DeferDestroy(bool on) { if (on) - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, (int*) NULL); else - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL); } wxThreadError wxThread::Destroy() diff --git a/src/gtk1/timer.cpp b/src/gtk1/timer.cpp index 36aada6e6f..fb74fc13dc 100644 --- a/src/gtk1/timer.cpp +++ b/src/gtk1/timer.cpp @@ -15,6 +15,51 @@ #include "wx/timer.h" #include "gtk/gtk.h" +/* +#include "glib.h" +*/ + +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +/* +static GTimer *g_timer = (GTimer*) NULL; + +void wxStartTimer() +{ + if (g_timer) + { + g_timer_rest( g_timer ); + } + else + { + g_timer = g_timer_new(); + g_timer_start( g_timer ); + } +} + +long wxGetElapsedTime( bool resetTimer ) +{ + gulong res = 0; + if (g_timer) + { + g_timer_elapsed( g_timer, &res ); + if (resetTimer) g_timer_reset( g_timer ); + } + + return res; +} + +bool wxGetLocalTime( long *timeZone, int *dstObserved ) +{ +} + +long wxGetCurrentTime() +{ +} +*/ + //----------------------------------------------------------------------------- // wxTimer diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index ea023f37e2..28d35e2adc 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -30,13 +30,10 @@ #include #include -#include -#include -#include - #include "glib.h" #include "gdk/gdk.h" #include "gtk/gtk.h" +#include "gtk/gtkfeatures.h" #include "gdk/gdkx.h" #ifdef __SVR4__ @@ -79,12 +76,7 @@ void wxDisplaySize( int *width, int *height ) void wxGetMousePosition( int* x, int* y ) { - Window dumw; - int dumi; - unsigned int dumu; - - XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(), - &dumw,&dumw,x,y,&dumi,&dumi,&dumu ); + gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL ); } bool wxColourDisplay(void) @@ -97,6 +89,14 @@ int wxDisplayDepth(void) return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth; } +int wxGetOsVersion(int *majorVsn, int *minorVsn) +{ + if (majorVsn) *majorVsn = GTK_MAJOR_VERSION; + if (minorVsn) *minorVsn = GTK_MINOR_VERSION; + + return wxGTK; +} + //------------------------------------------------------------------------ // user and home routines //------------------------------------------------------------------------ @@ -124,7 +124,8 @@ char *wxGetUserHome( const wxString &user ) { who = getpwnam(ptr); } - // We now make sure the the user exists! + + /* We now make sure the the user exists! */ if (who == NULL) { who = getpwuid(getuid()); @@ -250,37 +251,37 @@ bool wxDirExists( const wxString& dir ) struct wxEndProcessData { - gint pid, tag; - wxProcess *process; + gint pid, tag; + wxProcess *process; }; static void GTK_EndProcessDetector(gpointer data, gint source, GdkInputCondition WXUNUSED(condition) ) { - wxEndProcessData *proc_data = (wxEndProcessData *)data; - int pid; + wxEndProcessData *proc_data = (wxEndProcessData *)data; + int pid; - pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid); + pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid); - /* wait4 is not part of any standard, use at own risk - * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) - * --- offer@sgi.com */ + /* wait4 is not part of any standard, use at own risk + * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) + * --- offer@sgi.com */ #if !defined(__sgi) - wait4(proc_data->pid, NULL, 0, NULL); + wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL); #else - wait3((int *) NULL, 0, (rusage *) NULL); + wait3((int *) NULL, 0, (rusage *) NULL); #endif - close(source); - gdk_input_remove(proc_data->tag); + close(source); + gdk_input_remove(proc_data->tag); - if (proc_data->process) - proc_data->process->OnTerminate(proc_data->pid); + if (proc_data->process) + proc_data->process->OnTerminate(proc_data->pid); - if (proc_data->pid > 0) - delete proc_data; - else - proc_data->pid = 0; + if (proc_data->pid > 0) + delete proc_data; + else + proc_data->pid = 0; } long wxExecute( char **argv, bool sync, wxProcess *process ) @@ -291,8 +292,9 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) wxCHECK_MSG( *argv, 0, "can't exec empty command" ); /* Create pipes */ - if (pipe(end_proc_detect) == -1) { - wxLogSysError(_("Pipe creation failed")); + if (pipe(end_proc_detect) == -1) + { + wxLogSysError( "Pipe creation failed" ); return 0; } @@ -302,12 +304,13 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) #else pid_t pid = fork(); #endif - if (pid == -1) { - // error - wxLogSysError(_("Fork failed")); + if (pid == -1) + { + wxLogSysError( "Fork failed" ); return 0; } - else if (pid == 0) { + else if (pid == 0) + { // we're in child close(end_proc_detect[0]); // close reading side // These three lines close the open file descriptors to @@ -325,20 +328,23 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) execvp (*argv, argv); #endif // there is no return after successful exec() - wxLogSysError(_("Can't execute '%s'"), *argv); + wxLogSysError( "Can't execute '%s'", *argv); _exit(-1); } - else { + else + { // we're in parent close(end_proc_detect[1]); // close writing side data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ, GTK_EndProcessDetector, (gpointer)data); data->pid = pid; - if (!sync) { + if (!sync) + { data->process = process; } - else { + else + { data->process = (wxProcess *) NULL; data->pid = -(data->pid); diff --git a/src/gtk1/utilsres.cpp b/src/gtk1/utilsres.cpp index 748d845d37..d14f938bde 100644 --- a/src/gtk1/utilsres.cpp +++ b/src/gtk1/utilsres.cpp @@ -255,10 +255,14 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, // home directory instead of current directory -- JACS (void)GetIniFile(buffer, file); - wxNode *node = wxTheResourceCache->Find(buffer); + wxNode *node = (wxNode*) NULL; /* suppress egcs warning */ + node = wxTheResourceCache->Find(buffer); if (node) + { database = (XrmDatabase)node->Data(); - else { + } + else + { database = XrmGetFileDatabase(buffer); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); diff --git a/src/gtk1/wave.cpp b/src/gtk1/wave.cpp index a5255b57b9..2436c23461 100644 --- a/src/gtk1/wave.cpp +++ b/src/gtk1/wave.cpp @@ -33,6 +33,9 @@ #include "wx/file.h" #include "wx/wave.h" +//----------------------------------------------------------------- +// wxWave +//----------------------------------------------------------------- wxWave::wxWave() : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) @@ -42,101 +45,106 @@ wxWave::wxWave() wxWave::wxWave(const wxString& sFileName, bool isResource) : m_waveLength(0), m_isResource(isResource), m_waveData(NULL) { - Create(sFileName, isResource); + Create(sFileName, isResource); } wxWave::wxWave(int size, const byte* data) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) { - Create(size, data); + Create(size, data); } wxWave::~wxWave() { - Free(); + Free(); } bool wxWave::Create(const wxString& fileName, bool isResource) { - Free(); + Free(); - if (isResource) - { - // todo + if (isResource) + { + // todo + return (m_waveData ? TRUE : FALSE); + } + else + { + m_isResource = FALSE; - return (m_waveData ? TRUE : FALSE); - } - else - { - m_isResource = FALSE; + wxFile fileWave; + if (!fileWave.Open(fileName, wxFile::read)) + { + return FALSE; + } - wxFile fileWave; - if (!fileWave.Open(fileName, wxFile::read)) - return FALSE; - - m_waveLength = (int) fileWave.Length(); + m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; - if (!m_waveData) - return FALSE; + m_waveData = new byte[m_waveLength]; + if (!m_waveData) + { + return FALSE; + } - fileWave.Read(m_waveData, m_waveLength); + fileWave.Read(m_waveData, m_waveLength); - return TRUE; - } + return TRUE; + } } bool wxWave::Create(int size, const byte* data) { - Free(); - m_isResource = FALSE; - m_waveLength=size; - m_waveData = new byte[size]; - if (!m_waveData) - return FALSE; + Free(); + m_isResource = FALSE; + m_waveLength=size; + m_waveData = new byte[size]; + if (!m_waveData) + { + return FALSE; + } - for (int i=0; im_height ); } +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +wxWindow* wxGetActiveWindow() +{ + return g_focusWindow; +} + //----------------------------------------------------------------------------- // wxWindow //----------------------------------------------------------------------------- diff --git a/src/iodbc/henv.ci b/src/iodbc/henv.ci index b8df08fe55..46a2125d69 100644 --- a/src/iodbc/henv.ci +++ b/src/iodbc/henv.ci @@ -14,73 +14,73 @@ static struct { char* symbol; } odbcapi_symtab[] = { #if (ODBCVER >= 0x0300) - en_AllocHandle CLI_NAME_PREFIX "AllocHandle", - en_FreeHandle CLI_NAME_PREFIX "FreeHandle", + { en_AllocHandle CLI_NAME_PREFIX "AllocHandle" }, + { en_FreeHandle CLI_NAME_PREFIX "FreeHandle" }, #endif - en_AllocEnv, CLI_NAME_PREFIX "AllocEnv", - en_AllocConnect, CLI_NAME_PREFIX "AllocConnect", - en_Connect, CLI_NAME_PREFIX "Connect", - en_DriverConnect, CLI_NAME_PREFIX "DriverConnect", - en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect", + { en_AllocEnv, CLI_NAME_PREFIX "AllocEnv" }, + { en_AllocConnect, CLI_NAME_PREFIX "AllocConnect" }, + { en_Connect, CLI_NAME_PREFIX "Connect" }, + { en_DriverConnect, CLI_NAME_PREFIX "DriverConnect" }, + { en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect" }, - en_DataSources, CLI_NAME_PREFIX "DataSources", - en_Drivers, CLI_NAME_PREFIX "Driver", - en_GetInfo, CLI_NAME_PREFIX "GetInfo", - en_GetFunctions, CLI_NAME_PREFIX "GetFunctions", - en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo", + { en_DataSources, CLI_NAME_PREFIX "DataSources" }, + { en_Drivers, CLI_NAME_PREFIX "Driver" }, + { en_GetInfo, CLI_NAME_PREFIX "GetInfo" }, + { en_GetFunctions, CLI_NAME_PREFIX "GetFunctions" }, + { en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo" }, - en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption", - en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption", - en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption", - en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption", + { en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption" }, + { en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption" }, + { en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption" }, + { en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption" }, - en_AllocStmt, CLI_NAME_PREFIX "AllocStmt", - en_Prepare, CLI_NAME_PREFIX "Prepare", - en_BindParameter, CLI_NAME_PREFIX "BindParameter", - en_ParamOptions, CLI_NAME_PREFIX "ParamOptions", - en_GetCursorName, CLI_NAME_PREFIX "GetCursorName", - en_SetCursorName, CLI_NAME_PREFIX "SetCursorName", - en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions", - en_SetParam, CLI_NAME_PREFIX "SetParam", + { en_AllocStmt, CLI_NAME_PREFIX "AllocStmt" }, + { en_Prepare, CLI_NAME_PREFIX "Prepare" }, + { en_BindParameter, CLI_NAME_PREFIX "BindParameter" }, + { en_ParamOptions, CLI_NAME_PREFIX "ParamOptions" }, + { en_GetCursorName, CLI_NAME_PREFIX "GetCursorName" }, + { en_SetCursorName, CLI_NAME_PREFIX "SetCursorName" }, + { en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions" }, + { en_SetParam, CLI_NAME_PREFIX "SetParam" }, - en_Execute, CLI_NAME_PREFIX "Execute", - en_ExecDirect, CLI_NAME_PREFIX "ExecDirect", - en_NativeSql, CLI_NAME_PREFIX "NativeSql", - en_DescribeParam, CLI_NAME_PREFIX "DescribeParam", - en_NumParams, CLI_NAME_PREFIX "NumParams", - en_ParamData, CLI_NAME_PREFIX "ParamData", - en_PutData, CLI_NAME_PREFIX "PutData", + { en_Execute, CLI_NAME_PREFIX "Execute" }, + { en_ExecDirect, CLI_NAME_PREFIX "ExecDirect" }, + { en_NativeSql, CLI_NAME_PREFIX "NativeSql" }, + { en_DescribeParam, CLI_NAME_PREFIX "DescribeParam" }, + { en_NumParams, CLI_NAME_PREFIX "NumParams" }, + { en_ParamData, CLI_NAME_PREFIX "ParamData" }, + { en_PutData, CLI_NAME_PREFIX "PutData" }, - en_RowCount, CLI_NAME_PREFIX "RowCount", - en_NumResultCols, CLI_NAME_PREFIX "NumResultCols", - en_DescribeCol, CLI_NAME_PREFIX "DescribeCol", - en_ColAttributes, CLI_NAME_PREFIX "ColAttributes", - en_BindCol, CLI_NAME_PREFIX "BindCol", - en_Fetch, CLI_NAME_PREFIX "Fetch", - en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch", - en_GetData, CLI_NAME_PREFIX "GetData", - en_SetPos, CLI_NAME_PREFIX "SetPos", - en_MoreResults, CLI_NAME_PREFIX "MoreResults", - en_Error, CLI_NAME_PREFIX "Error", + { en_RowCount, CLI_NAME_PREFIX "RowCount" }, + { en_NumResultCols, CLI_NAME_PREFIX "NumResultCols" }, + { en_DescribeCol, CLI_NAME_PREFIX "DescribeCol" }, + { en_ColAttributes, CLI_NAME_PREFIX "ColAttributes" }, + { en_BindCol, CLI_NAME_PREFIX "BindCol" }, + { en_Fetch, CLI_NAME_PREFIX "Fetch" }, + { en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch" }, + { en_GetData, CLI_NAME_PREFIX "GetData" }, + { en_SetPos, CLI_NAME_PREFIX "SetPos" }, + { en_MoreResults, CLI_NAME_PREFIX "MoreResults" }, + { en_Error, CLI_NAME_PREFIX "Error" }, - en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges", - en_Columns, CLI_NAME_PREFIX "Columns", - en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys", - en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys", - en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns", - en_Procedures, CLI_NAME_PREFIX "Procedures", - en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns", - en_Statistics, CLI_NAME_PREFIX "Statistics", - en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges", - en_Tables, CLI_NAME_PREFIX "Tables", + { en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges" }, + { en_Columns, CLI_NAME_PREFIX "Columns" }, + { en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys" }, + { en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys" }, + { en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns" }, + { en_Procedures, CLI_NAME_PREFIX "Procedures" }, + { en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns" }, + { en_Statistics, CLI_NAME_PREFIX "Statistics" }, + { en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges" }, + { en_Tables, CLI_NAME_PREFIX "Tables" }, - en_FreeStmt, CLI_NAME_PREFIX "FreeStmt", - en_Cancel, CLI_NAME_PREFIX "Cancel", - en_Transact, CLI_NAME_PREFIX "Transact", + { en_FreeStmt, CLI_NAME_PREFIX "FreeStmt" }, + { en_Cancel, CLI_NAME_PREFIX "Cancel" }, + { en_Transact, CLI_NAME_PREFIX "Transact" }, - en_Disconnect, CLI_NAME_PREFIX "Disconnect", - en_FreeConnect, CLI_NAME_PREFIX "FreeConnect", - en_FreeEnv, CLI_NAME_PREFIX "FreeEnv", + { en_Disconnect, CLI_NAME_PREFIX "Disconnect" }, + { en_FreeConnect, CLI_NAME_PREFIX "FreeConnect" }, + { en_FreeEnv, CLI_NAME_PREFIX "FreeEnv" }, - en_NullProc, NULL + { en_NullProc, NULL } }; diff --git a/src/iodbc/herr.ci b/src/iodbc/herr.ci index b9dbe0ba75..0e63022644 100644 --- a/src/iodbc/herr.ci +++ b/src/iodbc/herr.ci @@ -1,98 +1,98 @@ static const sqlerrmsg_t sqlerrmsg_tab[] = { - en_00000, "00000", "", - en_01000, "01000", "General warning", - en_01002, "01002", "Disconnect error", - en_01004, "01004", "Data truncated", - en_01006, "01006", "Privilege not revoked", - en_01S00, "01S00", "Invalid connection string attribute", - en_01S01, "01S01", "Error in row", - en_01S02, "01S02", "Optional value changed", - en_01S03, "01S03", "No rows updated or deleted", - en_01S04, "01S04", "More than one row updated or deleted", - en_07001, "07001", "Wrong number of parameters", - en_07006, "07006", "Restricted data type attribute violation", - en_08001, "08001", "Unable to connect to data source", - en_08002, "08002", "Connection in use", - en_08003, "08003", "Connect not open", - en_08004, "08004", "Data source rejected establishment of connection", - en_08007, "08007", "Connection failure during transaction", - en_08S01, "08S01", "Communication link failure", - en_21S01, "21S01", "Insert value list does not match", - en_21S02, "21S02", "Degree of derived table does not match column list", - en_22001, "22001", "String data right truncation", - en_22003, "22003", "Numeric value out of range", - en_22005, "22005", "Error in assignment", - en_22008, "22008", "Datetime field overflow", - en_22012, "22012", "Division by zero", - en_22026, "22026", "String data, length mismatch", - en_23000, "23000", "Integrity constraint violation", - en_24000, "24000", "Invalid cursor state", - en_25000, "25000", "Invalid transaction state", - en_28000, "28000", "Invalid authorization specification", - en_34000, "34000", "Invalid cursor name", - en_37000, "37000", "Syntex error or access violation", - en_3C000, "3C000", "Duplicate cursor name", - en_40001, "40001", "Serialization failure", - en_42000, "42000", "Syntax error or access violation", - en_70100, "70100", "Operation aborted", - en_IM001, "IM001", "Driver does not support this function", - en_IM002, "IM002", "Data source name not found and no default " - "driver specified. Driver could not be loaded", - en_IM003, "IM003", "Specified driver could not be loaded", - en_IM004, "IM004", "Driver's SQLAllocEnv() failed", - en_IM005, "IM005", "Driver's SQLAllocConnect() failed", - en_IM006, "IM006", "Driver's SQLSetConnectOption failed", - en_IM007, "IM007", "No data source or driver specified, dialog prohibited", - en_IM008, "IM008", "Dialog failed", - en_IM009, "IM009", "Unable to load translation DLL", - en_IM010, "IM010", "Data source name too long", - en_IM011, "IM011", "Driver name too long", - en_IM012, "IM012", "DRIVER keyword syntax error", - en_IM013, "IM013", "Trace file error", - en_IM014, "IM014", "Try to change tracing file while tracing is on", - en_S0001, "S0001", "Base table or view already exists", - en_S0002, "S0002", "Base table not found", - en_S0011, "S0011", "Index already exists", - en_S0012, "S0012", "Index not found", - en_S0021, "S0021", "Column already exists", - en_S0022, "S0022", "Column not found", - en_S0023, "S0023", "No default for column", - en_S1000, "S1000", "General error", - en_S1001, "S1001", "Memory allocation failure", - en_S1002, "S1002", "Invalid column number", - en_S1003, "S1003", "Program type out of range", - en_S1004, "S1004", "SQL data type out of range", - en_S1008, "S1008", "Operation canceled", - en_S1009, "S1009", "Invalid argument value", - en_S1010, "S1010", "Function sequence error", - en_S1011, "S1011", "Operation invalid at this time", - en_S1012, "S1012", "Invalid transaction operation code specified", - en_S1015, "S1015", "No cursor name available", - en_S1090, "S1090", "Invalid string or buffer length", - en_S1091, "S1091", "Descriptor type out of range", - en_S1092, "S1092", "Option type out of range", - en_S1093, "S1093", "Invalid parameter", - en_S1094, "S1094", "Invalid scale value", - en_S1095, "S1095", "Function type out of range", - en_S1096, "S1096", "Information type out of range", - en_S1097, "S1097", "Column type out of range", - en_S1098, "S1098", "Scope type out of range", - en_S1099, "S1099", "Nullable type out of range", - en_S1100, "S1100", "Uniquenss option type out of range", - en_S1101, "S1101", "Accuracy option type out of range", - en_S1103, "S1103", "Direction option out of range", - en_S1104, "S1104", "Invalid precision value", - en_S1105, "S1105", "Invalid parameter type", - en_S1106, "S1106", "Fetch type out of range", - en_S1107, "S1107", "Row value out of range", - en_S1108, "S1108", "Concurrency option out of range", - en_S1109, "S1109", "Invalid cursor position", - en_S1110, "S1110", "Invalid driver completion", - en_S1111, "S1111", "Invalid bookmark value", - en_S1C00, "S1C00", "Driver not capable", - en_S1T00, "S1T00", "Timeout expired", - en_sqlstat_total, NULL, NULL + { en_00000, "00000", "" }, + { en_01000, "01000", "General warning" }, + { en_01002, "01002", "Disconnect error" }, + { en_01004, "01004", "Data truncated" }, + { en_01006, "01006", "Privilege not revoked" }, + { en_01S00, "01S00", "Invalid connection string attribute" }, + { en_01S01, "01S01", "Error in row" }, + { en_01S02, "01S02", "Optional value changed" }, + { en_01S03, "01S03", "No rows updated or deleted" }, + { en_01S04, "01S04", "More than one row updated or deleted" }, + { en_07001, "07001", "Wrong number of parameters" }, + { en_07006, "07006", "Restricted data type attribute violation" }, + { en_08001, "08001", "Unable to connect to data source" }, + { en_08002, "08002", "Connection in use" }, + { en_08003, "08003", "Connect not open" }, + { en_08004, "08004", "Data source rejected establishment of connection" }, + { en_08007, "08007", "Connection failure during transaction" }, + { en_08S01, "08S01", "Communication link failure" }, + { en_21S01, "21S01", "Insert value list does not match" }, + { en_21S02, "21S02", "Degree of derived table does not match column list" }, + { en_22001, "22001", "String data right truncation" }, + { en_22003, "22003", "Numeric value out of range" }, + { en_22005, "22005", "Error in assignment" }, + { en_22008, "22008", "Datetime field overflow" }, + { en_22012, "22012", "Division by zero" }, + { en_22026, "22026", "String data, length mismatch" }, + { en_23000, "23000", "Integrity constraint violation" }, + { en_24000, "24000", "Invalid cursor state" }, + { en_25000, "25000", "Invalid transaction state" }, + { en_28000, "28000", "Invalid authorization specification" }, + { en_34000, "34000", "Invalid cursor name" }, + { en_37000, "37000", "Syntex error or access violation" }, + { en_3C000, "3C000", "Duplicate cursor name" }, + { en_40001, "40001", "Serialization failure" }, + { en_42000, "42000", "Syntax error or access violation" }, + { en_70100, "70100", "Operation aborted" }, + { en_IM001, "IM001", "Driver does not support this function" }, + { en_IM002, "IM002", "Data source name not found and no default " + "driver specified. Driver could not be loaded" }, + { en_IM003, "IM003", "Specified driver could not be loaded" }, + { en_IM004, "IM004", "Driver's SQLAllocEnv() failed" }, + { en_IM005, "IM005", "Driver's SQLAllocConnect() failed" }, + { en_IM006, "IM006", "Driver's SQLSetConnectOption failed" }, + { en_IM007, "IM007", "No data source or driver specified, dialog prohibited" }, + { en_IM008, "IM008", "Dialog failed" }, + { en_IM009, "IM009", "Unable to load translation DLL" }, + { en_IM010, "IM010", "Data source name too long" }, + { en_IM011, "IM011", "Driver name too long" }, + { en_IM012, "IM012", "DRIVER keyword syntax error" }, + { en_IM013, "IM013", "Trace file error" }, + { en_IM014, "IM014", "Try to change tracing file while tracing is on" }, + { en_S0001, "S0001", "Base table or view already exists" }, + { en_S0002, "S0002", "Base table not found" }, + { en_S0011, "S0011", "Index already exists" }, + { en_S0012, "S0012", "Index not found" }, + { en_S0021, "S0021", "Column already exists" }, + { en_S0022, "S0022", "Column not found" }, + { en_S0023, "S0023", "No default for column" }, + { en_S1000, "S1000", "General error" }, + { en_S1001, "S1001", "Memory allocation failure" }, + { en_S1002, "S1002", "Invalid column number" }, + { en_S1003, "S1003", "Program type out of range" }, + { en_S1004, "S1004", "SQL data type out of range" }, + { en_S1008, "S1008", "Operation canceled" }, + { en_S1009, "S1009", "Invalid argument value" }, + { en_S1010, "S1010", "Function sequence error" }, + { en_S1011, "S1011", "Operation invalid at this time" }, + { en_S1012, "S1012", "Invalid transaction operation code specified" }, + { en_S1015, "S1015", "No cursor name available" }, + { en_S1090, "S1090", "Invalid string or buffer length" }, + { en_S1091, "S1091", "Descriptor type out of range" }, + { en_S1092, "S1092", "Option type out of range" }, + { en_S1093, "S1093", "Invalid parameter" }, + { en_S1094, "S1094", "Invalid scale value" }, + { en_S1095, "S1095", "Function type out of range" }, + { en_S1096, "S1096", "Information type out of range" }, + { en_S1097, "S1097", "Column type out of range" }, + { en_S1098, "S1098", "Scope type out of range" }, + { en_S1099, "S1099", "Nullable type out of range" }, + { en_S1100, "S1100", "Uniquenss option type out of range" }, + { en_S1101, "S1101", "Accuracy option type out of range" }, + { en_S1103, "S1103", "Direction option out of range" }, + { en_S1104, "S1104", "Invalid precision value" }, + { en_S1105, "S1105", "Invalid parameter type" }, + { en_S1106, "S1106", "Fetch type out of range" }, + { en_S1107, "S1107", "Row value out of range" }, + { en_S1108, "S1108", "Concurrency option out of range" }, + { en_S1109, "S1109", "Invalid cursor position" }, + { en_S1110, "S1110", "Invalid driver completion" }, + { en_S1111, "S1111", "Invalid bookmark value" }, + { en_S1C00, "S1C00", "Driver not capable" }, + { en_S1T00, "S1T00", "Timeout expired" }, + { en_sqlstat_total, NULL, NULL } }; static char FAR* sqlerrhd = "[iODBC][Driver Manager]"; diff --git a/utils/dialoged/Makefile b/utils/dialoged/Makefile deleted file mode 100644 index 3f7a4dce0d..0000000000 --- a/utils/dialoged/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../setup/general/makedirs diff --git a/utils/dialoged/src/.cvsignore b/utils/dialoged/src/.cvsignore index 4646a42c35..7437ad4782 100644 --- a/utils/dialoged/src/.cvsignore +++ b/utils/dialoged/src/.cvsignore @@ -1,3 +1,7 @@ Linux linux-gnu linux +Test.h +Test.wxr +dialog.h +dialog.wxr \ No newline at end of file diff --git a/utils/dialoged/src/Makefile b/utils/dialoged/src/Makefile index 35ce1069fd..05ad82cc43 100644 --- a/utils/dialoged/src/Makefile +++ b/utils/dialoged/src/Makefile @@ -1 +1,38 @@ -include ../../../setup/general/makedirs + +CC = g++ + +DialogEd: dialoged.o dlghndlr.o edlist.o edtree.o reseditr.o reswrite.o \ + symbtabl.o winprop.o winstyle.o + $(CC) -o DialogEd \ + dialoged.o dlghndlr.o edlist.o edtree.o reseditr.o reswrite.o \ + symbtabl.o winprop.o winstyle.o `wx-config --libs` + +dialoged.o: dialoged.cpp + $(CC) `wx-config --cflags` -c dialoged.cpp + +dlghndlr.o: dlghndlr.cpp + $(CC) `wx-config --cflags` -c dlghndlr.cpp + +edlist.o: edlist.cpp + $(CC) `wx-config --cflags` -c edlist.cpp + +edtree.o: edtree.cpp + $(CC) `wx-config --cflags` -c edtree.cpp + +reseditr.o: reseditr.cpp + $(CC) `wx-config --cflags` -c reseditr.cpp + +reswrite.o: reswrite.cpp + $(CC) `wx-config --cflags` -c reswrite.cpp + +symbtabl.o: symbtabl.cpp + $(CC) `wx-config --cflags` -c symbtabl.cpp + +winprop.o: winprop.cpp + $(CC) `wx-config --cflags` -c winprop.cpp + +winstyle.o: winstyle.cpp + $(CC) `wx-config --cflags` -c winstyle.cpp + +clean: + rm -f *.o DialogEd diff --git a/utils/dialoged/src/Makefile.in b/utils/dialoged/src/Makefile.in deleted file mode 100644 index 02414a2cb4..0000000000 --- a/utils/dialoged/src/Makefile.in +++ /dev/null @@ -1,26 +0,0 @@ -# WXXT base directory -WXBASEDIR=@WXBASEDIR@ - -# set the OS type for compilation -OS=@OS@ -# compile a library only -RULE=bin - -# define library name -BIN_TARGET=dialoged -# define library sources -BIN_SRC=dialoged.cpp dlghndlr.cpp edlist.cpp edtree.cpp \ - reseditr.cpp reswrite.cpp symbtabl.cpp winprop.cpp winstyle.cpp - -#define library objects -BIN_OBJ=dialoged.o dlghndlr.o edlist.o edtree.o \ - reseditr.o reswrite.o symbtabl.o winprop.o winstyle.o - -# additional things needed to link -BIN_LINK= - -# additional things needed to compile -ADD_COMPILE= - -# include the definitions now -include ../../../../template.mak diff --git a/utils/glcanvas/src/Makefile.in b/utils/glcanvas/src/Makefile.in index 2bed8a867e..79d15e4503 100644 --- a/utils/glcanvas/src/Makefile.in +++ b/utils/glcanvas/src/Makefile.in @@ -1,5 +1,5 @@ # -# wGLCanvas source makefile for Unix +# wxGLCanvas source makefile for Unix # # Copyright 1998, Robert Roebling # @@ -18,8 +18,8 @@ NONE= # define library name LIB_TARGET=wx_opengl_gtk -LIB_MAJOR=0 -LIB_MINOR=1 +LIB_MAJOR=1 +LIB_MINOR=0 # define library sources diff --git a/utils/glcanvas/src/glcanvas.cpp b/utils/glcanvas/src/glcanvas.cpp index 44f28e7e0b..a668badcab 100644 --- a/utils/glcanvas/src/glcanvas.cpp +++ b/utils/glcanvas/src/glcanvas.cpp @@ -13,12 +13,24 @@ #pragma implementation "glcanvas.h" #endif -#include "wx/wxprec.h" +#include "glcanvas.h" #include "wx/frame.h" #include "wx/colour.h" -#include "glcanvas.h" -#include +#include "wx/module.h" +#include "wx/app.h" + +#include "gtk/gtk.h" +#include "gdk/gdk.h" +extern "C" { +#include "gdk/gdkx.h" +} + +//--------------------------------------------------------------------------- +// global variables +//--------------------------------------------------------------------------- + +XVisualInfo *g_visual_info = (XVisualInfo*) NULL; //--------------------------------------------------------------------------- // wxGLContext @@ -28,66 +40,57 @@ IMPLEMENT_CLASS(wxGLContext,wxObject) wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette) ) { - m_window = win; - m_widget = win->m_wxwindow; + m_window = win; + m_widget = win->m_wxwindow; - int data[] = {GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1, - GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None}; - - Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); - XVisualInfo *visual_info = glXChooseVisual( display, DefaultScreen(display), data ); + wxCHECK_RET( g_visual_info != NULL, "invalid visual for OpenGl" ); + + m_glContext = glXCreateContext( GDK_DISPLAY(), g_visual_info, None, GL_TRUE ); - wxCHECK_RET( visual_info != NULL, "Couldn't choose visual for OpenGl" ); + wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" ); - m_glContext = glXCreateContext( display, visual_info, None, GL_TRUE ); - - wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" ); - - glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); + glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); } wxGLContext::~wxGLContext() { - if (m_glContext) - { - Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); - glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); + if (m_glContext) + { + glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); - glXDestroyContext( display, m_glContext ); - } + glXDestroyContext( GDK_DISPLAY(), m_glContext ); + } } void wxGLContext::SwapBuffers() { - if (m_glContext) - { - Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); - glXSwapBuffers( display, GDK_WINDOW_XWINDOW( m_widget->window ) ); - } + if (m_glContext) + { + glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( m_widget->window ) ); + } } void wxGLContext::SetCurrent() { - if (m_glContext) - { - Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); - glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); - } + if (m_glContext) + { + glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); + } } void wxGLContext::SetColour(const char *colour) { - float r = 0.0; - float g = 0.0; - float b = 0.0; - wxColour *col = wxTheColourDatabase->FindColour(colour); - if (col) - { - r = (float)(col->Red()/256.0); - g = (float)(col->Green()/256.0); - b = (float)(col->Blue()/256.0); - glColor3f( r, g, b); - } + float r = 0.0; + float g = 0.0; + float b = 0.0; + wxColour *col = wxTheColourDatabase->FindColour(colour); + if (col) + { + r = (float)(col->Red()/256.0); + g = (float)(col->Green()/256.0); + b = (float)(col->Blue()/256.0); + glColor3f( r, g, b); + } } void wxGLContext::SetupPixelFormat() @@ -100,7 +103,7 @@ void wxGLContext::SetupPalette( const wxPalette& WXUNUSED(palette) ) wxPalette wxGLContext::CreateDefaultPalette() { - return wxNullPalette; + return wxNullPalette; } //--------------------------------------------------------------------------- @@ -118,44 +121,79 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, int *WXUNUSED(attribList), const wxPalette& palette): wxScrolledWindow(parent, id, pos, size, style, name) { - m_glContext = new wxGLContext( TRUE, this, palette ); + m_glContext = new wxGLContext( TRUE, this, palette ); } wxGLCanvas::~wxGLCanvas() { - if (m_glContext) delete m_glContext; + if (m_glContext) delete m_glContext; } void wxGLCanvas::SwapBuffers() { - if (m_glContext) m_glContext->SwapBuffers(); + if (m_glContext) m_glContext->SwapBuffers(); } void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) { - int width, height; - GetClientSize(& width, & height); + int width, height; + GetClientSize(& width, & height); - if (m_glContext) - { - m_glContext->SetCurrent(); + if (m_glContext) + { + m_glContext->SetCurrent(); - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); - glMatrixMode(GL_MODELVIEW); - } + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); + glMatrixMode(GL_MODELVIEW); + } } void wxGLCanvas::SetCurrent() { - if (m_glContext) m_glContext->SetCurrent(); + if (m_glContext) m_glContext->SetCurrent(); } void wxGLCanvas::SetColour( const char *colour ) { - if (m_glContext) m_glContext->SetColour( colour ); + if (m_glContext) m_glContext->SetColour( colour ); } +//-------------------------------------------------------------------- +// wxGLModule +//-------------------------------------------------------------------- + +class wxGLModule : public wxModule +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + +private: + DECLARE_DYNAMIC_CLASS(wxGLModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxGLModule, wxModule) + +bool wxGLModule::OnInit() +{ + int data[] = { GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1, + GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None}; + + g_visual_info = glXChooseVisual( GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()), data ); + + wxCHECK_MSG( g_visual_info != NULL, FALSE, "Couldn't choose visual for OpenGl" ); + + wxVisualSetByExternal = gdkx_visual_get(g_visual_info->visualid); + + wxColormapSetByExternal = gdk_colormap_new( gdkx_visual_get(g_visual_info->visualid), TRUE ); + + return TRUE; +} + +void wxGLModule::OnExit() +{ +} diff --git a/wxGTK.spec b/wxGTK.spec index 365e634378..b93582a23e 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -4,17 +4,17 @@ Version: 2b1 Release: 1 Copyright: LGPL Group: X11/Libraries -Source: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK2b1.tgz +Source0: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK2b1.tgz URL: http://www.freiburg.linux.de/~wxxt/docs.html Packager: Michael Kiefte Requires: gtk+ >= 1.0.4 %description -wxWindows is a free C++ library for cross-platform GUI development. With wxWindows, you can create applications for different GUIs from the same source code. +wxWindows is a free C++ library for cross-platform GUI development. With wxWindows, you can create applications for different GUIs from the same source code. This package also contains a dialog editor. %prep %setup -n wxGTK -./configure --with-threads +./configure --prefix=/usr --with-threads %build make src @@ -30,5 +30,10 @@ make install %files %doc COPYING.LIB INSTALL.txt LICENCE.txt README.txt SYMBOLS.txt TODO.txt -/usr/local/include -/usr/local/lib +/usr/include/wx +/usr/lib/wx +/usr/lib/libwx_gtk_1_0.a +/usr/lib/libwx_gtk_1_0.so +/usr/lib/libwx_gtk_1_0.so.1 +/usr/lib/libwx_gtk_1_0.so.1.99 +/usr/bin/wx-config