1 //----------------------------------------------------------------------------
2 // Class definition include
3 //----------------------------------------------------------------------------
4 #include "pPlotterScaleY.h"
6 // ----------------------------------------------------------------------------
7 // WX headers inclusion.
8 // For compilers that support precompilation, includes <wx/wx.h>.
9 // ----------------------------------------------------------------------------
15 //----------------------------------------------------------------------------
16 // Class implementation
17 //----------------------------------------------------------------------------
19 #define mpLN10 2.3025850929940456840179914546844
21 IMPLEMENT_CLASS(pPlotterScaleY, pPlotterLayer)
22 //----------------------------------------------------------------------------
24 //----------------------------------------------------------------------------
25 pPlotterScaleY::pPlotterScaleY(wxString aName,int flags) {
28 SetFont(*wxSMALL_FONT);
29 SetPen(*wxGREY_PEN);*/
30 wxFont ff( *wxSMALL_FONT);
31 wxPen pp( *wxGREY_PEN);
36 void pPlotterScaleY::Plot(wxDC& dc, mpWindow& w)
45 float min= (float)w.getMinScrY();
46 float max=(float)w.getMaxScrY();
47 float scrY=(float)w.GetScrY()-50;
48 double scaleY=(scrY/(max-min))*w.getZoomFactor();
49 int offsetpy=w.getOffsetPixelsY();
50 int offsetY=w.getOffsetY();
56 // const int orgy = w.GetScrY()-40;
57 // dc.SetDeviceOrigin(70,orgy);
58 // dc.SetAxisOrientation(true,true); //EED MacOx ???
61 dc.SetDeviceOrigin(70,orgy);
62 dc.SetAxisOrientation(true,false);
64 // const int extend = w.GetScrY()-50; //EED
67 dc.DrawLine( 0,0, 0, (max-min)*scaleY);
80 float step=(max-min)/divisions;
83 //drawing the axe with the numbers
85 //drawing the first line
86 dc.DrawLine(0,0,-10,0);
87 s.Printf(_T("%d"),(int)(min));
88 dc.DrawText(s,(wxCoord)-20,(wxCoord)0);
91 for(float i=0;i<=(max);i+=step)
94 int p=(i-min-offsetY)*scaleY+offsetpy;
97 dc.DrawLine(0,p,-10,p);
98 s.Printf(_T("%d"),(int)(i));
99 dc.DrawText(s,(wxCoord)-20,(wxCoord)p);
102 //drawing the last line
103 int p=(max-min-offsetY)*scaleY+offsetpy;
104 dc.DrawLine(0,p,-10,p);
105 s.Printf(_T("%d"),(int)(max));
106 dc.DrawText(s,(wxCoord)-20,(wxCoord)p);