From 4693b20c7500190c3cc8c02919c45436bf5efbc9 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Fri, 21 Sep 2001 20:21:44 +0000 Subject: [PATCH] Unicode compilation fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/calendar/calendar.cpp | 13 ++- samples/checklst/checklst.cpp | 3 +- samples/config/conftest.cpp | 4 +- samples/dialogs/dialogs.cpp | 34 +++---- samples/dialup/nettest.cpp | 30 +++--- samples/dnd/dnd.cpp | 147 ++++++++++++++++++++++------- samples/dragimag/dragimag.cpp | 2 +- samples/drawing/drawing.cpp | 46 ++++----- samples/font/font.cpp | 34 +++---- samples/help/Makefile.in | 2 +- samples/help/demo.cpp | 15 ++- samples/help/makefile.vc | 2 +- samples/html/Makefile.vc | 16 ++-- samples/html/helpview/helpview.cpp | 4 +- samples/html/test/test.cpp | 2 +- samples/html/widget/widget.cpp | 4 +- samples/image/image.cpp | 48 +++++----- samples/internat/internat.cpp | 21 ++--- samples/mdi/mdi.cpp | 4 +- samples/menu/menu.cpp | 18 ++-- samples/newgrid/griddemo.cpp | 18 ++-- samples/newgrid/griddemo.h | 2 +- samples/ownerdrw/ownerdrw.cpp | 11 ++- samples/png/pngdemo.cpp | 10 +- samples/proplist/proplist.cpp | 6 +- samples/rotate/rotate.cpp | 4 +- samples/scroll/scroll.cpp | 24 ++--- samples/scrollsub/scrollsub.cpp | 4 +- samples/sockets/Makefile.in | 11 ++- samples/sockets/client.cpp | 28 +++--- samples/sockets/makefile.vc | 4 +- samples/sockets/server.cpp | 7 +- samples/splitter/splitter.cpp | 4 +- samples/statbar/statbar.cpp | 5 +- samples/text/text.cpp | 13 +-- samples/thread/thread.cpp | 24 ++--- samples/treectrl/treectrl.cpp | 76 +++++++-------- samples/treectrl/treectrl.h | 2 +- samples/typetest/typetest.cpp | 78 +++++++-------- samples/wizard/wizard.cpp | 2 +- 40 files changed, 428 insertions(+), 354 deletions(-) diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 195fc2af98..6996c10e6b 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -299,7 +299,7 @@ MyPanel::MyPanel(wxFrame *frame) SetAutoLayout(TRUE); wxString date; - date.Printf("Selected date: %s", + date.Printf(wxT("Selected date: %s"), wxDateTime::Today().FormatISODate().c_str()); m_date = new wxStaticText(this, -1, date); m_calendar = new wxCalendarCtrl(this, Calendar_CalCtrl, @@ -329,31 +329,31 @@ MyPanel::MyPanel(wxFrame *frame) void MyPanel::OnCalendar(wxCalendarEvent& event) { - wxLogMessage("Selected %s from calendar", + wxLogMessage(wxT("Selected %s from calendar"), event.GetDate().FormatISODate().c_str()); } void MyPanel::OnCalendarChange(wxCalendarEvent& event) { wxString s; - s.Printf("Selected date: %s", event.GetDate().FormatISODate().c_str()); + s.Printf(wxT("Selected date: %s"), event.GetDate().FormatISODate().c_str()); m_date->SetLabel(s); } void MyPanel::OnCalMonthChange(wxCalendarEvent& WXUNUSED(event)) { - wxLogStatus("Calendar month changed"); + wxLogStatus(wxT("Calendar month changed")); } void MyPanel::OnCalYearChange(wxCalendarEvent& WXUNUSED(event)) { - wxLogStatus("Calendar year changed"); + wxLogStatus(wxT("Calendar year changed")); } void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event) { - wxLogMessage("Clicked on %s", + wxLogMessage(wxT("Clicked on %s"), wxDateTime::GetWeekDayName(event.GetWeekDay()).c_str()); } @@ -392,4 +392,3 @@ void MyPanel::HighlightSpecial(bool on) m_calendar->Refresh(); } - diff --git a/samples/checklst/checklst.cpp b/samples/checklst/checklst.cpp index c5d5cd7580..553bf0760c 100644 --- a/samples/checklst/checklst.cpp +++ b/samples/checklst/checklst.cpp @@ -204,8 +204,7 @@ void CheckListBoxFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void CheckListBoxFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(wxT("Demo of wxCheckListBox control\n" - "© Vadim Zeitlin 1998-1999"), + wxMessageBox(wxT("Demo of wxCheckListBox control\n© Vadim Zeitlin 1998-1999"), wxT("About wxCheckListBox"), wxICON_INFORMATION, this); } diff --git a/samples/config/conftest.cpp b/samples/config/conftest.cpp index 16ced7f3fe..19b06638e3 100644 --- a/samples/config/conftest.cpp +++ b/samples/config/conftest.cpp @@ -194,11 +194,11 @@ MyFrame::MyFrame() wxString s; if ( pConfig->Read("TestValue", &s) ) { - wxLogStatus(this, "TestValue from config is '%s'", s.c_str()); + wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str()); } else { - wxLogStatus(this, "TestValue not found in the config"); + wxLogStatus(this, wxT("TestValue not found in the config")); } } diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index c27afabc23..1420859da4 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -278,20 +278,20 @@ void MyFrame::LogDialog(wxCommandEvent& event) // being flushed -- test it { wxBusyCursor bc; - wxLogMessage("This is some message - everything is ok so far."); - wxLogMessage("Another message...\n... this one is on multiple lines"); - wxLogWarning("And then something went wrong!"); + wxLogMessage(wxT("This is some message - everything is ok so far.")); + wxLogMessage(wxT("Another message...\n... this one is on multiple lines")); + wxLogWarning(wxT("And then something went wrong!")); // and if ~wxBusyCursor doesn't do it, then call it manually wxYield(); } - wxLogError("Intermediary error handler decided to abort."); - wxLogError("The top level caller detected an unrecoverable error."); + wxLogError(wxT("Intermediary error handler decided to abort.")); + wxLogError(wxT("The top level caller detected an unrecoverable error.")); wxLog::FlushActive(); - wxLogMessage("And this is the same dialog but with only one message."); + wxLogMessage(wxT("And this is the same dialog but with only one message.")); } void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) ) @@ -333,7 +333,7 @@ void MyFrame::PasswordEntry(wxCommandEvent& WXUNUSED(event)) this); if ( !!pwd ) { - wxMessageBox(wxString::Format("Your password is '%s'", pwd.c_str()), + wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd.c_str()), "Got password", wxOK | wxICON_INFORMATION, this); } } @@ -386,10 +386,10 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) ) if ( count ) { wxString msg; - msg.Printf("You selected %u items:\n", count); + msg.Printf(wxT("You selected %u items:\n"), count); for ( size_t n = 0; n < count; n++ ) { - msg += wxString::Format("\t%u: %u (%s)\n", n, selections[n], + msg += wxString::Format(wxT("\t%u: %u (%s)\n"), n, selections[n], choices[selections[n]].c_str()); } wxLogMessage(msg); @@ -515,8 +515,8 @@ void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) ) dialog2.ShowModal(); } #else - wxLogError("Sorry, generic dir dialog not available:\n" - "set wxUSE_DIRDLGG to 1 and recompile"); + wxLogError(wxT("Sorry, generic dir dialog not available:\n") + wxT("set wxUSE_DIRDLGG to 1 and recompile")); #endif } @@ -615,11 +615,11 @@ void MyFrame::ShowProgress( wxCommandEvent& WXUNUSED(event) ) if ( !cont ) { - wxLogStatus("Progress dialog aborted!"); + wxLogStatus(wxT("Progress dialog aborted!")); } else { - wxLogStatus("Countdown from %d finished", max); + wxLogStatus(wxT("Countdown from %d finished"), max); } } @@ -669,7 +669,7 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT ) { - wxLogMessage("Find %s'%s' (flags: %s)", + wxLogMessage(wxT("Find %s'%s' (flags: %s)"), type == wxEVT_COMMAND_FIND_NEXT ? "next " : "", event.GetFindString().c_str(), DecodeFindDialogEventFlags(event.GetFlags()).c_str()); @@ -677,7 +677,7 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) else if ( type == wxEVT_COMMAND_FIND_REPLACE || type == wxEVT_COMMAND_FIND_REPLACE_ALL ) { - wxLogMessage("Replace %s'%s' with '%s' (flags: %s)", + wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"), type == wxEVT_COMMAND_FIND_REPLACE_ALL ? "all " : "", event.GetFindString().c_str(), event.GetReplaceString().c_str(), @@ -685,13 +685,13 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) } else if ( type == wxEVT_COMMAND_FIND_CLOSE ) { - wxLogMessage("Find dialog is being closed."); + wxLogMessage(wxT("Find dialog is being closed.")); event.GetDialog()->Destroy(); } else { - wxLogError("Unknown find dialog event!"); + wxLogError(wxT("Unknown find dialog event!")); } } diff --git a/samples/dialup/nettest.cpp b/samples/dialup/nettest.cpp index adad854763..c5e727bf5e 100644 --- a/samples/dialup/nettest.cpp +++ b/samples/dialup/nettest.cpp @@ -164,7 +164,7 @@ bool MyApp::OnInit() if ( !m_dial->IsOk() ) { - wxLogError("The sample can't run on this system."); + wxLogError(wxT("The sample can't run on this system.")); wxLog::GetActiveTarget()->Flush(); @@ -189,18 +189,18 @@ int MyApp::OnExit() void MyApp::OnConnected(wxDialUpEvent& event) { - const char *msg; + const wxChar *msg; if ( event.IsOwnEvent() ) { - msg = event.IsConnectedEvent() ? "Successfully connected" - : "Dialing failed"; + msg = event.IsConnectedEvent() ? wxT("Successfully connected") + : wxT("Dialing failed"); - wxLogStatus(""); + wxLogStatus(wxT("")); } else { - msg = event.IsConnectedEvent() ? "Just connected!" - : "Disconnected"; + msg = event.IsConnectedEvent() ? wxT("Just connected!") + : wxT("Disconnected"); } wxLogMessage(msg); @@ -262,27 +262,27 @@ void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event)) { if ( wxGetApp().GetDialer()->HangUp() ) { - wxLogStatus(this, "Connection was succesfully terminated."); + wxLogStatus(this, wxT("Connection was succesfully terminated.")); } else { - wxLogStatus(this, "Failed to hang up."); + wxLogStatus(this, wxT("Failed to hang up.")); } } void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event)) { - wxLogStatus(this, "Preparing to dial..."); + wxLogStatus(this, wxT("Preparing to dial...")); wxYield(); wxBeginBusyCursor(); if ( wxGetApp().GetDialer()->Dial() ) { - wxLogStatus(this, "Dialing..."); + wxLogStatus(this, wxT("Dialing...")); } else { - wxLogStatus(this, "Dialing attempt failed."); + wxLogStatus(this, wxT("Dialing attempt failed.")); } wxEndBusyCursor(); @@ -291,9 +291,9 @@ void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCheck(wxCommandEvent& WXUNUSED(event)) { if(wxGetApp().GetDialer()->IsOnline()) - wxLogMessage("Network is online."); + wxLogMessage(wxT("Network is online.")); else - wxLogMessage("Network is offline."); + wxLogMessage(wxT("Network is offline.")); } void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event)) @@ -302,7 +302,7 @@ void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event)) size_t nCount = wxGetApp().GetDialer()->GetISPNames(names); if ( nCount == 0 ) { - wxLogWarning("No ISPs found."); + wxLogWarning(wxT("No ISPs found.")); } else { diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 4f5f76d60e..164dd9c712 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -29,6 +29,12 @@ #define USE_METAFILES #endif // Windows +#define USE_RESOURCES 0 +#if !wxUSE_RESOURCES +#undef USE_RESOURCES +#define USE_RESOURCES 0 +#endif + #include "wx/intl.h" #include "wx/log.h" @@ -38,7 +44,11 @@ #include "wx/image.h" #include "wx/clipbrd.h" #include "wx/colordlg.h" -#include "wx/resource.h" +#if USE_RESOURCES + #include "wx/resource.h" +#else + #include "wx/sizer.h" +#endif #ifdef USE_METAFILES #include "wx/metafile.h" @@ -84,7 +94,7 @@ private: // Define a custom dtop target accepting URLs // ---------------------------------------------------------------------------- -class WXDLLEXPORT URLDropTarget : public wxDropTarget +class URLDropTarget : public wxDropTarget { public: URLDropTarget() { SetDataObject(new wxURLDataObject); } @@ -342,12 +352,12 @@ public: const wxColour& col) : DnDShape(pos, size, col) { - wxLogMessage("DnDTriangularShape is being created"); + wxLogMessage(wxT("DnDTriangularShape is being created")); } virtual ~DnDTriangularShape() { - wxLogMessage("DnDTriangularShape is being deleted"); + wxLogMessage(wxT("DnDTriangularShape is being deleted")); } virtual Kind GetKind() const { return Triangle; } @@ -379,12 +389,12 @@ public: const wxColour& col) : DnDShape(pos, size, col) { - wxLogMessage("DnDRectangularShape is being created"); + wxLogMessage(wxT("DnDRectangularShape is being created")); } virtual ~DnDRectangularShape() { - wxLogMessage("DnDRectangularShape is being deleted"); + wxLogMessage(wxT("DnDRectangularShape is being deleted")); } virtual Kind GetKind() const { return Rectangle; } @@ -416,12 +426,12 @@ public: const wxColour& col) : DnDShape(pos, size, col) { - wxLogMessage("DnDEllipticShape is being created"); + wxLogMessage(wxT("DnDEllipticShape is being created")); } virtual ~DnDEllipticShape() { - wxLogMessage("DnDEllipticShape is being deleted"); + wxLogMessage(wxT("DnDEllipticShape is being deleted")); } virtual Kind GetKind() const { return Ellipse; } @@ -441,7 +451,7 @@ public: // A wxDataObject specialisation for the application-specific data // ---------------------------------------------------------------------------- -static const char *shapeFormatId = "wxShape"; +static const wxChar *shapeFormatId = wxT("wxShape"); class DnDShapeDataObject : public wxDataObject { @@ -560,7 +570,7 @@ public: else { wxASSERT_MSG( m_dobjBitmap.IsSupported(format), - "unexpected format" ); + wxT("unexpected format") ); if ( !m_hasBitmap ) CreateBitmap(); @@ -589,7 +599,7 @@ public: else { wxASSERT_MSG( m_dobjBitmap.IsSupported(format), - "unexpected format" ); + wxT("unexpected format") ); if ( !m_hasBitmap ) CreateBitmap(); @@ -601,7 +611,8 @@ public: virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf) { - wxCHECK_MSG( format == m_formatShape, FALSE, "unsupported format" ); + wxCHECK_MSG( format == m_formatShape, FALSE, + wxT( "unsupported format") ); delete m_shape; m_shape = DnDShape::New(buf); @@ -729,7 +740,7 @@ public: { if ( !GetData() ) { - wxLogError("Failed to get drag and drop data"); + wxLogError(wxT("Failed to get drag and drop data")); return wxDragNone; } @@ -841,6 +852,7 @@ END_EVENT_TABLE() // `Main program' equivalent, creating windows and returning main app frame bool DnDApp::OnInit() { +#if USE_RESOURCES // load our ressources wxPathList pathList; pathList.Add("."); @@ -852,13 +864,14 @@ bool DnDApp::OnInit() wxString path = pathList.FindValidPath("dnd.wxr"); if ( !path ) { - wxLogError("Can't find the resource file dnd.wxr in the current " - "directory, aborting."); + wxLogError(wxT("Can't find the resource file dnd.wxr in the current ") + wxT("directory, aborting.")); return FALSE; } wxDefaultResourceTable->ParseResourceFile(path); +#endif // switch on trace messages #if defined(__WXGTK__) @@ -1030,7 +1043,7 @@ void DnDFrame::OnNewFrame(wxCommandEvent& WXUNUSED(event)) { (new DnDShapeFrame(this))->Show(TRUE); - wxLogStatus(this, "Double click the new frame to select a shape for it"); + wxLogStatus(this, wxT("Double click the new frame to select a shape for it")); } void DnDFrame::OnDrag(wxCommandEvent& WXUNUSED(event)) @@ -1316,27 +1329,27 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event)) wxClipboardLocker locker; if ( !locker ) { - wxLogError("Can't open clipboard"); + wxLogError(wxT("Can't open clipboard")); } else { if ( !wxTheClipboard->AddData(dobj) ) { - wxLogError("Can't copy file(s) to the clipboard"); + wxLogError(wxT("Can't copy file(s) to the clipboard")); } else { - wxLogStatus(this, "%d file%s copied to the clipboard", - count, count == 1 ? "" : "s"); + wxLogStatus(this, wxT("%d file%s copied to the clipboard"), + count, count == 1 ? wxT("") : wxT("s")); } } } else { - wxLogStatus(this, "Aborted"); + wxLogStatus(this, wxT("Aborted")); } #else // !MSW - wxLogError("Sorry, not implemented"); + wxLogError(wxT("Sorry, not implemented")); #endif // MSW/!MSW } @@ -1425,9 +1438,14 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) // ---------------------------------------------------------------------------- DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) +#if !USE_RESOURCES + :wxDialog( parent, 6001, wxT("Choose Shape"), wxPoint( 10, 10 ), + wxSize( 40, 40 ), + wxRAISED_BORDER|wxCAPTION|wxTHICK_FRAME|wxSYSTEM_MENU ) +#endif { m_shape = shape; - +#if USE_RESOURCES LoadFromResource(parent, "dialogShape"); m_textX = (wxTextCtrl *)wxFindWindowByName("textX", this); @@ -1436,6 +1454,69 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) m_textH = (wxTextCtrl *)wxFindWindowByName("textH", this); m_radio = (wxRadioBox *)wxFindWindowByName("radio", this); +#else + wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL ); + + // radio box + wxBoxSizer* shapesSizer = new wxBoxSizer( wxHORIZONTAL ); + const wxString choices[] = { wxT("None"), wxT("Triangle"), + wxT("Rectangle"), wxT("Ellipse") }; + + m_radio = new wxRadioBox( this, -1, wxT("&Shape"), + wxDefaultPosition, wxDefaultSize, 4, choices, 4, + wxRA_SPECIFY_COLS ); + shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 ); + topSizer->Add( shapesSizer, 0, wxALL, 2 ); + + // attributes + wxStaticBox* box = new wxStaticBox( this, -1, wxT("&Attributes") ); + wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL ); + wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 4, 2 ); + + wxStaticText* st; + + st = new wxStaticText( this, -1, wxT("Position &X:") ); + m_textX = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, + wxSize( 30, 20 ) ); + xywhSizer->Add( st, 1, wxGROW|wxALL, 2 ); + xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 ); + + st = new wxStaticText( this, -1, wxT("Size &width:") ); + m_textW = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, + wxSize( 30, 20 ) ); + xywhSizer->Add( st, 1, wxGROW|wxALL, 2 ); + xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 ); + + st = new wxStaticText( this, -1, wxT("&Y:") ); + m_textY = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, + wxSize( 30, 20 ) ); + xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 ); + xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 ); + + st = new wxStaticText( this, -1, wxT("&height:") ); + m_textH = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, + wxSize( 30, 20 ) ); + xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 ); + xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 ); + + wxButton* col = new wxButton( this, Button_Colour, wxT("&Colour...") ); + attrSizer->Add( xywhSizer, 1, wxGROW ); + attrSizer->Add( col, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2 ); + topSizer->Add( attrSizer, 0, wxGROW|wxALL, 5 ); + + // buttons + wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL ); + wxButton* bt; + bt = new wxButton( this, wxID_OK, wxT("Ok") ); + buttonSizer->Add( bt, 0, wxALL, 2 ); + bt = new wxButton( this, wxID_CANCEL, wxT("Cancel") ); + buttonSizer->Add( bt, 0, wxALL, 2 ); + topSizer->Add( buttonSizer, 0, wxALL|wxALIGN_RIGHT, 2 ); + + SetAutoLayout( TRUE ); + SetSizer( topSizer ); + topSizer->Fit( this ); +#endif } DnDShape *DnDShapeDialog::GetShape() const @@ -1479,10 +1560,10 @@ bool DnDShapeDialog::TransferDataFromWindow() { m_shapeKind = (DnDShape::Kind)m_radio->GetSelection(); - m_pos.x = atoi(m_textX->GetValue()); - m_pos.y = atoi(m_textY->GetValue()); - m_size.x = atoi(m_textW->GetValue()); - m_size.y = atoi(m_textH->GetValue()); + m_pos.x = wxAtoi(m_textX->GetValue()); + m_pos.y = wxAtoi(m_textY->GetValue()); + m_size.x = wxAtoi(m_textW->GetValue()); + m_size.y = wxAtoi(m_textH->GetValue()); if ( !m_pos.x || !m_pos.y || !m_size.x || !m_size.y ) { @@ -1582,7 +1663,7 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event) { default: case wxDragError: - wxLogError("An error occured during drag and drop operation"); + wxLogError(wxT("An error occured during drag and drop operation")); break; case wxDragNone: @@ -1621,7 +1702,7 @@ void DnDShapeFrame::OnDrop(wxCoord x, wxCoord y, DnDShape *shape) wxPoint pt(x, y); wxString s; - s.Printf("Shape dropped at (%ld, %ld)", pt.x, pt.y); + s.Printf(wxT("Shape dropped at (%ld, %ld)"), pt.x, pt.y); SetStatusText(s); shape->Move(pt); @@ -1661,7 +1742,7 @@ void DnDShapeFrame::OnCopyShape(wxCommandEvent& event) wxClipboardLocker clipLocker; if ( !clipLocker ) { - wxLogError("Can't open the clipboard"); + wxLogError(wxT("Can't open the clipboard")); return; } @@ -1675,7 +1756,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& event) wxClipboardLocker clipLocker; if ( !clipLocker ) { - wxLogError("Can't open the clipboard"); + wxLogError(wxT("Can't open the clipboard")); return; } @@ -1687,7 +1768,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& event) } else { - wxLogStatus("No shape on the clipboard"); + wxLogStatus(wxT("No shape on the clipboard")); } } @@ -1740,7 +1821,7 @@ DnDShape *DnDShape::New(const void *buf) wxColour(dump.r, dump.g, dump.b)); default: - wxFAIL_MSG("invalid shape!"); + wxFAIL_MSG(wxT("invalid shape!")); return NULL; } } diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index a0732462dc..a8e88e1fd7 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -393,7 +393,7 @@ bool MyApp::OnInit() for (i = 1; i < 4; i++) { wxString filename; - filename.Printf("%s%d.png", (const char*) rootName, i); + filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i); if (image.LoadFile(filename, wxBITMAP_TYPE_PNG)) { DragShape* newShape = new DragShape(image.ConvertToBitmap()); diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 9fdf5136d3..145fdf19e6 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -310,9 +310,9 @@ bool MyApp::OnInit() if ( !LoadImages() ) { - wxLogError("Can't load one of the bitmap files needed for this sample " - "from the current or parent directory, please copy them " - "there."); + wxLogError(wxT("Can't load one of the bitmap files needed ") + wxT("for this sample from the current or parent ") + wxT("directory, please copy them there.")); // stop here DeleteBitmaps(); @@ -572,7 +572,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) { dc.SetPen( wxPen( "black", width, wxSOLID) ); dc.SetBrush( *wxRED_BRUSH ); - dc.DrawText(wxString::Format("Testing lines of width %d", width), x + 10, y - 10); + dc.DrawText(wxString::Format(wxT("Testing lines of width %d"), width), x + 10, y - 10); dc.DrawRectangle( x+10, y+10, 100, 190 ); dc.DrawText("Solid/dot/short dash/long dash/dot dash", x + 150, y + 10); @@ -833,7 +833,7 @@ void MyCanvas::DrawText(wxDC& dc) for ( int n = -180; n < 180; n += 30 ) { - text.Printf(" %d rotated text", n); + text.Printf(wxT(" %d rotated text"), n); dc.DrawRotatedText(text , 400, 400, n); } @@ -845,10 +845,10 @@ void MyCanvas::DrawText(wxDC& dc) long height; long descent; dc.GetTextExtent( "This is Swiss 18pt text.", &length, &height, &descent ); - text.Printf( "Dimensions are length %ld, height %ld, descent %ld", length, height, descent ); + text.Printf( wxT("Dimensions are length %ld, height %ld, descent %ld"), length, height, descent ); dc.DrawText( text, 110, 80 ); - text.Printf( "CharHeight() returns: %d", dc.GetCharHeight() ); + text.Printf( wxT("CharHeight() returns: %d"), dc.GetCharHeight() ); dc.DrawText( text, 110, 120 ); dc.DrawRectangle( 100, 40, 4, height ); @@ -878,21 +878,21 @@ static const struct int rop; } rasterOperations[] = { - { "wxAND", wxAND }, - { "wxAND_INVERT", wxAND_INVERT }, - { "wxAND_REVERSE", wxAND_REVERSE }, - { "wxCLEAR", wxCLEAR }, - { "wxCOPY", wxCOPY }, - { "wxEQUIV", wxEQUIV }, - { "wxINVERT", wxINVERT }, - { "wxNAND", wxNAND }, - { "wxNO_OP", wxNO_OP }, - { "wxOR", wxOR }, - { "wxOR_INVERT", wxOR_INVERT }, - { "wxOR_REVERSE", wxOR_REVERSE }, - { "wxSET", wxSET }, - { "wxSRC_INVERT", wxSRC_INVERT }, - { "wxXOR", wxXOR }, + { wxT("wxAND"), wxAND }, + { wxT("wxAND_INVERT"), wxAND_INVERT }, + { wxT("wxAND_REVERSE"), wxAND_REVERSE }, + { wxT("wxCLEAR"), wxCLEAR }, + { wxT("wxCOPY"), wxCOPY }, + { wxT("wxEQUIV"), wxEQUIV }, + { wxT("wxINVERT"), wxINVERT }, + { wxT("wxNAND"), wxNAND }, + { wxT("wxNO_OP"), wxNO_OP }, + { wxT("wxOR"), wxOR }, + { wxT("wxOR_INVERT"), wxOR_INVERT }, + { wxT("wxOR_REVERSE"), wxOR_REVERSE }, + { wxT("wxSET"), wxSET }, + { wxT("wxSRC_INVERT"), wxSRC_INVERT }, + { wxT("wxXOR"), wxXOR }, }; void MyCanvas::DrawImages(wxDC& dc) @@ -1128,7 +1128,7 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event) long x = dc.DeviceToLogicalX( pos.x ); long y = dc.DeviceToLogicalY( pos.y ); wxString str; - str.Printf( "Current mouse position: %d,%d", (int)x, (int)y ); + str.Printf( wxT("Current mouse position: %d,%d"), (int)x, (int)y ); m_owner->SetStatusText( str ); } diff --git a/samples/font/font.cpp b/samples/font/font.cpp index d919ea6a59..472ac4a4ab 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -273,7 +273,7 @@ protected: const wxString& encoding) { wxString text; - text.Printf("Encoding %d: %s (available in facename '%s')\n", + text.Printf(wxT("Encoding %d: %s (available in facename '%s')\n"), ++m_n, encoding.c_str(), facename.c_str()); m_text += text; return TRUE; @@ -290,7 +290,7 @@ void MyFrame::OnEnumerateEncodings(wxCommandEvent& WXUNUSED(event)) fontEnumerator.EnumerateEncodings(); - wxLogMessage("Enumerating all available encodings:\n%s", + wxLogMessage(wxT("Enumerating all available encodings:\n%s"), fontEnumerator.GetText().c_str()); } @@ -329,8 +329,8 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, int nFacenames = fontEnumerator.GetFacenames().GetCount(); if ( !silent ) { - wxLogStatus(this, "Found %d %sfonts", - nFacenames, fixedWidthOnly ? "fixed width " : ""); + wxLogStatus(this, wxT("Found %d %sfonts"), + nFacenames, fixedWidthOnly ? wxT("fixed width ") : wxT("")); } wxString facename; @@ -368,7 +368,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, } else if ( !silent ) { - wxLogWarning("No such fonts found."); + wxLogWarning(wxT("No such fonts found.")); } return FALSE; @@ -419,15 +419,15 @@ void MyFrame::OnCheckNativeToFromString(wxCommandEvent& WXUNUSED(event)) if ( fontInfo.IsEmpty() ) { - wxLogError("Native font info string is empty!"); + wxLogError(wxT("Native font info string is empty!")); } else { wxFont *font = wxFont::New(fontInfo); if ( fontInfo != font->GetNativeFontInfoDesc() ) - wxLogError("wxNativeFontInfo ToString()/FromString() broken!"); + wxLogError(wxT("wxNativeFontInfo ToString()/FromString() broken!")); else - wxLogError("wxNativeFontInfo works: %s", fontInfo.c_str()); + wxLogError(wxT("wxNativeFontInfo works: %s"), fontInfo.c_str()); delete font; } } @@ -526,7 +526,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) if ( line.Left(len) == prefix ) { // found! - const char *pc = line.c_str() + len; + const wxChar *pc = line.c_str() + len; if ( *pc == '"' ) pc++; @@ -541,7 +541,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) if ( !charset ) { - wxLogError("The file '%s' doesn't contain charset information.", + wxLogError(wxT("The file '%s' doesn't contain charset information."), filename.c_str()); return; @@ -551,7 +551,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) wxFontEncoding fontenc = wxTheFontMapper->CharsetToEncoding(charset); if ( fontenc == wxFONTENCODING_SYSTEM ) { - wxLogError("Charset '%s' is unsupported.", charset.c_str()); + wxLogError(wxT("Charset '%s' is unsupported."), charset.c_str()); return; } @@ -573,13 +573,13 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) } else { - wxLogWarning("Cannot convert from '%s' to '%s'.", + wxLogWarning(wxT("Cannot convert from '%s' to '%s'."), wxFontMapper::GetEncodingDescription(fontenc).c_str(), wxFontMapper::GetEncodingDescription(encAlt).c_str()); } } else - wxLogWarning("No fonts for encoding '%s' on this system.", + wxLogWarning(wxT("No fonts for encoding '%s' on this system."), wxFontMapper::GetEncodingDescription(fontenc).c_str()); } @@ -595,7 +595,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) } else { - wxLogWarning("No fonts for encoding '%s' on this system.", + wxLogWarning(wxT("No fonts for encoding '%s' on this system."), wxFontMapper::GetEncodingDescription(fontenc).c_str()); } } @@ -667,7 +667,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // output the font name/info wxString fontInfo; - fontInfo.Printf("Font size is %d points, family is %s, style %s, weight %s", + fontInfo.Printf(wxT("Font size is %d points, family is %s, style %s, weight %s"), m_font.GetPointSize(), m_font.GetFamilyString().c_str(), m_font.GetStyleString().c_str(), @@ -679,7 +679,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxString fontDesc = m_font.GetNativeFontInfoDesc(); dc.SetFont(m_font); - fontInfo.Printf("Native font info: %s", fontDesc.c_str()); + fontInfo.Printf(wxT("Native font info: %s"), fontDesc.c_str()); dc.DrawText(fontInfo, 5, 5 + dc.GetCharHeight()); } @@ -700,7 +700,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { for ( int j = 0; j < 32; j++ ) { - dc.DrawText(char(32*i + j), x + w*j, y + h*i); + dc.DrawText(wxChar(32*i + j), x + w*j, y + h*i); } } diff --git a/samples/help/Makefile.in b/samples/help/Makefile.in index ef4f2ae6a7..1ab0a6a898 100644 --- a/samples/help/Makefile.in +++ b/samples/help/Makefile.in @@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../.. program_dir = samples/help -PROGRAM=help +PROGRAM=demo OBJECTS =demo.o DEPFILES=demo.d diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index f97e551d24..a74435de3a 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -312,7 +312,7 @@ bool MyApp::OnInit() // using HTML help if ( !frame->GetHelpController().Initialize("doc") ) { - wxLogError("Cannot initialize the help system, aborting."); + wxLogError(wxT("Cannot initialize the help system, aborting.")); return FALSE; } @@ -320,7 +320,7 @@ bool MyApp::OnInit() #if wxUSE_MS_HTML_HELP if( !frame->GetMSHtmlHelpController().Initialize("doc") ) { - wxLogError("Cannot initialize the MS HTML Help system."); + wxLogError(wxT("Cannot initialize the MS HTML Help system.")); } #endif @@ -328,7 +328,7 @@ bool MyApp::OnInit() // you need to call Initialize in order to use wxBestHelpController if( !frame->GetBestHelpController().Initialize("doc") ) { - wxLogError("Cannot initialize the best help system, aborting."); + wxLogError(wxT("Cannot initialize the best help system, aborting.")); } #endif @@ -338,7 +338,7 @@ bool MyApp::OnInit() #if USE_OLD_HTML_HELP if ( !frame->GetHtmlHelpController().Initialize("doc") ) { - wxLogError("Cannot initialize the HTML help system, aborting."); + wxLogError(wxT("Cannot initialize the HTML help system, aborting.")); return FALSE; } @@ -348,7 +348,7 @@ bool MyApp::OnInit() // (zipped) form if ( !frame->GetAdvancedHtmlHelpController().Initialize("doc") ) { - wxLogError("Cannot initialize the advanced HTML help system, aborting."); + wxLogError(wxT("Cannot initialize the advanced HTML help system, aborting.")); return FALSE; } @@ -513,7 +513,7 @@ void MyFrame::OnMSHtmlHelp(wxCommandEvent& event) void MyFrame::OnBestHelp(wxCommandEvent& event) { -#if wxUSE_MS_HTML_HELP && wxUSE_HTML +#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP ShowHelp(event.GetId(), m_bestHelp); #endif } @@ -691,8 +691,7 @@ MyModalDialog::MyModalDialog(wxWindow *parent) wxTextCtrl *text = new wxTextCtrl(this, -1, wxT("A demo text control"), wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE); - text->SetHelpText(_("Type text here if you have got nothing more " - "interesting to do")); + text->SetHelpText(_("Type text here if you have got nothing more interesting to do")); sizerTop->Add(text, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); sizerTop->Add(sizerRow, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); diff --git a/samples/help/makefile.vc b/samples/help/makefile.vc index 723b606f7e..19d4592590 100644 --- a/samples/help/makefile.vc +++ b/samples/help/makefile.vc @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) PROGRAM=demo -EXTRALIBS=htmlhelp.lib +# EXTRALIBS=htmlhelp.lib OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/samples/html/Makefile.vc b/samples/html/Makefile.vc index 948b7720b9..81d5a067ef 100644 --- a/samples/html/Makefile.vc +++ b/samples/html/Makefile.vc @@ -23,21 +23,21 @@ LINK_DEBUG_FLAGS="/RELEASE" all: cd $(WXDIR)\samples\html\about - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\help - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\helpview - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\printing - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\test - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\virtual - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\widget - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\html\zip - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) clean: cd $(WXDIR)\samples\html\about diff --git a/samples/html/helpview/helpview.cpp b/samples/html/helpview/helpview.cpp index a6165db270..f8cb26d42a 100644 --- a/samples/html/helpview/helpview.cpp +++ b/samples/html/helpview/helpview.cpp @@ -70,8 +70,8 @@ bool MyApp::OnInit() help = new wxHtmlHelpController; if (argc < 2) { - wxLogError("Usage : helpview []"); - wxLogError(" helpfile may be .hhp, .zip or .htb"); + wxLogError(wxT("Usage : helpview []")); + wxLogError(wxT(" helpfile may be .hhp, .zip or .htb")); return FALSE; } diff --git a/samples/html/test/test.cpp b/samples/html/test/test.cpp index cd299a8bf3..0bbf21fd5f 100644 --- a/samples/html/test/test.cpp +++ b/samples/html/test/test.cpp @@ -212,7 +212,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageOpen(wxCommandEvent& WXUNUSED(event)) { - wxString p = wxFileSelector("Open HTML document", "", "", "", "HTML files|*.htm"); + wxString p = wxFileSelector(wxT("Open HTML document"), wxT(""), wxT(""), wxT(""), wxT("HTML files|*.htm")); if (p != wxEmptyString) m_Html -> LoadPage(p); } diff --git a/samples/html/widget/widget.cpp b/samples/html/widget/widget.cpp index c0f8105a8c..43f03c55ed 100644 --- a/samples/html/widget/widget.cpp +++ b/samples/html/widget/widget.cpp @@ -47,8 +47,8 @@ TAG_HANDLER_BEGIN(MYBIND, "MYBIND") int ax, ay; int fl = 0; - tag.ScanParam("X", "%i", &ax); - tag.ScanParam("Y", "%i", &ay); + tag.ScanParam(wxT("X"), wxT("%i"), &ax); + tag.ScanParam(wxT("Y"), wxT("%i"), &ay); if (tag.HasParam("FLOAT")) fl = ax; wnd = new wxTextCtrl( m_WParser -> GetWindow(), -1, tag.GetParam("NAME"), diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 2e768ad4ba..71540921bc 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -144,18 +144,18 @@ public: image.SetOption(wxBMP_FORMAT, bppvalues[bppselection]); wxString deffilename = bppchoices[bppselection]; - deffilename.Replace(" ", "_"); - deffilename += ".bmp"; - wxString savefilename = wxFileSelector( "Save Image", - "", + deffilename.Replace(wxT(" "), wxT("_")); + deffilename += wxT(".bmp"); + wxString savefilename = wxFileSelector( wxT("Save Image"), + wxT(""), deffilename, - (const char *)NULL, - "BMP files (*.bmp)|*.bmp|" - "PNG files (*.png)|*.png|" - "JPEG files (*.jpg)|*.jpg|" - "GIF files (*.gif)|*.gif|" - "TIFF files (*.tif)|*.tif|" - "PCX files (*.pcx)|*.pcx", + (const wxChar *)NULL, + wxT("BMP files (*.bmp)|*.bmp|") + wxT("PNG files (*.png)|*.png|") + wxT("JPEG files (*.jpg)|*.jpg|") + wxT("GIF files (*.gif)|*.gif|") + wxT("TIFF files (*.tif)|*.tif|") + wxT("PCX files (*.pcx)|*.pcx"), wxSAVE); if ( savefilename.empty() ) @@ -259,18 +259,18 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, // try to find the directory with our images wxString dir; - if ( wxFile::Exists("./horse.png") ) + if ( wxFile::Exists(wxT("./horse.png")) ) dir = "./"; - else if ( wxFile::Exists("../horse.png") ) + else if ( wxFile::Exists(wxT("../horse.png")) ) dir = "../"; else - wxLogWarning("Can't find image files in either '.' or '..'!"); + wxLogWarning(wxT("Can't find image files in either '.' or '..'!")); wxImage image = bitmap.ConvertToImage(); #if wxUSE_LIBPNG if ( !image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG )) - wxLogError("Can't save file"); + wxLogError(wxT("Can't save file")); image.Destroy(); @@ -280,7 +280,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.png")) ) - wxLogError("Can't load PNG image"); + wxLogError(wxT("Can't load PNG image")); else my_horse_png = new wxBitmap( image ); #endif // wxUSE_LIBPNG @@ -289,7 +289,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.jpg")) ) - wxLogError("Can't load JPG image"); + wxLogError(wxT("Can't load JPG image")); else my_horse_jpeg = new wxBitmap( image ); #endif // wxUSE_LIBJPEG @@ -298,7 +298,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.gif")) ) - wxLogError("Can't load GIF image"); + wxLogError(wxT("Can't load GIF image")); else my_horse_gif = new wxBitmap( image ); #endif @@ -307,7 +307,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.pcx"), wxBITMAP_TYPE_PCX ) ) - wxLogError("Can't load PCX image"); + wxLogError(wxT("Can't load PCX image")); else my_horse_pcx = new wxBitmap( image ); #endif @@ -315,7 +315,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.bmp"), wxBITMAP_TYPE_BMP ) ) - wxLogError("Can't load BMP image"); + wxLogError(wxT("Can't load BMP image")); else my_horse_bmp = new wxBitmap( image ); @@ -323,19 +323,19 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.xpm"), wxBITMAP_TYPE_XPM ) ) - wxLogError("Can't load XPM image"); + wxLogError(wxT("Can't load XPM image")); else my_horse_xpm = new wxBitmap( image ); if ( !image.SaveFile( dir + wxString("test.xpm"), wxBITMAP_TYPE_XPM )) - wxLogError("Can't save file"); + wxLogError(wxT("Can't save file")); #endif #if wxUSE_PNM image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.pnm"), wxBITMAP_TYPE_PNM ) ) - wxLogError("Can't load PNM image"); + wxLogError(wxT("Can't load PNM image")); else my_horse_pnm = new wxBitmap( image ); #endif @@ -344,7 +344,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.tif"), wxBITMAP_TYPE_TIF ) ) - wxLogError("Can't load TIFF image"); + wxLogError(wxT("Can't load TIFF image")); else my_horse_tiff = new wxBitmap( image ); #endif diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 3d313fece4..67da9dc10e 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -47,7 +47,7 @@ protected: class MyFrame: public wxFrame { public: - MyFrame(wxFrame *frame, const char *title, int x, int y, int w, int h, + MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h, wxLocale& m_locale); public: @@ -114,7 +114,7 @@ bool MyApp::OnInit() /* not needed any more, done in wxLocale ctor m_locale.AddCatalog("wxstd"); // 1) for library messages */ - m_locale.AddCatalog("internat"); // 2) our private one + m_locale.AddCatalog(wxT("internat")); // 2) our private one /* this catalog is installed in standard location on Linux systems, it might not be installed on yours - just ignore the errrors or comment out this line then */ @@ -155,8 +155,8 @@ bool MyApp::OnInit() } // My frame constructor -MyFrame::MyFrame(wxFrame *frame, const char *title, int x, int y, int w, int h, - wxLocale& l) +MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, + int w, int h, wxLocale& l) : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)), m_locale(l) { @@ -170,15 +170,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxString localeInfo; - localeInfo.Printf(_("Language: %s\n" - "System locale name: %s\n" - "Canonical locale name: %s\n"), + localeInfo.Printf(_("Language: %s\nSystem locale name: %s\nCanonical locale name: %s\n"), m_locale.GetLocale(), m_locale.GetSysName().c_str(), m_locale.GetCanonicalName().c_str()); - wxMessageDialog(this, wxString(_("I18n sample\n" - "(c) 1998, 1999 Vadim Zeitlin and Julian Smart")) + wxMessageDialog(this, wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart")) + wxT("\n\n") + localeInfo, _("About Internat"), wxOK | wxICON_INFORMATION).ShowModal(); } @@ -192,13 +189,13 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) return; int num; - sscanf(str, "%d", &num); + wxSscanf(str, wxT("%d"), &num); if ( num == 0 ) str = _("You've probably entered an invalid number."); else if ( num == 9 ) // this message is not translated (not in catalog) str = "You've found a bug in this program!"; else if ( num != 17 ) // a more implicit way to write _() - str = wxGetTranslation("Bad luck! try again..."); + str = wxGetTranslation(wxT("Bad luck! try again...")); else { str.Empty(); // string must be split in two -- otherwise the translation won't be found @@ -213,5 +210,5 @@ void MyFrame::OnOpen(wxCommandEvent&) { // open a bogus file -- the error message should be also translated if you've // got wxstd.mo somewhere in the search path - wxFile file("NOTEXIST.ING"); + wxFile file(wxT("NOTEXIST.ING")); } diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index f3077f4ade..5e67d487e2 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -475,7 +475,7 @@ void MyChild::OnMove(wxMoveEvent& event) // to be the width of the MDI canvas border) wxPoint pos1 = event.GetPosition(), pos2 = GetPosition(); - wxLogStatus("position from event: (%d, %d), from frame (%d, %d)", + wxLogStatus(wxT("position from event: (%d, %d), from frame (%d, %d)"), pos1.x, pos1.y, pos2.x, pos2.y); event.Skip(); @@ -489,7 +489,7 @@ void MyChild::OnSize(wxSizeEvent& event) wxSize size1 = event.GetSize(), size2 = GetSize(), size3 = GetClientSize(); - wxLogStatus("size from event: %dx%d, from frame %dx%d, client %dx%d", + wxLogStatus(wxT("size from event: %dx%d, from frame %dx%d, client %dx%d"), size1.x, size1.y, size2.x, size2.y, size3.x, size3.y); event.Skip(); diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 0751bad75d..29da4ca89f 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -368,7 +368,7 @@ wxMenu *MyFrame::CreateDummyMenu(wxString *title) if ( title ) { - title->Printf("Dummy menu &%d", ++m_countDummy); + title->Printf(wxT("Dummy menu &%d"), ++m_countDummy); } return menu; @@ -382,7 +382,7 @@ wxMenuItem *MyFrame::GetLastMenuItem() const wxMenuItemList::Node *node = menu->GetMenuItems().GetLast(); if ( !node ) { - wxLogWarning("No last item in the last menu!"); + wxLogWarning(wxT("No last item in the last menu!")); return NULL; } @@ -398,10 +398,10 @@ void MyFrame::LogMenuEvent(const wxCommandEvent& event) if ( !GetMenuBar()->FindItem(id) ) return; - wxString msg = wxString::Format("Menu command %d", id); + wxString msg = wxString::Format(wxT("Menu command %d"), id); if ( GetMenuBar()->FindItem(id)->IsCheckable() ) { - msg += wxString::Format(" (the item is currently %schecked)", + msg += wxString::Format(wxT(" (the item is currently %schecked)"), event.IsChecked() ? "" : "not "); } @@ -437,7 +437,7 @@ void MyFrame::OnDeleteMenu(wxCommandEvent& WXUNUSED(event)) if ( count == 2 ) { // don't let delete the first 2 menus - wxLogError("Can't delete any more menus"); + wxLogError(wxT("Can't delete any more menus")); } else { @@ -488,7 +488,7 @@ void MyFrame::OnGetLabelMenu(wxCommandEvent& WXUNUSED(event)) wxMenuBar *mbar = GetMenuBar(); size_t count = mbar->GetMenuCount(); - wxLogMessage("The label of the last menu item is '%s'", + wxLogMessage(wxT("The label of the last menu item is '%s'"), mbar->GetLabelTop(count - 1).c_str()); } @@ -502,7 +502,7 @@ void MyFrame::OnSetLabelMenu(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDummy(wxCommandEvent& event) { - wxLogMessage("Dummy item #%d", event.GetId() - Menu_Dummy_First + 1); + wxLogMessage(wxT("Dummy item #%d"), event.GetId() - Menu_Dummy_First + 1); } void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event)) @@ -533,7 +533,7 @@ void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event)) size_t count = menu->GetMenuItemCount(); if ( !count ) { - wxLogWarning("No items to delete!"); + wxLogWarning(wxT("No items to delete!")); } else { @@ -583,7 +583,7 @@ void MyFrame::OnGetLabelMenuItem(wxCommandEvent& WXUNUSED(event)) if ( item ) { - wxLogMessage("The label of the last menu item is '%s'", + wxLogMessage(wxT("The label of the last menu item is '%s'"), item->GetLabel().c_str()); } } diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index c8d022ef55..aaf3bebcd5 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -712,7 +712,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) if ( ev.ShiftDown() ) logBuf << " (shift down)"; if ( ev.ControlDown() ) logBuf << " (control down)"; - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call event skip if you want default grid processing // @@ -725,7 +725,7 @@ void GridFrame::OnCellLeftClick( wxGridEvent& ev ) logBuf = ""; logBuf << "Left click at row " << ev.GetRow() << " col " << ev.GetCol(); - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call event skip if you want default grid processing // (cell highlighting etc.) @@ -738,7 +738,7 @@ void GridFrame::OnRowSize( wxGridSizeEvent& ev ) { logBuf = ""; logBuf << "Resized row " << ev.GetRowOrCol(); - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); } @@ -748,7 +748,7 @@ void GridFrame::OnColSize( wxGridSizeEvent& ev ) { logBuf = ""; logBuf << "Resized col " << ev.GetRowOrCol(); - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); } @@ -767,7 +767,7 @@ void GridFrame::OnSelectCell( wxGridEvent& ev ) << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F') << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )"; - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call Skip() if you want the default processing // to occur in wxGrid @@ -789,7 +789,7 @@ void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev ) << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F') << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )"; - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); } @@ -801,21 +801,21 @@ void GridFrame::OnCellValueChanged( wxGridEvent& ev ) << " row " << ev.GetRow() << " col " << ev.GetCol(); - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); } void GridFrame::OnEditorShown( wxGridEvent& ev ) { - wxLogMessage( "Cell editor shown." ); + wxLogMessage( wxT("Cell editor shown.") ); ev.Skip(); } void GridFrame::OnEditorHidden( wxGridEvent& ev ) { - wxLogMessage( "Cell editor hidden." ); + wxLogMessage( wxT("Cell editor hidden.") ); ev.Skip(); } diff --git a/samples/newgrid/griddemo.h b/samples/newgrid/griddemo.h index d10a53a2f3..bdbaf2db77 100644 --- a/samples/newgrid/griddemo.h +++ b/samples/newgrid/griddemo.h @@ -177,7 +177,7 @@ public: int GetNumberCols() { return m_sizeGrid; } wxString GetValue( int row, int col ) { - return wxString::Format("(%d, %d)", row, col); + return wxString::Format(wxT("(%d, %d)"), row, col); } void SetValue( int , int , const wxString& ) { /* ignore */ } diff --git a/samples/ownerdrw/ownerdrw.cpp b/samples/ownerdrw/ownerdrw.cpp index a7f130b1f3..4488631127 100644 --- a/samples/ownerdrw/ownerdrw.cpp +++ b/samples/ownerdrw/ownerdrw.cpp @@ -273,15 +273,16 @@ void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event) { wxString strSelection; unsigned int nSel = event.GetSelection(); - strSelection.sprintf("item %d selected (%schecked)", nSel, - m_pListBox->IsChecked(nSel) ? "" : "not "); + strSelection.sprintf(wxT("item %d selected (%schecked)"), nSel, + m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not ")); SetStatusText(strSelection); } void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event) { wxString strSelection; - strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection()); + strSelection.sprintf(wxT("item %d double clicked"), + m_pListBox->GetSelection()); wxMessageDialog dialog(this, strSelection); dialog.ShowModal(); } @@ -290,7 +291,7 @@ void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event) { wxString strSelection; unsigned int nItem = event.GetInt(); - strSelection.sprintf("item %d was %schecked", nItem, - m_pListBox->IsChecked(nItem) ? "" : "un"); + strSelection.sprintf(wxT("item %d was %schecked"), nItem, + m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un")); SetStatusText(strSelection); } diff --git a/samples/png/pngdemo.cpp b/samples/png/pngdemo.cpp index 473340a6e9..0d88f11699 100644 --- a/samples/png/pngdemo.cpp +++ b/samples/png/pngdemo.cpp @@ -100,8 +100,9 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event)) { - wxString f = wxFileSelector( "Save Image", (const char *)NULL, (const char *)NULL, - "png", "PNG files (*.png)|*.png" ); + wxString f = wxFileSelector( wxT("Save Image"), (const wxChar *)NULL, + (const wxChar *)NULL, + wxT("png"), wxT("PNG files (*.png)|*.png") ); if (f == "") return; @@ -128,8 +129,9 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event)) { // Show file selector. - wxString f = wxFileSelector("Open Image", (const char *) NULL, (const char *) NULL,"png", - "PNG files (*.png)|*.png"); + wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL, + (const wxChar *) NULL, wxT("png"), + wxT("PNG files (*.png)|*.png")); if (f == "") return; diff --git a/samples/proplist/proplist.cpp b/samples/proplist/proplist.cpp index dacd8be3d0..8ecd8f2a76 100644 --- a/samples/proplist/proplist.cpp +++ b/samples/proplist/proplist.cpp @@ -158,10 +158,10 @@ void MyApp::PropertyListTest(bool useDialog) sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); sheet->AddProperty(new wxProperty("julian", "one", "string")); sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); + wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); - wxStringList *strings2 = new wxStringList("earth", "fire", "wind", "water", NULL); + wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL); sheet->AddProperty(new wxProperty("string list", strings2, "stringlist")); wxPropertyListView *view = @@ -212,7 +212,7 @@ void MyApp::PropertyFormTest(bool useDialog) sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); sheet->AddProperty(new wxProperty("julian", "one", "string")); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); + wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); wxPropertyFormView *view = new wxPropertyFormView(NULL); diff --git a/samples/rotate/rotate.cpp b/samples/rotate/rotate.cpp index 89c7a0d299..2bdb6270e9 100644 --- a/samples/rotate/rotate.cpp +++ b/samples/rotate/rotate.cpp @@ -96,8 +96,8 @@ bool MyApp::OnInit() if ( !m_image.Ok() ) { - wxLogError("Can't load the test image, please copy it to the " - "program directory"); + wxLogError(wxT("Can't load the test image, please copy it to the ") + wxT("program directory")); return FALSE; } diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index 368a731825..8216846041 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -241,10 +241,10 @@ void MyCanvas::OnMouseDown( wxMouseEvent &event ) wxPoint pt( event.GetPosition() ); int x,y; CalcUnscrolledPosition( pt.x, pt.y, &x, &y ); - wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y ); + wxLogMessage( wxT("Mouse down event at: %d %d, scrolled: %d %d"), pt.x, pt.y, x, y ); if ( !event.LeftIsDown() ) - wxLogMessage( "Error: LeftIsDown() should be TRUE if for LeftDown()" ); + wxLogMessage( wxT("Error: LeftIsDown() should be TRUE if for LeftDown()") ); } } @@ -263,43 +263,43 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) void MyCanvas::OnQueryPosition( wxCommandEvent &WXUNUSED(event) ) { wxPoint pt( m_button->GetPosition() ); - wxLogMessage( "Position of ""Query position"" is %d %d", pt.x, pt.y ); + wxLogMessage( wxT("Position of \"Query position\" is %d %d"), pt.x, pt.y ); pt = ClientToScreen( pt ); - wxLogMessage( "Position of ""Query position"" on screen is %d %d", pt.x, pt.y ); + wxLogMessage( wxT("Position of \"Query position\" on screen is %d %d"), pt.x, pt.y ); } void MyCanvas::OnAddButton( wxCommandEvent &WXUNUSED(event) ) { - wxLogMessage( "Inserting button at position 10,70..." ); + wxLogMessage( wxT("Inserting button at position 10,70...") ); wxButton *button = new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(10,70), wxSize(80,25) ); wxPoint pt( button->GetPosition() ); - wxLogMessage( "-> Position after inserting %d %d", pt.x, pt.y ); + wxLogMessage( wxT("-> Position after inserting %d %d"), pt.x, pt.y ); } void MyCanvas::OnDeleteButton( wxCommandEvent &event ) { - wxLogMessage( "Deleting button inserted with ""Add button""..." ); + wxLogMessage( wxT("Deleting button inserted with \"Add button\"...") ); wxWindow *win = FindWindow( ID_NEWBUTTON ); if (win) win->Destroy(); else - wxLogMessage( "-> No window with id = ID_NEWBUTTON found." ); + wxLogMessage( wxT("-> No window with id = ID_NEWBUTTON found.") ); } void MyCanvas::OnMoveButton( wxCommandEvent &event ) { - wxLogMessage( "Moving button 10 pixels downward.." ); + wxLogMessage( wxT("Moving button 10 pixels downward..") ); wxWindow *win = FindWindow( event.GetId() ); wxPoint pt( win->GetPosition() ); - wxLogMessage( "-> Position before move is %d %d", pt.x, pt.y ); + wxLogMessage( wxT("-> Position before move is %d %d"), pt.x, pt.y ); win->Move( -1, pt.y + 10 ); pt = win->GetPosition(); - wxLogMessage( "-> Position after move is %d %d", pt.x, pt.y ); + wxLogMessage( wxT("-> Position after move is %d %d"), pt.x, pt.y ); } void MyCanvas::OnScrollWin( wxCommandEvent &WXUNUSED(event) ) { - wxLogMessage( "Scrolling 2 units up.\nThe white square and the controls should move equally!" ); + wxLogMessage( wxT("Scrolling 2 units up.\nThe white square and the controls should move equally!") ); int x,y; GetViewStart( &x, &y ); Scroll( -1, y+2 ); diff --git a/samples/scrollsub/scrollsub.cpp b/samples/scrollsub/scrollsub.cpp index 9c68b9fbd8..c53f93744b 100644 --- a/samples/scrollsub/scrollsub.cpp +++ b/samples/scrollsub/scrollsub.cpp @@ -308,7 +308,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // Has the region on screen been exposed? if (IsExposed(0,0,100,25)) { - wxLogMessage( "Redraw first cell" ); + wxLogMessage( wxT("Redraw first cell") ); dc.DrawRectangle( 0, 0, 100, 25 ); dc.DrawText( "First Cell", 5, 5 ); } @@ -323,7 +323,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // Has the region on screen been exposed? if (IsExposed(200,0,100,25)) { - wxLogMessage( "Redraw second cell" ); + wxLogMessage( wxT("Redraw second cell") ); dc.DrawRectangle( 200, 0, 100, 25 ); dc.DrawText( "Second Cell", 205, 5 ); } diff --git a/samples/sockets/Makefile.in b/samples/sockets/Makefile.in index 6b12993eca..f7ff32f5a3 100644 --- a/samples/sockets/Makefile.in +++ b/samples/sockets/Makefile.in @@ -28,12 +28,15 @@ include ../../src/make.env all: client@PROGRAM_EXT@ server@PROGRAM_EXT@ -client@PROGRAM_EXT@: client.o ../../lib/@WX_TARGET_LIBRARY@ - $(CC) $(LDFLAGS) -o client@PROGRAM_EXT@ client.o $(LDLIBS) +sockets_resources.o: sockets.rc + $(RESCOMP) $(RCINPUTSWITCH) $< $(RCOUTPUTSWITCH) $@ $(RESFLAGS) + +client@PROGRAM_EXT@: client.o ../../lib/@WX_TARGET_LIBRARY@ sockets_resources.o + $(CC) $(LDFLAGS) -o client@PROGRAM_EXT@ sockets_resources.o client.o $(LDLIBS) server@PROGRAM_EXT@: server.o ../../lib/@WX_TARGET_LIBRARY@ - $(CC) $(LDFLAGS) -o server@PROGRAM_EXT@ server.o $(LDLIBS) + $(CC) $(LDFLAGS) -o server@PROGRAM_EXT@ sockets_resources.o server.o $(LDLIBS) clean: - rm -f client@PROGRAM_EXT@ server@PROGRAM_EXT@ client.o server.o core + rm -f client@PROGRAM_EXT@ server@PROGRAM_EXT@ sockets_resources.o client.o server.o core diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index ec02f7eada..d99ef0205d 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -210,8 +210,7 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1, // Make a textctrl for logging m_text = new wxTextCtrl(this, -1, - _("Welcome to wxSocket demo: Client\n" - "Client ready\n"), + _("Welcome to wxSocket demo: Client\nClient ready\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); @@ -245,8 +244,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(_("wxSocket demo: Client\n" - "(c) 1999 Guillermo Rodriguez Garcia\n"), + wxMessageBox(_("wxSocket demo: Client\n(c) 1999 Guillermo Rodriguez Garcia\n"), _("About Client"), wxOK | wxICON_INFORMATION, this); } @@ -334,8 +332,8 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) { - const char *buf1; - char *buf2; + const wxChar *buf1; + wxChar *buf2; unsigned char len; // Disable socket menu entries (exception: Close Session) @@ -363,8 +361,8 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) m_sock->SetFlags(wxSOCKET_WAITALL); buf1 = _("Test string (less than 256 chars!)"); - len = wxStrlen(buf1) + 1; - buf2 = new char[len]; + len = (wxStrlen(buf1) + 1) * sizeof(wxChar); + buf2 = new wxChar[wxStrlen(buf1) + 1]; m_text->AppendText(_("Sending a test buffer to the server ...")); m_sock->Write(&len, 1); @@ -395,8 +393,8 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)) { - char *msg1; - char *msg2; + const wxChar *msg1; + wxChar *msg2; size_t len; // Disable socket menu entries (exception: Close Session) @@ -423,9 +421,9 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)) _("Test 2 ..."), _("Yes I like wxWindows!")); - msg1 = (char *)s.c_str(); - len = wxStrlen(msg1) + 1; - msg2 = new char[len]; + msg1 = s.c_str(); + len = (wxStrlen(msg1) + 1) * sizeof(wxChar); + msg2 = new wxChar[wxStrlen(msg1) + 1]; m_text->AppendText(_("Sending the string with WriteMsg ...")); m_sock->WriteMsg(msg1, len); @@ -566,9 +564,7 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event)) // Print the contents type and file size wxString s; - s.Printf(_("Contents type: %s\n" - "File size: %i\n" - "Starting to download...\n"), + s.Printf(_("Contents type: %s\nFile size: %i\nStarting to download...\n"), url.GetProtocol().GetContentType().c_str(), data->GetSize()); m_text->AppendText(s); diff --git a/samples/sockets/makefile.vc b/samples/sockets/makefile.vc index 3864d7dd9d..0a6dc8f324 100644 --- a/samples/sockets/makefile.vc +++ b/samples/sockets/makefile.vc @@ -11,8 +11,8 @@ !include $(WXWIN)/src/makevc.env all: - nmake -f server.vc FINAL=$(FINAL) - nmake -f client.vc FINAL=$(FINAL) + nmake -f server.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) + nmake -f client.vc FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) clean: nmake -f server.vc clean diff --git a/samples/sockets/server.cpp b/samples/sockets/server.cpp index a44f0925c5..cbdcc5c5c6 100644 --- a/samples/sockets/server.cpp +++ b/samples/sockets/server.cpp @@ -216,8 +216,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(_("wxSocket demo: Server\n" - "(c) 1999 Guillermo Rodriguez Garcia\n"), + wxMessageBox(_("wxSocket demo: Server\n(c) 1999 Guillermo Rodriguez Garcia\n"), _("About Server"), wxOK | wxICON_INFORMATION, this); } @@ -257,7 +256,7 @@ void MyFrame::Test2(wxSocketBase *sock) #define MAX_MSG_SIZE 10000 wxString s; - char *buf = new char[MAX_MSG_SIZE]; + wxChar *buf = new wxChar[MAX_MSG_SIZE]; wxUint32 len; m_text->AppendText(_("Test 2 begins\n")); @@ -266,7 +265,7 @@ void MyFrame::Test2(wxSocketBase *sock) // are not affected by them anyway. // Read the message - len = sock->ReadMsg(buf, MAX_MSG_SIZE).LastCount(); + len = sock->ReadMsg(buf, MAX_MSG_SIZE * sizeof(wxChar)).LastCount(); s.Printf(_("Client says: %s\n"), buf); m_text->AppendText(s); m_text->AppendText(_("Sending the data back\n")); diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp index 2cec8e6c8d..2c956b311e 100644 --- a/samples/splitter/splitter.cpp +++ b/samples/splitter/splitter.cpp @@ -245,7 +245,9 @@ void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) ) void MyFrame::UpdateUIHorizontal(wxUpdateUIEvent& event) { - event.Enable( ( (!m_splitter->IsSplit()) || (m_splitter->GetSplitMode() != wxSPLIT_HORIZONTAL) ) ); + bool foo = ( (!m_splitter->IsSplit()) || (m_splitter->GetSplitMode() != wxSPLIT_HORIZONTAL) ); + if( !foo ) + event.Enable( foo ); } void MyFrame::UpdateUIVertical(wxUpdateUIEvent& event) diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 588d97b2f5..1d9ded23ac 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -353,11 +353,12 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event)) sb->SetFieldsCount(nFields, widths); wxLogStatus(this, - wxString::Format("Status bar now has %ld fields", nFields)); + wxString::Format(wxT("Status bar now has %ld fields"), + nFields)); } else { - wxLogStatus(this, "Cancelled"); + wxLogStatus(this, wxT("Cancelled")); } } diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 081fac5582..2c3a30455f 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -207,7 +207,7 @@ private: text->Freeze(); for ( int i = 0; i < 100; i++ ) - text->AppendText(wxString::Format("Line %i\n", i)); + text->AppendText(wxString::Format(wxT("Line %i\n"), i)); text->SetInsertionPoint(0); @@ -624,11 +624,7 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event) long line, column, pos = GetInsertionPoint(); PositionToXY(pos, &column, &line); - wxLogMessage( _T("Current position: %ld\n" - "Current line, column: (%ld, %ld)\n" - "Number of lines: %ld\n" - "Current line length: %ld\n" - "Total text length: %u (%ld)"), + wxLogMessage( _T("Current position: %ld\nCurrent line, column: (%ld, %ld)\nNumber of lines: %ld\nCurrent line length: %ld\nTotal text length: %u (%ld)"), pos, line, column, GetNumberOfLines(), @@ -1058,9 +1054,8 @@ void MyFrame::OnFileSave(wxCommandEvent& event) { #if wxUSE_FILE // verify that the fil length is correct (it wasn't under Win95) - wxFile file("dummy.txt"); - wxLogStatus(this, _T("Successfully saved file " - "(text len = %ld, file size = %ld)"), + wxFile file(wxT("dummy.txt")); + wxLogStatus(this, _T("Successfully saved file (text len = %ld, file size = %ld)"), m_panel->m_textrich->GetValue().length(), file.Length()); #endif diff --git a/samples/thread/thread.cpp b/samples/thread/thread.cpp index 19a99c2d6c..9c5d3d816e 100644 --- a/samples/thread/thread.cpp +++ b/samples/thread/thread.cpp @@ -184,7 +184,7 @@ void *MyThread::Entry() { wxString text; - text.Printf("Thread 0x%x started (priority = %d).\n", + text.Printf(wxT("Thread 0x%x started (priority = %d).\n"), GetId(), GetPriority()); WriteText(text); // wxLogMessage(text); -- test wxLog thread safeness @@ -195,14 +195,14 @@ void *MyThread::Entry() if ( TestDestroy() ) break; - text.Printf("[%u] Thread 0x%x here.\n", m_count, GetId()); + text.Printf(wxT("[%u] Thread 0x%x here.\n"), m_count, GetId()); WriteText(text); // wxSleep() can't be called from non-GUI thread! wxThread::Sleep(1000); } - text.Printf("Thread 0x%x finished.\n", GetId()); + text.Printf(wxT("Thread 0x%x finished.\n"), GetId()); WriteText(text); // wxLogMessage(text); -- test wxLog thread safeness @@ -250,7 +250,7 @@ void *MyWorkerThread::Entry() break; wxString text; - text.Printf("[%u] Thread 0x%x here!!", m_count, GetId()); + text.Printf(wxT("[%u] Thread 0x%x here!!"), m_count, GetId()); // create any type of command event here wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, WORKER_EVENT ); @@ -360,7 +360,7 @@ MyThread *MyFrame::CreateThread() if ( thread->Create() != wxTHREAD_NO_ERROR ) { - wxLogError("Can't create thread!"); + wxLogError(wxT("Can't create thread!")); } wxCriticalSectionLocker enter(wxGetApp().m_critsect); @@ -405,7 +405,7 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) ) } wxString msg; - msg.Printf("%d new threads created.", count); + msg.Printf(wxT("%d new threads created."), count); SetStatusText(msg, 1); // ...and then start them @@ -421,7 +421,7 @@ void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) ) if ( thread->Run() != wxTHREAD_NO_ERROR ) { - wxLogError("Can't start thread!"); + wxLogError(wxT("Can't start thread!")); } SetStatusText("New thread started.", 1); @@ -434,7 +434,7 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) ) // stop the last thread if ( wxGetApp().m_threads.IsEmpty() ) { - wxLogError("No thread to stop!"); + wxLogError(wxT("No thread to stop!")); wxGetApp().m_critsect.Leave(); } @@ -464,7 +464,7 @@ void MyFrame::OnResumeThread(wxCommandEvent& WXUNUSED(event) ) if ( n == count ) { - wxLogError("No thread to resume!"); + wxLogError(wxT("No thread to resume!")); } else { @@ -485,7 +485,7 @@ void MyFrame::OnPauseThread(wxCommandEvent& WXUNUSED(event) ) if ( n < 0 ) { - wxLogError("No thread to pause!"); + wxLogError(wxT("No thread to pause!")); } else { @@ -512,7 +512,7 @@ void MyFrame::OnIdle(wxIdleEvent &event) m_nRunning = nRunning; m_nCount = nCount; - wxLogStatus(this, "%u threads total, %u running.", nCount, nRunning); + wxLogStatus(this, wxT("%u threads total, %u running."), nCount, nRunning); } //else: avoid flicker - don't print anything } @@ -561,7 +561,7 @@ void MyFrame::OnStartWorker(wxCommandEvent& WXUNUSED(event)) if ( thread->Create() != wxTHREAD_NO_ERROR ) { - wxLogError("Can't create thread!"); + wxLogError(wxT("Can't create thread!")); } m_dlgProgress = new wxProgressDialog diff --git a/samples/treectrl/treectrl.cpp b/samples/treectrl/treectrl.cpp index 5f69e18e1c..6e6a8a613f 100644 --- a/samples/treectrl/treectrl.cpp +++ b/samples/treectrl/treectrl.cpp @@ -54,12 +54,12 @@ #endif // verify that the item is ok and insult the user if it is not -#define CHECK_ITEM( item ) if ( !item.IsOk() ) { \ - wxMessageBox("Please select some item first!", \ - "Tree sample error", \ - wxOK | wxICON_EXCLAMATION, \ - this); \ - return; \ +#define CHECK_ITEM( item ) if ( !item.IsOk() ) { \ + wxMessageBox(wxT("Please select some item first!"), \ + wxT("Tree sample error"), \ + wxOK | wxICON_EXCLAMATION, \ + this); \ + return; \ } BEGIN_EVENT_TABLE(MyFrame, wxFrame) @@ -143,7 +143,7 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { // Create the main frame window - MyFrame *frame = new MyFrame("wxTreeCtrl Test", 50, 50, 450, 600); + MyFrame *frame = new MyFrame(wxT("wxTreeCtrl Test"), 50, 50, 450, 600); // Show the frame frame->Show(TRUE); @@ -173,9 +173,9 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) *tree_menu = new wxMenu, *item_menu = new wxMenu; - file_menu->Append(TreeTest_About, "&About..."); + file_menu->Append(TreeTest_About, wxT("&About...")); file_menu->AppendSeparator(); - file_menu->Append(TreeTest_Quit, "E&xit\tAlt-X"); + file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X")); style_menu->Append(TreeTest_TogButtons, "Toggle &normal buttons"); style_menu->Append(TreeTest_TogTwist, "Toggle &twister buttons"); @@ -187,10 +187,10 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) style_menu->Append(TreeTest_TogBorder, "Toggle &item border"); style_menu->Append(TreeTest_TogEdit, "Toggle &edit mode"); #ifndef NO_MULTIPLE_SELECTION - style_menu->Append(TreeTest_ToggleSel, "Toggle &selection mode"); + style_menu->Append(TreeTest_ToggleSel, wxT("Toggle &selection mode")); #endif // NO_MULTIPLE_SELECTION - style_menu->Append(TreeTest_ToggleImages, "Toggle show ima&ges"); - style_menu->Append(TreeTest_SetImageSize, "Set image si&ze..."); + style_menu->Append(TreeTest_ToggleImages, wxT("Toggle show ima&ges")); + style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze...")); tree_menu->Append(TreeTest_Recreate, "&Recreate the tree"); tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset"); @@ -401,7 +401,7 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event)) for ( size_t n = 0; n < count; n++ ) { - wxLogMessage("\t%s", m_treeCtrl->GetItemText(array.Item(n)).c_str()); + wxLogMessage(wxT("\t%s"), m_treeCtrl->GetItemText(array.Item(n)).c_str()); } } @@ -519,7 +519,7 @@ void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event)) static int s_num = 0; wxString text; - text.Printf("Item #%d", ++s_num); + text.Printf(wxT("Item #%d"), ++s_num); m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(), text /*, @@ -710,9 +710,9 @@ void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent, { // at depth 1 elements won't have any more children if ( hasChildren ) - str.Printf("%s child %d", "Folder", n + 1); + str.Printf(wxT("%s child %d"), wxT("Folder"), n + 1); else - str.Printf("%s child %d.%d", "File", folder, n + 1); + str.Printf(wxT("%s child %d.%d"), wxT("File"), folder, n + 1); // here we pass to AppendItem() normal and selected item images (we // suppose that selected image follows the normal one in the enum) @@ -806,11 +806,11 @@ void MyTreeCtrl::DoToggleIcon(const wxTreeItemId& item) // avoid repetition -#define TREE_EVENT_HANDLER(name) \ -void MyTreeCtrl::name(wxTreeEvent& event) \ -{ \ - wxLogMessage(#name); \ - event.Skip(); \ +#define TREE_EVENT_HANDLER(name) \ +void MyTreeCtrl::name(wxTreeEvent& event) \ +{ \ + wxLogMessage(wxT(#name)); \ + event.Skip(); \ } TREE_EVENT_HANDLER(OnBeginRDrag) @@ -833,14 +833,14 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) { m_draggedItem = event.GetItem(); - wxLogMessage("OnBeginDrag: started dragging %s", + wxLogMessage(wxT("OnBeginDrag: started dragging %s"), GetItemText(m_draggedItem).c_str()); event.Allow(); } else { - wxLogMessage("OnBeginDrag: this item can't be dragged."); + wxLogMessage(wxT("OnBeginDrag: this item can't be dragged.")); } } @@ -859,13 +859,13 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event) if ( !itemDst.IsOk() ) { - wxLogMessage("OnEndDrag: can't drop here."); + wxLogMessage(wxT("OnEndDrag: can't drop here.")); return; } wxString text = GetItemText(itemSrc); - wxLogMessage("OnEndDrag: '%s' copied to '%s'.", + wxLogMessage(wxT("OnEndDrag: '%s' copied to '%s'."), text.c_str(), GetItemText(itemDst).c_str()); // just do append here - we could also insert it just before/after the item @@ -881,13 +881,13 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event) void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event) { - wxLogMessage("OnBeginLabelEdit"); + wxLogMessage(wxT("OnBeginLabelEdit")); // for testing, prevent this item's label editing wxTreeItemId itemId = event.GetItem(); if ( IsTestItem(itemId) ) { - wxMessageBox("You can't edit this item."); + wxMessageBox(wxT("You can't edit this item.")); event.Veto(); } @@ -895,12 +895,12 @@ void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event) { - wxLogMessage("OnEndLabelEdit"); + wxLogMessage(wxT("OnEndLabelEdit")); // don't allow anything except letters in the labels if ( !event.GetLabel().IsWord() ) { - wxMessageBox("The label should contain only letters."); + wxMessageBox(wxT("The label should contain only letters.")); event.Veto(); } @@ -908,13 +908,13 @@ void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnItemCollapsing(wxTreeEvent& event) { - wxLogMessage("OnItemCollapsing"); + wxLogMessage(wxT("OnItemCollapsing")); // for testing, prevent the user from collapsing the first child folder wxTreeItemId itemId = event.GetItem(); if ( IsTestItem(itemId) ) { - wxMessageBox("You can't collapse this item."); + wxMessageBox(wxT("You can't collapse this item.")); event.Veto(); } @@ -931,7 +931,7 @@ void MyTreeCtrl::OnItemActivated(wxTreeEvent& event) item->ShowInfo(this); } - wxLogMessage("OnItemActivated"); + wxLogMessage(wxT("OnItemActivated")); } void MyTreeCtrl::OnItemRightClick(wxTreeEvent& event) @@ -970,24 +970,24 @@ void MyTreeCtrl::OnRMouseDClick(wxMouseEvent& event) { wxTreeItemId id = HitTest(event.GetPosition()); if ( !id ) - wxLogMessage("No item under mouse"); + wxLogMessage(wxT("No item under mouse")); else { MyTreeItemData *item = (MyTreeItemData *)GetItemData(id); if ( item ) - wxLogMessage("Item '%s' under mouse", item->GetDesc()); + wxLogMessage(wxT("Item '%s' under mouse"), item->GetDesc()); } } -static inline const char *Bool2String(bool b) +static inline const wxChar *Bool2String(bool b) { - return b ? "" : "not "; + return b ? wxT("") : wxT("not "); } void MyTreeItemData::ShowInfo(wxTreeCtrl *tree) { - wxLogMessage("Item '%s': %sselected, %sexpanded, %sbold,\n" - "%u children (%u immediately under this item).", + wxLogMessage(wxT("Item '%s': %sselected, %sexpanded, %sbold,\n") + wxT("%u children (%u immediately under this item)."), m_desc.c_str(), Bool2String(tree->IsSelected(GetId())), Bool2String(tree->IsExpanded(GetId())), diff --git a/samples/treectrl/treectrl.h b/samples/treectrl/treectrl.h index 9891315968..0b61f54218 100644 --- a/samples/treectrl/treectrl.h +++ b/samples/treectrl/treectrl.h @@ -43,7 +43,7 @@ public: MyTreeItemData(const wxString& desc) : m_desc(desc) { } void ShowInfo(wxTreeCtrl *tree); - const char *GetDesc() const { return m_desc.c_str(); } + const wxChar *GetDesc() const { return m_desc.c_str(); } private: wxString m_desc; diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index bb0e047620..b7be53b1a2 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -295,7 +295,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { file_input.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); } textCtrl.WriteText( "\n\n\n" ); @@ -315,7 +315,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { file_input2.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); } textCtrl.WriteText( "\n\n\n" ); @@ -334,14 +334,14 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { buf_input3.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); } for (int j = 0; j < 2000; j++) buf_input3.Read( &ch, 1 ); textCtrl.WriteText( "\n" ); buf_input3.SeekI( 3 ); buf_input3.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "\n\n\n" ); } @@ -370,7 +370,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) { file_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (file_input.LastError()) { @@ -397,7 +397,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) file_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (file_input.LastError()) { @@ -419,7 +419,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) { ffile_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (ffile_input.LastError()) { @@ -446,7 +446,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) ffile_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (ffile_input.LastError()) { @@ -468,7 +468,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) { buf_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (buf_input.LastError()) { @@ -495,7 +495,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) buf_input.Read( &ch, 1 ); textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (wxChar)(ch + '0') ); textCtrl.WriteText( "; stream.LastError() returns: " ); switch (buf_input.LastError()) { @@ -540,9 +540,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); @@ -560,9 +560,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); @@ -582,9 +582,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); @@ -601,9 +601,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); @@ -620,9 +620,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); @@ -639,9 +639,9 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; } - msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); + msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); - msg.Printf( "wxBufferedInputStream.TellI() returns: %d\n", (int)buf_input.TellI() ); + msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() ); textCtrl.WriteText( msg ); textCtrl.WriteText( "\n\n" ); } @@ -667,27 +667,27 @@ void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event)) wxFileInputStream file_input( wxString("test_wx.dat") ); ch = file_input.Peek(); - str.Printf( "First char peeked: %d\n", (int) ch ); + str.Printf( wxT("First char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = file_input.GetC(); - str.Printf( "First char read: %d\n", (int) ch ); + str.Printf( wxT("First char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = file_input.Peek(); - str.Printf( "Second char peeked: %d\n", (int) ch ); + str.Printf( wxT("Second char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = file_input.GetC(); - str.Printf( "Second char read: %d\n", (int) ch ); + str.Printf( wxT("Second char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = file_input.Peek(); - str.Printf( "Third char peeked: %d\n", (int) ch ); + str.Printf( wxT("Third char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = file_input.GetC(); - str.Printf( "Third char read: %d\n", (int) ch ); + str.Printf( wxT("Third char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); @@ -697,27 +697,27 @@ void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event)) wxMemoryInputStream input( buf, 10 ); ch = input.Peek(); - str.Printf( "First char peeked: %d\n", (int) ch ); + str.Printf( wxT("First char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = input.GetC(); - str.Printf( "First char read: %d\n", (int) ch ); + str.Printf( wxT("First char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = input.Peek(); - str.Printf( "Second char peeked: %d\n", (int) ch ); + str.Printf( wxT("Second char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = input.GetC(); - str.Printf( "Second char read: %d\n", (int) ch ); + str.Printf( wxT("Second char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = input.Peek(); - str.Printf( "Third char peeked: %d\n", (int) ch ); + str.Printf( wxT("Third char peeked: %d\n"), (int) ch ); textCtrl.WriteText( str ); ch = input.GetC(); - str.Printf( "Third char read: %d\n", (int) ch ); + str.Printf( wxT("Third char read: %d\n"), (int) ch ); textCtrl.WriteText( str ); } @@ -735,11 +735,11 @@ void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event)) printf( "\n\nConversion with wxConvLocal:\n" ); wxConvCurrent = &wxConvLocal; printf( (const char*) str.mbc_str() ); - +#if defined(__WXGTK__) printf( "\n\nConversion with wxConvGdk:\n" ); wxConvCurrent = &wxConvGdk; printf( (const char*) str.mbc_str() ); - +#endif printf( "\n\nConversion with wxConvLibc:\n" ); wxConvCurrent = &wxConvLibc; printf( (const char*) str.mbc_str() ); @@ -802,11 +802,11 @@ void MyApp::DoMIMEDemo(wxCommandEvent& WXUNUSED(event)) filetype->GetOpenCommand(&open, params); textCtrl << "MIME information about extension '" << ext << "'\n" - << "\tMIME type: " << ( !type ? "unknown" + << "\tMIME type: " << ( !type ? wxT("unknown") : type.c_str() ) << '\n' - << "\tDescription: " << ( !desc ? "" : desc.c_str() ) + << "\tDescription: " << ( !desc ? wxT("") : desc.c_str() ) << '\n' - << "\tCommand to open: " << ( !open ? "no" : open.c_str() ) + << "\tCommand to open: " << ( !open ? wxT("no") : open.c_str() ) << '\n'; delete filetype; diff --git a/samples/wizard/wizard.cpp b/samples/wizard/wizard.cpp index 5268716caa..6e54020f40 100644 --- a/samples/wizard/wizard.cpp +++ b/samples/wizard/wizard.cpp @@ -352,5 +352,5 @@ void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnWizardCancel(wxWizardEvent& WXUNUSED(event)) { - wxLogStatus(this, "The wizard was cancelled."); + wxLogStatus(this, wxT("The wizard was cancelled.")); } -- 2.45.2