+ m_bBadFileOpen = false;
+
+ return true;
+}
+
+bool
+PhantomFileDocument::OnSaveDocument(const wxString& filename)
+{
+ if (! m_phantom.fileWrite (filename.mb_str(wxConvUTF8))) {
+ *theApp->getLog() << _T("Unable to write phantom file ") << filename << _T("\n");
+ return false;
+ }
+ if (theApp->getVerboseLogging())
+ *theApp->getLog() << _T("Wrote phantom file ") << filename << _T("\n");
+ Modify(false);
+ return true;
+}
+
+bool
+PhantomFileDocument::IsModified(void) const
+{
+ return false;
+}
+
+void
+PhantomFileDocument::Modify(bool mod)
+{
+ wxDocument::Modify(mod);
+}
+
+
+PhantomFileView*
+PhantomFileDocument::getView() const
+{
+ return dynamic_cast<PhantomFileView*>(GetFirstView());
+}
+
+void
+PhantomFileDocument::Activate()
+{
+#if CTSIM_MDI
+ getView()->getFrame()->Activate();
+#endif
+};
+
+// PlotFileDocument
+
+IMPLEMENT_DYNAMIC_CLASS(PlotFileDocument, wxDocument)
+
+bool
+PlotFileDocument::OnSaveDocument(const wxString& filename)
+{
+ m_namePlot = filename.c_str();
+ if (! m_plot.fileWrite (filename.mb_str(wxConvUTF8))) {
+ *theApp->getLog() << _T("Unable to write plot file ") << filename << _T("\n");
+ return false;
+ }
+ if (theApp->getVerboseLogging())
+ *theApp->getLog() << _T("Wrote plot file ") << filename << _T("\n");
+ Modify(false);
+ return true;
+}
+
+bool
+PlotFileDocument::OnOpenDocument(const wxString& filename)
+{
+ if (! OnSaveModified())
+ return false;
+
+ if (! m_plot.fileRead (filename.mb_str(wxConvUTF8))) {
+ *theApp->getLog() << _T("Unable to read plot file ") << filename << _T("\n");
+ m_bBadFileOpen = true;
+ return false;
+ }
+ m_bBadFileOpen = false;
+
+ if (theApp->getVerboseLogging() && filename != _T(""))
+ *theApp->getLog() << _T("Read plot file ") << filename << _T("\n");
+
+ SetFilename (filename, true);
+ m_namePlot = filename.c_str();
+ Modify (false);
+ getView()->setInitialClientSize();
+ UpdateAllViews();
+