+ GetFirstView()->OnUpdate (GetFirstView(), NULL);
+ m_bBadFileOpen = false;
+
+ return true;
+}
+
+bool PhantomFileDocument::OnSaveDocument(const wxString& filename)
+{
+ if (! m_phantom.fileWrite (filename.c_str())) {
+ *theApp->getLog() << "Unable to write phantom file " << filename << "\n";
+ return false;
+ }
+ *theApp->getLog() << "Wrote phantom file " << filename << "\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());
+}
+
+// PlotFileDocument
+
+IMPLEMENT_DYNAMIC_CLASS(PlotFileDocument, wxDocument)
+
+bool PlotFileDocument::OnSaveDocument(const wxString& filename)
+{
+ m_namePlot = filename.c_str();
+ if (! m_plot.fileWrite (filename)) {
+ *theApp->getLog() << "Unable to write plot file " << filename << "\n";
+ return false;
+ }
+ *theApp->getLog() << "Wrote plot file " << filename << "\n";
+ Modify(false);
+ return true;
+}
+
+bool PlotFileDocument::OnOpenDocument(const wxString& filename)
+{
+ if (! OnSaveModified())
+ return false;
+
+ if (! m_plot.fileRead (filename.c_str())) {
+ *theApp->getLog() << "Unable to read plot file " << filename << "\n";
+ m_bBadFileOpen = true;
+ return false;
+ }
+ *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;
+