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
This commit is contained in:
Robert Roebling
1998-12-10 14:34:14 +00:00
parent 5e5f494a6e
commit 3069ac4e45
18 changed files with 113 additions and 77 deletions

View File

@@ -66,6 +66,7 @@ class wxCheckBox: public wxControl
void ApplyWidgetStyle(); void ApplyWidgetStyle();
bool m_blockFirstEvent;
}; };
#endif // __GTKCHECKBOXH__ #endif // __GTKCHECKBOXH__

View File

@@ -66,6 +66,7 @@ class wxCheckBox: public wxControl
void ApplyWidgetStyle(); void ApplyWidgetStyle();
bool m_blockFirstEvent;
}; };
#endif // __GTKCHECKBOXH__ #endif // __GTKCHECKBOXH__

View File

@@ -351,9 +351,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
(*m_multitext) << " More text."; (*m_multitext) << " More text.";
// m_multitext->SetBackgroundColour("wheat"); // m_multitext->SetBackgroundColour("wheat");
(void)new wxStaticBox( panel, -1, "wxClipboard", wxPoint(345,50), wxSize(160,145) ); (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_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); m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text);
wxString choices2[] = wxString choices2[] =
@@ -428,6 +428,17 @@ void MyPanel::OnPasteFromClipboard( wxCommandEvent &WXUNUSED(event) )
void MyPanel::OnCopyToClipboard( 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) ) void MyPanel::OnCutToClipboard( wxCommandEvent &WXUNUSED(event) )

View File

@@ -18,6 +18,7 @@
#include <wx/zstream.h> #include <wx/zstream.h>
#include <wx/utils.h> #include <wx/utils.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "wx/log.h"
#include "../zlib/zlib.h" // don't change this, Robert #include "../zlib/zlib.h" // don't change this, Robert
#ifdef __BORLANDC__ #ifdef __BORLANDC__
@@ -127,9 +128,9 @@ wxZlibOutputStream::~wxZlibOutputStream()
Sync(); Sync();
err = deflate(m_deflate, Z_FINISH); err = deflate(m_deflate, Z_FINISH);
if (err != Z_STREAM_END) { if (err != Z_STREAM_END)
wxDebugMsg(_("wxZlibOutputStream: an error occured while we was closing " {
"the stream.\n")); wxLogDebug( "wxZlibOutputStream: an error occured while closing the stream.\n" );
return; return;
} }

View File

@@ -27,6 +27,13 @@ extern bool g_blockEventsOnDrag;
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{ {
if (!cb->HasVMT()) return; if (!cb->HasVMT()) return;
if (cb->m_blockFirstEvent)
{
cb->m_blockFirstEvent = FALSE;
return;
}
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); 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_widget = gtk_check_button_new_with_label( m_label );
m_blockFirstEvent = FALSE;
wxSize newSize = size; wxSize newSize = size;
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label ); if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26; 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 ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
m_blockFirstEvent = TRUE;
} }
bool wxCheckBox::GetValue() const bool wxCheckBox::GetValue() const

View File

