X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;fp=src%2Fviews.cpp;h=3411a45f67061e52f7970f54c35baff9149db003;hp=5f0d4d4a3d7cbf88b74909d68630d2ee94ef4c48;hb=e8462f7431582627e44906239077f1c696eefba1;hpb=9bdb753c5363d92b7e5698d75a967dc1fbc76b1a diff --git a/src/views.cpp b/src/views.cpp index 5f0d4d4..3411a45 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -1310,14 +1310,9 @@ ImageFileView::OnExport (wxCommandEvent& event) strWildcard = _T("Miscellaneous (*.*)|*.*"); } -#if WXWIN_COMPATIBILITY_2_4 const wxString& strFilename = wxFileSelector (_T("Export Filename"), _T(""), - _T(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxHIDE_READONLY | wxSAVE); -#else - const wxString& strFilename = wxFileSelector (_T("Export Filename"), _T(""), - _T(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxSAVE); -#endif - if (strFilename) { + _T(""), strExt, strWildcard, wxFD_OVERWRITE_PROMPT | wxFD_SAVE); + if (strFilename.Length() > 0) { rIF.exportImage (strFormatName.mb_str(wxConvUTF8), strFilename.mb_str(wxConvUTF8), 1, 1, m_dMinPixel, m_dMaxPixel); *theApp->getLog() << _T("Exported file ") << strFilename << _T("\n"); } @@ -1956,42 +1951,42 @@ ImageFileView::OnPlotHistogram (wxCommandEvent& event) pX[i] = dMin + (i + 0.5) * dBinWidth; pY[i] = 0; } - for (int ix = 0; ix < nx; ix++) + for (int ix = 0; ix < nx; ix++) { for (int iy = 0; iy < ny; iy++) { int iBin = nearest ((v[ix][iy] - dMin) / dBinWidth); if (iBin >= 0 && iBin < NUMBER_HISTOGRAM_BINS) pY[iBin] += 1; } - - PlotFile& rPlotFile = pPlotDoc->getPlotFile(); + } + PlotFile& rPlotFile = pPlotDoc->getPlotFile(); + std::ostringstream os; + os << "Histogram"; + std::string title("title "); + title += os.str(); + rPlotFile.addEzsetCommand (title.c_str()); + rPlotFile.addEzsetCommand ("xlabel Pixel Value"); + rPlotFile.addEzsetCommand ("ylabel Count"); + rPlotFile.addEzsetCommand ("box"); + rPlotFile.addEzsetCommand ("grid"); + rPlotFile.setCurveSize (2, NUMBER_HISTOGRAM_BINS); + rPlotFile.addColumn (0, pX); + rPlotFile.addColumn (1, pY); + for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) { std::ostringstream os; - os << "Histogram"; - std::string title("title "); - title += os.str(); - rPlotFile.addEzsetCommand (title.c_str()); - rPlotFile.addEzsetCommand ("xlabel Pixel Value"); - rPlotFile.addEzsetCommand ("ylabel Count"); - rPlotFile.addEzsetCommand ("box"); - rPlotFile.addEzsetCommand ("grid"); - rPlotFile.setCurveSize (2, NUMBER_HISTOGRAM_BINS); - rPlotFile.addColumn (0, pX); - rPlotFile.addColumn (1, pY); - for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) { - std::ostringstream os; - os << dynamic_cast(GetDocument()->GetFirstView()->GetFrame())->GetTitle().mb_str(wxConvUTF8); - os << ": " << rIF.labelGet(iL).getLabelString(); - rPlotFile.addDescription (os.str().c_str()); - } - os << " plot of " << wxConvUTF8.cWX2MB(dynamic_cast(GetDocument()->GetFirstView()->GetFrame())->GetTitle().c_str()); - *theApp->getLog() << wxConvUTF8.cMB2WX(os.str().c_str()) << _T("\n"); + os << dynamic_cast(GetDocument()->GetFirstView()->GetFrame())->GetTitle().mb_str(wxConvUTF8); + os << ": " << rIF.labelGet(iL).getLabelString(); rPlotFile.addDescription (os.str().c_str()); - delete pX; - delete pY; - if (theApp->getAskDeleteNewDocs()) - pPlotDoc->Modify (true); - pPlotDoc->getView()->getFrame()->Show(true); - pPlotDoc->UpdateAllViews (); - pPlotDoc->Activate(); + } + os << " plot of " << wxConvUTF8.cWX2MB(dynamic_cast(GetDocument()->GetFirstView()->GetFrame())->GetTitle().c_str()); + *theApp->getLog() << wxConvUTF8.cMB2WX(os.str().c_str()) << _T("\n"); + rPlotFile.addDescription (os.str().c_str()); + delete pX; + delete pY; + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); + pPlotDoc->getView()->getFrame()->Show(true); + pPlotDoc->UpdateAllViews (); + pPlotDoc->Activate(); } }