r600: *** empty log message ***
[ctsim.git] / src / ctsim.cpp
index 26a57b33984ada0195523c3cdc9bc73696a54fb5..5bd53127267ae3bd857d87017cc6c28c38e4cf40 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.92 2001/03/02 21:11:50 kevin Exp $
+**  $Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 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
@@ -69,7 +69,7 @@
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.92 2001/03/02 21:11:50 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -84,7 +84,7 @@ IMPLEMENT_APP(CTSimApp)
 CTSimApp::CTSimApp()
 :  m_bAdvancedOptions(false), m_bSetModifyNewDocs(true), m_bVerboseLogging(false), m_bShowStartupTips(true),
 m_iCurrentTip(0), m_bUseBackgroundTasks(false),
-m_docManager(NULL), m_pFrame(NULL), m_pLog(0), m_pLogDoc(0), m_pConfig(0)
+m_docManager(NULL), m_pFrame(NULL), m_pLog(0),  m_pConfig(0), m_pLogDoc(0)
 {
   theApp = this;
 }
@@ -336,6 +336,8 @@ EVT_MENU(MAINMENU_HELP_TIPS, MainFrame::OnHelpTips)
 EVT_MENU(MAINMENU_IMPORT, MainFrame::OnImport)
 EVT_MENU(IDH_QUICKSTART, MainFrame::OnHelpButton)
 EVT_MENU(MAINMENU_LOG_EVENT, MainFrame::OnLogEvent)
+EVT_MENU(NEW_IMAGEFILE_EVENT, MainFrame::OnNewImageFile)
+EVT_MENU(NEW_PROJECTIONFILE_EVENT, MainFrame::OnNewProjectionFile)
 EVT_BUTTON(IDH_DLG_RASTERIZE, MainFrame::OnHelpButton)
 EVT_BUTTON(IDH_DLG_PROJECTIONS, MainFrame::OnHelpButton)
 EVT_BUTTON(IDH_DLG_RECONSTRUCTION, MainFrame::OnHelpButton)
@@ -589,6 +591,49 @@ CTSimApp::getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<Imag
 }
 
 
+void
+MainFrame::OnNewImageFile (wxCommandEvent& event)
+{
+  ImageFile* pImageFile = reinterpret_cast<ImageFile*>(event.GetClientData());
+
+  ImageFileDocument* pImageDoc = theApp->newImageDoc();
+  if (! pImageDoc) {
+    sys_error (ERR_SEVERE, "Unable to create image file");
+    return;
+  }  
+  pImageDoc->setImageFile (pImageFile);
+  pImageDoc->UpdateAllViews (NULL);
+  if (ImageFileView* imageView = pImageDoc->getView()) {
+    imageView->OnUpdate (imageView, NULL);
+    imageView->getFrame()->SetFocus();
+    imageView->getFrame()->Show(true);
+  }
+  if (theApp->getAskDeleteNewDocs())
+    pImageDoc->Modify (true);
+
+}
+
+void
+MainFrame::OnNewProjectionFile (wxCommandEvent& event)
+{
+  Projections* pProjections = reinterpret_cast<Projections*>(event.GetClientData());
+  ProjectionFileDocument* pProjDoc = theApp->newProjectionDoc();
+  if (! pProjDoc) {
+    sys_error (ERR_SEVERE, "Unable to create projection file");
+    return;
+  }  
+  pProjDoc->setProjections (pProjections);
+  pProjDoc->UpdateAllViews (NULL);
+  if (ProjectionFileView* projView = pProjDoc->getView()) {
+    projView->OnUpdate (projView, NULL);
+    projView->getFrame()->SetFocus();
+    projView->getFrame()->Show(true);
+  }
+
+  if (theApp->getAskDeleteNewDocs())
+    pProjDoc->Modify (true);
+}
+
 void
 MainFrame::OnLogEvent (wxCommandEvent& event)
 {