m_deviceOriginX = m_deviceOriginY = 0;
m_logicalScaleX = m_logicalScaleY =
- m_userScaleX = m_userScaleY =
+ m_userScaleX = m_userScaleY =
m_scaleX = m_scaleY = 1.0;
m_logicalFunction = -1;
void DrawRoundedRectangle(const wxRect& r, double radius)
{ DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
+ void DrawCircle(long x, long y, long radius)
+ { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
void DrawEllipse(long x, long y, long width, long height)
{ DoDrawEllipse(x, y, width, height); }
void DrawEllipse(const wxPoint& pt, const wxSize& sz)
void OnOption(wxCommandEvent &event);
void OnMouseMove(wxMouseEvent &event);
- wxColour SelectColour() const;
+ wxColour SelectColour();
+ void PrepareDC(wxDC& dc);
protected:
int m_backgroundMode;
menuUserScale->Append( UserScale_Restore, "Restore to normal\tCtrl-0" );
wxMenu *menuAxis = new wxMenu;
- menuAxis->Append( AxisMirror_Horiz, "Mirror horizontally\tCtrl-\\", "", TRUE );
- menuAxis->Append( AxisMirror_Vertic, "Mirror vertically\tCtrl-/", "", TRUE );
+ menuAxis->Append( AxisMirror_Horiz, "Mirror horizontally\tCtrl-M", "", TRUE );
+ menuAxis->Append( AxisMirror_Vertic, "Mirror vertically\tCtrl-N", "", TRUE );
wxMenu *menuLogical = new wxMenu;
menuLogical->Append( LogicalOrigin_MoveDown, "Move &down\tCtrl-D" );
Refresh();
}
-void MyFrame::OnPaint(wxPaintEvent &WXUNUSED(event) )
+void MyFrame::PrepareDC(wxDC& dc)
{
- wxPaintDC dc(this);
dc.SetMapMode( m_mapMode );
dc.SetUserScale( m_xUserScale, m_yUserScale );
dc.SetLogicalOrigin( m_xLogicalOrigin, m_yLogicalOrigin );
dc.SetAxisOrientation( m_xAxisReversed, m_yAxisReversed );
+}
+
+void MyFrame::OnPaint(wxPaintEvent &WXUNUSED(event) )
+{
+ wxPaintDC dc(this);
+ PrepareDC(dc);
dc.SetBackgroundMode( m_backgroundMode );
if ( m_backgroundBrush.Ok() )
if ( m_colourBackground.Ok() )
dc.SetTextBackground( m_colourBackground );
+ // mark the origin
+ dc.DrawCircle(0, 0, 10);
+#ifndef __WXGTK__ // not implemented in wxGTK :-(
+ dc.FloodFill(0, 0, wxColour(255, 0, 0));
+#endif // __WXGTK__
+
dc.DrawRectangle( 10, 10, 90, 90 );
dc.DrawRoundedRectangle( 10, 110, 90, 90, 5 );
void MyFrame::OnMouseMove(wxMouseEvent &event)
{
wxClientDC dc(this);
- dc.SetMapMode( m_mapMode );
- dc.SetUserScale( m_xUserScale, m_yUserScale );
- dc.SetLogicalOrigin( m_xLogicalOrigin, m_yLogicalOrigin );
+ PrepareDC(dc);
wxPoint pos = event.GetPosition();
long x = dc.DeviceToLogicalX( pos.x );
SetStatusText( str );
}
-wxColour MyFrame::SelectColour() const
+wxColour MyFrame::SelectColour()
{
wxColour col;
wxColourData data;