]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/plot.cpp
no message
[wxWidgets.git] / src / generic / plot.cpp
index 46ded83bd83690ec760cf4883c4afd4bd7540824..9d363e9880004da9e29fcee0dd5b22589c86cb05 100644 (file)
@@ -20,6 +20,8 @@
 #pragma hdrstop
 #endif
 
+#if wxUSE_PLOT
+
 #ifndef WX_PRECOMP
 #include "wx/object.h"
 #include "wx/font.h"
@@ -124,8 +126,8 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
     view_x *= wxPLOT_SCROLL_STEP;
     view_y *= wxPLOT_SCROLL_STEP;
     
-    int x = event.GetX();
-    int y = event.GetY();
+    wxCoord x = event.GetX();
+    wxCoord y = event.GetY();
     x += view_x;
     y += view_y;
     
@@ -139,7 +141,7 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
         double end = curve->GetEndY();
         wxCoord offset_y = curve->GetOffsetY();
             
-        double dy = (end - curve->GetY( x/m_owner->GetZoom() )) / range;
+        double dy = (end - curve->GetY( (wxInt32)(x/m_owner->GetZoom()) )) / range;
         wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
                 
         if ((y-curve_y < 4) && (y-curve_y > -4))
@@ -194,8 +196,6 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
     if (to == -1)
         to = view_x + client_width;
         
-    to += 2;  // no idea why this is needed
-
     double zoom = m_owner->GetZoom();
 
     int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) );
@@ -204,6 +204,8 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
     start_x = wxMax( view_x, start_x );
     end_x = wxMin( view_x + client_width, end_x );
     
+    end_x++;
+
     double double_client_height = (double)client_height;
     double range = curve->GetEndY() - curve->GetStartY();
     double end = curve->GetEndY();
@@ -212,7 +214,7 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
     wxCoord y=0,last_y=0;
     for (int x = start_x; x < end_x; x++)
     {
-        double dy = (end - curve->GetY( x/zoom )) / range;
+        double dy = (end - curve->GetY( (wxInt32)(x/zoom) )) / range;
         y = (wxCoord)(dy * double_client_height) - offset_y - 1;
             
         if (x != start_x)
@@ -308,8 +310,8 @@ void wxPlotXAxisArea::OnMouse( wxMouseEvent &event )
     view_x *= wxPLOT_SCROLL_STEP;
     view_y *= wxPLOT_SCROLL_STEP;
     
-    int x = event.GetX();
-    int y = event.GetY();
+    wxCoord x = event.GetX();
+    wxCoord y = event.GetY();
     x += view_x;
     y += view_y;
     
@@ -758,7 +760,7 @@ void wxPlotWindow::SetZoom( double zoom )
     }
     SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP, 
                    (int)((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0, 
-                   (int)view_x*zoom/old_zoom, 0, 
+                   (int)(view_x*zoom/old_zoom), 0, 
                    TRUE );
 
     RedrawXAxis();
@@ -778,7 +780,7 @@ void wxPlotWindow::ResetScrollbar()
     }
     
     SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP, 
-                   ((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0 );
+                   (int)(((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1), 0 );
 }
 
 void wxPlotWindow::RedrawXAxis()
@@ -953,3 +955,5 @@ static wxBitmap *GetDownBitmap()
 
     return s_bitmap;
 }
+
+#endif // wxUSE_PLOT