From b5789150456227cff15ca6526ccca7ad41fa6930 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 25 Jan 2001 18:25:21 +0000 Subject: [PATCH 1/1] Changed wxCanvas constants from XXX to wxXXX git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/canvas/canvas.h | 13 +++++++++---- contrib/samples/canvas/test/test.cpp | 20 ++++++++++---------- contrib/samples/plot/plot.cpp | 2 +- contrib/src/canvas/canvas.cpp | 14 ++++++++------ 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/contrib/include/wx/canvas/canvas.h b/contrib/include/wx/canvas/canvas.h index f0a08a707a..521c27ef86 100644 --- a/contrib/include/wx/canvas/canvas.h +++ b/contrib/include/wx/canvas/canvas.h @@ -34,7 +34,12 @@ class wxCanvasAdmin; //---------------------------------------------------------------------------- // wxCanvasObject //---------------------------------------------------------------------------- -enum DRAGMODE {DRAG_RECTANGLE,DRAG_ONTOP,DRAG_REDRAW}; +enum wxDRAG_MODE +{ + wxDRAG_RECTANGLE, + wxDRAG_ONTOP, + wxDRAG_REDRAW +}; //:defenition // wxCanvasObject is the base class for Canvas Objects. @@ -88,10 +93,10 @@ public: //DRAG_RECTANGLE = as a rectangle when drag is in progress | //DRAG_ONTOP = only redraw the object when dragging | //DRAG_REDRAW = redraw the damaged areas when dragging - void SetDragMode(DRAGMODE mode) { m_dragmode=mode; }; + void SetDragMode(wxDRAG_MODE mode) { m_dragmode=mode; }; //return the dragmode - DRAGMODE GetDragMode() { return m_dragmode; }; + wxDRAG_MODE GetDragMode() { return m_dragmode; }; //called when starting a drag virtual void DragStart(); @@ -193,7 +198,7 @@ protected: bool m_isImage:1; bool m_visible:1; bool m_dragable:1; - DRAGMODE m_dragmode:2; + wxDRAG_MODE m_dragmode:3; //boundingbox in world coordinates wxBoundingBox m_bbox; diff --git a/contrib/samples/canvas/test/test.cpp b/contrib/samples/canvas/test/test.cpp index 8ae36d6b6a..410a3780bd 100644 --- a/contrib/samples/canvas/test/test.cpp +++ b/contrib/samples/canvas/test/test.cpp @@ -63,18 +63,18 @@ void MywxCanvasObjectRef::OnMouseEvent(wxMouseEvent &event) if (event.LeftDown()) { CaptureMouse(); - if (m_dragmode != DRAG_REDRAW) + if (m_dragmode != wxDRAG_REDRAW) DragStart(); } else if (event.LeftUp()) { ReleaseMouse(); - if (m_dragmode != DRAG_REDRAW) + if (m_dragmode != wxDRAG_REDRAW) DragEnd(); } else if (IsCapturedMouse()) { - if (m_dragmode != DRAG_REDRAW) + if (m_dragmode != wxDRAG_REDRAW) DragRelative(x-xprev,y-yprev); else MoveRelative(x-xprev,y-yprev); @@ -120,18 +120,18 @@ void MyEventHandler::OnMouseEvent(wxMouseEvent &event) if (event.LeftDown()) { obj->CaptureMouse(); - if (obj->GetDragMode() != DRAG_REDRAW) + if (obj->GetDragMode() != wxDRAG_REDRAW) obj->DragStart(); } else if (event.LeftUp()) { obj->ReleaseMouse(); - if (obj->GetDragMode() != DRAG_REDRAW) + if (obj->GetDragMode() != wxDRAG_REDRAW) obj->DragEnd(); } else if (obj->IsCapturedMouse()) { - if (obj->GetDragMode() != DRAG_REDRAW) + if (obj->GetDragMode() != wxDRAG_REDRAW) obj->DragRelative(x-xprev,y-yprev); else obj->MoveRelative(x-xprev,y-yprev); @@ -207,7 +207,7 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons m_splitter = new MySplitterWindow(this, SPLITTER_WINDOW); m_canvas1 = new MyCanvas(&m_canvasadmin, m_splitter, CANVAS1, wxPoint(0, 0), wxSize(400, 400),wxHSCROLL|wxVSCROLL); - m_canvas1->SetYaxis(TRUE); + m_canvas1->SetYaxis(FALSE); m_canvas1->SetMappingScroll(-300,-300,500,500,false); m_canvas1->SetScroll(-400,-400,600,600); m_canvas1->SetColour(wxColour(255, 255, 255) ); @@ -282,7 +282,7 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons m_datatree->Append( new wxCanvasLine( 10,-15,i,300 ) ); /* m_sm4 = new wxCanvasImage( image, 0,270,64,32 ); - m_sm4->SetDragMode(DRAG_RECTANGLE); + m_sm4->SetDragMode(wxDRAG_RECTANGLE); m_datatree->Append( m_sm4 ); */ @@ -454,13 +454,13 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons m_ref2 = new MywxCanvasObjectRef(80,450, group1); m_ref2->SetRotation(-35); - m_ref2->SetDragMode(DRAG_RECTANGLE); + m_ref2->SetDragMode(wxDRAG_RECTANGLE); m_datatree->Prepend( m_ref2 ); wxCanvasCircle* cir = new wxCanvasCircle( -100, -150, 100 ); cir->SetBrush(wxBrush(wxColour(19,215,6),wxHORIZONTAL_HATCH )); cir->SetPen(wxPen(wxColour(198,3,105 ),30,wxSOLID)); - cir->SetDragMode(DRAG_REDRAW); + cir->SetDragMode(wxDRAG_REDRAW); m_datatree->Prepend( cir ); wxCanvasEllipse* elp = new wxCanvasEllipse( -100, 250, 100,300 ); diff --git a/contrib/samples/plot/plot.cpp b/contrib/samples/plot/plot.cpp index 38e9d803f2..4dde687e76 100644 --- a/contrib/samples/plot/plot.cpp +++ b/contrib/samples/plot/plot.cpp @@ -121,7 +121,7 @@ MyFrame::MyFrame() m_plot = new wxPlotWindow( this, -1, wxPoint(0,0), wxSize(100,100), wxSUNKEN_BORDER | wxPLOT_DEFAULT ); m_plot->SetUnitsPerValue( 0.01 ); - m_plot->SetScrollOnThumbRelease( TRUE ); +// m_plot->SetScrollOnThumbRelease( TRUE ); m_plot->Add( new MyPlotCurve( 0, -1.5, 1.5 ) ); m_plot->Add( new MyPlotCurve( 50, -1.5, 1.5 ) ); diff --git a/contrib/src/canvas/canvas.cpp b/contrib/src/canvas/canvas.cpp index 55cb94d21a..7a63dc0352 100644 --- a/contrib/src/canvas/canvas.cpp +++ b/contrib/src/canvas/canvas.cpp @@ -60,9 +60,9 @@ wxCanvasObject::wxCanvasObject() m_isVector = FALSE; m_isImage = FALSE; m_visible = TRUE; - m_dragmode = DRAG_ONTOP; + m_dragmode = wxDRAG_ONTOP; // handy when debugging -// m_dragmode = DRAG_RECTANGLE; +// m_dragmode = wxDRAG_RECTANGLE; m_dragable = TRUE; } @@ -216,7 +216,7 @@ void wxCanvasObject::MoveRelative( double x, double y ) void wxCanvasObject::DragStart() { - if (m_dragmode == DRAG_RECTANGLE) + if (m_dragmode == wxDRAG_RECTANGLE) { this->SetVisible(FALSE); wxTransformMatrix help; @@ -236,7 +236,7 @@ void wxCanvasObject::DragStart() dc.SetBrush(wxNullBrush); dc.SetPen(wxNullPen); } - else + else if (m_dragmode != wxDRAG_REDRAW) { this->SetVisible(FALSE); wxTransformMatrix help; @@ -266,7 +266,7 @@ void wxCanvasObject::DragStart() void wxCanvasObject::DragRelative( double x, double y) { - if (m_dragmode == DRAG_RECTANGLE) + if (m_dragmode == wxDRAG_RECTANGLE) { wxTransformMatrix help; @@ -285,7 +285,7 @@ void wxCanvasObject::DragRelative( double x, double y) dc.SetBrush(wxNullBrush); dc.SetPen(wxNullPen); } - else + else if (m_dragmode != wxDRAG_REDRAW) { wxClientDC dc(m_admin->GetActive()); wxMemoryDC tmp; @@ -336,6 +336,8 @@ void wxCanvasObject::DragRelative( double x, double y) dcm.SelectObject(wxNullBitmap); this->SetVisible(FALSE); } + else + MoveRelative(x,y); } -- 2.45.2