void ApplyWidgetStyle();
+ bool m_blockFirstEvent;
};
#endif // __GTKCHECKBOXH__
void ApplyWidgetStyle();
+ bool m_blockFirstEvent;
};
#endif // __GTKCHECKBOXH__
(*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[] =
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) )
#include <wx/zstream.h>
#include <wx/utils.h>
#include <wx/intl.h>
+#include "wx/log.h"
#include "../zlib/zlib.h" // don't change this, Robert
#ifdef __BORLANDC__
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;
}
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());
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;
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
#include "wx/app.h"
#include "wx/msgdlg.h"
#include "wx/image.h"
+#include "wx/log.h"
//-----------------------------------------------------------------------------
// start and end of document/page
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.
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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.
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{
#include "wx/wx.h"
#include "wx/module.h"
#include "wx/thread.h"
+#include "wx/log.h"
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()
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
+#include "wx/log.h"
enum thread_state {
STATE_IDLE = 0,
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;
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
+#include "wx/log.h"
enum thread_state {
STATE_IDLE = 0,
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;
}
vfprintf( stderr, format, ap );
fflush( stderr );
va_end(ap);
-};
+}
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 )
{
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
exit(3); // the same exit code as for abort()
-};
+}
//------------------------------------------------------------------------
// directory routines
strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
-};
+}
//------------------------------------------------------------------------
// subprocess routines
delete proc_data;
else
proc_data->pid = 0;
-};
+}
long wxExecute( char **argv, bool sync, wxProcess *process )
{
// failed!
return pid;
}
-};
+}
long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
delete [] tmp;
return lRc;
-};
+}
#include "wx/statusbr.h"
#include "wx/intl.h"
#include "wx/settings.h"
+#include "wx/log.h"
#include "gdk/gdkprivate.h"
#include "gdk/gdkkeysyms.h"
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;
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)
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());
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;
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
#include "wx/app.h"
#include "wx/msgdlg.h"
#include "wx/image.h"
+#include "wx/log.h"
//-----------------------------------------------------------------------------
// start and end of document/page
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.
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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.
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{
#include "wx/wx.h"
#include "wx/module.h"
#include "wx/thread.h"
+#include "wx/log.h"
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()
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
+#include "wx/log.h"
enum thread_state {
STATE_IDLE = 0,
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;
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
+#include "wx/log.h"
enum thread_state {
STATE_IDLE = 0,
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;
}
vfprintf( stderr, format, ap );
fflush( stderr );
va_end(ap);
-};
+}
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 )
{
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
exit(3); // the same exit code as for abort()
-};
+}
//------------------------------------------------------------------------
// directory routines
strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
-};
+}
//------------------------------------------------------------------------
// subprocess routines
delete proc_data;
else
proc_data->pid = 0;
-};
+}
long wxExecute( char **argv, bool sync, wxProcess *process )
{
// failed!
return pid;
}
-};
+}
long wxExecute( const wxString& command, bool sync, wxProcess *process )
{
delete [] tmp;
return lRc;
-};
+}
#include "wx/statusbr.h"
#include "wx/intl.h"
#include "wx/settings.h"
+#include "wx/log.h"
#include "gdk/gdkprivate.h"
#include "gdk/gdkkeysyms.h"
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;
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)