From 3069ac4e452f98644f9cdcae52a36ed9b9a93a31 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 10 Dec 1998 14:34:14 +0000 Subject: [PATCH] Removed a few old wxDebugMsg (now wxLogDebug) block first event from wxCeckBox after SetValue() also git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/checkbox.h | 1 + include/wx/gtk1/checkbox.h | 1 + samples/controls/controls.cpp | 15 +++++++++++++-- src/common/zstream.cpp | 7 ++++--- src/gtk/checkbox.cpp | 11 +++++++++++ src/gtk/dcps.cpp | 23 ++++++++++++----------- src/gtk/threadno.cpp | 3 ++- src/gtk/threadpsx.cpp | 4 ++-- src/gtk/threadsgi.cpp | 4 ++-- src/gtk/utilsgtk.cpp | 14 +++++++------- src/gtk/window.cpp | 24 +++++++++++------------- src/gtk1/checkbox.cpp | 11 +++++++++++ src/gtk1/dcps.cpp | 23 ++++++++++++----------- src/gtk1/threadno.cpp | 3 ++- src/gtk1/threadpsx.cpp | 4 ++-- src/gtk1/threadsgi.cpp | 4 ++-- src/gtk1/utilsgtk.cpp | 14 +++++++------- src/gtk1/window.cpp | 24 +++++++++++------------- 18 files changed, 113 insertions(+), 77 deletions(-) diff --git a/include/wx/gtk/checkbox.h b/include/wx/gtk/checkbox.h index c410c2d728..f883cf78c9 100644 --- a/include/wx/gtk/checkbox.h +++ b/include/wx/gtk/checkbox.h @@ -66,6 +66,7 @@ class wxCheckBox: public wxControl void ApplyWidgetStyle(); + bool m_blockFirstEvent; }; #endif // __GTKCHECKBOXH__ diff --git a/include/wx/gtk1/checkbox.h b/include/wx/gtk1/checkbox.h index c410c2d728..f883cf78c9 100644 --- a/include/wx/gtk1/checkbox.h +++ b/include/wx/gtk1/checkbox.h @@ -66,6 +66,7 @@ class wxCheckBox: public wxControl void ApplyWidgetStyle(); + bool m_blockFirstEvent; }; #endif // __GTKCHECKBOXH__ diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 84c39dc99d..2172c7d265 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -351,9 +351,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : (*m_multitext) << " More text."; // m_multitext->SetBackgroundColour("wheat"); (void)new wxStaticBox( panel, -1, "wxClipboard", wxPoint(345,50), wxSize(160,145) ); - (void)new wxButton( panel, ID_COPY_TEXT, "Copy text", wxPoint(370,70), wxSize(110,30) ); + (void)new wxButton( panel, ID_COPY_TEXT, "Copy line 1", wxPoint(370,70), wxSize(110,30) ); (void)new wxButton( panel, ID_PASTE_TEXT, "Paste text", wxPoint(370,110), wxSize(110,30) ); - (void)new wxButton( panel, ID_CUT_TEXT, "Cut text", wxPoint(370,150), wxSize(110,30) ); + (void)new wxButton( panel, ID_CUT_TEXT, "Cut line 1", wxPoint(370,150), wxSize(110,30) ); m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text); wxString choices2[] = @@ -428,6 +428,17 @@ void MyPanel::OnPasteFromClipboard( wxCommandEvent &WXUNUSED(event) ) void MyPanel::OnCopyToClipboard( wxCommandEvent &WXUNUSED(event) ) { +#ifdef __WXGTK__ + + wxString text( m_multitext->GetLineText(0) ); + + if (text.IsEmpty()) return; + + wxTextDataObject *data = new wxTextDataObject( text ); + + wxTheClipboard->SetData( data ); + +#endif } void MyPanel::OnCutToClipboard( wxCommandEvent &WXUNUSED(event) ) diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index a0daeb4da9..110199eda6 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -18,6 +18,7 @@ #include #include #include +#include "wx/log.h" #include "../zlib/zlib.h" // don't change this, Robert #ifdef __BORLANDC__ @@ -127,9 +128,9 @@ wxZlibOutputStream::~wxZlibOutputStream() Sync(); err = deflate(m_deflate, Z_FINISH); - if (err != Z_STREAM_END) { - wxDebugMsg(_("wxZlibOutputStream: an error occured while we was closing " - "the stream.\n")); + if (err != Z_STREAM_END) + { + wxLogDebug( "wxZlibOutputStream: an error occured while closing the stream.\n" ); return; } diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index c125d9d2df..36753bd61b 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -27,6 +27,13 @@ extern bool g_blockEventsOnDrag; static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) { if (!cb->HasVMT()) return; + + if (cb->m_blockFirstEvent) + { + cb->m_blockFirstEvent = FALSE; + return; + } + if (g_blockEventsOnDrag) return; wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); @@ -57,6 +64,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label m_widget = gtk_check_button_new_with_label( m_label ); + m_blockFirstEvent = FALSE; + wxSize newSize = size; if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label ); if (newSize.y == -1) newSize.y = 26; @@ -91,6 +100,8 @@ void wxCheckBox::SetValue( bool state ) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE ); else gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); + + m_blockFirstEvent = TRUE; } bool wxCheckBox::GetValue() const diff --git a/src/gtk/dcps.cpp b/src/gtk/dcps.cpp index bb7800ea0d..6812fe95b4 100644 --- a/src/gtk/dcps.cpp +++ b/src/gtk/dcps.cpp @@ -22,6 +22,7 @@ #include "wx/app.h" #include "wx/msgdlg.h" #include "wx/image.h" +#include "wx/log.h" //----------------------------------------------------------------------------- // start and end of document/page @@ -1499,8 +1500,8 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, strcat(afmName,".afm"); FILE *afmFile = fopen(afmName,"r"); if(afmFile==NULL){ - wxDebugMsg("GetTextExtent: can't open AFM file '%s'\n",afmName); - wxDebugMsg(" using approximate values\n"); + wxLogDebug("GetTextExtent: can't open AFM file '%s'\n",afmName); + wxLogDebug(" using approximate values\n"); int i; for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value lastDescender = -150; // dito. @@ -1519,7 +1520,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, if(strncmp(line,"Descender",9)==0){ if((sscanf(line,"%s%d",descString,&lastDescender)!=2) || (strcmp(descString,"Descender")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad descender)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad descender)\n", afmName,line); } } @@ -1527,7 +1528,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"UnderlinePosition",17)==0){ if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) || (strcmp(upString,"UnderlinePosition")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad UnderlinePosition)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad UnderlinePosition)\n", afmName,line); } } @@ -1535,7 +1536,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"UnderlineThickness",18)==0){ if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) || (strcmp(utString,"UnderlineThickness")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad UnderlineThickness)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad UnderlineThickness)\n", afmName,line); } } @@ -1543,12 +1544,12 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"EncodingScheme",14)==0){ if((sscanf(line,"%s%s",utString,encString)!=2) || (strcmp(utString,"EncodingScheme")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad EncodingScheme)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad EncodingScheme)\n", afmName,line); } else if (strncmp(encString, "AdobeStandardEncoding", 21)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)\n", afmName,line, encString); } } @@ -1556,18 +1557,18 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"C ",2)==0){ if(sscanf(line,"%s%d%s%s%d", cString,&ascii,semiString,WXString,&cWidth)!=5){ - wxDebugMsg("AFM-file '%s': line '%s' has an error (bad character width)\n",afmName,line); + wxLogDebug("AFM-file '%s': line '%s' has an error (bad character width)\n",afmName,line); } if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0){ - wxDebugMsg("AFM-file '%s': line '%s' has a format error\n",afmName,line); + wxLogDebug("AFM-file '%s': line '%s' has a format error\n",afmName,line); } //printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); if(ascii>=0 && ascii<256){ lastWidths[ascii] = cWidth; // store width }else{ /* MATTHEW: this happens a lot; don't print an error */ - // wxDebugMsg("AFM-file '%s': ASCII value %d out of range\n",afmName,ascii); + // wxLogDebug("AFM-file '%s': ASCII value %d out of range\n",afmName,ascii); } } // C.) ignore other entries. @@ -1600,7 +1601,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, unsigned char *p; for(p=(unsigned char *)(const char *)string; *p; p++){ if(lastWidths[*p]== INT_MIN){ - wxDebugMsg("GetTextExtent: undefined width for character '%c' (%d)\n", + wxLogDebug("GetTextExtent: undefined width for character '%c' (%d)\n", *p,*p); widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space }else{ diff --git a/src/gtk/threadno.cpp b/src/gtk/threadno.cpp index 375d2ac6a7..ee844fbf0f 100644 --- a/src/gtk/threadno.cpp +++ b/src/gtk/threadno.cpp @@ -15,6 +15,7 @@ #include "wx/wx.h" #include "wx/module.h" #include "wx/thread.h" +#include "wx/log.h" wxMutex::wxMutex() { @@ -24,7 +25,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked) - wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked); + wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked ); } wxMutexError wxMutex::Lock() diff --git a/src/gtk/threadpsx.cpp b/src/gtk/threadpsx.cpp index 4219e404be..2fb5106aa7 100644 --- a/src/gtk/threadpsx.cpp +++ b/src/gtk/threadpsx.cpp @@ -19,6 +19,7 @@ #include "wx/thread.h" #include "wx/module.h" #include "wx/utils.h" +#include "wx/log.h" enum thread_state { STATE_IDLE = 0, @@ -63,8 +64,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", - m_locked); + wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); pthread_mutex_destroy(&(p_internal->p_mutex)); delete p_internal; diff --git a/src/gtk/threadsgi.cpp b/src/gtk/threadsgi.cpp index 66b6b0da7b..556d032152 100644 --- a/src/gtk/threadsgi.cpp +++ b/src/gtk/threadsgi.cpp @@ -21,6 +21,7 @@ #include "wx/thread.h" #include "wx/module.h" #include "wx/utils.h" +#include "wx/log.h" enum thread_state { STATE_IDLE = 0, @@ -57,8 +58,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", - m_locked); + wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); delete p_internal; } diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index f0808a2301..331b2e9cea 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -212,7 +212,7 @@ void wxDebugMsg( const char *format, ... ) vfprintf( stderr, format, ap ); fflush( stderr ); va_end(ap); -}; +} void wxError( const wxString &msg, const wxString &title ) { @@ -220,7 +220,7 @@ void wxError( const wxString &msg, const wxString &title ) if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); fprintf( stderr, ".\n" ); -}; +} void wxFatalError( const wxString &msg, const wxString &title ) { @@ -229,7 +229,7 @@ void wxFatalError( const wxString &msg, const wxString &title ) if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); fprintf( stderr, ".\n" ); exit(3); // the same exit code as for abort() -}; +} //------------------------------------------------------------------------ // directory routines @@ -241,7 +241,7 @@ bool wxDirExists( const wxString& dir ) strcpy( buf, WXSTRINGCAST(dir) ); struct stat sbuf; return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); -}; +} //------------------------------------------------------------------------ // subprocess routines @@ -280,7 +280,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source, delete proc_data; else proc_data->pid = 0; -}; +} long wxExecute( char **argv, bool sync, wxProcess *process ) { @@ -351,7 +351,7 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) // failed! return pid; } -}; +} long wxExecute( const wxString& command, bool sync, wxProcess *process ) { @@ -373,4 +373,4 @@ long wxExecute( const wxString& command, bool sync, wxProcess *process ) delete [] tmp; return lRc; -}; +} diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 0a7b3f3bc5..9fb88d4e1f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -27,6 +27,7 @@ #include "wx/statusbr.h" #include "wx/intl.h" #include "wx/settings.h" +#include "wx/log.h" #include "gdk/gdkprivate.h" #include "gdk/gdkkeysyms.h" @@ -1155,8 +1156,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - if (m_needParent && (parent == NULL)) - wxFatalError( "Need complete parent.", name ); + wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." ); m_widget = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL; @@ -2873,19 +2873,17 @@ void wxWindow::SetConstraintSizes(bool recurse) wxString winName; if (GetName() == "") - winName = _("unnamed"); + winName = "unnamed"; else winName = GetName(); - wxDebugMsg(_("Constraint(s) not satisfied for window of type %s, name %s:\n"), (const char *)windowClass, (const char *)winName); - if (!constr->left.GetDone()) - wxDebugMsg(_(" unsatisfied 'left' constraint.\n")); - if (!constr->right.GetDone()) - wxDebugMsg(_(" unsatisfied 'right' constraint.\n")); - if (!constr->width.GetDone()) - wxDebugMsg(_(" unsatisfied 'width' constraint.\n")); - if (!constr->height.GetDone()) - wxDebugMsg(_(" unsatisfied 'height' constraint.\n")); - wxDebugMsg(_("Please check constraints: try adding AsIs() constraints.\n")); + wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", + (const char *)windowClass, + (const char *)winName); + if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); + if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); + if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); + if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" ); + wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" ); } if (recurse) diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index c125d9d2df..36753bd61b 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -27,6 +27,13 @@ extern bool g_blockEventsOnDrag; static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) { if (!cb->HasVMT()) return; + + if (cb->m_blockFirstEvent) + { + cb->m_blockFirstEvent = FALSE; + return; + } + if (g_blockEventsOnDrag) return; wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); @@ -57,6 +64,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label m_widget = gtk_check_button_new_with_label( m_label ); + m_blockFirstEvent = FALSE; + wxSize newSize = size; if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label ); if (newSize.y == -1) newSize.y = 26; @@ -91,6 +100,8 @@ void wxCheckBox::SetValue( bool state ) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE ); else gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); + + m_blockFirstEvent = TRUE; } bool wxCheckBox::GetValue() const diff --git a/src/gtk1/dcps.cpp b/src/gtk1/dcps.cpp index bb7800ea0d..6812fe95b4 100644 --- a/src/gtk1/dcps.cpp +++ b/src/gtk1/dcps.cpp @@ -22,6 +22,7 @@ #include "wx/app.h" #include "wx/msgdlg.h" #include "wx/image.h" +#include "wx/log.h" //----------------------------------------------------------------------------- // start and end of document/page @@ -1499,8 +1500,8 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, strcat(afmName,".afm"); FILE *afmFile = fopen(afmName,"r"); if(afmFile==NULL){ - wxDebugMsg("GetTextExtent: can't open AFM file '%s'\n",afmName); - wxDebugMsg(" using approximate values\n"); + wxLogDebug("GetTextExtent: can't open AFM file '%s'\n",afmName); + wxLogDebug(" using approximate values\n"); int i; for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value lastDescender = -150; // dito. @@ -1519,7 +1520,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, if(strncmp(line,"Descender",9)==0){ if((sscanf(line,"%s%d",descString,&lastDescender)!=2) || (strcmp(descString,"Descender")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad descender)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad descender)\n", afmName,line); } } @@ -1527,7 +1528,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"UnderlinePosition",17)==0){ if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) || (strcmp(upString,"UnderlinePosition")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad UnderlinePosition)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad UnderlinePosition)\n", afmName,line); } } @@ -1535,7 +1536,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"UnderlineThickness",18)==0){ if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) || (strcmp(utString,"UnderlineThickness")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad UnderlineThickness)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad UnderlineThickness)\n", afmName,line); } } @@ -1543,12 +1544,12 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"EncodingScheme",14)==0){ if((sscanf(line,"%s%s",utString,encString)!=2) || (strcmp(utString,"EncodingScheme")!=0)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (bad EncodingScheme)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (bad EncodingScheme)\n", afmName,line); } else if (strncmp(encString, "AdobeStandardEncoding", 21)) { - wxDebugMsg("AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)\n", + wxLogDebug("AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)\n", afmName,line, encString); } } @@ -1556,18 +1557,18 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, else if(strncmp(line,"C ",2)==0){ if(sscanf(line,"%s%d%s%s%d", cString,&ascii,semiString,WXString,&cWidth)!=5){ - wxDebugMsg("AFM-file '%s': line '%s' has an error (bad character width)\n",afmName,line); + wxLogDebug("AFM-file '%s': line '%s' has an error (bad character width)\n",afmName,line); } if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0){ - wxDebugMsg("AFM-file '%s': line '%s' has a format error\n",afmName,line); + wxLogDebug("AFM-file '%s': line '%s' has a format error\n",afmName,line); } //printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); if(ascii>=0 && ascii<256){ lastWidths[ascii] = cWidth; // store width }else{ /* MATTHEW: this happens a lot; don't print an error */ - // wxDebugMsg("AFM-file '%s': ASCII value %d out of range\n",afmName,ascii); + // wxLogDebug("AFM-file '%s': ASCII value %d out of range\n",afmName,ascii); } } // C.) ignore other entries. @@ -1600,7 +1601,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, unsigned char *p; for(p=(unsigned char *)(const char *)string; *p; p++){ if(lastWidths[*p]== INT_MIN){ - wxDebugMsg("GetTextExtent: undefined width for character '%c' (%d)\n", + wxLogDebug("GetTextExtent: undefined width for character '%c' (%d)\n", *p,*p); widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space }else{ diff --git a/src/gtk1/threadno.cpp b/src/gtk1/threadno.cpp index 375d2ac6a7..ee844fbf0f 100644 --- a/src/gtk1/threadno.cpp +++ b/src/gtk1/threadno.cpp @@ -15,6 +15,7 @@ #include "wx/wx.h" #include "wx/module.h" #include "wx/thread.h" +#include "wx/log.h" wxMutex::wxMutex() { @@ -24,7 +25,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked) - wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked); + wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked ); } wxMutexError wxMutex::Lock() diff --git a/src/gtk1/threadpsx.cpp b/src/gtk1/threadpsx.cpp index 4219e404be..2fb5106aa7 100644 --- a/src/gtk1/threadpsx.cpp +++ b/src/gtk1/threadpsx.cpp @@ -19,6 +19,7 @@ #include "wx/thread.h" #include "wx/module.h" #include "wx/utils.h" +#include "wx/log.h" enum thread_state { STATE_IDLE = 0, @@ -63,8 +64,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", - m_locked); + wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); pthread_mutex_destroy(&(p_internal->p_mutex)); delete p_internal; diff --git a/src/gtk1/threadsgi.cpp b/src/gtk1/threadsgi.cpp index 66b6b0da7b..556d032152 100644 --- a/src/gtk1/threadsgi.cpp +++ b/src/gtk1/threadsgi.cpp @@ -21,6 +21,7 @@ #include "wx/thread.h" #include "wx/module.h" #include "wx/utils.h" +#include "wx/log.h" enum thread_state { STATE_IDLE = 0, @@ -57,8 +58,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", - m_locked); + wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); delete p_internal; } diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index f0808a2301..331b2e9cea 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -212,7 +212,7 @@ void wxDebugMsg( const char *format, ... ) vfprintf( stderr, format, ap ); fflush( stderr ); va_end(ap); -}; +} void wxError( const wxString &msg, const wxString &title ) { @@ -220,7 +220,7 @@ void wxError( const wxString &msg, const wxString &title ) if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); fprintf( stderr, ".\n" ); -}; +} void wxFatalError( const wxString &msg, const wxString &title ) { @@ -229,7 +229,7 @@ void wxFatalError( const wxString &msg, const wxString &title ) if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); fprintf( stderr, ".\n" ); exit(3); // the same exit code as for abort() -}; +} //------------------------------------------------------------------------ // directory routines @@ -241,7 +241,7 @@ bool wxDirExists( const wxString& dir ) strcpy( buf, WXSTRINGCAST(dir) ); struct stat sbuf; return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); -}; +} //------------------------------------------------------------------------ // subprocess routines @@ -280,7 +280,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source, delete proc_data; else proc_data->pid = 0; -}; +} long wxExecute( char **argv, bool sync, wxProcess *process ) { @@ -351,7 +351,7 @@ long wxExecute( char **argv, bool sync, wxProcess *process ) // failed! return pid; } -}; +} long wxExecute( const wxString& command, bool sync, wxProcess *process ) { @@ -373,4 +373,4 @@ long wxExecute( const wxString& command, bool sync, wxProcess *process ) delete [] tmp; return lRc; -}; +} diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 0a7b3f3bc5..9fb88d4e1f 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -27,6 +27,7 @@ #include "wx/statusbr.h" #include "wx/intl.h" #include "wx/settings.h" +#include "wx/log.h" #include "gdk/gdkprivate.h" #include "gdk/gdkkeysyms.h" @@ -1155,8 +1156,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { - if (m_needParent && (parent == NULL)) - wxFatalError( "Need complete parent.", name ); + wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." ); m_widget = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL; @@ -2873,19 +2873,17 @@ void wxWindow::SetConstraintSizes(bool recurse) wxString winName; if (GetName() == "") - winName = _("unnamed"); + winName = "unnamed"; else winName = GetName(); - wxDebugMsg(_("Constraint(s) not satisfied for window of type %s, name %s:\n"), (const char *)windowClass, (const char *)winName); - if (!constr->left.GetDone()) - wxDebugMsg(_(" unsatisfied 'left' constraint.\n")); - if (!constr->right.GetDone()) - wxDebugMsg(_(" unsatisfied 'right' constraint.\n")); - if (!constr->width.GetDone()) - wxDebugMsg(_(" unsatisfied 'width' constraint.\n")); - if (!constr->height.GetDone()) - wxDebugMsg(_(" unsatisfied 'height' constraint.\n")); - wxDebugMsg(_("Please check constraints: try adding AsIs() constraints.\n")); + wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", + (const char *)windowClass, + (const char *)winName); + if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); + if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); + if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); + if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" ); + wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" ); } if (recurse) -- 2.45.2