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
This commit is contained in:
Robert Roebling
1999-12-04 10:37:39 +00:00
parent 4f72fe4f1a
commit 58c837a4e6
39 changed files with 262 additions and 317 deletions

View File

@@ -1,17 +1,11 @@
-------------------- High priority --------------------- -------------------- High priority ---------------------
Fix bug that thread sample reports about non-finished threads.
More testing of Unicode support. More testing of Unicode support.
Add ID based i18n system as a replacement for the Add ID based i18n system as a replacement for the
unelegant gettext system. unelegant gettext system.
Add controls to wxToolbar.
Add TIFF handler. Someone? (Hint, hint).
Improve, update translations. Install *.mo files somewehere. Improve, update translations. Install *.mo files somewehere.
-------------------- Medium priority --------------------- -------------------- Medium priority ---------------------

View File

@@ -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_COMBOBOX_SELECTED = wxEVT_FIRST + 15;
const wxEventType wxEVT_COMMAND_TOOL_RCLICKED = wxEVT_FIRST + 16; const wxEventType wxEVT_COMMAND_TOOL_RCLICKED = wxEVT_FIRST + 16;
const wxEventType wxEVT_COMMAND_TOOL_ENTER = wxEVT_FIRST + 17; const wxEventType wxEVT_COMMAND_TOOL_ENTER = wxEVT_FIRST + 17;
const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_FIRST + 18;
/* Sockets send events, too */ /* Sockets send events, too */
const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50; 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_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_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_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 // Generic command events
#define EVT_COMMAND_LEFT_CLICK(id, fn) { wxEVT_COMMAND_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, #define EVT_COMMAND_LEFT_CLICK(id, fn) { wxEVT_COMMAND_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },

View File

@@ -19,6 +19,7 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/string.h" #include "wx/string.h"
#include "wx/palette.h" #include "wx/palette.h"
#include "wx/gdiobj.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
@@ -57,7 +58,7 @@ private:
// wxBitmap // wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmap: public wxObject class wxBitmap: public wxGDIObject
{ {
public: public:
wxBitmap(); wxBitmap();

View File

@@ -19,6 +19,7 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/string.h" #include "wx/string.h"
#include "wx/palette.h" #include "wx/palette.h"
#include "wx/gdiobj.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
@@ -57,7 +58,7 @@ private:
// wxBitmap // wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmap: public wxObject class wxBitmap: public wxGDIObject
{ {
public: public:
wxBitmap(); wxBitmap();

View File

@@ -522,7 +522,7 @@ wxView::wxView()
// SetDocument(doc); // SetDocument(doc);
m_viewDocument = (wxDocument*) NULL; m_viewDocument = (wxDocument*) NULL;
m_viewTypeName = ""; m_viewTypeName = wxT("");
m_viewFrame = (wxFrame *) NULL; m_viewFrame = (wxFrame *) NULL;
} }
@@ -1989,7 +1989,7 @@ void wxFileHistory::Load(wxConfigBase& config)
m_fileHistory[m_fileHistoryN] = copystring((const wxChar*) historyFile); m_fileHistory[m_fileHistoryN] = copystring((const wxChar*) historyFile);
m_fileHistoryN ++; m_fileHistoryN ++;
buf.Printf(wxT("file%d"), m_fileHistoryN+1); buf.Printf(wxT("file%d"), m_fileHistoryN+1);
historyFile = ""; historyFile = wxT("");
} }
AddFilesToMenu(); AddFilesToMenu();
} }

View File

