r315: Coverted POL to C++ class
[ctsim.git] / src / views.cpp
index 9188b34714abb25b48898c89476271b96d76c679..465990360c18f9dc160ff598a4e48bca40db67ac 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.38 2000/12/25 21:54:26 kevin Exp $
+**  $Id: views.cpp,v 1.39 2000/12/27 03:16:02 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -91,9 +91,10 @@ ImageFileCanvas::DrawRubberBandCursor (wxDC& dc, int x, int y)
   int nx = rIF.nx();\r
   int ny = rIF.ny();\r
   \r
+  int yPt = ny - y - 1;\r
   dc.SetLogicalFunction (wxINVERT);\r
   dc.SetPen (*wxGREEN_PEN);\r
-  dc.DrawLine (0, y, nx, y);\r
+  dc.DrawLine (0, yPt, nx, yPt);\r
   dc.DrawLine (x, 0, x, ny);\r
   dc.SetLogicalFunction (wxCOPY);\r
 }\r
@@ -121,38 +122,33 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
   
   wxPoint pt(event.GetLogicalPosition(dc));
   \r
+  const ImageFile& rIF = m_pView->GetDocument()->getImageFile();\r
+  ImageFileArrayConst v = rIF.getArray();\r
+  int nx = rIF.nx();\r
+  int ny = rIF.ny();\r
+  const int yPt = ny - 1 - pt.y;\r
   if (event.RightIsDown()) {\r
-    const ImageFile& rIF = m_pView->GetDocument()->getImageFile();\r
-    ImageFileArrayConst v = rIF.getArray();\r
-    int nx = rIF.nx();\r
-    int ny = rIF.ny();\r
-    \r
     if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) {\r
       std::ostringstream os;\r
-      os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n";\r
+      os << "Image value (" << pt.x << "," << yPt << ") = " << v[pt.x][yPt] << "\n";\r
       *theApp->getLog() << os.str().c_str();\r
     } else\r
-      *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n";\r
+      *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n";\r
   }\r
-  else if (event.LeftIsDown() || event.LeftUp()) {\r
-    const ImageFile& rIF = m_pView->GetDocument()->getImageFile();\r
-    ImageFileArrayConst v = rIF.getArray();\r
-    int nx = rIF.nx();\r
-    int ny = rIF.ny();\r
-    \r
+  else if (event.LeftIsDown() || event.LeftUp() || event.RightUp()) {\r
     if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) {\r
       if (m_xCursor >= 0 && m_yCursor >= 0) {\r
         DrawRubberBandCursor (dc, m_xCursor, m_yCursor);\r
       }\r
-      DrawRubberBandCursor (dc, pt.x, pt.y);\r
+      DrawRubberBandCursor (dc, pt.x, yPt);\r
       m_xCursor = pt.x;\r
-      m_yCursor = pt.y;\r
+      m_yCursor = yPt;\r
     } else\r
-      *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n";\r
+      *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n";\r
   }\r
   if (event.LeftUp()) {\r
     std::ostringstream os;\r
-    os << "Selected column " << pt.x << " , row " << pt.y << "\n";\r
+    os << "Selected column " << pt.x << " , row " << yPt << "\n";\r
     *theApp->getLog() << os.str().c_str();\r
   }\r
 }
@@ -501,6 +497,7 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
       rPlotFile.addEzsetCommand (title.c_str());\r
       rPlotFile.addEzsetCommand ("xlabel Column");\r
       rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+      rPlotFile.addEzsetCommand ("lxfrac 0");\r
       rPlotFile.addEzsetCommand ("box");\r
       rPlotFile.addEzsetCommand ("grid");\r
       rPlotFile.setCurveSize (2, nx);\r
@@ -548,6 +545,7 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
       rPlotFile.addEzsetCommand (title.c_str());\r
       rPlotFile.addEzsetCommand ("xlabel Row");\r
       rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+      rPlotFile.addEzsetCommand ("lxfrac 0");\r
       rPlotFile.addEzsetCommand ("box");\r
       rPlotFile.addEzsetCommand ("grid");\r
       rPlotFile.setCurveSize (2, nx);\r
@@ -609,6 +607,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
         rPlotFile.addEzsetCommand (title.c_str());\r
         rPlotFile.addEzsetCommand ("xlabel Row");\r
         rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("lxfrac 0");\r
         rPlotFile.addEzsetCommand ("curve 1");\r
         rPlotFile.addEzsetCommand ("color 2");\r
         rPlotFile.addEzsetCommand ("curve 2");\r
@@ -680,6 +679,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
         rPlotFile.addEzsetCommand (title.c_str());\r
         rPlotFile.addEzsetCommand ("xlabel Column");\r
         rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("lxfrac 0");\r
         rPlotFile.addEzsetCommand ("curve 1");\r
         rPlotFile.addEzsetCommand ("color 2");\r
         rPlotFile.addEzsetCommand ("curve 2");\r
@@ -1540,7 +1540,6 @@ PlotFileView::OnDraw (wxDC* dc)
     m_canvas->GetClientSize (&xsize, &ysize);\r
     SGPDriver driver (dc, xsize, ysize);\r
     SGP sgp (driver);\r
-    const PlotFile& rPhantom = GetDocument()->getPlotFile();\r
     EZPlot plot (sgp);\r
 \r
     for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r