Unicode compilation fixes (patch from Dimitri)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-03-27 18:45:20 +00:00
parent 4ccf704abd
commit f565a6c2f4
10 changed files with 385 additions and 301 deletions

View File

@@ -256,10 +256,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf(_T("This is the network functions test sample.\n" msg.Printf( wxT("This is the network functions test sample.\n")
"<EFBFBD> 1999 Vadim Zeitlin")); wxT("<EFBFBD> 1999 Vadim Zeitlin") );
wxMessageBox(msg, _T("About NetTest"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, wxT("About NetTest"), wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event))

View File

@@ -293,9 +293,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(_T("Event sample shows different ways of using events\n" wxMessageBox( wxT("Event sample shows different ways of using events\n")
"<EFBFBD> 2001 Vadim Zeitlin"), wxT("<EFBFBD> 2001 Vadim Zeitlin"),
_T("About Event Sample"), wxOK | wxICON_INFORMATION, this); wxT("About Event Sample"), wxOK | wxICON_INFORMATION, this );
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -304,9 +304,12 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDynamic(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDynamic(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(_T("This is a dynamic event handler which can be connected " wxMessageBox
"and disconnected during run-time."), (
_T("Dynamic Event Handler"), wxOK | wxICON_INFORMATION, this); wxT("This is a dynamic event handler which can be connected ")
wxT("and disconnected at run-time."),
wxT("Dynamic Event Handler"), wxOK | wxICON_INFORMATION, this
);
} }
void MyFrame::OnConnect(wxCommandEvent& event) void MyFrame::OnConnect(wxCommandEvent& event)

View File

@@ -24,6 +24,10 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#if wxUSE_UNICODE
#error "This sample can't be compiled in Unicode mode."
#endif // wxUSE_UNICODE
#include "wx/resource.h" #include "wx/resource.h"
#include <ctype.h> #include <ctype.h>
@@ -52,8 +56,8 @@
// Under Windows, some compilers can't include // Under Windows, some compilers can't include
// a whole .wxr file. So we use a .rc user-defined resource // a whole .wxr file. So we use a .rc user-defined resource
// instead. dialog1 will point to the whole .wxr 'file'. // instead. dialog1 will point to the whole .wxr 'file'.
static char *dialog1 = NULL; static wxChar *dialog1 = NULL;
static char *menu1 = NULL; static wxChar *menu1 = NULL;
#else #else
// Other platforms should have sensible compilers that // Other platforms should have sensible compilers that
// cope with long strings. // cope with long strings.
@@ -77,8 +81,8 @@ bool MyApp::OnInit(void)
{ {
#if defined(__WXMSW__) #if defined(__WXMSW__)
// Load the .wxr 'file' from a .rc resource, under Windows. // Load the .wxr 'file' from a .rc resource, under Windows.
dialog1 = wxLoadUserResource("dialog1", "WXRDATA"); dialog1 = wxLoadUserResource(wxT("dialog1"), wxT("WXRDATA"));
menu1 = wxLoadUserResource("menu1", "WXRDATA"); menu1 = wxLoadUserResource(wxT("menu1"), wxT("WXRDATA"));
// All resources in the file (only one in this case) get parsed // All resources in the file (only one in this case) get parsed
// by this call. // by this call.
wxResourceParseString(dialog1); wxResourceParseString(dialog1);
@@ -92,7 +96,9 @@ bool MyApp::OnInit(void)
#endif #endif
// Create the main frame window // Create the main frame window
frame = new MyFrame((wxFrame *) NULL, -1, (char *) "wxWindows Resource Sample", wxPoint(-1, -1), wxSize(300, 250)); frame = new MyFrame( (wxFrame *) NULL, -1,
(char *) "wxWindows Resource Sample",
wxPoint(-1, -1), wxSize(300, 250) );
// Give it a status line // Give it a status line
frame->CreateStatusBar(2); frame->CreateStatusBar(2);
@@ -103,7 +109,8 @@ bool MyApp::OnInit(void)
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
// Make a panel // Make a panel
frame->panel = new MyPanel(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame"); frame->panel = new MyPanel( frame, -1, wxPoint(0, 0), wxSize(400, 400),
0, "MyMainFrame" );
frame->Show(TRUE); frame->Show(TRUE);
SetTopWindow(frame); SetTopWindow(frame);
@@ -123,9 +130,12 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_LEFT_DOWN( MyPanel::OnClick) EVT_LEFT_DOWN( MyPanel::OnClick)
END_EVENT_TABLE() END_EVENT_TABLE()
MyPanel::MyPanel( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, MyPanel::MyPanel
int style, const wxString &name ) : (
wxPanel( parent, id, pos, size, style, name ) wxWindow *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size,
int style, const wxString &name
) : wxPanel( parent, id, pos, size, style, name )
{ {
} }
@@ -144,8 +154,11 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size): MyFrame::MyFrame
wxFrame(parent, id, title, pos, size) (
wxWindow *parent, const wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size
) : wxFrame(parent, id, title, pos, size)
{ {
panel = (wxWindow *) NULL; panel = (wxWindow *) NULL;
} }
@@ -165,13 +178,18 @@ void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
{ {
MyDialog *dialog = new MyDialog; MyDialog *dialog = new MyDialog;
if (dialog->LoadFromResource(this, "dialog1")) if (dialog->LoadFromResource(this, "dialog1"))
{ {
wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog); wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog);
if (text) if (text)
{
text->SetValue("wxWindows resource demo"); text->SetValue("wxWindows resource demo");
}
dialog->ShowModal(); dialog->ShowModal();
} }
dialog->Close(TRUE); dialog->Close(TRUE);
} }

