From 58c837a4e67c0996134cc0947691dc09c5f26687 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 4 Dec 1999 10:37:39 +0000 Subject: [PATCH] String changes for translations, Made wxBitmap derive from wxGDIObject, Removed #ifdefs around destrctors for GDI lists (wxBrushList etc), Created wxEVT_COMMAND_SPINCTRL_UPDATE with obvious usage. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/gtk/todo.txt | 6 -- include/wx/event.h | 2 + include/wx/gtk/bitmap.h | 3 +- include/wx/gtk1/bitmap.h | 3 +- src/common/docview.cpp | 4 +- src/common/dynlib.cpp | 6 +- src/common/fontmap.cpp | 28 ++++----- src/common/fs_zip.cpp | 10 ++-- src/common/ftp.cpp | 2 +- src/common/gdicmn.cpp | 6 -- src/common/imagbmp.cpp | 26 ++++++--- src/common/image.cpp | 32 +++++------ src/common/imaggif.cpp | 6 +- src/common/imagjpeg.cpp | 19 +++--- src/common/imagpcx.cpp | 13 ++--- src/common/imagpng.cpp | 3 +- src/common/imagpnm.cpp | 33 ++++++----- src/common/imagtiff.cpp | 8 +-- src/common/intl.cpp | 4 +- src/common/prntbase.cpp | 4 +- src/common/sckaddr.cpp | 6 +- src/common/socket.cpp | 7 ++- src/common/url.cpp | 4 +- src/generic/busyinfo.cpp | 2 +- src/generic/colrdlgg.cpp | 2 +- src/generic/dirdlgg.cpp | 2 +- src/generic/tipdlg.cpp | 2 +- src/gtk/brush.cpp | 121 +++++++++++++++++++-------------------- src/gtk/colour.cpp | 1 - src/gtk/dcclient.cpp | 4 +- src/gtk/fontdlg.cpp | 9 +-- src/gtk/joystick.cpp | 2 +- src/gtk/spinctrl.cpp | 31 +--------- src/gtk1/brush.cpp | 121 +++++++++++++++++++-------------------- src/gtk1/colour.cpp | 1 - src/gtk1/dcclient.cpp | 4 +- src/gtk1/fontdlg.cpp | 9 +-- src/gtk1/joystick.cpp | 2 +- src/gtk1/spinctrl.cpp | 31 +--------- 39 files changed, 262 insertions(+), 317 deletions(-) diff --git a/docs/gtk/todo.txt b/docs/gtk/todo.txt index 89a9b4c83c..98e91a925e 100644 --- a/docs/gtk/todo.txt +++ b/docs/gtk/todo.txt @@ -1,17 +1,11 @@ -------------------- High priority --------------------- -Fix bug that thread sample reports about non-finished threads. - More testing of Unicode support. Add ID based i18n system as a replacement for the unelegant gettext system. -Add controls to wxToolbar. - -Add TIFF handler. Someone? (Hint, hint). - Improve, update translations. Install *.mo files somewehere. -------------------- Medium priority --------------------- diff --git a/include/wx/event.h b/include/wx/event.h index 59a6470caf..900014b7d4 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -66,6 +66,7 @@ const wxEventType wxEVT_COMMAND_VLBOX_SELECTED = wxEVT_FIRST + 14; const wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED = wxEVT_FIRST + 15; const wxEventType wxEVT_COMMAND_TOOL_RCLICKED = wxEVT_FIRST + 16; const wxEventType wxEVT_COMMAND_TOOL_ENTER = wxEVT_FIRST + 17; +const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_FIRST + 18; /* Sockets send events, too */ const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50; @@ -1649,6 +1650,7 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ #define EVT_TOOL_RCLICKED_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, #define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, #define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, +#define EVT_SPINCTRL(id, fn) { wxEVT_COMMAND_SPINCTRL_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, // Generic command events #define EVT_COMMAND_LEFT_CLICK(id, fn) { wxEVT_COMMAND_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 2e8a50eb67..8449a01cdb 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -19,6 +19,7 @@ #include "wx/object.h" #include "wx/string.h" #include "wx/palette.h" +#include "wx/gdiobj.h" //----------------------------------------------------------------------------- // classes @@ -57,7 +58,7 @@ private: // wxBitmap //----------------------------------------------------------------------------- -class wxBitmap: public wxObject +class wxBitmap: public wxGDIObject { public: wxBitmap(); diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 2e8a50eb67..8449a01cdb 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -19,6 +19,7 @@ #include "wx/object.h" #include "wx/string.h" #include "wx/palette.h" +#include "wx/gdiobj.h" //----------------------------------------------------------------------------- // classes @@ -57,7 +58,7 @@ private: // wxBitmap //----------------------------------------------------------------------------- -class wxBitmap: public wxObject +class wxBitmap: public wxGDIObject { public: wxBitmap(); diff --git a/src/common/docview.cpp b/src/common/docview.cpp index a2863a485c..58c3f43fd8 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -522,7 +522,7 @@ wxView::wxView() // SetDocument(doc); m_viewDocument = (wxDocument*) NULL; - m_viewTypeName = ""; + m_viewTypeName = wxT(""); m_viewFrame = (wxFrame *) NULL; } @@ -1989,7 +1989,7 @@ void wxFileHistory::Load(wxConfigBase& config) m_fileHistory[m_fileHistoryN] = copystring((const wxChar*) historyFile); m_fileHistoryN ++; buf.Printf(wxT("file%d"), m_fileHistoryN+1); - historyFile = ""; + historyFile = wxT(""); } AddFilesToMenu(); } diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 8ad47c2b83..5086123d93 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -190,7 +190,7 @@ wxDllLoader::GetProgramHandle(void) // shl_findsymbol with NULL handle looks up in main program return 0; #else - wxFAIL_MSG(_("This method is not implemented under Windows or OS/2")); + wxFAIL_MSG( wxT("This method is not implemented under Windows or OS/2")); return 0; #endif } @@ -321,13 +321,13 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxString libPath("/lib:/usr/lib"); // system path first const char *envLibPath = getenv("LD_LIBRARY_PATH"); if ( envLibPath ) - libPath << ':' << envLibPath; + libPath << wxT(':') << envLibPath; wxStringTokenizer tokenizer(libPath, wxT(':')); while ( tokenizer.HasMoreToken() ) { wxString fullname(tokenizer.NextToken()); - fullname << '/' << libname; + fullname << wxT('/') << libname; if ( wxFileExists(fullname) ) { libname = fullname; diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 4f1e9bd0cb..a11228fc78 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -206,7 +206,7 @@ wxFontMapper::~wxFontMapper() void wxFontMapper::SetConfigPath(const wxString& prefix) { wxCHECK_RET( !prefix.IsEmpty() && prefix[0] == wxCONFIG_PATH_SEPARATOR, - _T("an absolute path should be given to " + wxT("an absolute path should be given to " "wxFontMapper::SetConfigPath()") ); m_configRootPath = prefix; @@ -254,7 +254,7 @@ bool wxFontMapper::ChangePath(const wxString& pathNew, wxString *pathOld) } wxASSERT_MSG( !pathNew || (pathNew[0] != wxCONFIG_PATH_SEPARATOR), - _T("should be a relative path") ); + wxT("should be a relative path") ); path += pathNew; @@ -278,7 +278,7 @@ wxString wxFontMapper::GetEncodingDescription(wxFontEncoding encoding) size_t count = WXSIZEOF(gs_encodingDescs); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - _T("inconsitency detected - forgot to update one of " + wxT("inconsitency detected - forgot to update one of " "the arrays?") ); for ( size_t i = 0; i < count; i++ ) @@ -301,7 +301,7 @@ wxString wxFontMapper::GetEncodingName(wxFontEncoding encoding) size_t count = WXSIZEOF(gs_encodingNames); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - _T("inconsitency detected - forgot to update one of " + wxT("inconsitency detected - forgot to update one of " "the arrays?") ); for ( size_t i = 0; i < count; i++ ) @@ -342,7 +342,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, } else { - wxLogDebug(_T("corrupted config data - invalid encoding %ld " + wxLogDebug(wxT("corrupted config data - invalid encoding %ld " "for charset '%s'"), value, charset.c_str()); } } @@ -368,20 +368,20 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, { cs.MakeUpper(); - if ( !cs || cs == _T("US-ASCII") ) + if ( !cs || cs == wxT("US-ASCII") ) encoding = wxFONTENCODING_DEFAULT; - else if ( cs == _T("KOI8-R") || cs == _T("KOI8-U") ) + else if ( cs == wxT("KOI8-R") || cs == wxT("KOI8-U") ) encoding = wxFONTENCODING_KOI8; - else if ( cs.Left(3) == _T("ISO") ) + else if ( cs.Left(3) == wxT("ISO") ) { // the dash is optional (or, to be exact, it is not, but // several brokenmails "forget" it) const wxChar *p = cs.c_str() + 3; - if ( *p == _T('-') ) + if ( *p == wxT('-') ) p++; unsigned int value; - if ( wxSscanf(p, _T("8859-%u"), &value) == 1 ) + if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { if ( value < wxFONTENCODING_ISO8859_MAX - wxFONTENCODING_ISO8859_1 ) @@ -392,7 +392,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, } } } - else if ( cs.Left(8) == _T("WINDOWS-") ) + else if ( cs.Left(8) == wxT("WINDOWS-") ) { int value; if ( wxSscanf(cs.c_str() + 8, wxT("%u"), &value) == 1 ) @@ -433,7 +433,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, size_t count = WXSIZEOF(gs_encodingDescs); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - _T("inconsitency detected - forgot to update one of " + wxT("inconsitency detected - forgot to update one of " "the arrays?") ); wxString *encodingNamesTranslated = new wxString[count]; @@ -499,7 +499,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, wxNativeEncodingInfo *info, bool interactive) { - wxCHECK_MSG( info, FALSE, _T("bad pointer in GetAltForEncoding") ); + wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") ); if ( encoding == wxFONTENCODING_DEFAULT ) { @@ -542,7 +542,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, } else { - wxLogDebug(_T("corrupted config data: string '%s' is not " + wxLogDebug(wxT("corrupted config data: string '%s' is not " "a valid font encoding info"), fontinfo.c_str()); } } diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index 96985ddc65..d390e17df0 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -61,7 +61,7 @@ wxZipFSHandler::~wxZipFSHandler() bool wxZipFSHandler::CanOpen(const wxString& location) { wxString p = GetProtocol(location); - return (p == "zip"); + return (p == wxT("zip") ); } @@ -73,14 +73,14 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l wxString left = GetLeftLocation(location); wxInputStream *s; - if (GetProtocol(left) != "file") { + if (GetProtocol(left) != wxT("file")) { return NULL; } s = new wxZipInputStream(left, right); if (s && (s -> LastError() == wxStream_NOERROR)) { return new wxFSFile(s, - left + "#zip:" + right, + left + wxT("#zip:") + right, GetMimeTypeFromExt(location), GetAnchor(location)); } @@ -101,7 +101,7 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags) m_Archive = NULL; } - if (GetProtocol(left) != "file") { + if (GetProtocol(left) != wxT("file")) { return wxEmptyString; } @@ -146,7 +146,7 @@ wxString wxZipFSHandler::DoFind() while (match == wxEmptyString) { unzGetCurrentFileInfo((unzFile)m_Archive, NULL, namebuf, 1024, NULL, 0, NULL, 0); - for (c = namebuf; *c; c++) if (*c == '\\') *c = '/'; + for (c = namebuf; *c; c++) if (*c == wxT('\\')) *c = wxT('/'); fn = namebuf; if (fn.Last() == wxT('/')) { fn.RemoveLast(); diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index a47d3a7b27..0ff2dfda36 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -65,7 +65,7 @@ wxFTP::wxFTP() m_user = wxT("anonymous"); m_passwd = wxGetUserId(); - m_passwd += '@'; + m_passwd += wxT('@'); m_passwd += wxGetHostName(); SetNotify(0); diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 4f33ad414b..d0f6c4199d 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -455,7 +455,6 @@ wxBitmapList::wxBitmapList () wxBitmapList::~wxBitmapList () { -#if defined(__WXMSW__) || defined(__WXMOTIF__) wxNode *node = First (); while (node) { @@ -465,13 +464,11 @@ wxBitmapList::~wxBitmapList () delete bitmap; node = next; } -#endif } // Pen and Brush lists wxPenList::~wxPenList () { -#if defined(__WXMSW__) || defined(__WXMOTIF__) wxNode *node = First (); while (node) { @@ -481,7 +478,6 @@ wxPenList::~wxPenList () delete pen; node = next; } -#endif } void wxPenList::AddPen (wxPen * pen) @@ -521,7 +517,6 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) wxBrushList::~wxBrushList () { -#if defined(__WXMSW__) || defined(__WXMOTIF__) wxNode *node = First (); while (node) { @@ -531,7 +526,6 @@ wxBrushList::~wxBrushList () delete brush; node = next; } -#endif } void wxBrushList::AddBrush (wxBrush * brush) diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index baec6a1d48..36483f8172 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -64,7 +64,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) #define poffset (line * width * 3 + column * 3) -bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSED(verbose), int WXUNUSED(index) ) +bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) { int rshift = 0, gshift = 0, bshift = 0; wxUint8 aByte; @@ -97,12 +97,14 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE int height = (int)wxINT32_SWAP_ON_BE( dbuf[1] ); if (width > 32767) { - wxLogError( wxT("Image width > 32767 pixels for file.") ); + if (verbose) + wxLogError( _("BMP: Image width > 32767 pixels for file.") ); return FALSE; } if (height > 32767) { - wxLogError( wxT("Image height > 32767 pixels for file.") ); + if (verbose) + wxLogError( _("BMP: Image height > 32767 pixels for file.") ); return FALSE; } @@ -115,7 +117,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE int bpp = (int)wxUINT16_SWAP_ON_BE( aWord ); if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32) { - wxLogError( wxT("unknown bitdepth in file.") ); + if (verbose) + wxLogError( _("BMP: Unknown bitdepth in file.") ); return FALSE; } @@ -123,7 +126,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] ); if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS) { - wxLogError( wxT("unknown encoding in Windows BMP file.") ); + if (verbose) + wxLogError( _("BMP: Unknown encoding in file.") ); return FALSE; } @@ -136,7 +140,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32))) { - wxLogError( wxT("encoding of BMP doesn't match bitdepth.") ); + if (verbose) + wxLogError( _("BMP: Encoding doesn't match bitdepth.") ); return FALSE; } if (bpp < 16) @@ -144,7 +149,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE cmap = (struct _cmap *)malloc(sizeof(struct _cmap) * ncolors); if (!cmap) { - wxLogError( wxT("Cannot allocate RAM for color map in BMP file.") ); + if (verbose) + wxLogError( _("BMP: Couldn't allocate memory.") ); return FALSE; } } @@ -155,7 +161,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE unsigned char *ptr = image->GetData(); if (!ptr) { - wxLogError( wxT("Cannot allocate RAM for RGB data in file.") ); + if (verbose) + wxLogError( _("BMP: Couldn't allocate memory.") ); if (cmap) free(cmap); return FALSE; @@ -263,7 +270,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE { if (comp == BI_RLE4) { - wxLogError( wxT("Can't deal with 4bit encoded yet.") ); + if (verbose) + wxLogError( _("BMP: Cannot deal with 4bit encoded yet.") ); image->Destroy(); free(cmap); return FALSE; diff --git a/src/common/image.cpp b/src/common/image.cpp index c714ea6b5b..29e7087ea3 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -45,7 +45,6 @@ class wxImageRefData: public wxObjectRefData { - public: wxImageRefData(); ~wxImageRefData(); @@ -72,7 +71,8 @@ wxImageRefData::wxImageRefData() wxImageRefData::~wxImageRefData() { - if (m_data) free( m_data ); + if (m_data) + free( m_data ); } wxList wxImage::sm_handlers; @@ -195,8 +195,8 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const wxCHECK_MSG( Ok(), image, wxT("invalid image") ); - wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()) - , image, wxT("invalid subimage size") ); + wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()), + image, wxT("invalid subimage size") ); int subwidth=rect.GetWidth(); const int subheight=rect.GetHeight(); @@ -383,9 +383,9 @@ bool wxImage::LoadFile( const wxString& filename, long type ) wxFileInputStream stream(filename); return LoadFile(stream, type); } - - else { - wxLogError( wxT("Can't load image from file '%s': file does not exist."), filename.c_str() ); + else + { + wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() ); return FALSE; } @@ -402,9 +402,9 @@ bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype ) wxFileInputStream stream(filename); return LoadFile(stream, mimetype); } - - else { - wxLogError( wxT("Can't load image from file '%s': file does not exist."), filename.c_str() ); + else + { + wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() ); return FALSE; } @@ -483,7 +483,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type ) } - wxLogWarning( wxT("No handler found for this image.") ); + wxLogWarning( _("No handler found for image type.") ); return FALSE; } @@ -491,7 +491,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type ) if (handler == NULL) { - wxLogWarning( wxT("No image handler for type %d defined."), type ); + wxLogWarning( _("No image handler for type %d defined."), type ); return FALSE; } @@ -509,7 +509,7 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype ) if (handler == NULL) { - wxLogWarning( wxT("No image handler for type %s defined."), mimetype.GetData() ); + wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); return FALSE; } @@ -525,7 +525,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type ) if (handler == NULL) { - wxLogWarning( wxT("No image handler for type %d defined."), type ); + wxLogWarning( _("No image handler for type %d defined."), type ); return FALSE; } @@ -541,7 +541,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) if (handler == NULL) { - wxLogWarning( wxT("No image handler for type %s defined."), mimetype.GetData() ); + wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); return FALSE; } @@ -680,7 +680,7 @@ bool wxImageHandler::CanRead( const wxString& name ) } else { - wxLogError( wxT("Can't check image format of file '%s': file does not exist."), name.c_str() ); + wxLogError( _("Can't check image format of file '%s': file does not exist."), name.c_str() ); return FALSE; } diff --git a/src/common/imaggif.cpp b/src/common/imaggif.cpp index 41211855a5..c487e75fa6 100644 --- a/src/common/imaggif.cpp +++ b/src/common/imaggif.cpp @@ -54,9 +54,9 @@ bool wxGIFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose { switch (error) { - case E_FORMATO: wxLogError(wxT("wxGIFHandler: error in image format")); break; - case E_MEMORIA: wxLogError(wxT("wxGIFHandler: couldn't allocate memory")); break; - default: wxLogError(wxT("wxGIFHandler: unknown error !!!")); + case E_FORMATO: wxLogError(_("GIF: Error in image format.")); break; + case E_MEMORIA: wxLogError(_("GIF: Couldn't allocate memory.")); break; + default: wxLogError(_("GIF: Unknown error.")); } } delete decod; diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 6676597e79..779d6cd498 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -169,7 +169,8 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos /* If we get here, the JPEG code has signaled an error. * We need to clean up the JPEG object, close the input file, and return. */ - if (verbose) wxLogError(_("Couldn't load a JPEG image - probably file is corrupted.")); + if (verbose) + wxLogError(_("JPEG: Couldn't load - file is probably corrupted.")); jpeg_destroy_decompress(&cinfo); if (image->Ok()) image->Destroy(); return FALSE; @@ -280,13 +281,15 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo if (!verbose) cinfo.err->output_message=NULL; /* Establish the setjmp return context for my_error_exit to use. */ - if (setjmp(jerr.setjmp_buffer)) { - /* If we get here, the JPEG code has signaled an error. - * We need to clean up the JPEG object, close the input file, and return. - */ - if (verbose) wxLogError(_("Couldn't save a JPEG image - probably file is corrupted.")); - jpeg_destroy_compress(&cinfo); - return FALSE; + if (setjmp(jerr.setjmp_buffer)) + { + /* If we get here, the JPEG code has signaled an error. + * We need to clean up the JPEG object, close the input file, and return. + */ + if (verbose) + wxLogError(_("JPEG: Couldn't save image.")); + jpeg_destroy_compress(&cinfo); + return FALSE; } jpeg_create_compress(&cinfo); diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 0ba41da2f2..37cf4182d1 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -229,7 +229,7 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose if (!CanRead(stream)) { if (verbose) - wxLogError(wxT("wxPCXHandler: this is not a PCX file")); + wxLogError(_("PCX: this is not a PCX file.")); return FALSE; } @@ -242,10 +242,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose { switch (error) { - case E_FORMATO: wxLogError(wxT("wxPCXHandler: image format unsupported")); break; - case E_MEMORIA: wxLogError(wxT("wxPCXHandler: couldn't allocate memory")); break; - case E_VERSION: wxLogError(wxT("wxPCXHandler: version number too low")); break; - default: wxLogError(wxT("wxPCXHandler: unknown error !!!")); + case E_FORMATO: wxLogError(_("PCX: Image format unsupported.")); break; + case E_MEMORIA: wxLogError(_("PCX: Couldn't allocate memory.")); break; + case E_VERSION: wxLogError(_("PCX: Wrong version number.")); break; + default: wxLogError(_("PCX: Unknown error.")); } } image->Destroy(); @@ -257,8 +257,7 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose bool wxPCXHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool verbose ) { - if (verbose) - wxLogError(wxT("wxPCXHandler::SaveFile still not implemented")); + wxFAIL_MSG(wxT("wxPCXHandler::SaveFile still not implemented")); return FALSE; } diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index e8d9f42c7e..898bc0e522 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -243,7 +243,8 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose error_nolines: lines = NULL; // called from before it was set error: - wxLogError(_("Couldn't load a PNG image - probably file is corrupted.")); + if (verbose) + wxLogError(_("Couldn't load a PNG image - file is corrupted or not enough memory.")); if ( image->Ok() ) { diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp index ec9edd90b1..700ea8d0b6 100644 --- a/src/common/imagpnm.cpp +++ b/src/common/imagpnm.cpp @@ -27,6 +27,7 @@ #include "wx/image.h" #include "wx/log.h" +#include "wx/intl.h" #include "wx/txtstrm.h" //----------------------------------------------------------------------------- @@ -50,7 +51,7 @@ void Skip_Comment(wxInputStream &stream) } } -bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSED(verbose), int WXUNUSED(index) ) +bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) { wxUint32 width, height; wxUint16 maxval; @@ -69,18 +70,19 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE if (buf_stream.GetC()==wxT('P')) c=buf_stream.GetC(); switch (c) - { - case wxT('2'): - wxLogError(wxT("Loading Grey Ascii PNM image is not yet implemented.")); - return FALSE; - case wxT('5'): - wxLogError(wxT("Loading Grey Raw PNM image is not yet implemented.")); - return FALSE; - case wxT('3'): case wxT('6'): break; - default : - wxLogError(wxT("Loading PNM image : file not recognized.")); - return FALSE; - } + { + case wxT('2'): + if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented.")); + return FALSE; + case wxT('5'): + if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented.")); + return FALSE; + case wxT('3'): + case wxT('6'): break; + default: + if (verbose) wxLogError(_("PNM: File format is not recognized.")); + return FALSE; + } text_stream.ReadLine(); // for the \n Skip_Comment(buf_stream); @@ -93,7 +95,8 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE unsigned char *ptr = image->GetData(); if (!ptr) { - wxLogError( wxT("Cannot allocate RAM for RGB data in PNM file.") ); + if (verbose) + wxLogError( _("PNM: Couldn't allocate memory.") ); return FALSE; } @@ -109,7 +112,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE if (buf_stream.LastError()!=wxSTREAM_NOERROR) { - wxLogError(wxT("Loading PNM image : file seems truncated.")); + if (verbose) wxLogError(_("PNM: File seems truncated.")); return FALSE; } } diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index b182648068..ab692dec26 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -128,7 +128,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if (!tif) { if (verbose) - wxLogError( _("Error loading TIFF image.") ); + wxLogError( _("TIFF: Error loading image.") ); return FALSE; } @@ -157,7 +157,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if (!raster) { if (verbose) - wxLogError( _("Not enough memory for loading TIFF image.") ); + wxLogError( _("TIFF: Couldn't allocate memory.") ); return FALSE; } @@ -166,7 +166,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if (!image->Ok()) { if (verbose) - wxLogError( _("Not enough memory for loading TIFF image.") ); + wxLogError( _("TIFF: Couldn't allocate memory.") ); _TIFFfree( raster ); @@ -176,7 +176,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) { if (verbose) - wxLogError( _("Error reading TIFF image.") ); + wxLogError( _("TIFF: Error reading image.") ); _TIFFfree( raster ); image->Destroy(); diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 295cd6783a..84022468f4 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -308,8 +308,8 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0) FIXME: UNICODE SUPPORT: must use CHARSET specifier! */ wxString szName = szName0; - if(szName.Find('.') != -1) // contains a dot - szName = szName.Left(szName.Find('.')); + if(szName.Find(wxT('.')) != -1) // contains a dot + szName = szName.Left(szName.Find(wxT('.'))); // FIXME VZ: I forgot the exact meaning of LC_PATH - anyone to remind me? // KB: search path where to find the mo files, probably : delimited diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index ce52bc53fd..5003ec570a 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -363,14 +363,14 @@ void wxPreviewControlBar::CreateButtons() if (m_buttonFlags & wxPREVIEW_PREVIOUS) { - m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y), + m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, wxT("<<"), wxPoint(x, y), wxSize(buttonWidth, buttonHeight)); x += gap + buttonWidth; } if (m_buttonFlags & wxPREVIEW_NEXT) { - m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>", + m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, wxT(">>"), wxPoint(x, y), wxSize(buttonWidth, buttonHeight)); x += gap + buttonWidth; } diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 398a3cf016..fbfea8ce3b 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -33,6 +33,7 @@ #include "wx/defs.h" #include "wx/object.h" #include "wx/log.h" +#include "wx/intl.h" #include "wx/gsocket.h" #include "wx/sckaddr.h" @@ -103,8 +104,9 @@ wxIPV4address::~wxIPV4address() bool wxIPV4address::Hostname(const wxString& name) { // Some people are sometimes fool. - if (name == wxT("")) { - wxLogWarning( wxT("Trying to solve a NULL hostname: giving up") ); + if (name == wxT("")) + { + wxLogWarning( _("Trying to solve a NULL hostname: giving up") ); return FALSE; } diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 0f7a633165..608ccd38d4 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -33,6 +33,7 @@ #include "wx/utils.h" #include "wx/module.h" #include "wx/log.h" +#include "wx/intl.h" #include #include @@ -315,7 +316,7 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes) if (sig != 0xfeeddead) { - wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg")); + wxLogWarning( _("TCP: invalid signature returned to ReadMsg.")); goto exit; } @@ -451,8 +452,8 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes) m_defer_timer = NULL; m_defering = NO_DEFER; - wxString s; - s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes); + //wxString s; + //s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes); //wxLogMessage(s); return nbytes-m_defer_nbytes; diff --git a/src/common/url.cpp b/src/common/url.cpp index 203beef31d..71cae1f2f7 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -162,7 +162,7 @@ bool wxURL::PrepHost(wxString& url) wxString temp_url; int pos, pos2; - if ((url.GetChar(0) != '/') || (url.GetChar(1) != '/')) + if ((url.GetChar(0) != wxT('/')) || (url.GetChar(1) != wxT('/'))) return FALSE; url = url(2, url.Length()); @@ -240,7 +240,7 @@ bool wxURL::FetchProtocol() // --------- wxURL get ------------------------------------------ // -------------------------------------------------------------- -wxInputStream *wxURL::GetInputStream(void) +wxInputStream *wxURL::GetInputStream() { wxInputStream *the_i_stream = NULL; diff --git a/src/generic/busyinfo.cpp b/src/generic/busyinfo.cpp index 0b94f12ab5..be101dcf52 100644 --- a/src/generic/busyinfo.cpp +++ b/src/generic/busyinfo.cpp @@ -25,7 +25,7 @@ wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) - : wxFrame(parent, -1, "", wxPoint(0, 0), wxSize(400, 80), wxTHICK_FRAME | wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW) + : wxFrame(parent, -1, wxT(""), wxPoint(0, 0), wxSize(400, 80), wxTHICK_FRAME | wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW) { wxPanel *p = new wxPanel( this ); wxStaticText *s = new wxStaticText( p, -1, message, wxPoint(20, 20), wxSize(360, 40), wxALIGN_CENTER ); diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 23026756ef..4d86072e80 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -124,7 +124,7 @@ wxGenericColourDialog::wxGenericColourDialog() } wxGenericColourDialog::wxGenericColourDialog(wxWindow *parent, wxColourData *data): - wxDialog(parent, -1, "Colour", wxPoint(0, 0), wxSize(900, 900), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) + wxDialog(parent, -1, wxT("Colour"), wxPoint(0, 0), wxSize(900, 900), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) { whichKind = 1; colourSelection = 0; diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index 2d64b555fb..d86581761f 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -146,7 +146,7 @@ void wxDirItemData::SetNewDirName( wxString path ) bool wxDirItemData::HasSubDirs() { - wxString search = m_path + "/*"; + wxString search = m_path + wxT("/*"); wxLogNull log; wxString path = wxFindFirstFile( search, wxDIR ); return (bool)(!path.IsNull()); diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp index 2a318713a7..f4631cf86d 100644 --- a/src/generic/tipdlg.cpp +++ b/src/generic/tipdlg.cpp @@ -174,7 +174,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent, wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next Tip")); - wxStaticText *text = new wxStaticText(this, -1, _("Did you know..."), wxDefaultPosition, wxSize(-1,25) ); + wxStaticText *text = new wxStaticText(this, -1, _("Did you know..."), wxDefaultPosition, wxSize(-1,30) ); #if defined(__WXMSW__) text->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD)); #else diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index 01f3665a7a..2f945402ce 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -21,8 +21,7 @@ class wxBrushRefData: public wxObjectRefData { - public: - +public: wxBrushRefData(); wxBrushRefData( const wxBrushRefData& data ); @@ -33,14 +32,14 @@ class wxBrushRefData: public wxObjectRefData wxBrushRefData::wxBrushRefData() { - m_style = 0; + m_style = 0; } wxBrushRefData::wxBrushRefData( const wxBrushRefData& data ) { - m_style = data.m_style; - m_stipple = data.m_stipple; - m_colour = data.m_colour; + m_style = data.m_style; + m_stipple = data.m_stipple; + m_colour = data.m_colour; } //----------------------------------------------------------------------------- @@ -51,130 +50,130 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) wxBrush::wxBrush() { - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxColour &colour, int style ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_style = style; - M_BRUSHDATA->m_colour = colour; + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = style; + M_BRUSHDATA->m_colour = colour; - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxBitmap &stippleBitmap ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_style = wxSTIPPLE; - M_BRUSHDATA->m_colour = *wxBLACK; - M_BRUSHDATA->m_stipple = stippleBitmap; + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = wxSTIPPLE; + M_BRUSHDATA->m_colour = *wxBLACK; + M_BRUSHDATA->m_stipple = stippleBitmap; - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxBrush &brush ) { - Ref( brush ); + Ref( brush ); - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::~wxBrush() { - if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); + if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); } wxBrush& wxBrush::operator = ( const wxBrush& brush ) { - if (*this == brush) return (*this); - Ref( brush ); - return *this; + if (*this == brush) return (*this); + Ref( brush ); + return *this; } bool wxBrush::operator == ( const wxBrush& brush ) { - return m_refData == brush.m_refData; + return m_refData == brush.m_refData; } bool wxBrush::operator != ( const wxBrush& brush ) { - return m_refData != brush.m_refData; + return m_refData != brush.m_refData; } bool wxBrush::Ok() const { - return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); + return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); } int wxBrush::GetStyle() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return 0; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return 0; + } - return M_BRUSHDATA->m_style; + return M_BRUSHDATA->m_style; } wxColour &wxBrush::GetColour() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return wxNullColour; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return wxNullColour; + } - return M_BRUSHDATA->m_colour; + return M_BRUSHDATA->m_colour; } wxBitmap *wxBrush::GetStipple() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return &wxNullBitmap; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return &wxNullBitmap; + } - return &M_BRUSHDATA->m_stipple; + return &M_BRUSHDATA->m_stipple; } void wxBrush::SetColour( const wxColour& col ) { - Unshare(); - M_BRUSHDATA->m_colour = col; + Unshare(); + M_BRUSHDATA->m_colour = col; } void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) { - Unshare(); - M_BRUSHDATA->m_colour.Set( r, g, b ); + Unshare(); + M_BRUSHDATA->m_colour.Set( r, g, b ); } void wxBrush::SetStyle( int style ) { - Unshare(); - M_BRUSHDATA->m_style = style; + Unshare(); + M_BRUSHDATA->m_style = style; } void wxBrush::SetStipple( const wxBitmap& stipple ) { - Unshare(); - M_BRUSHDATA->m_stipple = stipple; + Unshare(); + M_BRUSHDATA->m_stipple = stipple; } void wxBrush::Unshare() { - if (!m_refData) - { - m_refData = new wxBrushRefData(); - } - else - { - wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); - UnRef(); - m_refData = ref; - } + if (!m_refData) + { + m_refData = new wxBrushRefData(); + } + else + { + wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); + UnRef(); + m_refData = ref; + } } diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 7577edccfc..db73e73343 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -92,7 +92,6 @@ void wxColour::InitFromName( const wxString &colourName ) if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color )) { wxFAIL_MSG( wxT("wxColour: couldn't find colour") ); - wxPrintf( wxT("Colourname %s.\n"), WXSTRINGCAST colourName ); delete m_refData; m_refData = (wxObjectRefData *) NULL; diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 17d8ea2baa..31b0bf61bd 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -813,7 +813,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, wxCoord wxWindowDC::GetCharWidth() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); - wxCHECK_MSG( font, -1, _T("invalid font") ); + wxCHECK_MSG( font, -1, wxT("invalid font") ); return wxCoord(gdk_string_width( font, "H" ) / m_scaleX); } @@ -821,7 +821,7 @@ wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharHeight() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); - wxCHECK_MSG( font, -1, _T("invalid font") ); + wxCHECK_MSG( font, -1, wxT("invalid font") ); return wxCoord((font->ascent + font->descent) / m_scaleY); } diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index 021ad974ec..0cd7791011 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -84,7 +84,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial } else { - wxFAIL_MSG(_T("no registry in X font spec?")); + wxFAIL_MSG( wxT("no registry in X font spec?") ); } // restore the dash we changed to NUL above @@ -92,7 +92,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial } else { - wxFAIL_MSG(_T("no encoding in X font spec?")); + wxFAIL_MSG( wxT("no encoding in X font spec?") ); } // transfer the X registry/encoding to wxFontData - they are used by @@ -150,9 +150,7 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata ) wxFAIL_MSG( wxT("wxXX creation failed") ); return; } -#ifndef __WXGTK12__ - wxFAIL_MSG( wxT("TODO") ); -#else // GTK+ 1.2 + wxString m_message( _("Choose font") ); m_widget = gtk_font_selection_dialog_new( m_message.mbc_str() ); @@ -176,7 +174,6 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata ) gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); -#endif // GTK+ version } wxFontDialog::~wxFontDialog() diff --git a/src/gtk/joystick.cpp b/src/gtk/joystick.cpp index 0b7cf394f4..3b80491d4c 100644 --- a/src/gtk/joystick.cpp +++ b/src/gtk/joystick.cpp @@ -201,7 +201,7 @@ int wxJoystick::GetProductId(void) const wxString wxJoystick::GetProductName(void) const { - return ""; + return wxT(""); } int wxJoystick::GetXMin(void) const diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 6411633ad3..5e13787f4b 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -17,7 +17,6 @@ #if wxUSE_SPINCTRL #include "wx/utils.h" -#include "wx/spinbutt.h" #include @@ -37,8 +36,6 @@ extern bool g_isIdle; extern bool g_blockEventsOnDrag; -static const float sensitivity = 0.02; - //----------------------------------------------------------------------------- // "value_changed" //----------------------------------------------------------------------------- @@ -50,34 +47,10 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win if (!win->m_hasVMT) return; if (g_blockEventsOnDrag) return; - float diff = win->m_adjust->value - win->m_oldPos; - if (fabs(diff) < sensitivity) return; - win->m_oldPos = win->m_adjust->value; - - wxEventType command = wxEVT_NULL; - - float line_step = win->m_adjust->step_increment; - - if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN; - else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP; - else command = wxEVT_SCROLL_THUMBTRACK; - - int value = (int)ceil(win->m_adjust->value); - - wxSpinEvent event( command, win->GetId()); - event.SetPosition( value ); + wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId()); event.SetEventObject( win ); + event.SetInt( win->GetValue() ); win->GetEventHandler()->ProcessEvent( event ); - - /* always send a thumbtrack event */ - if (command != wxEVT_SCROLL_THUMBTRACK) - { - command = wxEVT_SCROLL_THUMBTRACK; - wxSpinEvent event2( command, win->GetId()); - event2.SetPosition( value ); - event2.SetEventObject( win ); - win->GetEventHandler()->ProcessEvent( event2 ); - } } //----------------------------------------------------------------------------- diff --git a/src/gtk1/brush.cpp b/src/gtk1/brush.cpp index 01f3665a7a..2f945402ce 100644 --- a/src/gtk1/brush.cpp +++ b/src/gtk1/brush.cpp @@ -21,8 +21,7 @@ class wxBrushRefData: public wxObjectRefData { - public: - +public: wxBrushRefData(); wxBrushRefData( const wxBrushRefData& data ); @@ -33,14 +32,14 @@ class wxBrushRefData: public wxObjectRefData wxBrushRefData::wxBrushRefData() { - m_style = 0; + m_style = 0; } wxBrushRefData::wxBrushRefData( const wxBrushRefData& data ) { - m_style = data.m_style; - m_stipple = data.m_stipple; - m_colour = data.m_colour; + m_style = data.m_style; + m_stipple = data.m_stipple; + m_colour = data.m_colour; } //----------------------------------------------------------------------------- @@ -51,130 +50,130 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) wxBrush::wxBrush() { - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxColour &colour, int style ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_style = style; - M_BRUSHDATA->m_colour = colour; + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = style; + M_BRUSHDATA->m_colour = colour; - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxBitmap &stippleBitmap ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_style = wxSTIPPLE; - M_BRUSHDATA->m_colour = *wxBLACK; - M_BRUSHDATA->m_stipple = stippleBitmap; + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = wxSTIPPLE; + M_BRUSHDATA->m_colour = *wxBLACK; + M_BRUSHDATA->m_stipple = stippleBitmap; - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::wxBrush( const wxBrush &brush ) { - Ref( brush ); + Ref( brush ); - if (wxTheBrushList) wxTheBrushList->AddBrush( this ); + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); } wxBrush::~wxBrush() { - if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); + if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); } wxBrush& wxBrush::operator = ( const wxBrush& brush ) { - if (*this == brush) return (*this); - Ref( brush ); - return *this; + if (*this == brush) return (*this); + Ref( brush ); + return *this; } bool wxBrush::operator == ( const wxBrush& brush ) { - return m_refData == brush.m_refData; + return m_refData == brush.m_refData; } bool wxBrush::operator != ( const wxBrush& brush ) { - return m_refData != brush.m_refData; + return m_refData != brush.m_refData; } bool wxBrush::Ok() const { - return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); + return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); } int wxBrush::GetStyle() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return 0; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return 0; + } - return M_BRUSHDATA->m_style; + return M_BRUSHDATA->m_style; } wxColour &wxBrush::GetColour() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return wxNullColour; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return wxNullColour; + } - return M_BRUSHDATA->m_colour; + return M_BRUSHDATA->m_colour; } wxBitmap *wxBrush::GetStipple() const { - if (m_refData == NULL) - { - wxFAIL_MSG( wxT("invalid brush") ); - return &wxNullBitmap; - } + if (m_refData == NULL) + { + wxFAIL_MSG( wxT("invalid brush") ); + return &wxNullBitmap; + } - return &M_BRUSHDATA->m_stipple; + return &M_BRUSHDATA->m_stipple; } void wxBrush::SetColour( const wxColour& col ) { - Unshare(); - M_BRUSHDATA->m_colour = col; + Unshare(); + M_BRUSHDATA->m_colour = col; } void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) { - Unshare(); - M_BRUSHDATA->m_colour.Set( r, g, b ); + Unshare(); + M_BRUSHDATA->m_colour.Set( r, g, b ); } void wxBrush::SetStyle( int style ) { - Unshare(); - M_BRUSHDATA->m_style = style; + Unshare(); + M_BRUSHDATA->m_style = style; } void wxBrush::SetStipple( const wxBitmap& stipple ) { - Unshare(); - M_BRUSHDATA->m_stipple = stipple; + Unshare(); + M_BRUSHDATA->m_stipple = stipple; } void wxBrush::Unshare() { - if (!m_refData) - { - m_refData = new wxBrushRefData(); - } - else - { - wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); - UnRef(); - m_refData = ref; - } + if (!m_refData) + { + m_refData = new wxBrushRefData(); + } + else + { + wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); + UnRef(); + m_refData = ref; + } } diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index 7577edccfc..db73e73343 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -92,7 +92,6 @@ void wxColour::InitFromName( const wxString &colourName ) if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color )) { wxFAIL_MSG( wxT("wxColour: couldn't find colour") ); - wxPrintf( wxT("Colourname %s.\n"), WXSTRINGCAST colourName ); delete m_refData; m_refData = (wxObjectRefData *) NULL; diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 17d8ea2baa..31b0bf61bd 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -813,7 +813,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, wxCoord wxWindowDC::GetCharWidth() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); - wxCHECK_MSG( font, -1, _T("invalid font") ); + wxCHECK_MSG( font, -1, wxT("invalid font") ); return wxCoord(gdk_string_width( font, "H" ) / m_scaleX); } @@ -821,7 +821,7 @@ wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharHeight() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); - wxCHECK_MSG( font, -1, _T("invalid font") ); + wxCHECK_MSG( font, -1, wxT("invalid font") ); return wxCoord((font->ascent + font->descent) / m_scaleY); } diff --git a/src/gtk1/fontdlg.cpp b/src/gtk1/fontdlg.cpp index 021ad974ec..0cd7791011 100644 --- a/src/gtk1/fontdlg.cpp +++ b/src/gtk1/fontdlg.cpp @@ -84,7 +84,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial } else { - wxFAIL_MSG(_T("no registry in X font spec?")); + wxFAIL_MSG( wxT("no registry in X font spec?") ); } // restore the dash we changed to NUL above @@ -92,7 +92,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial } else { - wxFAIL_MSG(_T("no encoding in X font spec?")); + wxFAIL_MSG( wxT("no encoding in X font spec?") ); } // transfer the X registry/encoding to wxFontData - they are used by @@ -150,9 +150,7 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata ) wxFAIL_MSG( wxT("wxXX creation failed") ); return; } -#ifndef __WXGTK12__ - wxFAIL_MSG( wxT("TODO") ); -#else // GTK+ 1.2 + wxString m_message( _("Choose font") ); m_widget = gtk_font_selection_dialog_new( m_message.mbc_str() ); @@ -176,7 +174,6 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata ) gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); -#endif // GTK+ version } wxFontDialog::~wxFontDialog() diff --git a/src/gtk1/joystick.cpp b/src/gtk1/joystick.cpp index 0b7cf394f4..3b80491d4c 100644 --- a/src/gtk1/joystick.cpp +++ b/src/gtk1/joystick.cpp @@ -201,7 +201,7 @@ int wxJoystick::GetProductId(void) const wxString wxJoystick::GetProductName(void) const { - return ""; + return wxT(""); } int wxJoystick::GetXMin(void) const diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index 6411633ad3..5e13787f4b 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -17,7 +17,6 @@ #if wxUSE_SPINCTRL #include "wx/utils.h" -#include "wx/spinbutt.h" #include @@ -37,8 +36,6 @@ extern bool g_isIdle; extern bool g_blockEventsOnDrag; -static const float sensitivity = 0.02; - //----------------------------------------------------------------------------- // "value_changed" //----------------------------------------------------------------------------- @@ -50,34 +47,10 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win if (!win->m_hasVMT) return; if (g_blockEventsOnDrag) return; - float diff = win->m_adjust->value - win->m_oldPos; - if (fabs(diff) < sensitivity) return; - win->m_oldPos = win->m_adjust->value; - - wxEventType command = wxEVT_NULL; - - float line_step = win->m_adjust->step_increment; - - if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN; - else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP; - else command = wxEVT_SCROLL_THUMBTRACK; - - int value = (int)ceil(win->m_adjust->value); - - wxSpinEvent event( command, win->GetId()); - event.SetPosition( value ); + wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId()); event.SetEventObject( win ); + event.SetInt( win->GetValue() ); win->GetEventHandler()->ProcessEvent( event ); - - /* always send a thumbtrack event */ - if (command != wxEVT_SCROLL_THUMBTRACK) - { - command = wxEVT_SCROLL_THUMBTRACK; - wxSpinEvent event2( command, win->GetId()); - event2.SetPosition( value ); - event2.SetEventObject( win ); - win->GetEventHandler()->ProcessEvent( event2 ); - } } //----------------------------------------------------------------------------- -- 2.45.2