@@ -190,7 +190,7 @@ wxDllLoader::GetProgramHandle(void)
// shl_findsymbol with NULL handle looks up in main program // shl_findsymbol with NULL handle looks up in main program
return 0; return 0;
#else #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; return 0;
#endif #endif
} }
@@ -321,13 +321,13 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
wxString libPath("/lib:/usr/lib"); // system path first wxString libPath("/lib:/usr/lib"); // system path first
const char *envLibPath = getenv("LD_LIBRARY_PATH"); const char *envLibPath = getenv("LD_LIBRARY_PATH");
if ( envLibPath ) if ( envLibPath )
libPath << ':' << envLibPath; libPath << wxT(':') << envLibPath;
wxStringTokenizer tokenizer(libPath, wxT(':')); wxStringTokenizer tokenizer(libPath, wxT(':'));
while ( tokenizer.HasMoreToken() ) while ( tokenizer.HasMoreToken() )
{ {
wxString fullname(tokenizer.NextToken()); wxString fullname(tokenizer.NextToken());
fullname << '/' << libname; fullname << wxT('/') << libname;
if ( wxFileExists(fullname) ) if ( wxFileExists(fullname) )
{ {
libname = fullname; libname = fullname;

View File

@@ -206,7 +206,7 @@ wxFontMapper::~wxFontMapper()
void wxFontMapper::SetConfigPath(const wxString& prefix) void wxFontMapper::SetConfigPath(const wxString& prefix)
{ {
wxCHECK_RET( !prefix.IsEmpty() && prefix[0] == wxCONFIG_PATH_SEPARATOR, 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()") ); "wxFontMapper::SetConfigPath()") );
m_configRootPath = prefix; m_configRootPath = prefix;
@@ -254,7 +254,7 @@ bool wxFontMapper::ChangePath(const wxString& pathNew, wxString *pathOld)
} }
wxASSERT_MSG( !pathNew || (pathNew[0] != wxCONFIG_PATH_SEPARATOR), wxASSERT_MSG( !pathNew || (pathNew[0] != wxCONFIG_PATH_SEPARATOR),
_T("should be a relative path") ); wxT("should be a relative path") );
path += pathNew; path += pathNew;
@@ -278,7 +278,7 @@ wxString wxFontMapper::GetEncodingDescription(wxFontEncoding encoding)
size_t count = WXSIZEOF(gs_encodingDescs); size_t count = WXSIZEOF(gs_encodingDescs);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings), wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
_T("inconsitency detected - forgot to update one of " wxT("inconsitency detected - forgot to update one of "
"the arrays?") ); "the arrays?") );
for ( size_t i = 0; i < count; i++ ) for ( size_t i = 0; i < count; i++ )
@@ -301,7 +301,7 @@ wxString wxFontMapper::GetEncodingName(wxFontEncoding encoding)
size_t count = WXSIZEOF(gs_encodingNames); size_t count = WXSIZEOF(gs_encodingNames);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings), wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
_T("inconsitency detected - forgot to update one of " wxT("inconsitency detected - forgot to update one of "
"the arrays?") ); "the arrays?") );
for ( size_t i = 0; i < count; i++ ) for ( size_t i = 0; i < count; i++ )
@@ -342,7 +342,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset,
} }
else else
{ {
wxLogDebug(_T("corrupted config data - invalid encoding %ld " wxLogDebug(wxT("corrupted config data - invalid encoding %ld "
"for charset '%s'"), value, charset.c_str()); "for charset '%s'"), value, charset.c_str());
} }
} }
@@ -368,20 +368,20 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset,
{ {
cs.MakeUpper(); cs.MakeUpper();
if ( !cs || cs == _T("US-ASCII") ) if ( !cs || cs == wxT("US-ASCII") )
encoding = wxFONTENCODING_DEFAULT; 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; 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 // the dash is optional (or, to be exact, it is not, but
// several brokenmails "forget" it) // several brokenmails "forget" it)
const wxChar *p = cs.c_str() + 3; const wxChar *p = cs.c_str() + 3;
if ( *p == _T('-') ) if ( *p == wxT('-') )
p++; p++;
unsigned int value; unsigned int value;
if ( wxSscanf(p, _T("8859-%u"), &value) == 1 ) if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
{ {
if ( value < wxFONTENCODING_ISO8859_MAX - if ( value < wxFONTENCODING_ISO8859_MAX -
wxFONTENCODING_ISO8859_1 ) 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; int value;
if ( wxSscanf(cs.c_str() + 8, wxT("%u"), &value) == 1 ) 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); size_t count = WXSIZEOF(gs_encodingDescs);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings), wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
_T("inconsitency detected - forgot to update one of " wxT("inconsitency detected - forgot to update one of "
"the arrays?") ); "the arrays?") );
wxString *encodingNamesTranslated = new wxString[count]; wxString *encodingNamesTranslated = new wxString[count];
@@ -499,7 +499,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info, wxNativeEncodingInfo *info,
bool interactive) bool interactive)
{ {
wxCHECK_MSG( info, FALSE, _T("bad pointer in GetAltForEncoding") ); wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") );
if ( encoding == wxFONTENCODING_DEFAULT ) if ( encoding == wxFONTENCODING_DEFAULT )
{ {
@@ -542,7 +542,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
} }
else 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()); "a valid font encoding info"), fontinfo.c_str());
} }
} }

View File

