47 wxSize size = GetClientSize();
50 dc.DrawLine( 0, size.y - 1, size.x, size.y - 1 );
60 double unitsPerInch = 25.4;
67 double pxPerUnit = dpi / unitsPerInch * value;
70 const int MIN_LABEL_SPACING = 30;
71 double lastLabelX = -MIN_LABEL_SPACING;
76 double pxPerMinorTick = pxPerUnit / 4.0;
78 for(
double x = 0; x <= size.x; x += pxPerMinorTick )
80 int tickCount = (int)round( x / pxPerMinorTick );
82 if( tickCount % 4 == 0 )
85 dc.DrawLine( x, size.y - 1, x, size.y - 16 );
87 int inchNum = tickCount / 4;
89 if( inchNum > 0 && x < size.x - 10 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
91 wxString label = wxString::Format( wxT(
"%d"), inchNum );
92 wxSize textSize = dc.GetTextExtent( label );
93 dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
100 dc.DrawLine( x, size.y - 1, x, size.y - 8 );
106 double pxPerMinorTick = pxPerUnit / 10.0;
108 for(
double x = 0; x <= size.x; x += pxPerMinorTick )
110 int tickCount = (int)round( x / pxPerMinorTick );
112 if( tickCount % 10 == 0 )
115 dc.DrawLine( x, size.y - 1, x, size.y - 16 );
117 int cmNum = tickCount / 10;
119 if( cmNum > 0 && x < size.x - 10 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
121 wxString label = wxString::Format( wxT(
"%d"), cmNum );
122 wxSize textSize = dc.GetTextExtent( label );
123 dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
130 dc.DrawLine( x, size.y - 1, x, size.y - 8 );
137 double pxPerMinorTick = pxPerUnit;
139 for(
double x = 0; x <= size.x; x += pxPerMinorTick )
141 int tickCount = (int)round( x / pxPerMinorTick );
143 if( tickCount % 10 == 0 )
146 dc.DrawLine( x, size.y - 1, x, size.y - 16 );
148 if( tickCount > 0 && x < size.x - 15 && ( x - lastLabelX ) >= MIN_LABEL_SPACING )
150 wxString label = wxString::Format( wxT(
"%d"), tickCount );
151 wxSize textSize = dc.GetTextExtent( label );
152 dc.DrawText( label, x - textSize.x / 2, size.y - 40 );
158 dc.DrawLine( x, size.y - 1, x, size.y - 8 );