r2100: *** empty log message ***
[ctsim.git] / src / views.cpp
index 6f6222086c7bf72adb8cabdf0391656dcb8cedc9..c0140b3d4578602f133c7d4647054acbcb84c13f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.157 2002/06/02 17:57:02 kevin Exp $
+**  $Id: views.cpp,v 1.158 2002/06/02 19:01:58 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
@@ -1324,11 +1324,9 @@ ImageFileView::OnConvert3d (wxCommandEvent& event)
   Graph3dFileDocument* pGraph3d = theApp->newGraph3dDoc();
   pGraph3d->setBadFileOpen();
   pGraph3d->createFromImageFile (rIF);
-  pGraph3d->getView()->OnUpdate (this, NULL);
   pGraph3d->UpdateAllViews();
-  pGraph3d->getView()->getFrame()->SetClientSize (400, 400);
   pGraph3d->getView()->getFrame()->Show (true);
-  GetDocumentManager()->ActivateView (pGraph3d->getView(), true, false);
+  pGraph3d->getView()->Activate(true);
   ::wxYield();
   pGraph3d->getView()->getCanvas()->SetFocus();
 }
@@ -2432,10 +2430,15 @@ ProjectionFileCanvas::GetBestSize () const
     bestSize.Set (rProj.nDet(), rProj.nView());
   }
   
-  if (bestSize.y < iMinY)
-    bestSize.y = iMinY;
+  if (bestSize.x > 800)
+    bestSize.x = 800;
+  if (bestSize.y > 800)
+    bestSize.y = 800;
+
   if (bestSize.x < iMinX)
     bestSize.x = iMinX;
+  if (bestSize.y < iMinY)
+    bestSize.y = iMinY;
 
   return bestSize;
 }
@@ -3082,12 +3085,11 @@ ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
 {
   m_pFrame = CreateChildFrame(doc, this);
   SetFrame(m_pFrame);
-  
-  int width, height;
-  m_pFrame->GetClientSize (&width, &height);
-  m_pFrame->SetTitle ("ProjectionFileView");
   m_pCanvas = CreateCanvas (m_pFrame);
-  
+  m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
+  m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
+  m_pFrame->SetTitle ("ProjectionFileView");
+
   m_pFrame->Show(true);
   Activate(true);
   
@@ -3105,16 +3107,13 @@ ProjectionFileView::OnDraw (wxDC* dc)
 void 
 ProjectionFileView::setInitialClientSize ()
 {
-  wxSize bestSize = m_pCanvas->GetBestSize();
-
-  if (bestSize.x > 800)
-    bestSize.x = 800;
-  if (bestSize.y > 800)
-    bestSize.y = 800;
+  if (m_pFrame && m_pCanvas) {
+    wxSize bestSize = m_pCanvas->GetBestSize();
 
-  m_pFrame->SetClientSize (bestSize);
-  m_pFrame->Show (true);
-  m_pFrame->SetFocus();
+    m_pFrame->SetClientSize (bestSize);
+    m_pFrame->Show (true);
+    m_pFrame->SetFocus();
+  }
 }  
 
 void