X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=3ec3b6bdae002955050f22087c48926cf07dcf42;hp=93d49b336da6917fd89d3ffce46677b70a07754b;hb=9b2bb510160bdb56f04847f5b55ab61dd8a47976;hpb=9f7d379c2b03f3c09907cfd885072433e0428042 diff --git a/src/views.cpp b/src/views.cpp index 93d49b3..3ec3b6b 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.cpp,v 1.43 2001/01/01 10:14:34 kevin Exp $ +** $Id: views.cpp,v 1.44 2001/01/02 05:34:57 kevin Exp $ ** ** 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 @@ -165,7 +165,8 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event) IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView) -BEGIN_EVENT_TABLE(ImageFileView, wxView) +BEGIN_EVENT_TABLE(ImageFileView, wxView) +EVT_MENU(IFMENU_FILE_EXPORT, ImageFileView::OnExport) EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties) EVT_MENU(IFMENU_VIEW_SCALE_MINMAX, ImageFileView::OnScaleMinMax) EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto) @@ -177,8 +178,15 @@ EVT_MENU(IFMENU_PROCESS_SQUARE, ImageFileView::OnSquare) EVT_MENU(IFMENU_PROCESS_SQRT, ImageFileView::OnSquareRoot) EVT_MENU(IFMENU_PROCESS_LOG, ImageFileView::OnLog) EVT_MENU(IFMENU_PROCESS_EXP, ImageFileView::OnExp) +EVT_MENU(IFMENU_PROCESS_ADD, ImageFileView::OnAdd) +EVT_MENU(IFMENU_PROCESS_SUBTRACT, ImageFileView::OnSubtract) +EVT_MENU(IFMENU_PROCESS_MULTIPLY, ImageFileView::OnMultiply) +EVT_MENU(IFMENU_PROCESS_DIVIDE, ImageFileView::OnDivide) EVT_MENU(IFMENU_PROCESS_FOURIER, ImageFileView::OnFourier) +EVT_MENU(IFMENU_PROCESS_SCALESIZE, ImageFileView::OnScaleSize) EVT_MENU(IFMENU_PROCESS_INVERSE_FOURIER, ImageFileView::OnInverseFourier) +EVT_MENU(IFMENU_PROCESS_SHUFFLEFOURIERTONATURALORDER, ImageFileView::OnShuffleFourierToNaturalOrder) +EVT_MENU(IFMENU_PROCESS_SHUFFLENATURALTOFOURIERORDER, ImageFileView::OnShuffleNaturalToFourierOrder) #ifdef HAVE_FFTW EVT_MENU(IFMENU_PROCESS_FFT, ImageFileView::OnFFT) EVT_MENU(IFMENU_PROCESS_IFFT, ImageFileView::OnIFFT) @@ -191,7 +199,8 @@ END_EVENT_TABLE() ImageFileView::ImageFileView(void) : wxView(), m_canvas(NULL), m_frame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false) -{ +{ + m_iDefaultExportFormatID = ImageFile::FORMAT_PNG; } ImageFileView::~ImageFileView(void) @@ -221,6 +230,10 @@ ImageFileView::OnProperties (wxCommandEvent& event) rIF.statistics (rIF.getImaginaryArray(), min, max, mean, mode, median, stddev); os << "\nImaginary: min: "< 0) { + os << "\n"; + rIF.printLabelsBrief (os); + } *theApp->getLog() << os.str().c_str(); wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION); dialogMsg.ShowModal(); @@ -292,7 +305,7 @@ ImageFileView::OnCompare (wxCommandEvent& event) rIF.statistics (min, max, mean, mode, median, stddev); os << rIF.getFilename() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; rCompareIF.statistics (min, max, mean, mode, median, stddev); - os << pCompareDoc->GetTitle().c_str() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; + os << pCompareDoc->GetFirstView()->GetFrame()->GetTitle().c_str() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; os << "\n"; double d, r, e; rIF.comparativeStatistics (rCompareIF, d, r, e); @@ -327,6 +340,7 @@ ImageFileView::OnInvertValues (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); rIF.invertPixelValues (rIF); + rIF.labelAdd ("Invert Pixel Values"); if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); @@ -337,6 +351,7 @@ ImageFileView::OnSquare (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); rIF.square (rIF); + rIF.labelAdd ("Square Pixel Values"); if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); @@ -347,6 +362,7 @@ ImageFileView::OnSquareRoot (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); rIF.sqrt (rIF); + rIF.labelAdd ("Square-root Pixel Values"); if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); @@ -357,6 +373,7 @@ ImageFileView::OnLog (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); rIF.log (rIF); + rIF.labelAdd ("Logrithm base-e Pixel Values"); if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); @@ -367,24 +384,125 @@ ImageFileView::OnExp (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); rIF.exp (rIF); + rIF.labelAdd ("Exponent base-e Pixel Values"); if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); } void -ImageFileView::OnFourier (wxCommandEvent& event) +ImageFileView::OnAdd (wxCommandEvent& event) { - ImageFile& rIF = GetDocument()->getImageFile(); - wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, m_frame, wxPD_APP_MODAL); - rIF.fourier (rIF); - m_bMinSpecified = false; - m_bMaxSpecified = false; - if (theApp->getSetModifyNewDocs()) - GetDocument()->Modify(TRUE); - GetDocument()->UpdateAllViews(this); + std::vector vecIF; + theApp->getCompatibleImages (GetDocument(), vecIF); + + if (vecIF.size() == 0) { + wxMessageBox ("There are no compatible image files open for comparision", "No comparison images"); + } else { + DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Add", vecIF, false); + + if (dialogGetCompare.ShowModal() == wxID_OK) { + ImageFile& rIF = GetDocument()->getImageFile(); + ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument(); + const ImageFile& rRHSIF = pRHSDoc->getImageFile(); + rIF.addImages (rRHSIF, rIF); + std::ostringstream os; + os << "Add image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() << " and " + << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str(); + rIF.labelAdd (os.str().c_str()); + *theApp->getLog() << os.str().c_str() << "\n"; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); + } + } } +void +ImageFileView::OnSubtract (wxCommandEvent& event) +{ + std::vector vecIF; + theApp->getCompatibleImages (GetDocument(), vecIF); + + if (vecIF.size() == 0) { + wxMessageBox ("There are no compatible image files open for comparision", "No comparison images"); + } else { + DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Subtract", vecIF, false); + + if (dialogGetCompare.ShowModal() == wxID_OK) { + ImageFile& rIF = GetDocument()->getImageFile(); + ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument(); + const ImageFile& rRHSIF = pRHSDoc->getImageFile(); + rIF.subtractImages (rRHSIF, rIF); + std::ostringstream os; + os << "Subtract image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() + << " and " << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str(); + rIF.labelAdd (os.str().c_str()); + *theApp->getLog() << os.str().c_str() << "\n"; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); + } + } +} + +void +ImageFileView::OnMultiply (wxCommandEvent& event) +{ + std::vector vecIF; + theApp->getCompatibleImages (GetDocument(), vecIF); + + if (vecIF.size() == 0) { + wxMessageBox ("There are no compatible image files open for comparision", "No comparison images"); + } else { + DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Multiply", vecIF, false); + + if (dialogGetCompare.ShowModal() == wxID_OK) { + ImageFile& rIF = GetDocument()->getImageFile(); + ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument(); + const ImageFile& rRHSIF = pRHSDoc->getImageFile(); + rIF.multiplyImages (rRHSIF, rIF); + std::ostringstream os; + os << "Multiply image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() + << " and " << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str(); + rIF.labelAdd (os.str().c_str()); + *theApp->getLog() << os.str().c_str() << "\n"; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); + } + } +} + +void +ImageFileView::OnDivide (wxCommandEvent& event) +{ + std::vector vecIF; + theApp->getCompatibleImages (GetDocument(), vecIF); + + if (vecIF.size() == 0) { + wxMessageBox ("There are no compatible image files open for comparision", "No comparison images"); + } else { + DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Divide", vecIF, false); + + if (dialogGetCompare.ShowModal() == wxID_OK) { + ImageFile& rIF = GetDocument()->getImageFile(); + ImageFileDocument* pRHSDoc = dialogGetCompare.getImageFileDocument(); + const ImageFile& rRHSIF = pRHSDoc->getImageFile(); + rIF.divideImages (rRHSIF, rIF); + std::ostringstream os; + os << "Divide image " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str() + << " by " << pRHSDoc->GetFirstView()->GetFrame()->GetTitle().c_str(); + rIF.labelAdd (os.str().c_str()); + *theApp->getLog() << os.str().c_str() << "\n"; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); + } + } +} + + #ifdef HAVE_FFTW void ImageFileView::OnFFT (wxCommandEvent& event) @@ -392,6 +510,7 @@ ImageFileView::OnFFT (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); wxProgressDialog dlgProgress (wxString("FFT"), wxString("FFT Progress"), 1, m_frame, wxPD_APP_MODAL); rIF.fft (rIF); + rIF.labelAdd ("FFT Image"); m_bMinSpecified = false; m_bMaxSpecified = false; if (theApp->getSetModifyNewDocs()) @@ -405,6 +524,7 @@ ImageFileView::OnIFFT (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); wxProgressDialog dlgProgress (wxString("IFFT"), wxString("IFFT Progress"), 1, m_frame, wxPD_APP_MODAL); rIF.ifft (rIF); + rIF.labelAdd ("IFFT Image"); m_bMinSpecified = false; m_bMaxSpecified = false; if (theApp->getSetModifyNewDocs()) @@ -413,12 +533,52 @@ ImageFileView::OnIFFT (wxCommandEvent& event) } #endif +void +ImageFileView::OnFourier (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, m_frame, wxPD_APP_MODAL); + rIF.fourier (rIF); + rIF.labelAdd ("Fourier Image"); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} void ImageFileView::OnInverseFourier (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); wxProgressDialog dlgProgress (wxString("Inverse Fourier"), wxString("Inverse Fourier Progress"), 1, m_frame, wxPD_APP_MODAL); rIF.inverseFourier (rIF); + rIF.labelAdd ("Inverse Fourier Image"); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnShuffleNaturalToFourierOrder (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + Fourier::shuffleNaturalToFourierOrder (rIF); + rIF.labelAdd ("Shuffle Natural To Fourier Order"); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnShuffleFourierToNaturalOrder (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + Fourier::shuffleFourierToNaturalOrder (rIF); + rIF.labelAdd ("Shuffle Fourier To Natural Order"); m_bMinSpecified = false; m_bMaxSpecified = false; if (theApp->getSetModifyNewDocs()) @@ -430,24 +590,30 @@ void ImageFileView::OnMagnitude (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); - rIF.magnitude (rIF); + if (rIF.isComplex()) { + rIF.magnitude (rIF); + rIF.labelAdd ("Magnitude of complex-image"); m_bMinSpecified = false; m_bMaxSpecified = false; if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); + } } void ImageFileView::OnPhase (wxCommandEvent& event) { ImageFile& rIF = GetDocument()->getImageFile(); - rIF.phase (rIF); + if (rIF.isComplex()) { + rIF.phase (rIF); + rIF.labelAdd ("Phase of complex-image"); m_bMinSpecified = false; m_bMaxSpecified = false; if (theApp->getSetModifyNewDocs()) GetDocument()->Modify(TRUE); GetDocument()->UpdateAllViews(this); + } } @@ -481,8 +647,9 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) file_menu->Append(wxID_SAVEAS, "Save &As..."); file_menu->Append(wxID_CLOSE, "&Close"); - file_menu->AppendSeparator(); + file_menu->AppendSeparator(); file_menu->Append(IFMENU_FILE_PROPERTIES, "P&roperties"); + file_menu->Append(IFMENU_FILE_EXPORT, "&Export..."); file_menu->AppendSeparator(); file_menu->Append(wxID_PRINT, "&Print..."); @@ -500,6 +667,13 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) process_menu->Append (IFMENU_PROCESS_LOG, "&Log"); process_menu->Append (IFMENU_PROCESS_EXP, "&Exp"); process_menu->AppendSeparator(); + process_menu->Append (IFMENU_PROCESS_ADD, "&Add"); + process_menu->Append (IFMENU_PROCESS_SUBTRACT, "Su&btract"); + process_menu->Append (IFMENU_PROCESS_MULTIPLY, "&Multiply"); + process_menu->Append (IFMENU_PROCESS_DIVIDE, "&Divide"); + process_menu->AppendSeparator(); + process_menu->Append (IFMENU_PROCESS_SCALESIZE, "S&cale Size..."); + process_menu->AppendSeparator(); #ifdef HAVE_FFTW process_menu->Append (IFMENU_PROCESS_FFT, "&FFT"); process_menu->Append (IFMENU_PROCESS_IFFT, "&IFFT"); @@ -509,6 +683,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) process_menu->Append (IFMENU_PROCESS_FOURIER, "&Fourier"); process_menu->Append (IFMENU_PROCESS_INVERSE_FOURIER, "&Inverse Fourier"); #endif + process_menu->Append (IFMENU_PROCESS_SHUFFLEFOURIERTONATURALORDER, "S&huffle Fourier to Natural Order"); + process_menu->Append (IFMENU_PROCESS_SHUFFLENATURALTOFOURIERORDER, "Shu&ffle Natural to Fourier Order"); process_menu->Append (IFMENU_PROCESS_MAGNITUDE, "&Magnitude"); process_menu->Append (IFMENU_PROCESS_PHASE, "&Phase"); @@ -542,7 +718,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool -ImageFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) +ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { m_frame = CreateChildFrame(doc, this); SetFrame (m_frame); @@ -645,6 +821,80 @@ ImageFileView::OnClose (bool deleteWindow) return true; } +void +ImageFileView::OnExport (wxCommandEvent& event) +{ + ImageFile& rIF = dynamic_cast(GetDocument())->getImageFile(); + ImageFileArrayConst v = rIF.getArray(); + int nx = rIF.nx(); + int ny = rIF.ny(); + if (v != NULL && nx != 0 && ny != 0) { + if (! m_bMinSpecified || ! m_bMaxSpecified) { + double min, max; + rIF.getMinMax (min, max); + if (! m_bMinSpecified) + m_dMinPixel = min; + if (! m_bMaxSpecified) + m_dMaxPixel = max; + } + + DialogExportParameters dialogExport (m_frame, m_iDefaultExportFormatID); + if (dialogExport.ShowModal() == wxID_OK) { + wxString strFormatName (dialogExport.getFormatName ()); + m_iDefaultExportFormatID = ImageFile::convertFormatNameToID (strFormatName.c_str()); + + wxString strExt; + wxString strWildcard; + if (m_iDefaultExportFormatID == ImageFile::FORMAT_PGM || m_iDefaultExportFormatID == ImageFile::FORMAT_PGMASCII) { + strExt = ".pgm"; + strWildcard = "PGM Files (*.pgm)|*.pgm"; + } +#ifdef HAVE_PNG + else if (m_iDefaultExportFormatID == ImageFile::FORMAT_PNG || m_iDefaultExportFormatID == ImageFile::FORMAT_PNG16) { + strExt = ".png"; + strWildcard = "PNG Files (*.png)|*.png"; + } +#endif + + const wxString& strFilename = wxFileSelector (wxString("Export Filename"), wxString(""), + wxString(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxHIDE_READONLY | wxSAVE); + if (strFilename) { + rIF.exportImage (strFormatName.c_str(), strFilename.c_str(), 1, 1, m_dMinPixel, m_dMaxPixel); + *theApp->getLog() << "Exported file " << strFilename << "\n"; + } + } + } +} + +void +ImageFileView::OnScaleSize (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + unsigned int iOldNX = rIF.nx(); + unsigned int iOldNY = rIF.ny(); + + DialogGetXYSize dialogGetXYSize (m_frame, "Set New X & Y Dimensions", iOldNX, iOldNY); + if (dialogGetXYSize.ShowModal() == wxID_OK) { + unsigned int iNewNX = dialogGetXYSize.getXSize(); + unsigned int iNewNY = dialogGetXYSize.getYSize(); + std::ostringstream os; + os << "Scale Size from (" << iOldNX << "," << iOldNY << ") to (" << iNewNX << "," << iNewNY << ")"; + ImageFileDocument* pScaledDoc = dynamic_cast(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT)); + if (! pScaledDoc) { + sys_error (ERR_SEVERE, "Unable to create image file"); + return; + } + ImageFile& rScaledIF = pScaledDoc->getImageFile(); + rScaledIF.setArraySize (iNewNX, iNewNY); + rScaledIF.labelAdd (os.str().c_str()); + rIF.scaleImage (rScaledIF); + *theApp->getLog() << os.str().c_str() << "\n"; + if (theApp->getSetModifyNewDocs()) + pScaledDoc->Modify(TRUE); + pScaledDoc->UpdateAllViews (this); + pScaledDoc->GetFirstView()->OnUpdate (this, NULL); + } +} void ImageFileView::OnPlotRow (wxCommandEvent& event) @@ -896,7 +1146,7 @@ PhantomCanvas::PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos } void -PhantomCanvas::OnDraw(wxDC& dc) +PhantomCanvas::OnDraw (wxDC& dc) { if (m_pView) m_pView->OnDraw(& dc); @@ -936,12 +1186,14 @@ PhantomView::OnProperties (wxCommandEvent& event) const int idPhantom = GetDocument()->getPhantomID(); const wxString& namePhantom = GetDocument()->getPhantomName(); std::ostringstream os; - os << "Phantom " << namePhantom.c_str() << " (" << idPhantom << ")\n"; - *theApp->getLog() << os.str().c_str(); + os << "Phantom " << namePhantom.c_str() << " (" << idPhantom << ")" << "\n"; + const Phantom& rPhantom = GetDocument()->getPhantom(); + rPhantom.printDefinitions (os); #if DEBUG - const Phantom& rPhantom = GetDocument()->getPhantom(); - rPhantom.print(); + rPhantom.print (os); #endif + *theApp->getLog() << os.str().c_str() << "\n"; + wxMessageBox (os.str().c_str(), "Phantom Properties"); } @@ -1102,7 +1354,8 @@ PhantomView::CreateChildFrame(wxDocument *doc, wxView *view) file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter..."); - file_menu->Append(wxID_OPEN, "&Open..."); + file_menu->Append(wxID_OPEN, "&Open..."); + file_menu->Append(wxID_SAVEAS, "Save &As..."); file_menu->Append(wxID_CLOSE, "&Close"); file_menu->AppendSeparator(); @@ -1571,9 +1824,10 @@ PlotFileView::~PlotFileView(void) void PlotFileView::OnProperties (wxCommandEvent& event) { - const PlotFile& rProj = GetDocument()->getPlotFile(); + const PlotFile& rPlot = GetDocument()->getPlotFile(); std::ostringstream os; - os << "Columns: " << rProj.getNumColumns() << ", Records: " << rProj.getNumRecords() << "\n"; + os << "Columns: " << rPlot.getNumColumns() << ", Records: " << rPlot.getNumRecords() << "\n"; + rPlot.printHeaders (os); *theApp->getLog() << os.str().c_str(); wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION); dialogMsg.ShowModal(); @@ -1605,9 +1859,10 @@ void PlotFileView::OnScaleMinMax (wxCommandEvent& event) { const PlotFile& rPlotFile = GetDocument()->getPlotFile(); - double min, max; - - if (! m_bMinSpecified && ! m_bMaxSpecified) { + double min; + double max; + + if (! m_bMinSpecified || ! m_bMaxSpecified) { if (! rPlotFile.getMinMax (1, min, max)) { *theApp->getLog() << "Error: unable to find Min/Max\n"; return; @@ -1739,7 +1994,6 @@ PlotFileView::OnDraw (wxDC* dc) void PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) { - if (m_canvas) { const PlotFile& rPlotFile = GetDocument()->getPlotFile(); const int iNColumns = rPlotFile.getNumColumns(); const int iNRecords = rPlotFile.getNumRecords(); @@ -1779,9 +2033,9 @@ PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) delete pdXaxis; delete pdY; } - - m_canvas->Refresh(); - } + + if (m_canvas) + m_canvas->Refresh(); } bool