@@ -61,7 +61,7 @@ wxZipFSHandler::~wxZipFSHandler()
bool wxZipFSHandler::CanOpen(const wxString& location) bool wxZipFSHandler::CanOpen(const wxString& location)
{ {
wxString p = GetProtocol(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); wxString left = GetLeftLocation(location);
wxInputStream *s; wxInputStream *s;
if (GetProtocol(left) != "file") { if (GetProtocol(left) != wxT("file")) {
return NULL; return NULL;
} }
s = new wxZipInputStream(left, right); s = new wxZipInputStream(left, right);
if (s && (s -> LastError() == wxStream_NOERROR)) { if (s && (s -> LastError() == wxStream_NOERROR)) {
return new wxFSFile(s, return new wxFSFile(s,
left + "#zip:" + right, left + wxT("#zip:") + right,
GetMimeTypeFromExt(location), GetMimeTypeFromExt(location),
GetAnchor(location)); GetAnchor(location));
} }
@@ -101,7 +101,7 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags)
m_Archive = NULL; m_Archive = NULL;
} }
if (GetProtocol(left) != "file") { if (GetProtocol(left) != wxT("file")) {
return wxEmptyString; return wxEmptyString;
} }
@@ -146,7 +146,7 @@ wxString wxZipFSHandler::DoFind()
while (match == wxEmptyString) while (match == wxEmptyString)
{ {
unzGetCurrentFileInfo((unzFile)m_Archive, NULL, namebuf, 1024, NULL, 0, NULL, 0); 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; fn = namebuf;
if (fn.Last() == wxT('/')) { if (fn.Last() == wxT('/')) {
fn.RemoveLast(); fn.RemoveLast();

View File

@@ -65,7 +65,7 @@ wxFTP::wxFTP()
m_user = wxT("anonymous"); m_user = wxT("anonymous");
m_passwd = wxGetUserId(); m_passwd = wxGetUserId();
m_passwd += '@'; m_passwd += wxT('@');
m_passwd += wxGetHostName(); m_passwd += wxGetHostName();
SetNotify(0); SetNotify(0);

View File

@@ -455,7 +455,6 @@ wxBitmapList::wxBitmapList ()
wxBitmapList::~wxBitmapList () wxBitmapList::~wxBitmapList ()
{ {
#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First (); wxNode *node = First ();
while (node) while (node)
{ {
@@ -465,13 +464,11 @@ wxBitmapList::~wxBitmapList ()
delete bitmap; delete bitmap;
node = next; node = next;
} }
#endif
} }
// Pen and Brush lists // Pen and Brush lists
wxPenList::~wxPenList () wxPenList::~wxPenList ()
{ {
#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First (); wxNode *node = First ();
while (node) while (node)
{ {
@@ -481,7 +478,6 @@ wxPenList::~wxPenList ()
delete pen; delete pen;
node = next; node = next;
} }
#endif
} }
void wxPenList::AddPen (wxPen * pen) void wxPenList::AddPen (wxPen * pen)
@@ -521,7 +517,6 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
wxBrushList::~wxBrushList () wxBrushList::~wxBrushList ()
{ {
#if defined(__WXMSW__) || defined(__WXMOTIF__)
wxNode *node = First (); wxNode *node = First ();
while (node) while (node)
{ {
@@ -531,7 +526,6 @@ wxBrushList::~wxBrushList ()
delete brush; delete brush;
node = next; node = next;
} }
#endif
} }
void wxBrushList::AddBrush (wxBrush * brush) void wxBrushList::AddBrush (wxBrush * brush)

View File

@@ -64,7 +64,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#define poffset (line * width * 3 + column * 3) #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; int rshift = 0, gshift = 0, bshift = 0;
wxUint8 aByte; wxUint8 aByte;
@@ -97,12 +97,14 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
int height = (int)wxINT32_SWAP_ON_BE( dbuf[1] ); int height = (int)wxINT32_SWAP_ON_BE( dbuf[1] );
if (width > 32767) if (width > 32767)
{ {
wxLogError( wxT("Image width > 32767 pixels for file.") ); if (verbose)
wxLogError( _("BMP: Image width > 32767 pixels for file.") );
return FALSE; return FALSE;
} }
if (height > 32767) if (height > 32767)
{ {
wxLogError( wxT("Image height > 32767 pixels for file.") ); if (verbose)
wxLogError( _("BMP: Image height > 32767 pixels for file.") );
return FALSE; return FALSE;
} }
@@ -115,7 +117,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
int bpp = (int)wxUINT16_SWAP_ON_BE( aWord ); int bpp = (int)wxUINT16_SWAP_ON_BE( aWord );
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32) 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; return FALSE;
} }
@@ -123,7 +126,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] ); int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS) 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; return FALSE;
} }
@@ -136,7 +140,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_RLE8) && (bpp != 8)) ||
((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32))) ((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; return FALSE;
} }
if (bpp < 16) if (bpp < 16)
@@ -144,7 +149,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
cmap = (struct _cmap *)malloc(sizeof(struct _cmap) * ncolors); cmap = (struct _cmap *)malloc(sizeof(struct _cmap) * ncolors);
if (!cmap) if (!cmap)
{ {
wxLogError( wxT("Cannot allocate RAM for color map in BMP file.") ); if (verbose)
wxLogError( _("BMP: Couldn't allocate memory.") );
return FALSE; return FALSE;
} }
} }
@@ -155,7 +161,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
unsigned char *ptr = image->GetData(); unsigned char *ptr = image->GetData();
if (!ptr) if (!ptr)
{ {
wxLogError( wxT("Cannot allocate RAM for RGB data in file.") ); if (verbose)
wxLogError( _("BMP: Couldn't allocate memory.") );
if (cmap) if (cmap)
free(cmap); free(cmap);
return FALSE; return FALSE;
@@ -263,7 +270,8 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
{ {
if (comp == BI_RLE4) 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(); image->Destroy();
free(cmap); free(cmap);
return FALSE; return FALSE;

View File

@@ -45,7 +45,6 @@
class wxImageRefData: public wxObjectRefData class wxImageRefData: public wxObjectRefData
{ {
public: public:
wxImageRefData(); wxImageRefData();
~wxImageRefData(); ~wxImageRefData();
@@ -72,7 +71,8 @@ wxImageRefData::wxImageRefData()
wxImageRefData::~wxImageRefData() wxImageRefData::~wxImageRefData()
{ {
if (m_data) free( m_data ); if (m_data)
free( m_data );
} }
wxList wxImage::sm_handlers; wxList wxImage::sm_handlers;
@@ -195,8 +195,8 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const
wxCHECK_MSG( Ok(), image, wxT("invalid image") ); wxCHECK_MSG( Ok(), image, wxT("invalid image") );
wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()) wxCHECK_MSG( (rect.GetLeft()>=0) && (rect.GetTop()>=0) && (rect.GetRight()<=GetWidth()) && (rect.GetBottom()<=GetHeight()),
, image, wxT("invalid subimage size") ); image, wxT("invalid subimage size") );
int subwidth=rect.GetWidth(); int subwidth=rect.GetWidth();
const int subheight=rect.GetHeight(); const int subheight=rect.GetHeight();
@@ -383,9 +383,9 @@ bool wxImage::LoadFile( const wxString& filename, long type )
wxFileInputStream stream(filename); wxFileInputStream stream(filename);
return LoadFile(stream, type); return LoadFile(stream, type);
} }
else
else { {
wxLogError( wxT("Can't load image from file '%s': file does not exist."), filename.c_str() ); wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
return FALSE; return FALSE;
} }
@@ -402,9 +402,9 @@ bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
wxFileInputStream stream(filename); wxFileInputStream stream(filename);
return LoadFile(stream, mimetype); return LoadFile(stream, mimetype);
} }
else
else { {
wxLogError( wxT("Can't load image from file '%s': file does not exist."), filename.c_str() ); wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
return FALSE; 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; return FALSE;
} }
@@ -491,7 +491,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type )
if (handler == NULL) if (handler == NULL)
{ {
wxLogWarning( wxT("No image handler for type %d defined."), type ); wxLogWarning( _("No image handler for type %d defined."), type );
return FALSE; return FALSE;
} }
@@ -509,7 +509,7 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype )
if (handler == NULL) 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; return FALSE;
} }
@@ -525,7 +525,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type )
if (handler == NULL) if (handler == NULL)
{ {
wxLogWarning( wxT("No image handler for type %d defined."), type ); wxLogWarning( _("No image handler for type %d defined."), type );
return FALSE; return FALSE;
} }
@@ -541,7 +541,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype )
if (handler == NULL) 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; return FALSE;
} }
@@ -680,7 +680,7 @@ bool wxImageHandler::CanRead( const wxString& name )
} }
else { 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; return FALSE;
} }

