From fa1246da51720a6cd7fe4879a0a25795b13b2455 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 2 Jun 2002 19:01:58 +0000 Subject: [PATCH] r2100: *** empty log message *** --- src/docs.cpp | 4 ++-- src/graph3dview.cpp | 16 +++++++++------- src/graph3dview.h | 3 ++- src/views.cpp | 39 +++++++++++++++++++-------------------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/docs.cpp b/src/docs.cpp index 5a73fe8..15ef98c 100644 --- a/src/docs.cpp +++ b/src/docs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: docs.cpp,v 1.39 2002/06/02 17:57:02 kevin Exp $ +** $Id: docs.cpp,v 1.40 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 @@ -225,8 +225,8 @@ ProjectionFileDocument::OnOpenDocument(const wxString& filename) *theApp->getLog() << "Read projection file " << filename << "\n"; SetFilename(filename, true); Modify(false); - UpdateAllViews(); getView()->setInitialClientSize(); + UpdateAllViews(); m_bBadFileOpen = false; return true; diff --git a/src/graph3dview.cpp b/src/graph3dview.cpp index 474c524..0349444 100644 --- a/src/graph3dview.cpp +++ b/src/graph3dview.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: graph3dview.cpp,v 1.24 2001/09/24 11:34:06 kevin Exp $ +** $Id: graph3dview.cpp,v 1.25 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 @@ -173,8 +173,6 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { m_pFrame = CreateChildFrame(doc, this); - int width, height; - m_pFrame->GetClientSize (&width, &height); m_pFrame->SetTitle("Graph3dFileView"); m_pCanvas = CreateCanvas (m_pFrame); @@ -183,9 +181,6 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) InitGL(); - 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->Show(true); Activate(true); @@ -204,7 +199,7 @@ Graph3dFileView::CreateCanvas (wxFrame* parent) int width, height; parent->GetClientSize (&width, &height); - pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(0, 0), wxSize(200, 200), 0); + pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(0, 0), wxSize(width,height), 0); pCanvas->SetBackgroundColour(*wxWHITE); pCanvas->Clear(); @@ -848,6 +843,13 @@ Graph3dFileCanvas::OnDraw (wxDC& dc) m_pView->OnDraw(& dc); } + +wxSize +Graph3dFileCanvas::GetBestSize() const +{ + return wxSize (400,400); +} + void Graph3dFileCanvas::OnSize (wxSizeEvent& event) { diff --git a/src/graph3dview.h b/src/graph3dview.h index 90b6d44..bcd40ca 100644 --- a/src/graph3dview.h +++ b/src/graph3dview.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: graph3dview.h,v 1.9 2002/05/28 18:43:16 kevin Exp $ +** $Id: graph3dview.h,v 1.10 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 @@ -140,6 +140,7 @@ public: virtual ~Graph3dFileCanvas(); virtual void OnDraw(wxDC& dc); + virtual wxSize GetBestSize() const; void OnSize(wxSizeEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnChar(wxKeyEvent& event); diff --git a/src/views.cpp b/src/views.cpp index 6f62220..c0140b3 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -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 -- 2.34.1