r312: *** empty log message ***
[ctsim.git] / src / views.cpp
index 740c81c03615fca0236f43947be4c453041d817c..8b1abce2803d6167fa5d90ad2addf1d6166342e2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.36 2000/12/22 04:18:00 kevin Exp $
+**  $Id: views.cpp,v 1.37 2000/12/23 18:12:35 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
@@ -493,11 +493,15 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
       sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");\r
     } else {\r
       PlotFile& rPlotFile = pPlotDoc->getPlotFile();\r
-      std::ostringstream title;\r
-      title << "Row " << yCursor;\r
-      rPlotFile.setTitle(title.str());\r
-      rPlotFile.setXLabel("Column");\r
-      rPlotFile.setYLabel("Pixel Value");\r
+      std::ostringstream os;\r
+      os << "Row " << yCursor;\r
+      std::string title("title ");\r
+      title += os.str();\r
+      rPlotFile.addEzsetCommand (title.c_str());\r
+      rPlotFile.addEzsetCommand ("xlabel Column");\r
+      rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+      rPlotFile.addEzsetCommand ("box");\r
+      rPlotFile.addEzsetCommand ("grid");\r
       rPlotFile.setCurveSize (2, nx);\r
       rPlotFile.addColumn (0, pX);\r
       rPlotFile.addColumn (1, pY);\r
@@ -535,11 +539,15 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
       sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");\r
     } else {\r
       PlotFile& rPlotFile = pPlotDoc->getPlotFile();\r
-      std::ostringstream title;\r
-      title << "Column " << xCursor;\r
-      rPlotFile.setTitle(title.str());\r
-      rPlotFile.setXLabel("Row");\r
-      rPlotFile.setYLabel("Pixel Value");\r
+      std::ostringstream os;\r
+      os << "Column " << xCursor;\r
+      std::string title("title ");\r
+      title += os.str();\r
+      rPlotFile.addEzsetCommand (title.c_str());\r
+      rPlotFile.addEzsetCommand ("xlabel Row");\r
+      rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+      rPlotFile.addEzsetCommand ("box");\r
+      rPlotFile.addEzsetCommand ("grid");\r
       rPlotFile.setCurveSize (2, nx);\r
       rPlotFile.addColumn (0, pX);\r
       rPlotFile.addColumn (1, pY);\r
@@ -561,7 +569,10 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
   \r
   std::vector<ImageFileDocument*> vecIFDoc;\r
   theApp->getCompatibleImages (GetDocument(), vecIFDoc);\r
-  \r
+  if (vecIFDoc.size() == 0) {\r
+    wxMessageBox ("No compatible images for Column Comparison", "Error");\r
+    return;\r
+  }\r
   DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);\r
   \r
   if (dialogGetCompare.ShowModal() == wxID_OK) {\r
@@ -588,11 +599,15 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
         sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");\r
       } else {\r
         PlotFile& rPlotFile = pPlotDoc->getPlotFile();\r
-        std::ostringstream title;\r
-        title << "Comparison of Column " << xCursor;\r
-        rPlotFile.setTitle(title.str());\r
-        rPlotFile.setXLabel("Row");\r
-        rPlotFile.setYLabel("Pixel Value");\r
+        std::ostringstream os;\r
+        os << "Column " << xCursor << " Comparison";\r
+        std::string title("title ");\r
+        title += os.str();\r
+        rPlotFile.addEzsetCommand (title.c_str());\r
+        rPlotFile.addEzsetCommand ("xlabel Row");\r
+        rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("box");\r
+        rPlotFile.addEzsetCommand ("grid");\r
         rPlotFile.setCurveSize (3, nx);\r
         rPlotFile.addColumn (0, pX);\r
         rPlotFile.addColumn (1, pY1);\r
@@ -618,6 +633,11 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
   std::vector<ImageFileDocument*> vecIFDoc;\r
   theApp->getCompatibleImages (GetDocument(), vecIFDoc);\r
   \r
+  if (vecIFDoc.size() == 0) {\r
+    wxMessageBox ("No compatible images for Row Comparison", "Error");\r
+    return;\r
+  }\r
+\r
   DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);\r
   \r
   if (dialogGetCompare.ShowModal() == wxID_OK) {\r
@@ -644,11 +664,15 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
         sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");\r
       } else {\r
         PlotFile& rPlotFile = pPlotDoc->getPlotFile();\r
-        std::ostringstream title;\r
-        title << "Comparison of Row " << yCursor;\r
-        rPlotFile.setTitle(title.str());\r
-        rPlotFile.setXLabel("Column");\r
-        rPlotFile.setYLabel("Pixel Value");\r
+        std::ostringstream os;\r
+        os << "Row " << yCursor << " Comparison";\r
+        std::string title("title ");\r
+        title += os.str();\r
+        rPlotFile.addEzsetCommand (title.c_str());\r
+        rPlotFile.addEzsetCommand ("xlabel Column");\r
+        rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("box");\r
+        rPlotFile.addEzsetCommand ("grid");\r
         rPlotFile.setCurveSize (3, ny);\r
         rPlotFile.addColumn (0, pX);\r
         rPlotFile.addColumn (1, pY1);\r
@@ -1060,7 +1084,7 @@ ProjectionFileView::OnReconstruct (wxCommandEvent& event)
     m_iDefaultTrace = dialogReconstruction.getTrace();
     if (m_iDefaultNX > 0 && m_iDefaultNY > 0) {
       ImageFileDocument* pReconDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));\r
-      if (pReconDoc) {\r
+      if (pReconDoc) {\r
         sys_error (ERR_SEVERE, "Unable to create image file");\r
         return;\r
       }
@@ -1500,23 +1524,10 @@ PlotFileView::OnDraw (wxDC* dc)
     SGP sgp (driver);\r
     const PlotFile& rPhantom = GetDocument()->getPlotFile();\r
     EZPlot plot (sgp);\r
-    \r
-    if (! rPlotFile.getTitle().empty()) {\r
-      std::string s("title ");\r
-      s += rPlotFile.getTitle();\r
-      plot.ezset (s);\r
-    }\r
-    if (! rPlotFile.getXLabel().empty()) {\r
-      std::string s("xlabel ");\r
-      s += rPlotFile.getXLabel();\r
-      plot.ezset (s);\r
-    }\r
-    if (! rPlotFile.getYLabel().empty()) {\r
-      std::string s("ylabel ");\r
-      s += rPlotFile.getYLabel();\r
-      plot.ezset (s);\r
-    }\r
-    \r
+\r
+    for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r
+       plot.ezset (rPlotFile.getEzsetCommand (iEzset));\r
+\r
     if (m_bMinSpecified) {\r
       std::ostringstream os;\r
       os << "ymin " << m_dMinPixel;\r