X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=12eaf54ba97c87ce6f7169847d6311648b4dfabd;hp=3a6db53239f66d2a41e71578d6fca667eae89b4e;hb=7ef11714a9a0ac96f523fcd85f64c671a8cee26f;hpb=6cea1255c6f86c368631246ece6ddcaf7be00ec4 diff --git a/src/views.cpp b/src/views.cpp index 3a6db53..12eaf54 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.85 2001/01/28 20:05:17 kevin Exp $ +** $Id: views.cpp,v 1.86 2001/01/28 21:57:09 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 @@ -912,7 +912,7 @@ bool ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { m_pFrame = CreateChildFrame(doc, this); - (m_pFrame); + (m_pFrame); m_bMinSpecified = false; m_bMaxSpecified = false; @@ -1000,7 +1000,7 @@ ImageFileView::OnClose (bool deleteWindow) return false; if (m_pCanvas) { - m_pCanvas->Show(false); + m_pCanvas->Show(false); m_pCanvas->setView(NULL); m_pCanvas = NULL; } @@ -1010,10 +1010,9 @@ ImageFileView::OnClose (bool deleteWindow) SetFrame(NULL); Activate(false); - + if (deleteWindow) { m_pFrame->Show(false); - ::wxYield(); m_pFrame->Destroy(); m_pFrame = NULL; } @@ -1822,7 +1821,13 @@ PhantomFileView::OnProjections (wxCommandEvent& event) for (int iView = 0; iView < rProj.nView(); iView++) { ::wxYield(); if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) { - pProjectionDoc->getView()->getFrame()->Close(true); + pProjectionDoc->getView()->getFrame()->Show(true); + GetDocumentManager()->ActivateView (pProjectionDoc->getView(), true, false); + pProjectionDoc->getView()->getFrame()->SetFocus(); + wxCommandEvent event; + GetDocumentManager()->OnFileClose (event); + GetDocumentManager()->ActivateView (this, true, false); + getFrame()->SetFocus(); return; } ::wxYield(); @@ -1836,8 +1841,13 @@ PhantomFileView::OnProjections (wxCommandEvent& event) for (int i = 0; i < rProj.nView(); i++) { theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace); if (! dlgProgress.Update (i+1)) { - pProjectionDoc->getView()->OnClose(true); - delete pProjectionDoc; + pProjectionDoc->getView()->getFrame()->Show(true); + GetDocumentManager()->ActivateView (pProjectionDoc->getView(), true, false); + pProjectionDoc->getView()->getFrame()->SetFocus(); + wxCommandEvent event; + GetDocumentManager()->OnFileClose (event); + GetDocumentManager()->ActivateView (this, true, false); + getFrame()->SetFocus(); return; } } @@ -1853,7 +1863,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event) ProjectionFileView* projView = pProjectionDoc->getView(); if (projView) { projView->OnUpdate (projView, NULL); - if (projView->getCanvas()) + if (projView->getCanvas()) projView->getCanvas()->SetClientSize (m_iDefaultNDet, m_iDefaultNView); if (wxFrame* pFrame = projView->getFrame()) { pFrame->Show(true); @@ -1897,9 +1907,12 @@ PhantomFileView::OnRasterize (wxCommandEvent& event) for (unsigned int i = 0; i < imageFile.nx(); i++) { rPhantom.convertToImagefile (imageFile, m_iDefaultRasterNSamples, Trace::TRACE_NONE, i, 1, true); if (! dlgProgress.Update (i+1)) { - pRasterDoc->Close(); - pRasterDoc->getView()->OnClose(true); - delete pRasterDoc; + GetDocumentManager()->ActivateView (pRasterDoc->getView(), true, true); + pRasterDoc->getView()->getFrame()->SetFocus(); + wxCommandEvent event; + GetDocumentManager()->OnFileClose (event); + GetDocumentManager()->ActivateView (this, true, false); + getFrame()->SetFocus(); return; } } @@ -2045,7 +2058,7 @@ PhantomFileView::OnClose (bool deleteWindow) return false; if (m_pCanvas) { - m_pCanvas->Show(false); + m_pCanvas->Show(false); m_pCanvas->setView(NULL); m_pCanvas = NULL; } @@ -2057,9 +2070,8 @@ PhantomFileView::OnClose (bool deleteWindow) Activate(false); if (deleteWindow) { - m_pFrame->Show(false); - ::wxYield(); - m_pFrame->Destroy(); + m_pFrame->Show(false); + m_pFrame->Destroy(); m_pFrame = NULL; } @@ -2132,7 +2144,7 @@ ProjectionFileView::ProjectionFileView() m_iDefaultNX = 256; m_iDefaultNY = 256; #endif - + m_iDefaultFilter = SignalFilter::FILTER_ABS_BANDLIMIT; m_dDefaultFilterParam = 1.; #if HAVE_FFTW @@ -2308,8 +2320,12 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) pReconstruct->reconstructView (i, 1); if (! dlgProgress.Update (i + 1)) { delete pReconstruct; - pReconDoc->getView()->OnClose(true); - delete pReconDoc; + GetDocumentManager()->ActivateView (pReconDoc->getView(), true, true); + pReconDoc->getView()->getFrame()->SetFocus(); + wxCommandEvent event; + GetDocumentManager()->OnFileClose (event); + GetDocumentManager()->ActivateView (this, true, false); + getFrame()->SetFocus(); return; } } @@ -2521,7 +2537,7 @@ ProjectionFileView::OnClose (bool deleteWindow) return false; if (m_pCanvas) { - m_pCanvas->Show(false); + m_pCanvas->Show(false); m_pCanvas->setView(NULL); m_pCanvas = NULL; } @@ -2534,7 +2550,6 @@ ProjectionFileView::OnClose (bool deleteWindow) if (deleteWindow) { m_pFrame->Show(false); - ::wxYield(); m_pFrame->Destroy(); m_pFrame = NULL; } @@ -2850,7 +2865,7 @@ PlotFileView::OnClose (bool deleteWindow) return false; if (m_pCanvas) { - m_pCanvas->Show(false); + m_pCanvas->Show(false); m_pCanvas->setView (NULL); m_pCanvas = NULL; } @@ -2861,11 +2876,10 @@ PlotFileView::OnClose (bool deleteWindow) Activate(false); m_pFrame->SetView(NULL); - SetFrame(NULL); + SetFrame(NULL); if (deleteWindow) { m_pFrame->Show(false); - ::wxYield(); - m_pFrame->Destroy(); + m_pFrame->Destroy(); m_pFrame = NULL; } return true; @@ -2919,21 +2933,20 @@ void TextFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) bool TextFileView::OnClose (bool deleteWindow) { - // if (m_pFrame && m_pFrame->GetTitle() == "Log") - return false; + // if (m_pFrame && m_pFrame->GetTitle() == "Log") + return false; if (! GetDocument() || ! GetDocument()->Close()) return false; m_pCanvas->Show(false); Activate(false); - + SetFrame(NULL); m_pFrame->SetView(NULL); if (deleteWindow) { m_pFrame->Show(false); - ::wxYield(); - m_pFrame->Destroy(); + m_pFrame->Destroy(); m_pFrame = NULL; }