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)
47 float min=(float)w.getMinScrX();
48 float max=(float)w.getMaxScrX();
49 float scrX=(float)w.GetScrX()-100;
50 double scaleX=(scrX/(max-min))*w.getZoomFactor();
51 int offsetpx=w.getOffsetPixelsX();
52 int offsetX=w.getOffsetX();
57 //const int orgy = w.GetScrY()-40;
58 // dc.SetDeviceOrigin(70,orgy);
59 // dc.SetAxisOrientation(true,true); //EED MacOx ???
62 //dc.SetDeviceOrigin(70,orgy);
63 dc.SetDeviceOrigin(70,0);
64 //dc.SetAxisOrientation(true,false);
65 double sizedc = dc.GetSize().GetY()-orgy;
67 //const int extend = w.GetScrX()-100; //JPRx
71 dc.DrawLine(0,GetYTranslated(sizedc, 0),(max-min)*scaleX,GetYTranslated(sizedc, 0));
84 float step=(max-min)/divisions;
86 //drawing the axe with the numbers
90 //drawing the first line
91 dc.DrawLine(0,GetYTranslated(sizedc, 0),0,GetYTranslated(sizedc, -10));
92 s.Printf(_T("%d"),(int)(min));
93 dc.DrawText(s,(wxCoord)0,GetYTranslated(sizedc, (wxCoord)-20));
95 for(float i=0;i<=(max);i+=step)
98 int p=(i-min-offsetX)*scaleX+offsetpx;
101 dc.DrawLine(p,0,p,-10);
102 s.Printf(_T("%d"),(int)(i));
103 dc.DrawText(s,(wxCoord)p,GetYTranslated(sizedc, (wxCoord)-20));
106 //drawing the last line
107 int p=(max-min-offsetX)*scaleX+offsetpx;
108 dc.DrawLine(p,GetYTranslated(sizedc, 0),p,GetYTranslated(sizedc, -10));
109 s.Printf(_T("%d"),(int)(max));
110 dc.DrawText(s,(wxCoord)p,GetYTranslated(sizedc, (wxCoord)-20));