** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: ctsim.cpp,v 1.111 2002/05/08 08:55:45 kevin Exp $
+** $Id: ctsim.cpp,v 1.112 2002/06/02 17:57: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
#endif
#endif
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.111 2002/05/08 08:55:45 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.112 2002/06/02 17:57:02 kevin Exp $";
struct option CTSimApp::ctsimOptions[] =
{
*theApp->getLog() << ", Build Date: " << __TIMESTAMP__;
#endif
#if defined(DEBUG)
- *theApp->getLog() << ", CTSim Debug version";
+ *theApp->getLog() << ", CTSim Debug version" << "\n";
#else
- *theApp->getLog() << ", CTSim Release version";
+ *theApp->getLog() << ", CTSim Release version" << "\n";
+#endif
+#ifdef CTSIMVERSION
+ *theApp->getLog() << "Version ";
+ *theApp->getLog() << CTSIMVERSION;
+#elif defined(VERSION)
+ *theApp->getLog() << "Version: " << VERSION;
#endif
-
*theApp->getLog() << "\n";
wxBitmap bmp (splash);
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.156 2002/05/30 17:02:32 kevin Exp $
+** $Id: views.cpp,v 1.157 2002/06/02 17:57: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
}
ImageFileCanvas::~ImageFileCanvas()
-{
- m_pView = NULL;
-}
+{}
void
ImageFileCanvas::OnDraw(wxDC& dc)
wxSize
ImageFileCanvas::GetBestSize() const
{
- if (! m_pView)
- return wxSize(0,0);
+ const int iMinX = 50;
+ const int iMinY = 20;
+ wxSize bestSize (iMinX,iMinY);
+
+ if (m_pView) {
+ const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
+ bestSize.Set (rIF.nx(), rIF.ny());
+ }
+
+ if (bestSize.x > 800)
+ bestSize.x = 800;
+ if (bestSize.y > 800)
+ bestSize.y = 800;
- const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
- return wxSize (rIF.nx(), rIF.ny());
+ if (bestSize.y < iMinY)
+ bestSize.y = iMinY;
+ if (bestSize.x < iMinX)
+ bestSize.x = iMinX;
+
+ return bestSize;
}
ImageFileCanvas*
ImageFileView::CreateCanvas (wxFrame* parent)
{
- ImageFileCanvas* pCanvas;
- int width, height;
- parent->GetClientSize(&width, &height);
-
- pCanvas = new ImageFileCanvas (this, parent, wxPoint(0, 0), wxSize(width, height), 0);
-
- pCanvas->SetScrollbars(20, 20, 50, 50);
+ ImageFileCanvas* pCanvas = new ImageFileCanvas (this, parent, wxPoint(0, 0),
+ wxSize(0,0), 0);
pCanvas->SetBackgroundColour(*wxWHITE);
pCanvas->Clear();
ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
{
#if CTSIM_MDI
- wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+ wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(10,10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
#else
- wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+ wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
#endif
theApp->setIconForFrame (subframe);
-
+
m_pFileMenu = new wxMenu;
m_pFileMenu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...\tCtrl-P");
m_pFileMenu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...\tCtrl-F");
bool
ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
{
- m_pFrame = CreateChildFrame(doc, this);
-
m_bMinSpecified = false;
m_bMaxSpecified = false;
m_dAutoScaleFactor = 1.;
- // int width, height;
- // m_pFrame->GetClientSize (&width, &height);
- m_pFrame->SetTitle("ImageFileView");
+ m_pFrame = CreateChildFrame(doc, this);
+ SetFrame (m_pFrame);
m_pCanvas = CreateCanvas (m_pFrame);
-
- // int x, y; // X requires a forced resize
- // m_pFrame->GetSize(&x, &y);
- // m_pFrame->SetSize(-1, -1, x, y);
- m_pFrame->SetFocus();
+ m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
+ m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
+ m_pFrame->SetTitle("ImageFileView");
+
m_pFrame->Show(true);
- // Activate(true);
+ Activate(true);
return true;
}
{
if (m_pFrame && m_pCanvas) {
wxSize bestSize = m_pCanvas->GetBestSize();
-
- if (bestSize.x > 800)
- bestSize.x = 800;
- if (bestSize.y > 800)
- bestSize.y = 800;
m_pFrame->SetClientSize (bestSize);
m_pFrame->Show (true);
bool
ImageFileView::OnClose (bool deleteWindow)
{
- //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
// PhantomCanvas
PhantomCanvas::PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
-: wxScrolledWindow(frame, -1, pos, size, style)
+ : wxScrolledWindow(frame, -1, pos, size, style), m_pView(v)
{
- m_pView = v;
}
PhantomCanvas::~PhantomCanvas ()
PhantomCanvas*
PhantomFileView::CreateCanvas (wxFrame *parent)
{
- PhantomCanvas* pCanvas;
-
- pCanvas = new PhantomCanvas (this, parent, wxPoint(0, 0), wxSize(0,0), 0);
+ PhantomCanvas* pCanvas = new PhantomCanvas (this, parent, wxPoint(0, 0),
+ wxSize(0,0), 0);
pCanvas->SetBackgroundColour(*wxWHITE);
pCanvas->Clear();
bool
PhantomFileView::OnClose (bool deleteWindow)
{
- //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
wxSize
ProjectionFileCanvas::GetBestSize () const
{
- wxSize best (0, 0);
- if (! m_pView)
- return best;
+ const int iMinX = 50;
+ const int iMinY = 20;
+ wxSize bestSize (iMinX,iMinY);
if (m_pView) {
Projections& rProj = m_pView->GetDocument()->getProjections();
- best.Set (rProj.nDet(), rProj.nView());
+ bestSize.Set (rProj.nDet(), rProj.nView());
}
- return best;
+ if (bestSize.y < iMinY)
+ bestSize.y = iMinY;
+ if (bestSize.x < iMinX)
+ bestSize.x = iMinX;
+
+ return bestSize;
}