Compile fixes for wxCanvas.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-09-11 08:13:34 +00:00
parent 2eebb742ab
commit 21840a6c0a
3 changed files with 48 additions and 46 deletions

View File

@@ -89,6 +89,7 @@ class wxCanvasObjectGroup
{ {
public: public:
wxCanvasObjectGroup(); wxCanvasObjectGroup();
virtual ~wxCanvasObjectGroup();
void SetOwner(wxCanvas* canvas); void SetOwner(wxCanvas* canvas);
wxCanvas *GetOwner() { return m_owner; } wxCanvas *GetOwner() { return m_owner; }

View 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 dx=0;
static int dy=0; static int dy=0;
int x = event.GetX(); int x = event.GetX();
int y = event.GetY(); int y = event.GetY();
if (event.m_leftDown) if (event.m_leftDown)
{ if (!first)
{ {
first=true; if (!first)
{
first=TRUE;
dx=x; dx=x;
dy=y; dy=y;
} }
@@ -71,8 +72,9 @@ void MywxCanvasImage::OnMouse(wxMouseEvent &event)
else if (IsCapturedMouse()) else if (IsCapturedMouse())
{ {
ReleaseMouse(); ReleaseMouse();
first=false; first=FALSE;
dx=0;dy=0; 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 bool first=FALSE;
static dx=0; static int dx=0;
static dy=0; static int dy=0;
//new position of object //new position of object
int x = m_owner->GetDeviceX( event.GetX()); int x = m_owner->GetDeviceX( event.GetX());
int y = m_owner->GetDeviceY( event.GetY()); int y = m_owner->GetDeviceY( event.GetY());
if (event.m_leftDown) if (event.m_leftDown)
{ if (!first)
{ {
first=true; if (!first)
{
first=FALSE;
dx=x; dx=x;
dy=y; dy=y;
} }
@@ -118,8 +121,9 @@ void MywxCanvasObjectGroupRef::OnMouse(wxMouseEvent &event)
else if (IsCapturedMouse()) else if (IsCapturedMouse())
{ {
ReleaseMouse(); ReleaseMouse();
first=false; first=FALSE;
dx=0;dy=0; dx=0;
dy=0;
} }
} }

View File

@@ -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)
@@ -160,51 +164,48 @@ void wxCanvasObjectGroup::ExtendArea(int x, int y)
} }
else else
{ {
m_validbounds = true; m_validbounds = TRUE;
m_minx = x; m_minx = x;
m_miny = y; m_miny = y;
m_maxx = x; m_maxx = x;
m_maxy = y; m_maxy = y;
} }
} }
void wxCanvasObjectGroup::DeleteContents( bool flag) void wxCanvasObjectGroup::DeleteContents( bool flag)
{ {
m_objects.DeleteContents( flag ); m_objects.DeleteContents( flag );
m_validbounds=false; m_validbounds = FALSE;
} }
void wxCanvasObjectGroup::Prepend( wxCanvasObject* obj ) void wxCanvasObjectGroup::Prepend( wxCanvasObject* obj )
{ {
m_objects.Insert( obj ); m_objects.Insert( obj );
m_validbounds=false; m_validbounds = FALSE;
} }
void wxCanvasObjectGroup::Append( wxCanvasObject* obj ) void wxCanvasObjectGroup::Append( wxCanvasObject* obj )
{ {
m_objects.Append( obj ); m_objects.Append( obj );
m_validbounds=false; m_validbounds = FALSE;
} }
void wxCanvasObjectGroup::Insert( size_t before, wxCanvasObject* obj ) void wxCanvasObjectGroup::Insert( size_t before, wxCanvasObject* obj )
{ {
m_objects.Insert( before, obj ); m_objects.Insert( before, obj );
m_validbounds=false; m_validbounds = FALSE;
} }
void wxCanvasObjectGroup::Remove( wxCanvasObject* obj ) void wxCanvasObjectGroup::Remove( wxCanvasObject* obj )
{ {
m_objects.DeleteObject( 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(); wxNode *node = m_objects.First();
while (node) 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 // cycle through all objects
wxNode *node = m_objects.First(); wxNode *node = m_objects.First();
while (node) 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,7 +369,6 @@ 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()); xabs += m_owner->GetDeviceX(GetPosX());
yabs += m_owner->GetDeviceY(GetPosY()); yabs += m_owner->GetDeviceY(GetPosY());
@@ -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_x = x;
m_y = y; m_y = y;