From f5d01a1cb74ad197a1e0cf2e05152322b4765f7f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Feb 1999 16:44:52 +0000 Subject: [PATCH] compilation fixes (errors and warnings) for wxWin 2.0 compatibility git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/bombs/bombs1.cpp | 5 ++--- samples/controls/controls.cpp | 4 ++-- samples/dynamic/dynamic.cpp | 26 +++++++++++++++----------- samples/wxpoem/wxpoem.cpp | 20 +++++++------------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/samples/bombs/bombs1.cpp b/samples/bombs/bombs1.cpp index 38ff757140..9215dd6978 100644 --- a/samples/bombs/bombs1.cpp +++ b/samples/bombs/bombs1.cpp @@ -46,8 +46,6 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2) wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID); wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID); wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBlue, 1, wxSOLID); - wxPen *whitePen = wxThePenList->FindOrCreatePen(*wxWhite, 1, wxSOLID); - wxPen *greyPen = wxThePenList->FindOrCreatePen(*wxGrey, 1, wxSOLID); wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID); wxBrush *greyBrush = wxTheBrushList->FindOrCreateBrush(*wxGrey, wxSOLID); wxBrush *redBrush = wxTheBrushList->FindOrCreateBrush(*wxRed, wxSOLID); @@ -168,7 +166,8 @@ void BombsCanvasClass::Refresh(int xc1, int yc1, int xc2, int yc2) // Called when the canvas receives a mouse event. void BombsCanvasClass::OnEvent(wxMouseEvent& event) -{ float fx, fy; +{ + long fx, fy; event.Position(&fx, &fy); int x = fx/(x_cell*X_UNIT); int y = fy/(y_cell*Y_UNIT); diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 0130c47615..5db7efa8dc 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -316,8 +316,8 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel) END_EVENT_TABLE() MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) - : m_notebook(NULL), m_text(NULL), - wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ) + : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ), + m_text(NULL), m_notebook(NULL) { // SetBackgroundColour("cadet blue"); diff --git a/samples/dynamic/dynamic.cpp b/samples/dynamic/dynamic.cpp index 44b4d0188c..c32ca01362 100644 --- a/samples/dynamic/dynamic.cpp +++ b/samples/dynamic/dynamic.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -39,20 +39,20 @@ class MyApp: public wxApp class MyFrame: public wxFrame { public: MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); - + public: void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); - bool OnClose(void) { return TRUE; } + bool OnClose(void) { return TRUE; } }; // ID for the menu commands -#define DYNAMIC_QUIT 1 -#define DYNAMIC_TEXT 101 -#define DYNAMIC_ABOUT 102 +#define DYNAMIC_QUIT 1 +#define DYNAMIC_TEXT 101 +#define DYNAMIC_ABOUT 102 // Create a new application object -IMPLEMENT_APP (MyApp) +IMPLEMENT_APP (MyApp) // `Main program' equivalent, creating windows and returning main app frame bool MyApp::OnInit(void) @@ -60,8 +60,12 @@ bool MyApp::OnInit(void) // Create the main frame window MyFrame *frame = new MyFrame(NULL, "Dynamic wxWindows App", 50, 50, 450, 340); - frame->Connect( DYNAMIC_QUIT, -1, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) MyFrame::OnQuit ); - frame->Connect( DYNAMIC_ABOUT, -1, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) MyFrame::OnAbout ); + frame->Connect( DYNAMIC_QUIT, -1, wxEVT_COMMAND_MENU_SELECTED, + (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) + &MyFrame::OnQuit ); + frame->Connect( DYNAMIC_ABOUT, -1, wxEVT_COMMAND_MENU_SELECTED, + (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) + &MyFrame::OnAbout ); // Give it an icon #ifdef __WXMSW__ @@ -86,7 +90,7 @@ bool MyApp::OnInit(void) // Show the frame frame->Show(TRUE); - + SetTopWindow(frame); return TRUE; @@ -105,7 +109,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) { wxMessageDialog dialog(this, "This demonstrates dynamic event handling", - "About Dynamic", wxYES_NO|wxCANCEL); + "About Dynamic", wxYES_NO|wxCANCEL); dialog.ShowModal(); } diff --git a/samples/wxpoem/wxpoem.cpp b/samples/wxpoem/wxpoem.cpp index dea7b5ac0f..7ae00905cc 100644 --- a/samples/wxpoem/wxpoem.cpp +++ b/samples/wxpoem/wxpoem.cpp @@ -76,8 +76,6 @@ static bool same_search = FALSE; // Searching on same string static long poem_index[600]; // Index of poem starts static long nitems = 0; // Number of poems -static int desired_char_height = DEFAULT_CHAR_HEIGHT; // Desired height -static char DesiredFont[64]; // Chosen font static int char_height = DEFAULT_CHAR_HEIGHT; // Actual height static int index_ptr = -1; // Pointer into index static int poem_height, poem_width; // Size of poem @@ -331,7 +329,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) dc->GetTextExtent(line, &xx, &yy); FindMax(&curr_width, (int)xx); - + if (DrawIt) { int x = (int)((width - xx)/2.0); @@ -400,7 +398,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) dc->DrawLine(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, height-THIN_LINE_BORDER); dc->DrawLine(width-THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, height-THIN_LINE_BORDER); dc->DrawLine(THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, THIN_LINE_BORDER); - + // Right and bottom white lines - 'grey' (black!) if // we're running on a mono display. if (wxColourDisplay()) @@ -584,7 +582,7 @@ void CopyToClipboard(HWND handle, char *s) bool MyApp::OnInit() { poem_buffer = new char[buf_size]; - + GreyPen = new wxPen("LIGHT GREY", THICK_LINE_WIDTH, wxSOLID); DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID); WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID); @@ -715,7 +713,7 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { int xx, yy; TheMainWindow->GetClientSize(&xx, &yy); - + wxMemoryDC memDC; memDC.SelectObject(* backingBitmap); dc.Blit(0, 0, backingBitmap->GetWidth(), backingBitmap->GetHeight(), &memDC, 0, 0); @@ -724,7 +722,7 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) void MyCanvas::OnMouseEvent(wxMouseEvent& event) { - float x, y; + long x, y; event.Position(&x, &y); static int startPosX, startPosY, startFrameX, startFrameY; @@ -733,11 +731,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) if (event.RightDown()) { // Versions from wxWin 1.67 are probably OK -#if 0 // wx_motif - FakePopupMenu(popupMenu, x, y); -#else PopupMenu(popupMenu, (int)x, (int)y ); -#endif } else if (event.LeftDown()) { @@ -756,7 +750,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) int x1 = (int)x; int y1 = (int)y; ClientToScreen(&x1, &y1); - + int dX = x1 - startPosX; int dY = y1 - startPosY; GetParent()->Move(startFrameX + dX, startFrameY + dY); @@ -1067,7 +1061,7 @@ bool Compile(void) fprintf(file, "%ld\n\n", nitems); for (j = 0; j < nitems; j++) fprintf(file, "%ld\n", poem_index[j]); - + fclose(file); PoetryNotify("Poetry index compiled."); return TRUE; -- 2.47.2