View File

@@ -54,9 +54,9 @@ bool wxGIFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
{ {
switch (error) switch (error)
{ {
case E_FORMATO: wxLogError(wxT("wxGIFHandler: error in image format")); break; case E_FORMATO: wxLogError(_("GIF: Error in image format.")); break;
case E_MEMORIA: wxLogError(wxT("wxGIFHandler: couldn't allocate memory")); break; case E_MEMORIA: wxLogError(_("GIF: Couldn't allocate memory.")); break;
default: wxLogError(wxT("wxGIFHandler: unknown error !!!")); default: wxLogError(_("GIF: Unknown error."));
} }
} }
delete decod; delete decod;

View File

@@ -169,7 +169,8 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
/* If we get here, the JPEG code has signaled an error. /* 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. * 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); jpeg_destroy_decompress(&cinfo);
if (image->Ok()) image->Destroy(); if (image->Ok()) image->Destroy();
return FALSE; return FALSE;
@@ -280,13 +281,15 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (!verbose) cinfo.err->output_message=NULL; if (!verbose) cinfo.err->output_message=NULL;
/* Establish the setjmp return context for my_error_exit to use. */ /* Establish the setjmp return context for my_error_exit to use. */
if (setjmp(jerr.setjmp_buffer)) { 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 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); if (verbose)
return FALSE; wxLogError(_("JPEG: Couldn't save image."));
jpeg_destroy_compress(&cinfo);
return FALSE;
} }
jpeg_create_compress(&cinfo); jpeg_create_compress(&cinfo);

View File

@@ -229,7 +229,7 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
if (!CanRead(stream)) if (!CanRead(stream))
{ {
if (verbose) if (verbose)
wxLogError(wxT("wxPCXHandler: this is not a PCX file")); wxLogError(_("PCX: this is not a PCX file."));
return FALSE; return FALSE;
} }
@@ -242,10 +242,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
{ {
switch (error) switch (error)
{ {
case E_FORMATO: wxLogError(wxT("wxPCXHandler: image format unsupported")); break; case E_FORMATO: wxLogError(_("PCX: Image format unsupported.")); break;
case E_MEMORIA: wxLogError(wxT("wxPCXHandler: couldn't allocate memory")); break; case E_MEMORIA: wxLogError(_("PCX: Couldn't allocate memory.")); break;
case E_VERSION: wxLogError(wxT("wxPCXHandler: version number too low")); break; case E_VERSION: wxLogError(_("PCX: Wrong version number.")); break;
default: wxLogError(wxT("wxPCXHandler: unknown error !!!")); default: wxLogError(_("PCX: Unknown error."));
} }
} }
image->Destroy(); 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 ) bool wxPCXHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool verbose )
{ {
if (verbose) wxFAIL_MSG(wxT("wxPCXHandler::SaveFile still not implemented"));
wxLogError(wxT("wxPCXHandler::SaveFile still not implemented"));
return FALSE; return FALSE;
} }

