X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fdocs.cpp;h=3f38883388fd67a5cd37bd2de07c11f51848f783;hp=0f07a5223507874b56fc5c7c59a20838a512f942;hb=747a2ec9e0f3c49723b36da0cc77270fbecc9dfe;hpb=1a050c98763fbbc0662731b0b76953acede6f5d7 diff --git a/src/docs.cpp b/src/docs.cpp index 0f07a52..3f38883 100644 --- a/src/docs.cpp +++ b/src/docs.cpp @@ -7,9 +7,7 @@ ** Date Started: July 2000 ** ** This is part of the CTSim program -** Copyright (c) 1983-2001 Kevin Rosenberg -** -** $Id$ +** Copyright (c) 1983-2009 Kevin Rosenberg ** ** 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 @@ -51,12 +49,12 @@ IMPLEMENT_DYNAMIC_CLASS(ImageFileDocument, wxDocument) bool ImageFileDocument::OnSaveDocument(const wxString& filename) { - if (! m_pImageFile->fileWrite (filename)) { - *theApp->getLog() << "Unable to write image file " << filename << "\n"; + if (! m_pImageFile->fileWrite (filename.mb_str(wxConvUTF8))) { + *theApp->getLog() << _T("Unable to write image file ") << filename << _T("\n"); return false; } if (theApp->getVerboseLogging()) - *theApp->getLog() << "Wrote image file " << filename << "\n"; + *theApp->getLog() << _T("Wrote image file ") << filename << _T("\n"); Modify(false); return true; } @@ -66,18 +64,19 @@ bool ImageFileDocument::OnOpenDocument(const wxString& filename) if (! OnSaveModified()) return false; - if (! m_pImageFile->fileRead (filename.c_str())) { - *theApp->getLog() << "Unable to read image file " << filename << "\n"; + if (! m_pImageFile->fileRead (filename.mb_str(wxConvUTF8))) { + *theApp->getLog() << _T("Unable to read image file ") << filename << _T("\n"); m_bBadFileOpen = true; return false; } - if (theApp->getVerboseLogging() && filename != "") - *theApp->getLog() << "Read image file " << filename << "\n"; + if (theApp->getVerboseLogging() && filename != _T("")) + *theApp->getLog() << _T("Read image file ") << filename << _T("\n"); SetFilename(filename, true); Modify(false); getView()->setInitialClientSize(); + this->SetFilename(filename, true); UpdateAllViews(); m_bBadFileOpen = false; @@ -106,13 +105,13 @@ bool ImageFileDocument::Revert () { if (IsModified()) { - wxString msg ("Revert to saved "); + wxString msg (_T("Revert to saved ")); msg += GetFilename(); - msg += "?"; - wxMessageDialog dialog (getView()->getFrame(), msg, "Are you sure?", wxYES_NO | wxNO_DEFAULT); + msg += _T("?"); + wxMessageDialog dialog (getView()->getFrame(), msg, _T("Are you sure?"), wxYES_NO | wxNO_DEFAULT); if (dialog.ShowModal() == wxID_YES) { if (theApp->getVerboseLogging()) - *theApp->getLog() << "Reverting to saved " << GetFilename() << "\n"; + *theApp->getLog() << _T("Reverting to saved ") << GetFilename() << _T("\n"); Modify (false); OnOpenDocument (GetFilename()); } @@ -177,7 +176,7 @@ BackgroundProcessingDocument::cancelRunningTasks() while (m_vecpBackgroundSupervisors.size() > 0) { ::wxYield(); - ::wxUsleep(50); + ::wxMilliSleep(50); } #endif } @@ -190,12 +189,12 @@ IMPLEMENT_DYNAMIC_CLASS(ProjectionFileDocument, BackgroundProcessingDocument) bool ProjectionFileDocument::OnSaveDocument(const wxString& filename) { - if (! m_pProjectionFile->write (filename.c_str())) { - *theApp->getLog() << "Unable to write projection file " << filename << "\n"; + if (! m_pProjectionFile->write (filename.mb_str(wxConvUTF8))) { + *theApp->getLog() << _T("Unable to write projection file ") << filename << _T("\n"); return false; } if (theApp->getVerboseLogging()) - *theApp->getLog() << "Wrote projection file " << filename << "\n"; + *theApp->getLog() << _T("Wrote projection file ") << filename << _T("\n"); Modify(false); return true; } @@ -213,15 +212,15 @@ ProjectionFileDocument::OnOpenDocument(const wxString& filename) if (! OnSaveModified()) return false; - if (! m_pProjectionFile->read (filename.c_str())) { - *theApp->getLog() << "Unable to read projection file " << filename << "\n"; + if (! m_pProjectionFile->read (filename.mb_str(wxConvUTF8))) { + *theApp->getLog() << _T("Unable to read projection file ") << filename << _T("\n"); m_bBadFileOpen = true; return false; } m_bBadFileOpen = false; - if (theApp->getVerboseLogging() && filename != "") - *theApp->getLog() << "Read projection file " << filename << "\n"; + if (theApp->getVerboseLogging() && filename != _T("")) + *theApp->getLog() << _T("Read projection file ") << filename << _T("\n"); SetFilename(filename, true); Modify(false); @@ -276,17 +275,17 @@ PhantomFileDocument::OnOpenDocument(const wxString& constFilename) wxString filename (constFilename); if (wxFile::Exists (filename)) { - m_phantom.createFromFile (filename); + m_phantom.createFromPhmFile (filename.mb_str(wxConvUTF8)); if (theApp->getVerboseLogging()) - *theApp->getLog() << "Read phantom file " << filename << "\n"; + *theApp->getLog() << _T("Read phantom file ") << filename << _T("\n"); } else { - filename.Replace (".phm", ""); - m_phantom.createFromPhantom (filename); + filename.Replace (_T(".phm"), _T("")); + m_phantom.createFromPhantom (filename.mb_str(wxConvUTF8)); } m_namePhantom = filename; SetFilename (filename, true); if (m_phantom.fail()) { - *theApp->getLog() << "Failure creating phantom " << filename << "\n"; + *theApp->getLog() << _T("Failure creating phantom ") << filename << _T("\n"); m_bBadFileOpen = true; return false; } @@ -301,12 +300,12 @@ PhantomFileDocument::OnOpenDocument(const wxString& constFilename) bool PhantomFileDocument::OnSaveDocument(const wxString& filename) { - if (! m_phantom.fileWrite (filename.c_str())) { - *theApp->getLog() << "Unable to write phantom file " << filename << "\n"; + 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() << "Wrote phantom file " << filename << "\n"; + *theApp->getLog() << _T("Wrote phantom file ") << filename << _T("\n"); Modify(false); return true; } @@ -346,12 +345,12 @@ 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"; + 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() << "Wrote plot file " << filename << "\n"; + *theApp->getLog() << _T("Wrote plot file ") << filename << _T("\n"); Modify(false); return true; } @@ -362,15 +361,15 @@ 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"; + 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 != "") - *theApp->getLog() << "Read plot file " << filename << "\n"; + if (theApp->getVerboseLogging() && filename != _T("")) + *theApp->getLog() << _T("Read plot file ") << filename << _T("\n"); SetFilename (filename, true); m_namePlot = filename.c_str();