X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fdocs.cpp;h=2a340d18e758c850a3f7422dd8cef80f0b0b28d2;hb=7e4ade1664a9e49295ee5ec249ed596d40d6db65;hp=47ca4dcb160a706aeac56bff77626ffbf765dc00;hpb=dc5eb7b285e647a99535740a99d73d468a856ba3;p=ctsim.git diff --git a/src/docs.cpp b/src/docs.cpp index 47ca4dc..2a340d1 100644 --- a/src/docs.cpp +++ b/src/docs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: docs.cpp,v 1.38 2002/05/03 00:40:30 kevin Exp $ +** $Id: docs.cpp,v 1.42 2002/06/04 19:24:03 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 @@ -49,6 +49,12 @@ #include "threadrecon.h" +const char szNEW_IMAGE_FILENAME[] = "___CTSIM___INTERNAL___NEW___.if"; +const char szNEW_PROJECTION_FILENAME[] = "___CTSIM___INTERNAL___NEW___.pj"; +const char szNEW_GRAPH3D_FILENAME[] = "___CTSIM___INTERNAL___NEW___.3d"; +const char szNEW_PLOT_FILENAME[] = "___CTSIM___INTERNAL___NEW___.plt"; + + // ImageFileDocument IMPLEMENT_DYNAMIC_CLASS(ImageFileDocument, wxDocument) @@ -65,22 +71,28 @@ bool ImageFileDocument::OnSaveDocument(const wxString& filename) return true; } -bool ImageFileDocument::OnOpenDocument(const wxString& filename) +bool ImageFileDocument::OnOpenDocument(const wxString& constFilename) { if (! OnSaveModified()) return false; - if (! m_pImageFile->fileRead (filename.c_str())) { + wxString filename (constFilename); + + if (filename == szNEW_IMAGE_FILENAME) + filename = ""; + else if (! m_pImageFile->fileRead (filename.c_str())) { *theApp->getLog() << "Unable to read image file " << filename << "\n"; m_bBadFileOpen = true; return false; } - if (theApp->getVerboseLogging()) + + if (theApp->getVerboseLogging() && filename != "") *theApp->getLog() << "Read image file " << filename << "\n"; + SetFilename(filename, true); Modify(false); - UpdateAllViews(); getView()->setInitialClientSize(); + UpdateAllViews(); m_bBadFileOpen = false; return true; @@ -211,22 +223,28 @@ ProjectionFileDocument::~ProjectionFileDocument() } bool -ProjectionFileDocument::OnOpenDocument(const wxString& filename) +ProjectionFileDocument::OnOpenDocument(const wxString& constFilename) { if (! OnSaveModified()) return false; - if (! m_pProjectionFile->read (filename.c_str())) { + wxString filename (constFilename); + + if (filename == szNEW_PROJECTION_FILENAME) + filename = ""; + else if (! m_pProjectionFile->read (filename.c_str())) { *theApp->getLog() << "Unable to read projection file " << filename << "\n"; m_bBadFileOpen = true; return false; } - if (theApp->getVerboseLogging()) + + if (theApp->getVerboseLogging() && filename != "") *theApp->getLog() << "Read projection file " << filename << "\n"; + SetFilename(filename, true); Modify(false); - UpdateAllViews(); getView()->setInitialClientSize(); + UpdateAllViews(); m_bBadFileOpen = false; return true; @@ -293,7 +311,6 @@ PhantomFileDocument::OnOpenDocument(const wxString& filename) m_idPhantom = m_phantom.id(); Modify(false); UpdateAllViews(); - //GetFirstView()->OnUpdate (GetFirstView(), NULL); m_bBadFileOpen = false; return true; @@ -358,23 +375,28 @@ PlotFileDocument::OnSaveDocument(const wxString& filename) } bool -PlotFileDocument::OnOpenDocument(const wxString& filename) +PlotFileDocument::OnOpenDocument(const wxString& constFilename) { if (! OnSaveModified()) return false; - if (! m_plot.fileRead (filename.c_str())) { + wxString filename (constFilename); + + if (filename == szNEW_PLOT_FILENAME) + filename = ""; + else if (! m_plot.fileRead (filename.c_str())) { *theApp->getLog() << "Unable to read plot file " << filename << "\n"; m_bBadFileOpen = true; return false; } - if (theApp->getVerboseLogging()) + + if (theApp->getVerboseLogging() && filename != "") *theApp->getLog() << "Read plot file " << filename << "\n"; + SetFilename (filename, true); m_namePlot = filename.c_str(); Modify (false); UpdateAllViews(); - //GetFirstView()->OnUpdate (NULL, NULL); m_bBadFileOpen = false; return true; @@ -437,7 +459,7 @@ TextFileDocument::OnOpenDocument(const wxString& filename) SetFilename (filename, true); Modify (false); - // UpdateAllViews(); + UpdateAllViews(); m_bBadFileOpen = false; return true; } @@ -499,7 +521,7 @@ Graph3dFileDocument::OnOpenDocument(const wxString& filename) { SetFilename (filename, true); Modify (false); - // UpdateAllViews(); + UpdateAllViews(); m_bBadFileOpen = false; return true; }