r603: no message
[ctsim.git] / src / views.cpp
index 74458f2d08189292e25ef4b330ae28e10302f2ee..5a802c459aecb011e94b9c8fb33a1043f16c8ce9 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.122 2001/03/01 07:30:49 kevin Exp $
+**  $Id: views.cpp,v 1.125 2001/03/02 21:11:50 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
@@ -249,7 +249,7 @@ END_EVENT_TABLE()
 ImageFileView::ImageFileView() 
 : wxView(), m_pFrame(NULL), m_pCanvas(NULL), m_pFileMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false)
 {
-  m_iDefaultExportFormatID = ImageFile::FORMAT_PNG;
+  m_iDefaultExportFormatID = ImageFile::EXPORT_FORMAT_PNG;
 }
 
 ImageFileView::~ImageFileView()
@@ -840,6 +840,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
+  m_pFileMenu->AppendSeparator();
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -1080,20 +1082,24 @@ ImageFileView::OnExport (wxCommandEvent& event)
     DialogExportParameters dialogExport (getFrameForChild(), m_iDefaultExportFormatID);
     if (dialogExport.ShowModal() == wxID_OK) {
       wxString strFormatName (dialogExport.getFormatName ());
-      m_iDefaultExportFormatID = ImageFile::convertFormatNameToID (strFormatName.c_str());
+      m_iDefaultExportFormatID = ImageFile::convertExportFormatNameToID (strFormatName.c_str());
       
       wxString strExt;
       wxString strWildcard;
-      if (m_iDefaultExportFormatID == ImageFile::FORMAT_PGM || m_iDefaultExportFormatID == ImageFile::FORMAT_PGMASCII) {
+      if (m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PGM || m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PGMASCII) {
         strExt = ".pgm";
         strWildcard = "PGM Files (*.pgm)|*.pgm";
       }
 #ifdef HAVE_PNG
-      else if (m_iDefaultExportFormatID == ImageFile::FORMAT_PNG || m_iDefaultExportFormatID == ImageFile::FORMAT_PNG16) {
+      else if (m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PNG || m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PNG16) {
         strExt = ".png";
         strWildcard = "PNG Files (*.png)|*.png";
       }
 #endif
+      else {
+        strExt = "";
+        strWildcard = "Miscellaneous (*.*)|*.*";
+      }
       
       const wxString& strFilename = wxFileSelector (wxString("Export Filename"), wxString(""), 
         wxString(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxHIDE_READONLY | wxSAVE);
@@ -1942,6 +1948,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
       }
     }
   } else {
+#if HAVE_WXTHREADS
     if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) {
       ProjectorSupervisorThread* pProjector = new ProjectorSupervisorThread (this, m_iDefaultNDet,
         m_iDefaultNView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
@@ -1954,7 +1961,9 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
       pProjector->SetPriority(60);
       pProjector->Run();
       return;
-    } else {
+    } else     
+#endif // HAVE_WXTHREADS
+       {
       pProj = new Projections;
       pProj->initFromScanner (theScanner);
       wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), pProj->nView() + 1, getFrameForChild(), wxPD_CAN_ABORT );
@@ -2022,16 +2031,19 @@ PhantomFileView::OnRasterize (wxCommandEvent& event)
     << m_iDefaultRasterNY << ", ViewRatio=" << m_dDefaultRasterViewRatio << ", nSamples=" 
     << m_iDefaultRasterNSamples;;
 
+#if HAVE_WXTHREADS
   if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) {
     RasterizerSupervisorThread* pThread = new RasterizerSupervisorThread (this, m_iDefaultRasterNX, m_iDefaultRasterNY,
-      m_dDefaultRasterViewRatio, m_iDefaultRasterNSamples, os.str().c_str());
+      m_iDefaultRasterNSamples, m_dDefaultRasterViewRatio, os.str().c_str());
     if (pThread->Create() != wxTHREAD_NO_ERROR) {
       *theApp->getLog() << "Error creating rasterizer thread\n";
       return;
     }
     pThread->SetPriority (60);
     pThread->Run();
-  } else {
+  } else 
+#endif
+  {
     ImageFile* pImageFile = new ImageFile (m_iDefaultRasterNX, m_iDefaultRasterNY);
     wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"), 
       pImageFile->nx() + 1, getFrameForChild(), wxPD_CAN_ABORT );
@@ -2106,6 +2118,8 @@ PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+  m_pFileMenu->AppendSeparator();
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -2457,6 +2471,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
     delete pDlgReconstruct;
     delete pReconstructor;
   } else {
+#if HAVE_WXTHREADS
     if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) {
       ReconstructorSupervisorThread* pReconstructor = new ReconstructorSupervisorThread (this, 
         m_iDefaultNX, m_iDefaultNY, optFilterName.c_str(), 
@@ -2470,7 +2485,9 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
       pReconstructor->SetPriority (60);
       pReconstructor->Run();
       return;
-    } else {
+    } else 
+#endif
+       {
       pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY);
       Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(), 
         m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), 
@@ -2554,6 +2571,8 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+  m_pFileMenu->AppendSeparator();
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -2884,6 +2903,8 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+  m_pFileMenu->AppendSeparator();
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
@@ -3137,6 +3158,8 @@ TextFileView::CreateChildFrame (wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+  m_pFileMenu->AppendSeparator();
+  m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
 #ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");