1 //----------------------------------------------------------------------------
2 // Class definition include
3 //----------------------------------------------------------------------------
4 #include "pPlotterScaleX.h"
6 // ----------------------------------------------------------------------------
7 // WX headers inclusion.
8 // For compilers that support precompilation, includes <wx/wx.h>.
9 // ----------------------------------------------------------------------------
15 //----------------------------------------------------------------------------
16 // Class implementation
17 //----------------------------------------------------------------------------
18 #define mpLN10 2.3025850929940456840179914546844
20 IMPLEMENT_CLASS(pPlotterScaleX, pPlotterLayer)
21 //----------------------------------------------------------------------------
23 //----------------------------------------------------------------------------
24 pPlotterScaleX::pPlotterScaleX(wxString aName,int flags) {
27 SetFont(*wxSMALL_FONT);
28 SetPen(*wxGREY_PEN);*/
29 wxFont ff( *wxSMALL_FONT);
30 wxPen pp( *wxGREY_PEN);
35 void pPlotterScaleX::Plot(wxDC& dc, mpWindow& w)
45 float min=(float)w.getMinScrX();
46 float max=(float)w.getMaxScrX();
47 float scrX=(float)w.GetScrX()-100;
48 double scaleX=(scrX/(max-min))*w.getZoomFactor();
49 int offsetpx=w.getOffsetPixelsX();
50 int offsetX=w.getOffsetX();
55 //const int orgy = w.GetScrY()-40;
56 // dc.SetDeviceOrigin(70,orgy);
57 // dc.SetAxisOrientation(true,true); //EED MacOx ???
60 dc.SetDeviceOrigin(70,orgy);
61 dc.SetAxisOrientation(true,false);
63 //const int extend = w.GetScrX()-100; //JPRx
67 dc.DrawLine(0,0,(max-min)*scaleX,0);
80 float step=(max-min)/divisions;
82 //drawing the axe with the numbers
86 //drawing the first line
87 dc.DrawLine(0,0,0,-10);
88 s.Printf(_T("%d"),(int)(min));
89 dc.DrawText(s,(wxCoord)0,(wxCoord)-20);
91 for(float i=0;i<=(max);i+=step)
94 int p=(i-min-offsetX)*scaleX+offsetpx;
97 dc.DrawLine(p,0,p,-10);
98 s.Printf(_T("%d"),(int)(i));
99 dc.DrawText(s,(wxCoord)p,(wxCoord)-20);
102 //drawing the last line
103 int p=(max-min-offsetX)*scaleX+offsetpx;
104 dc.DrawLine(p,0,p,-10);
105 s.Printf(_T("%d"),(int)(max));
106 dc.DrawText(s,(wxCoord)p,(wxCoord)-20);