Last samples/Unicode fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2002-12-16 20:25:28 +00:00
parent bbeb9cc4e8
commit 667e69a3c6
3 changed files with 52 additions and 52 deletions

View File

@@ -49,14 +49,14 @@ wxSTD ostream& DrawingDocument::SaveObject(wxSTD ostream& stream)
wxDocument::SaveObject(stream); wxDocument::SaveObject(stream);
wxInt32 n = doodleSegments.Number(); wxInt32 n = doodleSegments.Number();
stream << n << '\n'; stream << n << _T('\n');
wxNode *node = doodleSegments.First(); wxNode *node = doodleSegments.First();
while (node) while (node)
{ {
DoodleSegment *segment = (DoodleSegment *)node->Data(); DoodleSegment *segment = (DoodleSegment *)node->Data();
segment->SaveObject(stream); segment->SaveObject(stream);
stream << '\n'; stream << _T('\n');
node = node->Next(); node = node->Next();
} }
@@ -71,14 +71,14 @@ wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream)
wxTextOutputStream text_stream( stream ); wxTextOutputStream text_stream( stream );
wxInt32 n = doodleSegments.Number(); wxInt32 n = doodleSegments.Number();
text_stream << n << '\n'; text_stream << n << _T('\n');
wxNode *node = doodleSegments.First(); wxNode *node = doodleSegments.First();
while (node) while (node)
{ {
DoodleSegment *segment = (DoodleSegment *)node->Data(); DoodleSegment *segment = (DoodleSegment *)node->Data();
segment->SaveObject(stream); segment->SaveObject(stream);
text_stream << '\n'; text_stream << _T('\n');
node = node->Next(); node = node->Next();
} }
@@ -155,16 +155,16 @@ DoodleSegment::~DoodleSegment(void)
wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream) wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream)
{ {
wxInt32 n = lines.Number(); wxInt32 n = lines.Number();
stream << n << '\n'; stream << n << _T('\n');
wxNode *node = lines.First(); wxNode *node = lines.First();
while (node) while (node)
{ {
DoodleLine *line = (DoodleLine *)node->Data(); DoodleLine *line = (DoodleLine *)node->Data();
stream << line->x1 << " " << stream << line->x1 << _T(" ") <<
line->y1 << " " << line->y1 << _T(" ") <<
line->x2 << " " << line->x2 << _T(" ") <<
line->y2 << "\n"; line->y2 << _T("\n");
node = node->Next(); node = node->Next();
} }
@@ -176,16 +176,16 @@ wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream)
wxTextOutputStream text_stream( stream ); wxTextOutputStream text_stream( stream );
wxInt32 n = lines.Number(); wxInt32 n = lines.Number();
text_stream << n << '\n'; text_stream << n << _T('\n');
wxNode *node = lines.First(); wxNode *node = lines.First();
while (node) while (node)
{ {
DoodleLine *line = (DoodleLine *)node->Data(); DoodleLine *line = (DoodleLine *)node->Data();
text_stream << line->x1 << " " << text_stream << line->x1 << _T(" ") <<
line->y1 << " " << line->y1 << _T(" ") <<
line->x2 << " " << line->x2 << _T(" ") <<
line->y2 << "\n"; line->y2 << _T("\n");
node = node->Next(); node = node->Next();
} }

View File

@@ -56,48 +56,48 @@ bool MyApp::OnInit(void)
m_docManager = new wxDocManager; m_docManager = new wxDocManager;
//// Create a template relating drawing documents to their views //// Create a template relating drawing documents to their views
(void) new wxDocTemplate((wxDocManager *) m_docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View", (void) new wxDocTemplate((wxDocManager *) m_docManager, _T("Drawing"), _T("*.drw"), _T(""), _T("drw"), _T("Drawing Doc"), _T("Drawing View"),
CLASSINFO(DrawingDocument), CLASSINFO(DrawingView)); CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
//// Create a template relating text documents to their views //// Create a template relating text documents to their views
(void) new wxDocTemplate(m_docManager, "Text", "*.txt", "", "txt", "Text Doc", "Text View", (void) new wxDocTemplate(m_docManager, _T("Text"), _T("*.txt"), _T(""), _T("txt"), _T("Text Doc"), _T("Text View"),
CLASSINFO(TextEditDocument), CLASSINFO(TextEditView)); CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
//// Create the main frame window //// Create the main frame window
frame = new MyFrame((wxDocManager *) m_docManager, (wxFrame *) NULL, frame = new MyFrame((wxDocManager *) m_docManager, (wxFrame *) NULL,
"DocView Demo", wxPoint(0, 0), wxSize(500, 400), _T("DocView Demo"), wxPoint(0, 0), wxSize(500, 400),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
//// Give it an icon (this is ignored in MDI mode: uses resources) //// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__ #ifdef __WXMSW__
frame->SetIcon(wxIcon("doc")); frame->SetIcon(wxIcon(_T("doc")));
#endif #endif
#ifdef __X__ #ifdef __X__
frame->SetIcon(wxIcon("doc.xbm")); frame->SetIcon(wxIcon(_T("doc.xbm")));
#endif #endif
//// Make a menubar //// Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
wxMenu *edit_menu = (wxMenu *) NULL; wxMenu *edit_menu = (wxMenu *) NULL;
file_menu->Append(wxID_NEW, "&New...\tCtrl-N"); file_menu->Append(wxID_NEW, _T("&New...\tCtrl-N"));
file_menu->Append(wxID_OPEN, "&Open...\tCtrl-X"); file_menu->Append(wxID_OPEN, _T("&Open...\tCtrl-X"));
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, "E&xit\tAlt-X"); file_menu->Append(wxID_EXIT, _T("E&xit\tAlt-X"));
// A nice touch: a history of files visited. Use this menu. // A nice touch: a history of files visited. Use this menu.
m_docManager->FileHistoryUseMenu(file_menu); m_docManager->FileHistoryUseMenu(file_menu);
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(DOCVIEW_ABOUT, "&About\tF1"); help_menu->Append(DOCVIEW_ABOUT, _T("&About\tF1"));
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File"); menu_bar->Append(file_menu, _T("&File"));
if (edit_menu) if (edit_menu)
menu_bar->Append(edit_menu, "&Edit"); menu_bar->Append(edit_menu, _T("&Edit"));
menu_bar->Append(help_menu, "&Help"); menu_bar->Append(help_menu, _T("&Help"));
//// Associate the menu bar with the frame //// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
@@ -124,60 +124,60 @@ wxMDIChildFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isC
{ {
//// Make a child frame //// Make a child frame
wxDocMDIChildFrame *subframe = wxDocMDIChildFrame *subframe =
new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, "Child Frame", new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, _T("Child Frame"),
wxPoint(10, 10), wxSize(300, 300), wxPoint(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE | wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE); wxNO_FULL_REPAINT_ON_RESIZE);
#ifdef __WXMSW__ #ifdef __WXMSW__
subframe->SetIcon(wxString(isCanvas ? "chart" : "notepad")); subframe->SetIcon(wxString(isCanvas ? _T("chart") : _T("notepad")));
#endif #endif
#ifdef __X__ #ifdef __X__
subframe->SetIcon(wxIcon("doc.xbm")); subframe->SetIcon(wxIcon(_T("doc.xbm")));
#endif #endif
//// Make a menubar //// Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_NEW, "&New..."); file_menu->Append(wxID_NEW, _T("&New..."));
file_menu->Append(wxID_OPEN, "&Open..."); file_menu->Append(wxID_OPEN, _T("&Open..."));
file_menu->Append(wxID_CLOSE, "&Close"); file_menu->Append(wxID_CLOSE, _T("&Close"));
file_menu->Append(wxID_SAVE, "&Save"); file_menu->Append(wxID_SAVE, _T("&Save"));
file_menu->Append(wxID_SAVEAS, "Save &As..."); file_menu->Append(wxID_SAVEAS, _T("Save &As..."));
if (isCanvas) if (isCanvas)
{ {
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(wxID_PRINT, "&Print..."); file_menu->Append(wxID_PRINT, _T("&Print..."));
file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); file_menu->Append(wxID_PRINT_SETUP, _T("Print &Setup..."));
file_menu->Append(wxID_PREVIEW, "Print Pre&view"); file_menu->Append(wxID_PREVIEW, _T("Print Pre&view"));
} }
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, "E&xit"); file_menu->Append(wxID_EXIT, _T("E&xit"));
wxMenu *edit_menu = (wxMenu *) NULL; wxMenu *edit_menu = (wxMenu *) NULL;
if (isCanvas) if (isCanvas)
{ {
edit_menu = new wxMenu; edit_menu = new wxMenu;
edit_menu->Append(wxID_UNDO, "&Undo"); edit_menu->Append(wxID_UNDO, _T("&Undo"));
edit_menu->Append(wxID_REDO, "&Redo"); edit_menu->Append(wxID_REDO, _T("&Redo"));
edit_menu->AppendSeparator(); edit_menu->AppendSeparator();
edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); edit_menu->Append(DOCVIEW_CUT, _T("&Cut last segment"));
doc->GetCommandProcessor()->SetEditMenu(edit_menu); doc->GetCommandProcessor()->SetEditMenu(edit_menu);
} }
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(DOCVIEW_ABOUT, "&About"); help_menu->Append(DOCVIEW_ABOUT, _T("&About"));
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File"); menu_bar->Append(file_menu, _T("&File"));
if (isCanvas) if (isCanvas)
menu_bar->Append(edit_menu, "&Edit"); menu_bar->Append(edit_menu, _T("&Edit"));
menu_bar->Append(help_menu, "&Help"); menu_bar->Append(help_menu, _T("&Help"));
//// Associate the menu bar with the frame //// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
@@ -196,14 +196,14 @@ END_EVENT_TABLE()
MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title, MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
const wxPoint& pos, const wxSize& size, long type): const wxPoint& pos, const wxSize& size, long type):
wxDocMDIParentFrame(manager, frame, -1, title, pos, size, type, "myFrame") wxDocMDIParentFrame(manager, frame, -1, title, pos, size, type, _T("myFrame"))
{ {
editMenu = (wxMenu *) NULL; editMenu = (wxMenu *) NULL;
} }
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
(void)wxMessageBox("DocView Demo\nAuthor: Julian Smart\nUsage: docview.exe", "About DocView"); (void)wxMessageBox(_T("DocView Demo\nAuthor: Julian Smart\nUsage: docview.exe"), _T("About DocView"));
} }
// Creates a canvas. Called from view.cpp when a new drawing // Creates a canvas. Called from view.cpp when a new drawing