View File

@@ -243,7 +243,8 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
error_nolines: error_nolines:
lines = NULL; // called from before it was set lines = NULL; // called from before it was set
error: 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() ) if ( image->Ok() )
{ {

View File

@@ -27,6 +27,7 @@
#include "wx/image.h" #include "wx/image.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/intl.h"
#include "wx/txtstrm.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; wxUint32 width, height;
wxUint16 maxval; 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(); if (buf_stream.GetC()==wxT('P')) c=buf_stream.GetC();
switch (c) switch (c)
{ {
case wxT('2'): case wxT('2'):
wxLogError(wxT("Loading Grey Ascii PNM image is not yet implemented.")); if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented."));
return FALSE; return FALSE;
case wxT('5'): case wxT('5'):
wxLogError(wxT("Loading Grey Raw PNM image is not yet implemented.")); if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented."));
return FALSE; return FALSE;
case wxT('3'): case wxT('6'): break; case wxT('3'):
default : case wxT('6'): break;
wxLogError(wxT("Loading PNM image : file not recognized.")); default:
return FALSE; if (verbose) wxLogError(_("PNM: File format is not recognized."));
} return FALSE;
}
text_stream.ReadLine(); // for the \n text_stream.ReadLine(); // for the \n
Skip_Comment(buf_stream); Skip_Comment(buf_stream);
@@ -93,7 +95,8 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
unsigned char *ptr = image->GetData(); unsigned char *ptr = image->GetData();
if (!ptr) if (!ptr)
{ {
wxLogError( wxT("Cannot allocate RAM for RGB data in PNM file.") ); if (verbose)
wxLogError( _("PNM: Couldn't allocate memory.") );
return FALSE; return FALSE;
} }
@@ -109,7 +112,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
if (buf_stream.LastError()!=wxSTREAM_NOERROR) if (buf_stream.LastError()!=wxSTREAM_NOERROR)
{ {
wxLogError(wxT("Loading PNM image : file seems truncated.")); if (verbose) wxLogError(_("PNM: File seems truncated."));
return FALSE; return FALSE;
} }
} }

View File

@@ -128,7 +128,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (!tif) if (!tif)
{ {
if (verbose) if (verbose)
wxLogError( _("Error loading TIFF image.") ); wxLogError( _("TIFF: Error loading image.") );
return FALSE; return FALSE;
} }
@@ -157,7 +157,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (!raster) if (!raster)
{ {
if (verbose) if (verbose)
wxLogError( _("Not enough memory for loading TIFF image.") ); wxLogError( _("TIFF: Couldn't allocate memory.") );
return FALSE; return FALSE;
} }
@@ -166,7 +166,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (!image->Ok()) if (!image->Ok())
{ {
if (verbose) if (verbose)
wxLogError( _("Not enough memory for loading TIFF image.") ); wxLogError( _("TIFF: Couldn't allocate memory.") );
_TIFFfree( raster ); _TIFFfree( raster );
@@ -176,7 +176,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
if (!TIFFReadRGBAImage( tif, w, h, raster, 0 )) if (!TIFFReadRGBAImage( tif, w, h, raster, 0 ))
{ {
if (verbose) if (verbose)
wxLogError( _("Error reading TIFF image.") ); wxLogError( _("TIFF: Error reading image.") );
_TIFFfree( raster ); _TIFFfree( raster );
image->Destroy(); image->Destroy();

View File

@@ -308,8 +308,8 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0)
FIXME: UNICODE SUPPORT: must use CHARSET specifier! FIXME: UNICODE SUPPORT: must use CHARSET specifier!
*/ */
wxString szName = szName0; wxString szName = szName0;
if(szName.Find('.') != -1) // contains a dot if(szName.Find(wxT('.')) != -1) // contains a dot
szName = szName.Left(szName.Find('.')); szName = szName.Left(szName.Find(wxT('.')));
// FIXME VZ: I forgot the exact meaning of LC_PATH - anyone to remind me? // 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 // KB: search path where to find the mo files, probably : delimited

View File

@@ -363,14 +363,14 @@ void wxPreviewControlBar::CreateButtons()
if (m_buttonFlags & wxPREVIEW_PREVIOUS) 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)); wxSize(buttonWidth, buttonHeight));
x += gap + buttonWidth; x += gap + buttonWidth;
} }
if (m_buttonFlags & wxPREVIEW_NEXT) 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)); wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
x += gap + buttonWidth; x += gap + buttonWidth;
} }

View File

