X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/457814b5aa2ee5c83abc65a6aee2a3ebcb1af34f..0141d2c9bd1033b773847447029f4598b7d9e90e:/samples/docview/view.cpp diff --git a/samples/docview/view.cpp b/samples/docview/view.cpp index d604b6fa32..61cec41421 100644 --- a/samples/docview/view.cpp +++ b/samples/docview/view.cpp @@ -24,8 +24,8 @@ #include "wx/wx.h" #endif -#if !USE_DOC_VIEW_ARCHITECTURE -#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h! +#if !wxUSE_DOC_VIEW_ARCHITECTURE +#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #include "docview.h" @@ -44,7 +44,7 @@ END_EVENT_TABLE() // What to do when a view is created. Creates actual // windows for displaying the view. -bool DrawingView::OnCreate(wxDocument *doc, long flags) +bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { if (!singleWindowMode) { @@ -57,7 +57,7 @@ bool DrawingView::OnCreate(wxDocument *doc, long flags) // X seems to require a forced resize int x, y; frame->GetSize(&x, &y); - frame->SetSize(x, y); + frame->SetSize(-1, -1, x, y); #endif frame->Show(TRUE); } @@ -99,13 +99,13 @@ void DrawingView::OnDraw(wxDC *dc) } } -void DrawingView::OnUpdate(wxView *sender, wxObject *hint) +void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) { if (canvas) canvas->Refresh(); /* Is the following necessary? -#ifdef __WINDOWS__ +#ifdef __WXMSW__ if (canvas) canvas->Refresh(); #else @@ -128,14 +128,14 @@ bool DrawingView::OnClose(bool deleteWindow) // Clear the canvas in case we're in single-window mode, // and the canvas stays. canvas->Clear(); - canvas->view = NULL; - canvas = NULL; + canvas->view = (wxView *) NULL; + canvas = (MyCanvas *) NULL; wxString s(wxTheApp->GetAppName()); if (frame) frame->SetTitle(s); - SetFrame(NULL); + SetFrame((wxFrame *) NULL); Activate(FALSE); @@ -147,15 +147,15 @@ bool DrawingView::OnClose(bool deleteWindow) return TRUE; } -void DrawingView::OnCut(wxCommandEvent& event) +void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) ) { DrawingDocument *doc = (DrawingDocument *)GetDocument(); - doc->GetCommandProcessor()->Submit(new DrawingCommand("Cut Last Segment", DOODLE_CUT, doc, NULL)); + doc->GetCommandProcessor()->Submit(new DrawingCommand((char *) "Cut Last Segment", DOODLE_CUT, doc, (DoodleSegment *) NULL)); } IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView) -bool TextEditView::OnCreate(wxDocument *doc, long flags) +bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { frame = wxGetApp().CreateChildFrame(doc, this, FALSE); @@ -168,7 +168,7 @@ bool TextEditView::OnCreate(wxDocument *doc, long flags) // X seems to require a forced resize int x, y; frame->GetSize(&x, &y); - frame->SetSize(x, y); + frame->SetSize(-1, -1, x, y); #endif frame->Show(TRUE); @@ -178,11 +178,11 @@ bool TextEditView::OnCreate(wxDocument *doc, long flags) } // Handled by wxTextWindow -void TextEditView::OnDraw(wxDC *dc) +void TextEditView::OnDraw(wxDC *WXUNUSED(dc) ) { } -void TextEditView::OnUpdate(wxView *sender, wxObject *hint) +void TextEditView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) { } @@ -230,7 +230,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) if (!view) return; - static DoodleSegment *currentSegment = NULL; + static DoodleSegment *currentSegment = (DoodleSegment *) NULL; wxClientDC dc(this); PrepareDC(dc); @@ -244,7 +244,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) if (currentSegment->lines.Number() == 0) { delete currentSegment; - currentSegment = NULL; + currentSegment = (DoodleSegment *) NULL; } else { @@ -254,7 +254,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment)); view->GetDocument()->Modify(TRUE); - currentSegment = NULL; + currentSegment = (DoodleSegment *) NULL; } } @@ -264,11 +264,13 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) currentSegment = new DoodleSegment; DoodleLine *newLine = new DoodleLine; - newLine->x1 = xpos; newLine->y1 = ypos; - newLine->x2 = pt.x; newLine->y2 = pt.y; + newLine->x1 = (long)xpos; + newLine->y1 = (long)ypos; + newLine->x2 = pt.x; + newLine->y2 = pt.y; currentSegment->lines.Append(newLine); - dc.DrawLine(xpos, ypos, pt.x, pt.y); + dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y); } xpos = pt.x; ypos = pt.y;