]> git.saurik.com Git - wxWidgets.git/commitdiff
Compile fixes for wxCanvas.
authorRobert Roebling <robert@roebling.de>
Mon, 11 Sep 2000 08:13:34 +0000 (08:13 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 11 Sep 2000 08:13:34 +0000 (08:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/include/wx/canvas/canvas.h
contrib/samples/canvas/test/test.cpp
contrib/src/canvas/canvas.cpp

index d8d7075ce0fda58d8f05a2977820bbb52b047e42..d3a416e60e92efebdff184dd06346e255de4dbe1 100644 (file)
@@ -89,6 +89,7 @@ class wxCanvasObjectGroup
 {
 public:
     wxCanvasObjectGroup();
 {
 public:
     wxCanvasObjectGroup();
+    virtual ~wxCanvasObjectGroup();
 
     void SetOwner(wxCanvas* canvas);
     wxCanvas *GetOwner()              { return m_owner; }
 
     void SetOwner(wxCanvas* canvas);
     wxCanvas *GetOwner()              { return m_owner; }
index 83d6eb70142942a1899f1ccb7cca87d603b22edd..93392729724bee3056f5af18ab8ca8785512bfe3 100644 (file)
@@ -52,16 +52,17 @@ MywxCanvasImage::MywxCanvasImage( const wxImage &image, double x, double y, doub
 
 void MywxCanvasImage::OnMouse(wxMouseEvent &event)
 {
 
 void MywxCanvasImage::OnMouse(wxMouseEvent &event)
 {
-    static bool first=false;
+    static bool first=FALSE;
     static int dx=0;
     static int dy=0;
 
     int x = event.GetX();
     int y = event.GetY();
     if (event.m_leftDown)
     static int dx=0;
     static int dy=0;
 
     int x = event.GetX();
     int y = event.GetY();
     if (event.m_leftDown)
-    {   if (!first)
+    {   
+        if (!first)
         {
         {
-           first=true;
+           first=TRUE;
            dx=x;
            dy=y;
         }
            dx=x;
            dy=y;
         }
@@ -71,8 +72,9 @@ void MywxCanvasImage::OnMouse(wxMouseEvent &event)
     else if (IsCapturedMouse())
     {
         ReleaseMouse();
     else if (IsCapturedMouse())
     {
         ReleaseMouse();
-        first=false;
-        dx=0;dy=0;
+        first=FALSE;
+        dx=0;
+        dy=0;
     }
 }
 
     }
 }
 
@@ -97,18 +99,19 @@ MywxCanvasObjectGroupRef::MywxCanvasObjectGroupRef(double x, double y,wxCanvasOb
 
 void MywxCanvasObjectGroupRef::OnMouse(wxMouseEvent &event)
 {
 
 void MywxCanvasObjectGroupRef::OnMouse(wxMouseEvent &event)
 {
-    static bool first=false;
-    static dx=0;
-    static dy=0;
+    static bool first=FALSE;
+    static int dx=0;
+    static int dy=0;
 
     //new position of object
     int x = m_owner->GetDeviceX( event.GetX());
     int y = m_owner->GetDeviceY( event.GetY());
 
     if (event.m_leftDown)
 
     //new position of object
     int x = m_owner->GetDeviceX( event.GetX());
     int y = m_owner->GetDeviceY( event.GetY());
 
     if (event.m_leftDown)
-    {   if (!first)
+    {   
+        if (!first)
         {
         {
-           first=true;
+           first=FALSE;
            dx=x;
            dy=y;
         }
            dx=x;
            dy=y;
         }
@@ -118,8 +121,9 @@ void MywxCanvasObjectGroupRef::OnMouse(wxMouseEvent &event)
     else if (IsCapturedMouse())
     {
         ReleaseMouse();
     else if (IsCapturedMouse())
     {
         ReleaseMouse();
-        first=false;
-        dx=0;dy=0;
+        first=FALSE;
+        dx=0;
+        dy=0;
     }
 }
 
     }
 }
 
index af813f01731326c81566eb149244779e93a82564..300d87c568ef8c01ea4f675cd2f42b9d962165d1 100644 (file)
@@ -77,7 +77,7 @@ void wxCanvasObject::Move( int x, int y )
 {
     int old_x = m_area.x;
     int old_y = m_area.y;
 {
     int old_x = m_area.x;
     int old_y = m_area.y;
-
+    
     m_area.x = x;
     m_area.y = y;
 
     m_area.x = x;
     m_area.y = y;
 
@@ -132,7 +132,11 @@ void wxCanvasObject::WriteSVG( wxTextOutputStream &stream )
 
 wxCanvasObjectGroup::wxCanvasObjectGroup()
 {
 
 wxCanvasObjectGroup::wxCanvasObjectGroup()
 {
-    m_validbounds=false;
+    m_validbounds = FALSE;
+}
+
+wxCanvasObjectGroup::~wxCanvasObjectGroup()
+{
 }
 
 void wxCanvasObjectGroup::SetOwner(wxCanvas* canvas)
 }
 
 void wxCanvasObjectGroup::SetOwner(wxCanvas* canvas)
@@ -151,60 +155,57 @@ void wxCanvasObjectGroup::SetOwner(wxCanvas* canvas)
 
 void wxCanvasObjectGroup::ExtendArea(int x, int y)
 {
 
 void wxCanvasObjectGroup::ExtendArea(int x, int y)
 {
-   if (m_validbounds)
-   {
-     if ( x < m_minx ) m_minx = x;
-     if ( y < m_miny ) m_miny = y;
-     if ( x > m_maxx ) m_maxx = x;
-     if ( y > m_maxy ) m_maxy = y;
-   }
-   else
-   {
-      m_validbounds = true;
-
-      m_minx = x;
-      m_miny = y;
-      m_maxx = x;
-      m_maxy = y;
-   }
+    if (m_validbounds)
+    {
+        if (x < m_minx) m_minx = x;
+        if (y < m_miny) m_miny = y;
+        if (x > m_maxx) m_maxx = x;
+        if (y > m_maxy) m_maxy = y;
+    }
+    else
+    {
+        m_validbounds = TRUE;
 
 
+        m_minx = x;
+        m_miny = y;
+        m_maxx = x;
+        m_maxy = y;
+    }
 }
 
 }
 
-
 void wxCanvasObjectGroup::DeleteContents( bool flag)
 {
     m_objects.DeleteContents( flag );
 void wxCanvasObjectGroup::DeleteContents( bool flag)
 {
     m_objects.DeleteContents( flag );
-    m_validbounds=false;
+    m_validbounds = FALSE;
 }
 
 }
 
-
 void wxCanvasObjectGroup::Prepend( wxCanvasObject* obj )
 {
     m_objects.Insert( obj );
 void wxCanvasObjectGroup::Prepend( wxCanvasObject* obj )
 {
     m_objects.Insert( obj );
-    m_validbounds=false;
+    m_validbounds = FALSE;
 }
 
 void wxCanvasObjectGroup::Append( wxCanvasObject* obj )
 {
     m_objects.Append( obj );
 }
 
 void wxCanvasObjectGroup::Append( wxCanvasObject* obj )
 {
     m_objects.Append( obj );
-    m_validbounds=false;
+    m_validbounds = FALSE;
 }
 
 void wxCanvasObjectGroup::Insert( size_t before, wxCanvasObject* obj )
 {
     m_objects.Insert( before, obj );
 }
 
 void wxCanvasObjectGroup::Insert( size_t before, wxCanvasObject* obj )
 {
     m_objects.Insert( before, obj );
-    m_validbounds=false;
+    m_validbounds = FALSE;
 }
 
 void wxCanvasObjectGroup::Remove( wxCanvasObject* obj )
 {
     m_objects.DeleteObject( obj );
 }
 
 void wxCanvasObjectGroup::Remove( wxCanvasObject* obj )
 {
     m_objects.DeleteObject( obj );
-    m_validbounds=false;
+    m_validbounds = FALSE;
 }
 
 void wxCanvasObjectGroup::Recreate()
 {
 }
 
 void wxCanvasObjectGroup::Recreate()
 {
-    m_validbounds=false;
+    m_validbounds = FALSE;
     wxNode *node = m_objects.First();
     while (node)
     {
     wxNode *node = m_objects.First();
     while (node)
     {
@@ -220,7 +221,6 @@ void wxCanvasObjectGroup::Recreate()
 
 void wxCanvasObjectGroup::Render(int xabs, int yabs, int x, int y, int width, int height )
 {
 
 void wxCanvasObjectGroup::Render(int xabs, int yabs, int x, int y, int width, int height )
 {
-    wxImage *image = m_owner->GetBuffer();
     // cycle through all objects
     wxNode *node = m_objects.First();
     while (node)
     // cycle through all objects
     wxNode *node = m_objects.First();
     while (node)
@@ -309,7 +309,8 @@ wxCanvasObject* wxCanvasObjectGroup::IsHitObject( int x, int y, int margin )
         }
         node = node->Previous();
     }
         }
         node = node->Previous();
     }
-    return 0;
+    
+    return (wxCanvasObject*) NULL;
 }
 
 //----------------------------------------------------------------------------
 }
 
 //----------------------------------------------------------------------------
@@ -368,9 +369,8 @@ void wxCanvasObjectGroupRef::Recreate()
 
 void wxCanvasObjectGroupRef::Render(int xabs, int yabs, int x, int y, int width, int height )
 {
 
 void wxCanvasObjectGroupRef::Render(int xabs, int yabs, int x, int y, int width, int height )
 {
-    wxImage *image = m_owner->GetBuffer();
-    xabs+=m_owner->GetDeviceX(GetPosX());
-    yabs+=m_owner->GetDeviceY(GetPosY());
+    xabs += m_owner->GetDeviceX(GetPosX());
+    yabs += m_owner->GetDeviceY(GetPosY());
 
     int clip_x = xabs + m_group->GetXMin();
     int clip_width = m_group->GetXMax()-m_group->GetXMin();
 
     int clip_x = xabs + m_group->GetXMin();
     int clip_width = m_group->GetXMax()-m_group->GetXMin();
@@ -421,9 +421,6 @@ wxCanvasObject* wxCanvasObjectGroupRef::IsHitObject( int x, int y, int margin )
 
 void wxCanvasObjectGroupRef::Move( int x, int y )
 {
 
 void wxCanvasObjectGroupRef::Move( int x, int y )
 {
-    int old_x = m_x;
-    int old_y = m_y;
-
     m_x = x;
     m_y = y;
 
     m_x = x;
     m_y = y;