@@ -33,6 +33,7 @@
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/object.h" #include "wx/object.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/intl.h"
#include "wx/gsocket.h" #include "wx/gsocket.h"
#include "wx/sckaddr.h" #include "wx/sckaddr.h"
@@ -103,8 +104,9 @@ wxIPV4address::~wxIPV4address()
bool wxIPV4address::Hostname(const wxString& name) bool wxIPV4address::Hostname(const wxString& name)
{ {
// Some people are sometimes fool. // Some people are sometimes fool.
if (name == wxT("")) { if (name == wxT(""))
wxLogWarning( wxT("Trying to solve a NULL hostname: giving up") ); {
wxLogWarning( _("Trying to solve a NULL hostname: giving up") );
return FALSE; return FALSE;
} }

View File

@@ -33,6 +33,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/intl.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -315,7 +316,7 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes)
if (sig != 0xfeeddead) if (sig != 0xfeeddead)
{ {
wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg")); wxLogWarning( _("TCP: invalid signature returned to ReadMsg."));
goto exit; goto exit;
} }
@@ -451,8 +452,8 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes)
m_defer_timer = NULL; m_defer_timer = NULL;
m_defering = NO_DEFER; m_defering = NO_DEFER;
wxString s; //wxString s;
s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes); //s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes);
//wxLogMessage(s); //wxLogMessage(s);
return nbytes-m_defer_nbytes; return nbytes-m_defer_nbytes;

View File

@@ -162,7 +162,7 @@ bool wxURL::PrepHost(wxString& url)
wxString temp_url; wxString temp_url;
int pos, pos2; int pos, pos2;
if ((url.GetChar(0) != '/') || (url.GetChar(1) != '/')) if ((url.GetChar(0) != wxT('/')) || (url.GetChar(1) != wxT('/')))
return FALSE; return FALSE;
url = url(2, url.Length()); url = url(2, url.Length());
@@ -240,7 +240,7 @@ bool wxURL::FetchProtocol()
// --------- wxURL get ------------------------------------------ // --------- wxURL get ------------------------------------------
// -------------------------------------------------------------- // --------------------------------------------------------------
wxInputStream *wxURL::GetInputStream(void) wxInputStream *wxURL::GetInputStream()
{ {
wxInputStream *the_i_stream = NULL; wxInputStream *the_i_stream = NULL;

View File

@@ -25,7 +25,7 @@
wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) 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 ); wxPanel *p = new wxPanel( this );
wxStaticText *s = new wxStaticText( p, -1, message, wxPoint(20, 20), wxSize(360, 40), wxALIGN_CENTER ); wxStaticText *s = new wxStaticText( p, -1, message, wxPoint(20, 20), wxSize(360, 40), wxALIGN_CENTER );

View File

@@ -124,7 +124,7 @@ wxGenericColourDialog::wxGenericColourDialog()
} }
wxGenericColourDialog::wxGenericColourDialog(wxWindow *parent, wxColourData *data): 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; whichKind = 1;
colourSelection = 0; colourSelection = 0;

View File

@@ -146,7 +146,7 @@ void wxDirItemData::SetNewDirName( wxString path )
bool wxDirItemData::HasSubDirs() bool wxDirItemData::HasSubDirs()
{ {
wxString search = m_path + "/*"; wxString search = m_path + wxT("/*");
wxLogNull log; wxLogNull log;
wxString path = wxFindFirstFile( search, wxDIR ); wxString path = wxFindFirstFile( search, wxDIR );
return (bool)(!path.IsNull()); return (bool)(!path.IsNull());

View File

@@ -174,7 +174,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next Tip")); 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__) #if defined(__WXMSW__)
text->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD)); text->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD));
#else #else

View File

@@ -21,8 +21,7 @@
class wxBrushRefData: public wxObjectRefData class wxBrushRefData: public wxObjectRefData
{ {
public: public:
wxBrushRefData(); wxBrushRefData();
wxBrushRefData( const wxBrushRefData& data ); wxBrushRefData( const wxBrushRefData& data );
@@ -33,14 +32,14 @@ class wxBrushRefData: public wxObjectRefData
wxBrushRefData::wxBrushRefData() wxBrushRefData::wxBrushRefData()
{ {
m_style = 0; m_style = 0;
} }
wxBrushRefData::wxBrushRefData( const wxBrushRefData& data ) wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
{ {
m_style = data.m_style; m_style = data.m_style;
m_stipple = data.m_stipple; m_stipple = data.m_stipple;
m_colour = data.m_colour; m_colour = data.m_colour;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -51,130 +50,130 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush() wxBrush::wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxColour &colour, int style ) wxBrush::wxBrush( const wxColour &colour, int style )
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour; M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBitmap &stippleBitmap ) wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE; M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK; M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap; M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush &brush ) wxBrush::wxBrush( const wxBrush &brush )
{ {
Ref( brush ); Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::~wxBrush() wxBrush::~wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
} }
wxBrush& wxBrush::operator = ( const wxBrush& brush ) wxBrush& wxBrush::operator = ( const wxBrush& brush )
{ {
if (*this == brush) return (*this); if (*this == brush) return (*this);
Ref( brush ); Ref( brush );
return *this; return *this;
} }
bool wxBrush::operator == ( const wxBrush& brush ) bool wxBrush::operator == ( const wxBrush& brush )
{ {
return m_refData == brush.m_refData; return m_refData == brush.m_refData;
} }
bool wxBrush::operator != ( const wxBrush& brush ) bool wxBrush::operator != ( const wxBrush& brush )
{ {
return m_refData != brush.m_refData; return m_refData != brush.m_refData;
} }
bool wxBrush::Ok() const bool wxBrush::Ok() const
{ {
return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
} }
int wxBrush::GetStyle() const int wxBrush::GetStyle() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return 0; return 0;
} }
return M_BRUSHDATA->m_style; return M_BRUSHDATA->m_style;
} }
wxColour &wxBrush::GetColour() const wxColour &wxBrush::GetColour() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return wxNullColour; return wxNullColour;
} }
return M_BRUSHDATA->m_colour; return M_BRUSHDATA->m_colour;
} }
wxBitmap *wxBrush::GetStipple() const wxBitmap *wxBrush::GetStipple() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return &wxNullBitmap; return &wxNullBitmap;
} }
return &M_BRUSHDATA->m_stipple; return &M_BRUSHDATA->m_stipple;
} }
void wxBrush::SetColour( const wxColour& col ) void wxBrush::SetColour( const wxColour& col )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_colour = col; M_BRUSHDATA->m_colour = col;
} }
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_colour.Set( r, g, b ); M_BRUSHDATA->m_colour.Set( r, g, b );
} }
void wxBrush::SetStyle( int style ) void wxBrush::SetStyle( int style )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
} }
void wxBrush::SetStipple( const wxBitmap& stipple ) void wxBrush::SetStipple( const wxBitmap& stipple )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_stipple = stipple; M_BRUSHDATA->m_stipple = stipple;
} }
void wxBrush::Unshare() void wxBrush::Unshare()
{ {
if (!m_refData) if (!m_refData)
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
} }
else else
{ {
wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData );
UnRef(); UnRef();
m_refData = ref; m_refData = ref;
} }
} }