View File

@@ -47,7 +47,7 @@ END_EVENT_TABLE()
bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
{ {
frame = wxGetApp().CreateChildFrame(doc, this, TRUE); frame = wxGetApp().CreateChildFrame(doc, this, TRUE);
frame->SetTitle("DrawingView"); frame->SetTitle(_T("DrawingView"));
canvas = GetMainFrame()->CreateCanvas(this, frame); canvas = GetMainFrame()->CreateCanvas(this, frame);
#ifdef __X__ #ifdef __X__
@@ -129,7 +129,7 @@ bool DrawingView::OnClose(bool deleteWindow)
void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) ) void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
{ {
DrawingDocument *doc = (DrawingDocument *)GetDocument(); DrawingDocument *doc = (DrawingDocument *)GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingCommand((const wxString) "Cut Last Segment", DOODLE_CUT, doc, (DoodleSegment *) NULL)); doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Cut Last Segment"), DOODLE_CUT, doc, (DoodleSegment *) NULL));
} }
IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView) IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView)
@@ -141,7 +141,7 @@ bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
int width, height; int width, height;
frame->GetClientSize(&width, &height); frame->GetClientSize(&width, &height);
textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE); textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE);
frame->SetTitle("TextEditView"); frame->SetTitle(_T("TextEditView"));
#ifdef __X__ #ifdef __X__
// X seems to require a forced resize // X seems to require a forced resize
@@ -230,7 +230,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
// We've got a valid segment on mouse left up, so store it. // We've got a valid segment on mouse left up, so store it.
DrawingDocument *doc = (DrawingDocument *)view->GetDocument(); DrawingDocument *doc = (DrawingDocument *)view->GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment)); doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Add Segment"), DOODLE_ADD, doc, currentSegment));
view->GetDocument()->Modify(TRUE); view->GetDocument()->Modify(TRUE);
currentSegment = (DoodleSegment *) NULL; currentSegment = (DoodleSegment *) NULL;
@@ -257,7 +257,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
// Define a constructor for my text subwindow // Define a constructor for my text subwindow
MyTextWindow::MyTextWindow(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style): MyTextWindow::MyTextWindow(wxView *v, wxMDIChildFrame *frame, const wxPoint& pos, const wxSize& size, long style):
wxTextCtrl(frame, -1, "", pos, size, style) wxTextCtrl(frame, -1, _T(""), pos, size, style)
{ {
view = v; view = v;
} }