@@ -22,6 +22,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/log.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// start and end of document/page // start and end of document/page
@@ -1499,8 +1500,8 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
strcat(afmName,".afm"); strcat(afmName,".afm");
FILE *afmFile = fopen(afmName,"r"); FILE *afmFile = fopen(afmName,"r");
if(afmFile==NULL){ if(afmFile==NULL){
wxDebugMsg("GetTextExtent: can't open AFM file '%s'\n",afmName); wxLogDebug("GetTextExtent: can't open AFM file '%s'\n",afmName);
wxDebugMsg(" using approximate values\n"); wxLogDebug(" using approximate values\n");
int i; int i;
for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value
lastDescender = -150; // dito. lastDescender = -150; // dito.
@@ -1519,7 +1520,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
if(strncmp(line,"Descender",9)==0){ if(strncmp(line,"Descender",9)==0){
if((sscanf(line,"%s%d",descString,&lastDescender)!=2) if((sscanf(line,"%s%d",descString,&lastDescender)!=2)
|| (strcmp(descString,"Descender")!=0)) { || (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); afmName,line);
} }
} }
@@ -1527,7 +1528,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"UnderlinePosition",17)==0){ else if(strncmp(line,"UnderlinePosition",17)==0){
if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2)
|| (strcmp(upString,"UnderlinePosition")!=0)) { || (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); afmName,line);
} }
} }
@@ -1535,7 +1536,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"UnderlineThickness",18)==0){ else if(strncmp(line,"UnderlineThickness",18)==0){
if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2)
|| (strcmp(utString,"UnderlineThickness")!=0)) { || (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); afmName,line);
} }
} }
@@ -1543,12 +1544,12 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"EncodingScheme",14)==0){ else if(strncmp(line,"EncodingScheme",14)==0){
if((sscanf(line,"%s%s",utString,encString)!=2) if((sscanf(line,"%s%s",utString,encString)!=2)
|| (strcmp(utString,"EncodingScheme")!=0)) { || (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); afmName,line);
} }
else if (strncmp(encString, "AdobeStandardEncoding", 21)) 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); afmName,line, encString);
} }
} }
@@ -1556,18 +1557,18 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"C ",2)==0){ else if(strncmp(line,"C ",2)==0){
if(sscanf(line,"%s%d%s%s%d", if(sscanf(line,"%s%d%s%s%d",
cString,&ascii,semiString,WXString,&cWidth)!=5){ 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 || if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 ||
strcmp(WXString,"WX")!=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); //printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth);
if(ascii>=0 && ascii<256){ if(ascii>=0 && ascii<256){
lastWidths[ascii] = cWidth; // store width lastWidths[ascii] = cWidth; // store width
}else{ }else{
/* MATTHEW: this happens a lot; don't print an error */ /* 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. // C.) ignore other entries.
@@ -1600,7 +1601,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
unsigned char *p; unsigned char *p;
for(p=(unsigned char *)(const char *)string; *p; p++){ for(p=(unsigned char *)(const char *)string; *p; p++){
if(lastWidths[*p]== INT_MIN){ 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); *p,*p);
widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space
}else{ }else{

View File

@@ -15,6 +15,7 @@
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/log.h"
wxMutex::wxMutex() wxMutex::wxMutex()
{ {
@@ -24,7 +25,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked) 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() wxMutexError wxMutex::Lock()

View File

@@ -19,6 +19,7 @@
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h"
enum thread_state { enum thread_state {
STATE_IDLE = 0, STATE_IDLE = 0,
@@ -63,8 +64,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked > 0) if (m_locked > 0)
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
m_locked);
pthread_mutex_destroy(&(p_internal->p_mutex)); pthread_mutex_destroy(&(p_internal->p_mutex));
delete p_internal; delete p_internal;

View File

@@ -21,6 +21,7 @@
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h"
enum thread_state { enum thread_state {
STATE_IDLE = 0, STATE_IDLE = 0,
@@ -57,8 +58,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked > 0) if (m_locked > 0)
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
m_locked);
delete p_internal; delete p_internal;
} }

View File

@@ -212,7 +212,7 @@ void wxDebugMsg( const char *format, ... )
vfprintf( stderr, format, ap ); vfprintf( stderr, format, ap );
fflush( stderr ); fflush( stderr );
va_end(ap); va_end(ap);
}; }
void wxError( const wxString &msg, const wxString &title ) 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 (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" ); fprintf( stderr, ".\n" );
}; }
void wxFatalError( const wxString &msg, const wxString &title ) 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) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" ); fprintf( stderr, ".\n" );
exit(3); // the same exit code as for abort() exit(3); // the same exit code as for abort()
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// directory routines // directory routines
@@ -241,7 +241,7 @@ bool wxDirExists( const wxString& dir )
strcpy( buf, WXSTRINGCAST(dir) ); strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf; struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// subprocess routines // subprocess routines
@@ -280,7 +280,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
delete proc_data; delete proc_data;
else else
proc_data->pid = 0; proc_data->pid = 0;
}; }
long wxExecute( char **argv, bool sync, wxProcess *process ) long wxExecute( char **argv, bool sync, wxProcess *process )
{ {
@@ -351,7 +351,7 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
// failed! // failed!
return pid; return pid;
} }
}; }
long wxExecute( const wxString& command, bool sync, wxProcess *process ) long wxExecute( const wxString& command, bool sync, wxProcess *process )
{ {
@@ -373,4 +373,4 @@ long wxExecute( const wxString& command, bool sync, wxProcess *process )
delete [] tmp; delete [] tmp;
return lRc; return lRc;
}; }

View File

@@ -27,6 +27,7 @@
#include "wx/statusbr.h" #include "wx/statusbr.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/log.h"
#include "gdk/gdkprivate.h" #include "gdk/gdkprivate.h"
#include "gdk/gdkkeysyms.h" #include "gdk/gdkkeysyms.h"
@@ -1155,8 +1156,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
if (m_needParent && (parent == NULL)) wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." );
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
@@ -2873,19 +2873,17 @@ void wxWindow::SetConstraintSizes(bool recurse)
wxString winName; wxString winName;
if (GetName() == "") if (GetName() == "")
winName = _("unnamed"); winName = "unnamed";
else else
winName = GetName(); winName = GetName();
wxDebugMsg(_("Constraint(s) not satisfied for window of type %s, name %s:\n"), (const char *)windowClass, (const char *)winName); wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n",
if (!constr->left.GetDone()) (const char *)windowClass,
wxDebugMsg(_(" unsatisfied 'left' constraint.\n")); (const char *)winName);
if (!constr->right.GetDone()) if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" );
wxDebugMsg(_(" unsatisfied 'right' constraint.\n")); if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" );
if (!constr->width.GetDone()) if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" );
wxDebugMsg(_(" unsatisfied 'width' constraint.\n")); if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" );
if (!constr->height.GetDone()) wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" );
wxDebugMsg(_(" unsatisfied 'height' constraint.\n"));
wxDebugMsg(_("Please check constraints: try adding AsIs() constraints.\n"));
} }
if (recurse) if (recurse)

View File

@@ -27,6 +27,13 @@ extern bool g_blockEventsOnDrag;
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{ {
if (!cb->HasVMT()) return; if (!cb->HasVMT()) return;
if (cb->m_blockFirstEvent)
{
cb->m_blockFirstEvent = FALSE;
return;
}
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); 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_widget = gtk_check_button_new_with_label( m_label );
m_blockFirstEvent = FALSE;
wxSize newSize = size; wxSize newSize = size;
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label ); if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26; 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 ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
m_blockFirstEvent = TRUE;
} }
bool wxCheckBox::GetValue() const bool wxCheckBox::GetValue() const

View File

@@ -22,6 +22,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/log.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// start and end of document/page // start and end of document/page
@@ -1499,8 +1500,8 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
strcat(afmName,".afm"); strcat(afmName,".afm");
FILE *afmFile = fopen(afmName,"r"); FILE *afmFile = fopen(afmName,"r");
if(afmFile==NULL){ if(afmFile==NULL){
wxDebugMsg("GetTextExtent: can't open AFM file '%s'\n",afmName); wxLogDebug("GetTextExtent: can't open AFM file '%s'\n",afmName);
wxDebugMsg(" using approximate values\n"); wxLogDebug(" using approximate values\n");
int i; int i;
for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value for (i=0; i<256; i++) lastWidths[i] = 500; // an approximate value
lastDescender = -150; // dito. lastDescender = -150; // dito.
@@ -1519,7 +1520,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
if(strncmp(line,"Descender",9)==0){ if(strncmp(line,"Descender",9)==0){
if((sscanf(line,"%s%d",descString,&lastDescender)!=2) if((sscanf(line,"%s%d",descString,&lastDescender)!=2)
|| (strcmp(descString,"Descender")!=0)) { || (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); afmName,line);
} }
} }
@@ -1527,7 +1528,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"UnderlinePosition",17)==0){ else if(strncmp(line,"UnderlinePosition",17)==0){
if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) if((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2)
|| (strcmp(upString,"UnderlinePosition")!=0)) { || (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); afmName,line);
} }
} }
@@ -1535,7 +1536,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"UnderlineThickness",18)==0){ else if(strncmp(line,"UnderlineThickness",18)==0){
if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) if((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2)
|| (strcmp(utString,"UnderlineThickness")!=0)) { || (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); afmName,line);
} }
} }
@@ -1543,12 +1544,12 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"EncodingScheme",14)==0){ else if(strncmp(line,"EncodingScheme",14)==0){
if((sscanf(line,"%s%s",utString,encString)!=2) if((sscanf(line,"%s%s",utString,encString)!=2)
|| (strcmp(utString,"EncodingScheme")!=0)) { || (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); afmName,line);
} }
else if (strncmp(encString, "AdobeStandardEncoding", 21)) 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); afmName,line, encString);
} }
} }
@@ -1556,18 +1557,18 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
else if(strncmp(line,"C ",2)==0){ else if(strncmp(line,"C ",2)==0){
if(sscanf(line,"%s%d%s%s%d", if(sscanf(line,"%s%d%s%s%d",
cString,&ascii,semiString,WXString,&cWidth)!=5){ 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 || if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 ||
strcmp(WXString,"WX")!=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); //printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth);
if(ascii>=0 && ascii<256){ if(ascii>=0 && ascii<256){
lastWidths[ascii] = cWidth; // store width lastWidths[ascii] = cWidth; // store width
}else{ }else{
/* MATTHEW: this happens a lot; don't print an error */ /* 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. // C.) ignore other entries.
@@ -1600,7 +1601,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
unsigned char *p; unsigned char *p;
for(p=(unsigned char *)(const char *)string; *p; p++){ for(p=(unsigned char *)(const char *)string; *p; p++){
if(lastWidths[*p]== INT_MIN){ 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); *p,*p);
widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space widthSum += (long)(lastWidths[' ']/1000.0F * Size); // assume space
}else{ }else{

View File

@@ -15,6 +15,7 @@
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/log.h"
wxMutex::wxMutex() wxMutex::wxMutex()
{ {
@@ -24,7 +25,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked) 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() wxMutexError wxMutex::Lock()

View File

@@ -19,6 +19,7 @@
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h"
enum thread_state { enum thread_state {
STATE_IDLE = 0, STATE_IDLE = 0,
@@ -63,8 +64,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked > 0) if (m_locked > 0)
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
m_locked);
pthread_mutex_destroy(&(p_internal->p_mutex)); pthread_mutex_destroy(&(p_internal->p_mutex));
delete p_internal; delete p_internal;

View File

@@ -21,6 +21,7 @@
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h"
enum thread_state { enum thread_state {
STATE_IDLE = 0, STATE_IDLE = 0,
@@ -57,8 +58,7 @@ wxMutex::wxMutex()
wxMutex::~wxMutex() wxMutex::~wxMutex()
{ {
if (m_locked > 0) if (m_locked > 0)
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
m_locked);
delete p_internal; delete p_internal;
} }

View File

@@ -212,7 +212,7 @@ void wxDebugMsg( const char *format, ... )
vfprintf( stderr, format, ap ); vfprintf( stderr, format, ap );
fflush( stderr ); fflush( stderr );
va_end(ap); va_end(ap);
}; }
void wxError( const wxString &msg, const wxString &title ) 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 (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" ); fprintf( stderr, ".\n" );
}; }
void wxFatalError( const wxString &msg, const wxString &title ) 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) ); if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" ); fprintf( stderr, ".\n" );
exit(3); // the same exit code as for abort() exit(3); // the same exit code as for abort()
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// directory routines // directory routines
@@ -241,7 +241,7 @@ bool wxDirExists( const wxString& dir )
strcpy( buf, WXSTRINGCAST(dir) ); strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf; struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// subprocess routines // subprocess routines
@@ -280,7 +280,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
delete proc_data; delete proc_data;
else else
proc_data->pid = 0; proc_data->pid = 0;
}; }
long wxExecute( char **argv, bool sync, wxProcess *process ) long wxExecute( char **argv, bool sync, wxProcess *process )
{ {
@@ -351,7 +351,7 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
// failed! // failed!
return pid; return pid;
} }
}; }
long wxExecute( const wxString& command, bool sync, wxProcess *process ) long wxExecute( const wxString& command, bool sync, wxProcess *process )
{ {
@@ -373,4 +373,4 @@ long wxExecute( const wxString& command, bool sync, wxProcess *process )
delete [] tmp; delete [] tmp;
return lRc; return lRc;
}; }

View File

@@ -27,6 +27,7 @@
#include "wx/statusbr.h" #include "wx/statusbr.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/log.h"
#include "gdk/gdkprivate.h" #include "gdk/gdkprivate.h"
#include "gdk/gdkkeysyms.h" #include "gdk/gdkkeysyms.h"
@@ -1155,8 +1156,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
if (m_needParent && (parent == NULL)) wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." );
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
@@ -2873,19 +2873,17 @@ void wxWindow::SetConstraintSizes(bool recurse)
wxString winName; wxString winName;
if (GetName() == "") if (GetName() == "")
winName = _("unnamed"); winName = "unnamed";
else else
winName = GetName(); winName = GetName();
wxDebugMsg(_("Constraint(s) not satisfied for window of type %s, name %s:\n"), (const char *)windowClass, (const char *)winName); wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n",
if (!constr->left.GetDone()) (const char *)windowClass,
wxDebugMsg(_(" unsatisfied 'left' constraint.\n")); (const char *)winName);
if (!constr->right.GetDone()) if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" );
wxDebugMsg(_(" unsatisfied 'right' constraint.\n")); if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" );
if (!constr->width.GetDone()) if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" );
wxDebugMsg(_(" unsatisfied 'width' constraint.\n")); if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" );
if (!constr->height.GetDone()) wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" );
wxDebugMsg(_(" unsatisfied 'height' constraint.\n"));
wxDebugMsg(_("Please check constraints: try adding AsIs() constraints.\n"));
} }
if (recurse) if (recurse)