View File

@@ -92,7 +92,6 @@ void wxColour::InitFromName( const wxString &colourName )
if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color )) if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color ))
{ {
wxFAIL_MSG( wxT("wxColour: couldn't find colour") ); wxFAIL_MSG( wxT("wxColour: couldn't find colour") );
wxPrintf( wxT("Colourname %s.\n"), WXSTRINGCAST colourName );
delete m_refData; delete m_refData;
m_refData = (wxObjectRefData *) NULL; m_refData = (wxObjectRefData *) NULL;

View File

@@ -813,7 +813,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharWidth() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); 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); return wxCoord(gdk_string_width( font, "H" ) / m_scaleX);
} }
@@ -821,7 +821,7 @@ wxCoord wxWindowDC::GetCharWidth() const
wxCoord wxWindowDC::GetCharHeight() const wxCoord wxWindowDC::GetCharHeight() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); 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); return wxCoord((font->ascent + font->descent) / m_scaleY);
} }

View File

@@ -84,7 +84,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
} }
else 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 // restore the dash we changed to NUL above
@@ -92,7 +92,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
} }
else 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 // 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") ); wxFAIL_MSG( wxT("wxXX creation failed") );
return; return;
} }
#ifndef __WXGTK12__
wxFAIL_MSG( wxT("TODO") );
#else // GTK+ 1.2
wxString m_message( _("Choose font") ); wxString m_message( _("Choose font") );
m_widget = gtk_font_selection_dialog_new( m_message.mbc_str() ); 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_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );
#endif // GTK+ version
} }
wxFontDialog::~wxFontDialog() wxFontDialog::~wxFontDialog()

View File

@@ -201,7 +201,7 @@ int wxJoystick::GetProductId(void) const
wxString wxJoystick::GetProductName(void) const wxString wxJoystick::GetProductName(void) const
{ {
return ""; return wxT("");
} }
int wxJoystick::GetXMin(void) const int wxJoystick::GetXMin(void) const

View File