View File

@@ -273,12 +273,20 @@ void MyFrame::OnCommand( wxCommandEvent &event )
wxPrinter printer; wxPrinter printer;
wxLayoutPrintout printout(m_lwin->GetLayoutList(),_("M: Printout")); wxLayoutPrintout printout(m_lwin->GetLayoutList(),_("M: Printout"));
if (! printer.Print(this, &printout, TRUE)) if (! printer.Print(this, &printout, TRUE))
wxMessageBox( {
_("There was a problem with printing the message:\n" // Had to remove the split up strings that used to be below, and
"perhaps your current printer is not set up correctly?"), // put them into one long strong. Otherwise MSVC would give an
_("Printing"), wxOK); // error "C2308: concatenating mismatched wide strings" when
// building a Unicode version.
wxMessageBox
(
_("There was a problem with printing the message:\nperhaps your current printer is not set up correctly?"),
_("Printing"), wxOK
);
} }
break; break;
}
case ID_NOWRAP: case ID_NOWRAP:
case ID_WRAP: case ID_WRAP:
m_lwin->SetWrapMargin(event.GetId() == ID_NOWRAP ? 0 : 40); m_lwin->SetWrapMargin(event.GetId() == ID_NOWRAP ? 0 : 40);
@@ -335,10 +343,12 @@ void MyFrame::OnCommand( wxCommandEvent &event )
cout << *(export0->content.text); cout << *(export0->content.text);
else else
; // ignore itcout << "<!--UNKNOWN OBJECT>"; ; // ignore itcout << "<!--UNKNOWN OBJECT>";
delete export0; delete export0;
} }
}
break; break;
}
case ID_TEXT: case ID_TEXT:
{ {
wxLayoutExportObject *export0; wxLayoutExportObject *export0;
@@ -350,20 +360,25 @@ void MyFrame::OnCommand( wxCommandEvent &event )
cout << *(export0->content.text); cout << *(export0->content.text);
else else
cout << "<!--UNKNOWN OBJECT>"; cout << "<!--UNKNOWN OBJECT>";
delete export0; delete export0;
} }
}
break; break;
}
case ID_LONG_TEST: case ID_LONG_TEST:
{ {
wxString line; wxString line;
wxLayoutList *llist = m_lwin->GetLayoutList(); wxLayoutList *llist = m_lwin->GetLayoutList();
for(int i = 1; i < 300; i++) for(int i = 1; i < 300; i++)
{ {
line.Printf("This is line number %d.", i); line.Printf(wxT("This is line number %d."), i);
llist->Insert(line); llist->Insert(line);
llist->LineBreak(); llist->LineBreak();
} }
llist->MoveCursorTo(wxPoint(0,0)); llist->MoveCursorTo(wxPoint(0,0));
m_lwin->SetDirty(); m_lwin->SetDirty();
m_lwin->Refresh(); m_lwin->Refresh();
@@ -371,10 +386,12 @@ void MyFrame::OnCommand( wxCommandEvent &event )
} }
case ID_LINEBREAKS_TEST: case ID_LINEBREAKS_TEST:
wxLayoutImportText(m_lwin->GetLayoutList(), wxLayoutImportText
"This is a text\n" (
"with embedded line\n" m_lwin->GetLayoutList(),
"breaks.\n"); wxT("This is a text\nwith embedded line\nbreaks.\n")
);
m_lwin->SetDirty(); m_lwin->SetDirty();
m_lwin->Refresh(); m_lwin->Refresh();
break; break;

