{
const ImageFile& rIF = GetDocument()->getImageFile();
double min, max;
- if (! m_bMinSpecified && ! m_bMaxSpecified)
+ if (! m_bMinSpecified || ! m_bMaxSpecified)
rIF.getMinMax (min, max);
if (m_bMinSpecified)
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.empty()) {
rIF.exportImage (strFormatName.mb_str(wxConvUTF8), strFilename.mb_str(wxConvUTF8), 1, 1, m_dMinPixel, m_dMaxPixel);
*theApp->getLog() << _T("Exported file ") << strFilename << _T("\n");
}
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<int> ((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<wxFrame*>(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<wxFrame*>(GetDocument()->GetFirstView()->GetFrame())->GetTitle().c_str());
- *theApp->getLog() << wxConvUTF8.cMB2WX(os.str().c_str()) << _T("\n");
+ os << dynamic_cast<wxFrame*>(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<wxFrame*>(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();
}
}