@@ -17,7 +17,6 @@
#if wxUSE_SPINCTRL #if wxUSE_SPINCTRL
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/spinbutt.h"
#include <math.h> #include <math.h>
@@ -37,8 +36,6 @@ extern bool g_isIdle;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
static const float sensitivity = 0.02;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "value_changed" // "value_changed"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -50,34 +47,10 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win
if (!win->m_hasVMT) return; if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId());
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 );
event.SetEventObject( win ); event.SetEventObject( win );
event.SetInt( win->GetValue() );
win->GetEventHandler()->ProcessEvent( event ); 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 );
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -21,8 +21,7 @@
class wxBrushRefData: public wxObjectRefData class wxBrushRefData: public wxObjectRefData
{ {
public: public:
wxBrushRefData(); wxBrushRefData();
wxBrushRefData( const wxBrushRefData& data ); wxBrushRefData( const wxBrushRefData& data );
@@ -33,14 +32,14 @@ class wxBrushRefData: public wxObjectRefData
wxBrushRefData::wxBrushRefData() wxBrushRefData::wxBrushRefData()
{ {
m_style = 0; m_style = 0;
} }
wxBrushRefData::wxBrushRefData( const wxBrushRefData& data ) wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
{ {
m_style = data.m_style; m_style = data.m_style;
m_stipple = data.m_stipple; m_stipple = data.m_stipple;
m_colour = data.m_colour; m_colour = data.m_colour;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -51,130 +50,130 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush() wxBrush::wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxColour &colour, int style ) wxBrush::wxBrush( const wxColour &colour, int style )
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour; M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBitmap &stippleBitmap ) wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE; M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK; M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap; M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush &brush ) wxBrush::wxBrush( const wxBrush &brush )
{ {
Ref( brush ); Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::~wxBrush() wxBrush::~wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
} }
wxBrush& wxBrush::operator = ( const wxBrush& brush ) wxBrush& wxBrush::operator = ( const wxBrush& brush )
{ {
if (*this == brush) return (*this); if (*this == brush) return (*this);
Ref( brush ); Ref( brush );
return *this; return *this;
} }
bool wxBrush::operator == ( const wxBrush& brush ) bool wxBrush::operator == ( const wxBrush& brush )
{ {
return m_refData == brush.m_refData; return m_refData == brush.m_refData;
} }
bool wxBrush::operator != ( const wxBrush& brush ) bool wxBrush::operator != ( const wxBrush& brush )
{ {
return m_refData != brush.m_refData; return m_refData != brush.m_refData;
} }
bool wxBrush::Ok() const bool wxBrush::Ok() const
{ {
return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
} }
int wxBrush::GetStyle() const int wxBrush::GetStyle() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return 0; return 0;
} }
return M_BRUSHDATA->m_style; return M_BRUSHDATA->m_style;
} }
wxColour &wxBrush::GetColour() const wxColour &wxBrush::GetColour() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return wxNullColour; return wxNullColour;
} }
return M_BRUSHDATA->m_colour; return M_BRUSHDATA->m_colour;
} }
wxBitmap *wxBrush::GetStipple() const wxBitmap *wxBrush::GetStipple() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( wxT("invalid brush") ); wxFAIL_MSG( wxT("invalid brush") );
return &wxNullBitmap; return &wxNullBitmap;
} }
return &M_BRUSHDATA->m_stipple; return &M_BRUSHDATA->m_stipple;
} }
void wxBrush::SetColour( const wxColour& col ) void wxBrush::SetColour( const wxColour& col )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_colour = col; M_BRUSHDATA->m_colour = col;
} }
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_colour.Set( r, g, b ); M_BRUSHDATA->m_colour.Set( r, g, b );
} }
void wxBrush::SetStyle( int style ) void wxBrush::SetStyle( int style )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
} }
void wxBrush::SetStipple( const wxBitmap& stipple ) void wxBrush::SetStipple( const wxBitmap& stipple )
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_stipple = stipple; M_BRUSHDATA->m_stipple = stipple;
} }
void wxBrush::Unshare() void wxBrush::Unshare()
{ {
if (!m_refData) if (!m_refData)
{ {
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
} }
else else
{ {
wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData ); wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData );
UnRef(); UnRef();
m_refData = ref; m_refData = ref;
} }
} }

View File

@@ -92,7 +92,6 @@ void wxColour::InitFromName( const wxString &colourName )
if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color )) if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color ))
{ {
wxFAIL_MSG( wxT("wxColour: couldn't find colour") ); wxFAIL_MSG( wxT("wxColour: couldn't find colour") );
wxPrintf( wxT("Colourname %s.\n"), WXSTRINGCAST colourName );
delete m_refData; delete m_refData;
m_refData = (wxObjectRefData *) NULL; m_refData = (wxObjectRefData *) NULL;

View File

@@ -813,7 +813,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharWidth() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); 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); return wxCoord(gdk_string_width( font, "H" ) / m_scaleX);
} }
@@ -821,7 +821,7 @@ wxCoord wxWindowDC::GetCharWidth() const
wxCoord wxWindowDC::GetCharHeight() const wxCoord wxWindowDC::GetCharHeight() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); 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); return wxCoord((font->ascent + font->descent) / m_scaleY);
} }

View File

@@ -84,7 +84,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
} }
else 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 // restore the dash we changed to NUL above
@@ -92,7 +92,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
} }
else 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 // 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") ); wxFAIL_MSG( wxT("wxXX creation failed") );
return; return;
} }
#ifndef __WXGTK12__
wxFAIL_MSG( wxT("TODO") );
#else // GTK+ 1.2
wxString m_message( _("Choose font") ); wxString m_message( _("Choose font") );
m_widget = gtk_font_selection_dialog_new( m_message.mbc_str() ); 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_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );
#endif // GTK+ version
} }
wxFontDialog::~wxFontDialog() wxFontDialog::~wxFontDialog()

View File

@@ -201,7 +201,7 @@ int wxJoystick::GetProductId(void) const
wxString wxJoystick::GetProductName(void) const wxString wxJoystick::GetProductName(void) const
{ {
return ""; return wxT("");
} }
int wxJoystick::GetXMin(void) const int wxJoystick::GetXMin(void) const

View File

@@ -17,7 +17,6 @@
#if wxUSE_SPINCTRL #if wxUSE_SPINCTRL
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/spinbutt.h"
#include <math.h> #include <math.h>
@@ -37,8 +36,6 @@ extern bool g_isIdle;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
static const float sensitivity = 0.02;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "value_changed" // "value_changed"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -50,34 +47,10 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win
if (!win->m_hasVMT) return; if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId());
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 );
event.SetEventObject( win ); event.SetEventObject( win );
event.SetInt( win->GetValue() );
win->GetEventHandler()->ProcessEvent( event ); 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 );
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------