View File

@@ -81,7 +81,7 @@
wxLayoutObject::DebugDump(void) const wxLayoutObject::DebugDump(void) const
{ {
wxString str; wxString str;
str.Printf("%s",g_aTypeStrings[GetType()]); str.Printf(wxT("%s"), g_aTypeStrings[GetType()]);
return str; return str;
} }
#else #else
@@ -176,11 +176,16 @@ bool Contains(const wxRect &r, const wxPoint &p)
static static
void ReadString(wxString &to, wxString &from) void ReadString(wxString &to, wxString &from)
{ {
to = ""; to = wxT("");
const char *cptr = from.c_str(); const wxChar *cptr = from.c_str();
while(*cptr && *cptr != '\n') while(*cptr && *cptr != wxT('\n'))
to += *cptr++; {
to += cptr;
cptr++;
}
if(*cptr) cptr++; if(*cptr) cptr++;
from = cptr; from = cptr;
} }
@@ -196,8 +201,9 @@ wxLayoutObject::Read(wxString &istr)
{ {
wxString tmp; wxString tmp;
ReadString(tmp, istr); ReadString(tmp, istr);
int type = WXLO_TYPE_INVALID; long l = WXLO_TYPE_INVALID;
sscanf(tmp.c_str(),"%d", &type); tmp.ToLong(&l);
int type = (int) l;
switch(type) switch(type)
{ {
@@ -385,7 +391,7 @@ wxLayoutObjectText::DebugDump(void) const
wxString str; wxString str;
str = wxLayoutObject::DebugDump(); str = wxLayoutObject::DebugDump();
wxString str2; wxString str2;
str2.Printf(" `%s`", m_Text.c_str()); str2.Printf(wxT(" `%s`"), m_Text.c_str());
return str+str2; return str+str2;
} }
#endif #endif
@@ -400,7 +406,7 @@ wxLayoutObjectIcon::wxLayoutObjectIcon(wxBitmap const &icon)
{ {
if ( !icon.Ok() ) if ( !icon.Ok() )
{ {
wxFAIL_MSG("invalid icon"); wxFAIL_MSG(wxT("invalid icon"));
m_Icon = NULL; m_Icon = NULL;
@@ -592,43 +598,73 @@ wxLayoutObjectCmd::Read(wxString &istr)
{ {
wxLayoutObjectCmd *obj = new wxLayoutObjectCmd; wxLayoutObjectCmd *obj = new wxLayoutObjectCmd;
long l = 0;
wxString tmp; wxString tmp;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->family); tmp.ToLong(&l);
obj->m_StyleInfo->family = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->size); tmp.ToLong(&l);
obj->m_StyleInfo->size = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->style); tmp.ToLong(&l);
obj->m_StyleInfo->style = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->weight); tmp.ToLong(&l);
obj->m_StyleInfo->weight = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->underline); tmp.ToLong(&l);
obj->m_StyleInfo->underline = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->m_fg_valid); tmp.ToLong(&l);
obj->m_StyleInfo->m_fg_valid = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &obj->m_StyleInfo->m_bg_valid); tmp.ToLong(&l);
obj->m_StyleInfo->m_bg_valid = (int) l;
if(obj->m_StyleInfo->m_fg_valid) if(obj->m_StyleInfo->m_fg_valid)
{ {
int red, green, blue; int red, green, blue;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &red); tmp.ToLong(&l);
red = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &green); tmp.ToLong(&l);
green = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &blue); tmp.ToLong(&l);
blue = (int) l;
obj->m_StyleInfo->m_fg = wxColour(red, green, blue); obj->m_StyleInfo->m_fg = wxColour(red, green, blue);
} }
if(obj->m_StyleInfo->m_bg_valid) if(obj->m_StyleInfo->m_bg_valid)
{ {
int red, green, blue; int red, green, blue;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &red); tmp.ToLong(&l);
red = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &green); tmp.ToLong(&l);
green = (int) l;
ReadString(tmp, istr); ReadString(tmp, istr);
sscanf(tmp.c_str(),"%d", &blue); tmp.ToLong(&l);
blue = (int) l;
obj->m_StyleInfo->m_bg = wxColour(red, green, blue); obj->m_StyleInfo->m_bg = wxColour(red, green, blue);
} }
return obj; return obj;
} }
@@ -1006,6 +1042,7 @@ wxLayoutLine::DeleteWord(CoordType xpos)
i++; offset = 0; i++; offset = 0;
continue; continue;
} }
wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i; wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i;
size_t count = 0; size_t count = 0;
wxString str = tobj->GetText(); wxString str = tobj->GetText();
@@ -1019,11 +1056,12 @@ wxLayoutLine::DeleteWord(CoordType xpos)
wxASSERT(count+offset <= (size_t) (**i).GetLength()); wxASSERT(count+offset <= (size_t) (**i).GetLength());
((wxLayoutObjectText *)*i)->GetText().erase(offset,count); ((wxLayoutObjectText *)*i)->GetText().erase(offset,count);
m_Length -= count; m_Length -= count;
return true; return true;
} }
} }
wxFAIL_MSG("unreachable"); wxFAIL_MSG(wxT("unreachable"));
} }
wxLayoutLine * wxLayoutLine *
@@ -1322,7 +1360,8 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
// find the object which covers the wrapmargin: // find the object which covers the wrapmargin:
CoordType offset; CoordType offset;
wxLOiterator i = FindObject(wrapmargin, &offset); wxLOiterator i = FindObject(wrapmargin, &offset);
wxCHECK_MSG( i != NULLIT, FALSE, "Cannot find object covering wrapmargin."); wxCHECK_MSG( i != NULLIT, FALSE,
wxT("Cannot find object covering wrapmargin."));
// from this object on, the rest of the line must be copied to the // from this object on, the rest of the line must be copied to the
// next one: // next one:
@@ -1451,7 +1490,8 @@ wxLayoutLine::ReNumber(void)
void void
wxLayoutLine::MergeNextLine(wxLayoutList *llist) wxLayoutLine::MergeNextLine(wxLayoutList *llist)
{ {
wxCHECK_RET(GetNextLine(),"wxLayout internal error: no next line to merge"); wxCHECK_RET( GetNextLine(),
wxT("wxLayout internal error: no next line to merge"));
wxLayoutObjectList &list = GetNextLine()->m_ObjectList; wxLayoutObjectList &list = GetNextLine()->m_ObjectList;
wxLOiterator i; wxLOiterator i;
@@ -1569,7 +1609,7 @@ void
wxLayoutLine::Debug(void) const wxLayoutLine::Debug(void) const
{ {
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
WXLO_DEBUG(("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d", WXLO_DEBUG((wxT("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d"),
(long int) GetLineNumber(), (long int) GetLineNumber(),
(long int) pos.x, (long int) pos.y, (long int) pos.x, (long int) pos.y,
(long int) GetHeight(), (long int) GetHeight(),
@@ -1675,7 +1715,7 @@ wxLayoutList::~wxLayoutList()
Empty(); Empty();
m_FirstLine->DeleteLine(false, this); m_FirstLine->DeleteLine(false, this);
wxASSERT_MSG( m_numLines == 0, "line count calculation broken" ); wxASSERT_MSG( m_numLines == 0, wxT("line count calculation broken"));
} }
void void
@@ -1728,8 +1768,10 @@ wxLayoutList::Read(wxString &istr)
// check for a linebreak: // check for a linebreak:
wxString tmp; wxString tmp;
tmp = istr.BeforeFirst('\n'); tmp = istr.BeforeFirst('\n');
int type = WXLO_TYPE_INVALID; long l = WXLO_TYPE_INVALID;
sscanf(tmp.c_str(),"%d", &type); tmp.ToLong(&l);
int type = (int) l;
if(type == WXLO_TYPE_LINEBREAK) if(type == WXLO_TYPE_LINEBREAK)
{ {
LineBreak(); LineBreak();
@@ -1962,8 +2004,8 @@ wxLayoutList::MoveCursorHorizontally(int n)
bool bool
wxLayoutList::MoveCursorWord(int n, bool untilNext) wxLayoutList::MoveCursorWord(int n, bool untilNext)
{ {
wxCHECK_MSG( m_CursorLine, false, "no current line" ); wxCHECK_MSG( m_CursorLine, false, wxT("no current line") );
wxCHECK_MSG( n == -1 || n == +1, false, "not implemented yet" ); wxCHECK_MSG( n == -1 || n == +1, false, wxT("not implemented yet") );
CoordType moveDistance = 0; CoordType moveDistance = 0;
CoordType offset; CoordType offset;
@@ -2052,9 +2094,9 @@ wxLayoutList::MoveCursorWord(int n, bool untilNext)
if ( canAdvance ) if ( canAdvance )
{ {
const wxString& text = tobj->GetText(); const wxString& text = tobj->GetText();
const char *start = text.c_str(); const wxChar *start = text.c_str();
const char *end = start + text.length(); const wxChar *end = start + text.length();
const char *p = start + offset; const wxChar *p = start + offset;
if ( n < 0 ) if ( n < 0 )
{ {
@@ -2123,7 +2165,8 @@ bool
wxLayoutList::Insert(wxString const &text) wxLayoutList::Insert(wxString const &text)
{ {
wxASSERT(m_CursorLine); wxASSERT(m_CursorLine);
wxASSERT_MSG( text.Find('\n') == wxNOT_FOUND, "use wxLayoutImportText!" ); wxASSERT_MSG( text.Find(wxT('\n')) == wxNOT_FOUND,
wxT("use wxLayoutImportText!") );
if ( !text ) if ( !text )
return true; return true;
@@ -2245,7 +2288,7 @@ wxLayoutList::WrapAll(CoordType column)
bool bool
wxLayoutList::Delete(CoordType npos) wxLayoutList::Delete(CoordType npos)
{ {
wxCHECK_MSG(m_CursorLine, false, "can't delete in non existing line"); wxCHECK_MSG(m_CursorLine, false, wxT("can't delete in non existing line"));
if ( npos == 0 ) if ( npos == 0 )
return true; return true;
@@ -2300,7 +2343,7 @@ wxLayoutList::Delete(CoordType npos)
} }
else else
{ {
wxFAIL_MSG("can't delete all this"); wxFAIL_MSG(wxT("can't delete all this"));
return false; return false;
} }
@@ -2537,8 +2580,8 @@ wxLayoutList::Draw(wxDC &dc,
} }
InvalidateUpdateRect(); InvalidateUpdateRect();
WXLO_DEBUG(("Selection is %s : %ld,%ld/%ld,%ld", WXLO_DEBUG((wxT("Selection is %s : %ld,%ld/%ld,%ld"),
m_Selection.m_valid ? "valid" : "invalid", m_Selection.m_valid ? wxT("valid") : wxT("invalid"),
m_Selection.m_CursorA.x, m_Selection.m_CursorA.y, m_Selection.m_CursorA.x, m_Selection.m_CursorA.y,
m_Selection.m_CursorB.x, m_Selection.m_CursorB.y)); m_Selection.m_CursorB.x, m_Selection.m_CursorB.y));
} }
@@ -2650,14 +2693,14 @@ wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate)
coords += translate; coords += translate;
#ifdef WXLAYOUT_DEBUG #ifdef WXLAYOUT_DEBUG
WXLO_DEBUG(("Drawing cursor (%ld,%ld) at %ld,%ld, size %ld,%ld, line: %ld, len %ld", WXLO_DEBUG((wxT("Drawing cursor (%ld,%ld) at %ld,%ld, size %ld,%ld, line: %ld, len %ld"),
(long)m_CursorPos.x, (long)m_CursorPos.y, (long)m_CursorPos.x, (long)m_CursorPos.y,
(long)coords.x, (long)coords.y, (long)coords.x, (long)coords.y,
(long)m_CursorSize.x, (long)m_CursorSize.y, (long)m_CursorSize.x, (long)m_CursorSize.y,
(long)m_CursorLine->GetLineNumber(), (long)m_CursorLine->GetLineNumber(),
(long)m_CursorLine->GetLength())); (long)m_CursorLine->GetLength()));
wxLogStatus("Cursor is at (%d, %d)", m_CursorPos.x, m_CursorPos.y); wxLogStatus(wxT("Cursor is at (%d, %d)"), m_CursorPos.x, m_CursorPos.y);
#endif #endif
#ifdef WXLAYOUT_USE_CARET #ifdef WXLAYOUT_USE_CARET
@@ -2711,7 +2754,7 @@ wxLayoutList::StartSelection(const wxPoint& cposOrig, const wxPoint& spos)
wxPoint cpos(cposOrig); wxPoint cpos(cposOrig);
if ( cpos.x == -1 ) if ( cpos.x == -1 )
cpos = m_CursorPos; cpos = m_CursorPos;
WXLO_DEBUG(("Starting selection at %ld/%ld", cpos.x, cpos.y)); WXLO_DEBUG((wxT("Starting selection at %ld/%ld"), cpos.x, cpos.y));
m_Selection.m_CursorA = cpos; m_Selection.m_CursorA = cpos;
m_Selection.m_CursorB = cpos; m_Selection.m_CursorB = cpos;
m_Selection.m_ScreenA = spos; m_Selection.m_ScreenA = spos;
@@ -2729,7 +2772,7 @@ wxLayoutList::ContinueSelection(const wxPoint& cposOrig, const wxPoint& spos)
wxASSERT(m_Selection.m_selecting == true); wxASSERT(m_Selection.m_selecting == true);
wxASSERT(m_Selection.m_valid == false); wxASSERT(m_Selection.m_valid == false);
WXLO_DEBUG(("Continuing selection at %ld/%ld", cpos.x, cpos.y)); WXLO_DEBUG((wxT("Continuing selection at %ld/%ld"), cpos.x, cpos.y));
m_Selection.m_ScreenB = spos; m_Selection.m_ScreenB = spos;
m_Selection.m_CursorB = cpos; m_Selection.m_CursorB = cpos;
@@ -2741,7 +2784,7 @@ wxLayoutList::EndSelection(const wxPoint& cposOrig, const wxPoint& spos)
wxPoint cpos(cposOrig); wxPoint cpos(cposOrig);
if(cpos.x == -1) cpos = m_CursorPos; if(cpos.x == -1) cpos = m_CursorPos;
ContinueSelection(cpos, spos); ContinueSelection(cpos, spos);
WXLO_DEBUG(("Ending selection at %ld/%ld", cpos.x, cpos.y)); WXLO_DEBUG((wxT("Ending selection at %ld/%ld"), cpos.x, cpos.y));
// we always want m_CursorA <= m_CursorB! // we always want m_CursorA <= m_CursorB!
if( m_Selection.m_CursorA > m_Selection.m_CursorB ) if( m_Selection.m_CursorA > m_Selection.m_CursorB )
{ {
@@ -2930,7 +2973,7 @@ wxLayoutLine *
wxLayoutList::GetLine(CoordType index) const wxLayoutList::GetLine(CoordType index) const
{ {
wxASSERT_MSG( (0 <= index) && (index < (CoordType)m_numLines), wxASSERT_MSG( (0 <= index) && (index < (CoordType)m_numLines),
"invalid index" ); wxT("invalid index") );
wxLayoutLine *line; wxLayoutLine *line;
CoordType n = index; CoordType n = index;
@@ -3082,7 +3125,7 @@ wxLayoutList::ApplyStyle(wxLayoutStyleInfo const &si, wxDC &dc)
void void
wxLayoutList::Debug(void) wxLayoutList::Debug(void)
{ {
WXLO_DEBUG(("Cursor is in line %d, screen pos = (%d, %d)", WXLO_DEBUG((wxT("Cursor is in line %d, screen pos = (%d, %d)"),
m_CursorLine->GetLineNumber(), m_CursorLine->GetLineNumber(),
m_CursorScreenPos.x, m_CursorScreenPos.y)); m_CursorScreenPos.x, m_CursorScreenPos.y));
@@ -3182,7 +3225,7 @@ bool wxLayoutPrintout::OnPrintPage(int page)
top = (page - 1)*m_PrintoutHeight; top = (page - 1)*m_PrintoutHeight;
bottom = top + m_PrintoutHeight; bottom = top + m_PrintoutHeight;
WXLO_DEBUG(("OnPrintPage(%d) printing from %d to %d", page, top, WXLO_DEBUG((wxT("OnPrintPage(%d) printing from %d to %d"), page, top,
bottom)); bottom));
// SetDeviceOrigin() doesn't work here, so we need to manually // SetDeviceOrigin() doesn't work here, so we need to manually
// translate all coordinates. // translate all coordinates.

View File

@@ -292,7 +292,7 @@ public:
virtual wxString DebugDump(void) const; virtual wxString DebugDump(void) const;
#endif #endif
virtual CoordType GetLength(void) const { return strlen(m_Text.c_str()); } virtual CoordType GetLength(void) const { return wxStrlen(m_Text.c_str()); }
// for editing: // for editing:
wxString & GetText(void) { return m_Text; } wxString & GetText(void) { return m_Text; }
@@ -1273,7 +1273,7 @@ class wxLayoutDataObject : public wxCustomDataObject
public: public:
wxLayoutDataObject() wxLayoutDataObject()
{ {
SetFormat("application/wxlayoutlist"); SetFormat(wxT("application/wxlayoutlist"));
} }
// type safe wrappers // type safe wrappers

View File

@@ -741,8 +741,11 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
&& m_WrapMargin > 0 && m_WrapMargin > 0
&& m_llist->GetCursorPos().x > m_WrapMargin && m_llist->GetCursorPos().x > m_WrapMargin
&& isspace(keyCode)) && isspace(keyCode))
{
m_llist->WrapLine(m_WrapMargin); m_llist->WrapLine(m_WrapMargin);
m_llist->Insert((char)keyCode); }
m_llist->Insert((wxChar)keyCode);
SetDirty(); SetDirty();
} }
else else

View File

@@ -254,14 +254,14 @@ void MyFrame::ToggleLive(wxCommandEvent& event )
void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) ) void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) )
{ {
wxString str; wxString str;
str.Printf( _T(_T("%d")), m_splitter->GetMinimumPaneSize()); str.Printf( wxT("%d"), m_splitter->GetMinimumPaneSize());
str = wxGetTextFromUser(_T("Enter minimal size for panes:"), _T(""), str, this); str = wxGetTextFromUser(_T("Enter minimal size for panes:"), _T(""), str, this);
if ( str.IsEmpty() ) if ( str.IsEmpty() )
return; return;
int minsize = wxStrtol( str, (wxChar**)NULL, 10 ); int minsize = wxStrtol( str, (wxChar**)NULL, 10 );
m_splitter->SetMinimumPaneSize(minsize); m_splitter->SetMinimumPaneSize(minsize);
str.Printf( _T(_T("Min pane size = %d")), minsize); str.Printf( wxT("Min pane size = %d"), minsize);
SetStatusText(str, 1); SetStatusText(str, 1);
} }

View File

@@ -471,7 +471,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
data = new char[size]; data = new char[size];
sockstrm->Read(data, size); sockstrm->Read(data, size);
connection->OnExecute (topic_name, data, size, format); connection->OnExecute (topic_name, (wxChar *) data, size, format);
delete [] data; delete [] data;
break; break;
@@ -488,7 +488,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
data = new char[size]; data = new char[size];
sockstrm->Read(data, size); sockstrm->Read(data, size);
connection->OnAdvise (topic_name, item, data, size, format); connection->OnAdvise (topic_name, item, (wxChar *) data, size, format);
delete [] data; delete [] data;
break; break;

View File

@@ -734,7 +734,7 @@ _DDECallback(WORD wType,
0); 0);
DdeFreeDataHandle(hData); DdeFreeDataHandle(hData);
if ( connection->OnExecute(connection->m_topicName, if ( connection->OnExecute(connection->m_topicName,
connection->m_bufPtr, (wxChar *) connection->m_bufPtr,
(int)len, (int)len,
(wxIPCFormat) wFmt) ) (wxIPCFormat) wFmt) )
{ {
@@ -874,7 +874,7 @@ _DDECallback(WORD wType,
DdeFreeDataHandle(hData); DdeFreeDataHandle(hData);
if ( connection->OnAdvise(connection->m_topicName, if ( connection->OnAdvise(connection->m_topicName,
item_name, item_name,
connection->m_bufPtr, (wxChar *) connection->m_bufPtr,
(int)len, (int)len,
(wxIPCFormat) wFmt) ) (wxIPCFormat) wFmt) )
{ {