+
+// 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 (filename == "untitled.plt") {
+ wxString untitledFilename = theApp->getUntitledFilename();
+ SetFilename (untitledFilename, true);
+ } else {
+ if (! m_plot.fileRead (filename.c_str())) {
+ *theApp->getLog() << "Unable to read plot file " << filename << "\n";
+ return false;
+ }
+ *theApp->getLog() << "Read plot file " << filename << "\n";
+ SetFilename (filename, true);
+ m_namePlot = filename.c_str();
+ }
+ Modify (false);
+ UpdateAllViews();
+ GetFirstView()->OnUpdate (NULL, NULL);
+
+ return true;
+}
+
+bool PlotFileDocument::OnCloseDocument ()
+{
+ bool bReturn = wxDocument::OnCloseDocument();
+ return bReturn;
+}
+
+bool PlotFileDocument::IsModified(void) const
+{
+ return wxDocument::IsModified();
+}
+
+void PlotFileDocument::Modify(bool mod)
+{
+ wxDocument::Modify(mod);
+}
+