X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Fviews.cpp;h=465990360c18f9dc160ff598a4e48bca40db67ac;hb=65732cc5d8dbf867ed56a021c07c5636cea93b5a;hp=9188b34714abb25b48898c89476271b96d76c679;hpb=fd726516dd11fd37a675a94c1e7165c47d793b34;p=ctsim.git diff --git a/src/views.cpp b/src/views.cpp index 9188b34..4659903 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.38 2000/12/25 21:54:26 kevin Exp $ +** $Id: views.cpp,v 1.39 2000/12/27 03:16:02 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 @@ -91,9 +91,10 @@ ImageFileCanvas::DrawRubberBandCursor (wxDC& dc, int x, int y) int nx = rIF.nx(); int ny = rIF.ny(); + int yPt = ny - y - 1; dc.SetLogicalFunction (wxINVERT); dc.SetPen (*wxGREEN_PEN); - dc.DrawLine (0, y, nx, y); + dc.DrawLine (0, yPt, nx, yPt); dc.DrawLine (x, 0, x, ny); dc.SetLogicalFunction (wxCOPY); } @@ -121,38 +122,33 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event) wxPoint pt(event.GetLogicalPosition(dc)); + const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); + ImageFileArrayConst v = rIF.getArray(); + int nx = rIF.nx(); + int ny = rIF.ny(); + const int yPt = ny - 1 - pt.y; if (event.RightIsDown()) { - const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); - ImageFileArrayConst v = rIF.getArray(); - int nx = rIF.nx(); - int ny = rIF.ny(); - if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) { std::ostringstream os; - os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n"; + os << "Image value (" << pt.x << "," << yPt << ") = " << v[pt.x][yPt] << "\n"; *theApp->getLog() << os.str().c_str(); } else - *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n"; + *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n"; } - else if (event.LeftIsDown() || event.LeftUp()) { - const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); - ImageFileArrayConst v = rIF.getArray(); - int nx = rIF.nx(); - int ny = rIF.ny(); - + else if (event.LeftIsDown() || event.LeftUp() || event.RightUp()) { if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) { if (m_xCursor >= 0 && m_yCursor >= 0) { DrawRubberBandCursor (dc, m_xCursor, m_yCursor); } - DrawRubberBandCursor (dc, pt.x, pt.y); + DrawRubberBandCursor (dc, pt.x, yPt); m_xCursor = pt.x; - m_yCursor = pt.y; + m_yCursor = yPt; } else - *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n"; + *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n"; } if (event.LeftUp()) { std::ostringstream os; - os << "Selected column " << pt.x << " , row " << pt.y << "\n"; + os << "Selected column " << pt.x << " , row " << yPt << "\n"; *theApp->getLog() << os.str().c_str(); } } @@ -501,6 +497,7 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Column"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (2, nx); @@ -548,6 +545,7 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Row"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (2, nx); @@ -609,6 +607,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Row"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("curve 1"); rPlotFile.addEzsetCommand ("color 2"); rPlotFile.addEzsetCommand ("curve 2"); @@ -680,6 +679,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Column"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("curve 1"); rPlotFile.addEzsetCommand ("color 2"); rPlotFile.addEzsetCommand ("curve 2"); @@ -1540,7 +1540,6 @@ PlotFileView::OnDraw (wxDC* dc) m_canvas->GetClientSize (&xsize, &ysize); SGPDriver driver (dc, xsize, ysize); SGP sgp (driver); - const PlotFile& rPhantom = GetDocument()->getPlotFile(); EZPlot plot (sgp); for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)