r592: Added PPM & PNG File importing
[ctsim.git] / src / views.cpp
index 74458f2d08189292e25ef4b330ae28e10302f2ee..f902f19ca1d31b6a1c372282975a1c543976b58a 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.123 2001/03/01 20:02:18 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);
@@ -2106,6 +2112,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...");
@@ -2554,6 +2562,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 +2894,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 +3149,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...");