From: Kevin M. Rosenberg Date: Fri, 26 Jan 2001 23:23:00 +0000 (+0000) Subject: r442: Fixes to application shutdown X-Git-Tag: debian-4.5.3-3~575 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=a18f7b9629e21da7c33abc59718b5ab150f3e3d1 r442: Fixes to application shutdown --- diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index d82753f..7264fef 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,16 +6,13 @@ --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPABE.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPB1A.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /GR /GX /Zi /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"D:\ctsim\src\ctsim.cpp" -"D:\ctsim\src\dialogs.cpp" -"D:\ctsim\src\docs.cpp" "D:\ctsim\src\views.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPABE.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPABF.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPB1A.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPB1B.tmp" with contents [ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib xpmd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" /libpath:"..\..\..\wx2\lib" .\Debug\ctsim.obj @@ -31,14 +28,10 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w \wx2\lib\wxd.lib \wx2\lib\xpmd.lib ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPABF.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPB1B.tmp"

Output Window

Compiling... -ctsim.cpp views.cpp -Skipping... (no relevant changes detected) -dialogs.cpp -docs.cpp Linking... diff --git a/src/ctsim.cpp b/src/ctsim.cpp index 5c25369..3736f8d 100644 --- a/src/ctsim.cpp +++ b/src/ctsim.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsim.cpp,v 1.44 2001/01/26 21:22:37 kevin Exp $ +** $Id: ctsim.cpp,v 1.45 2001/01/26 23:23:00 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 @@ -70,7 +70,7 @@ #endif #endif -static const char* rcsindent = "$Id: ctsim.cpp,v 1.44 2001/01/26 21:22:37 kevin Exp $"; +static const char* rcsindent = "$Id: ctsim.cpp,v 1.45 2001/01/26 23:23:00 kevin Exp $"; struct option CTSimApp::ctsimOptions[] = { @@ -216,11 +216,6 @@ CTSimApp::usage(const char* program) int CTSimApp::OnExit() { - if (theApp->getConfig()) - theApp->getDocManager()->FileHistorySave (*theApp->getConfig()); - delete theApp->getDocManager(); -// m_docManager = NULL; - #ifdef HAVE_DMALLOC dmalloc_shutdown(); #endif @@ -371,6 +366,9 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const MainFrame::~MainFrame() { + if (theApp->getConfig()) + theApp->getDocManager()->FileHistorySave (*theApp->getConfig()); + delete theApp->getDocManager(); } void diff --git a/src/ctsim.h b/src/ctsim.h index b7954f5..57ac4ad 100644 --- a/src/ctsim.h +++ b/src/ctsim.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsim.h,v 1.31 2001/01/26 05:37:24 kevin Exp $ +** $Id: ctsim.h,v 1.32 2001/01/26 23:23:00 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 @@ -107,7 +107,7 @@ private: public: MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type); - ~MainFrame(); + virtual ~MainFrame(); #ifdef CTSIM_CUSTOM_MRU void OnMRUFile (wxCommandEvent& event); diff --git a/src/views.cpp b/src/views.cpp index 4e970c1..8053e7e 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.74 2001/01/26 21:33:06 kevin Exp $ +** $Id: views.cpp,v 1.75 2001/01/26 23:23:00 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 @@ -69,21 +69,13 @@ END_EVENT_TABLE() ImageFileCanvas::ImageFileCanvas (ImageFileView* 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_xCursor(-1), m_yCursor(-1) { - m_pView = v; - m_xCursor = -1; - m_yCursor = -1; } ImageFileCanvas::~ImageFileCanvas() { - if (m_pView) { - wxMenu* pMenu = m_pView->getFileMenu(); - theApp->getDocManager()->FileHistoryRemoveMenu (pMenu); - m_pView->canvasClosed(); - m_pView = NULL; - } + m_pView = NULL; } void @@ -232,14 +224,14 @@ EVT_MENU(IFMENU_PLOT_HISTOGRAM, ImageFileView::OnPlotHistogram) END_EVENT_TABLE() ImageFileView::ImageFileView() -: wxView(), m_canvas(NULL), m_frame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false), m_pFileMenu(0) +: wxView(), m_canvas(NULL), m_pFrame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false), m_pFileMenu(0) { m_iDefaultExportFormatID = ImageFile::FORMAT_PNG; } ImageFileView::~ImageFileView() { - + theApp->getDocManager()->FileHistoryRemoveMenu (m_pFileMenu); } void @@ -786,7 +778,11 @@ ImageFileView::CreateCanvas (wxView *view, wxFrame *parent) return pCanvas; } -wxFrame* +#if CTSIM_MDI +wxDocMDIChildFrame* +#else +wxDocChildFrame* +#endif ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) { #if CTSIM_MDI @@ -909,23 +905,23 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { - m_frame = CreateChildFrame(doc, this); - SetFrame (m_frame); + m_pFrame = CreateChildFrame(doc, this); + SetFrame (m_pFrame); m_bMinSpecified = false; m_bMaxSpecified = false; m_dAutoScaleFactor = 1.; int width, height; - m_frame->GetClientSize (&width, &height); - m_frame->SetTitle("ImageFileView"); - m_canvas = CreateCanvas (this, m_frame); + m_pFrame->GetClientSize (&width, &height); + m_pFrame->SetTitle("ImageFileView"); + m_canvas = CreateCanvas (this, m_pFrame); int x, y; // X requires a forced resize - m_frame->GetSize(&x, &y); - m_frame->SetSize(-1, -1, x, y); - m_frame->SetFocus(); - m_frame->Show(true); + m_pFrame->GetSize(&x, &y); + m_pFrame->SetSize(-1, -1, x, y); + m_pFrame->SetFocus(); + m_pFrame->Show(true); Activate(true); return true; @@ -934,10 +930,10 @@ ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) void ImageFileView::OnDraw (wxDC* dc) { - wxSize sizeWindow = m_frame->GetClientSize(); + wxSize sizeWindow = m_pFrame->GetClientSize(); wxSize sizeBest = m_canvas->GetBestSize(); if (sizeWindow.x > sizeBest.x || sizeWindow.y > sizeBest.y) - m_frame->SetClientSize (sizeBest); + m_pFrame->SetClientSize (sizeBest); if (m_bitmap.Ok()) dc->DrawBitmap(m_bitmap, 0, 0, false); @@ -982,7 +978,7 @@ ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) int xSize = nx; int ySize = ny; ySize = clamp (ySize, 0, 800); - m_frame->SetClientSize (xSize, ySize); + m_pFrame->SetClientSize (xSize, ySize); m_canvas->SetScrollbars(20, 20, nx/20, ny/20); m_canvas->SetBackgroundColour(*wxWHITE); } @@ -998,20 +994,23 @@ ImageFileView::OnClose (bool deleteWindow) return false; if (m_canvas) { - // m_canvas->Clear(); + m_canvas->Clear(); + m_canvas->Show(false); m_canvas->setView(NULL); m_canvas = NULL; } wxString s(theApp->GetAppName()); -// if (m_frame) -// m_frame->SetTitle(s); + if (m_pFrame) + m_pFrame->SetTitle(s); SetFrame(NULL); Activate(false); if (deleteWindow) { - delete m_frame; - return true; + m_pFrame->Show(false); + m_pFrame->Destroy(); +// delete m_pFrame; + m_pFrame = NULL; } return true; } @@ -1707,12 +1706,7 @@ PhantomCanvas::PhantomCanvas (PhantomFileView* v, wxFrame *frame, const wxPoint& PhantomCanvas::~PhantomCanvas () { - if (m_pView) { - wxMenu* pMenu = m_pView->getFileMenu(); - theApp->getDocManager()->FileHistoryRemoveMenu (pMenu); - m_pView->canvasClosed(); m_pView = NULL; - } } void @@ -1734,11 +1728,11 @@ EVT_MENU(PHMMENU_PROCESS_PROJECTIONS, PhantomFileView::OnProjections) END_EVENT_TABLE() PhantomFileView::PhantomFileView() -: wxView(), m_canvas(NULL), m_frame(NULL), m_pFileMenu(0) +: wxView(), m_canvas(NULL), m_pFrame(NULL), m_pFileMenu(0) { m_iDefaultNDet = 367; m_iDefaultNView = 320; - m_iDefaultNSample = 2; + m_iDefaultNSample = 1; m_dDefaultRotation = 1; m_dDefaultFocalLength = 2; m_dDefaultFieldOfView = 1; @@ -1752,7 +1746,7 @@ PhantomFileView::PhantomFileView() PhantomFileView::~PhantomFileView() { - + theApp->getDocManager()->FileHistoryRemoveMenu (m_pFileMenu); } void @@ -1838,7 +1832,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event) rProj.setRemark (os.str()); *theApp->getLog() << os.str().c_str() << "\n"; - m_frame->Lower(); + m_pFrame->Lower(); ::wxYield(); ProjectionFileView* projView = dynamic_cast(pProjectionDoc->GetFirstView()); if (projView) { @@ -1925,7 +1919,11 @@ PhantomFileView::CreateCanvas (wxView *view, wxFrame *parent) return pCanvas; } -wxFrame* +#if CTSIM_MDI +wxDocMDIChildFrame* +#else +wxDocChildFrame* +#endif PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view) { #if CTSIM_MDI @@ -1994,21 +1992,21 @@ PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool PhantomFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { - m_frame = CreateChildFrame(doc, this); - SetFrame(m_frame); + m_pFrame = CreateChildFrame(doc, this); + SetFrame(m_pFrame); int width, height; - m_frame->GetClientSize(&width, &height); - m_frame->SetTitle("PhantomFileView"); - m_canvas = CreateCanvas (this, m_frame); + m_pFrame->GetClientSize(&width, &height); + m_pFrame->SetTitle("PhantomFileView"); + m_canvas = CreateCanvas (this, m_pFrame); #ifdef __X__ int x, y; // X requires a forced resize - m_frame->GetSize(&x, &y); - m_frame->SetSize(-1, -1, x, y); + m_pFrame->GetSize(&x, &y); + m_pFrame->SetSize(-1, -1, x, y); #endif - m_frame->Show(true); + m_pFrame->Show(true); Activate(true); return true; @@ -2030,18 +2028,21 @@ PhantomFileView::OnClose (bool deleteWindow) if (m_canvas) { m_canvas->Clear(); m_canvas->setView(NULL); + m_canvas->Show(false); m_canvas = NULL; } wxString s(wxTheApp->GetAppName()); - if (m_frame) - m_frame->SetTitle(s); + if (m_pFrame) + m_pFrame->SetTitle(s); SetFrame(NULL); Activate(false); if (deleteWindow) { - delete m_frame; - m_frame = NULL; + m_pFrame->Show(false); + m_pFrame->Destroy(); +// delete m_pFrame; + m_pFrame = NULL; } return true; @@ -2069,12 +2070,7 @@ ProjectionFileCanvas::ProjectionFileCanvas (ProjectionFileView* v, wxFrame *fram ProjectionFileCanvas::~ProjectionFileCanvas () { - if (m_pView) { - wxMenu* pMenu = m_pView->getFileMenu(); - theApp->getDocManager()->FileHistoryRemoveMenu (pMenu); - m_pView->canvasClosed(); - m_pView = NULL; - } + m_pView = NULL; } void @@ -2109,7 +2105,7 @@ EVT_MENU(PJMENU_CONVERT_FFT_POLAR, ProjectionFileView::OnConvertFFTPolar) END_EVENT_TABLE() ProjectionFileView::ProjectionFileView() -: wxView(), m_canvas(NULL), m_frame(NULL), m_pFileMenu(0) +: wxView(), m_canvas(NULL), m_pFrame(NULL), m_pFileMenu(0) { m_iDefaultNX = 256; m_iDefaultNY = 256; @@ -2136,7 +2132,7 @@ ProjectionFileView::ProjectionFileView() ProjectionFileView::~ProjectionFileView() { - + theApp->getDocManager()->FileHistoryRemoveMenu (m_pFileMenu); } void @@ -2324,7 +2320,11 @@ ProjectionFileView::CreateCanvas (wxView *view, wxFrame *parent) return pCanvas; } -wxFrame* +#if CTSIM_MDI +wxDocMDIChildFrame* +#else +wxDocChildFrame* +#endif ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) { #ifdef CTSIM_MDI @@ -2402,21 +2402,21 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { - m_frame = CreateChildFrame(doc, this); - SetFrame(m_frame); + m_pFrame = CreateChildFrame(doc, this); + SetFrame(m_pFrame); int width, height; - m_frame->GetClientSize(&width, &height); - m_frame->SetTitle("ProjectionFileView"); - m_canvas = CreateCanvas(this, m_frame); + m_pFrame->GetClientSize(&width, &height); + m_pFrame->SetTitle("ProjectionFileView"); + m_canvas = CreateCanvas(this, m_pFrame); #ifdef __X__ int x, y; // X requires a forced resize - m_frame->GetSize(&x, &y); - m_frame->SetSize(-1, -1, x, y); + m_pFrame->GetSize(&x, &y); + m_pFrame->SetSize(-1, -1, x, y); #endif - m_frame->Show(true); + m_pFrame->Show(true); Activate(true); return true; @@ -2425,11 +2425,11 @@ ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) void ProjectionFileView::OnDraw (wxDC* dc) { - wxSize clientSize = m_frame->GetClientSize(); + wxSize clientSize = m_pFrame->GetClientSize(); wxSize bestSize = m_canvas->GetBestSize(); if (clientSize.x > bestSize.x || clientSize.y > bestSize.y) - m_frame->SetClientSize (bestSize); + m_pFrame->SetClientSize (bestSize); if (m_bitmap.Ok()) dc->DrawBitmap (m_bitmap, 0, 0, false); @@ -2477,7 +2477,7 @@ ProjectionFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) int ySize = nView; xSize = clamp (xSize, 0, 800); ySize = clamp (ySize, 0, 800); - m_frame->SetClientSize (xSize, ySize); + m_pFrame->SetClientSize (xSize, ySize); m_canvas->SetScrollbars (20, 20, nDet/20, nView/20); } @@ -2492,20 +2492,23 @@ ProjectionFileView::OnClose (bool deleteWindow) return false; if (m_canvas) { - //m_canvas->Clear(); + m_canvas->Clear(); m_canvas->setView(NULL); + m_canvas->Show(false); m_canvas = NULL; } -// wxString s(wxTheApp->GetAppName()); -// if (m_frame) -// m_frame->SetTitle(s); - SetFrame(NULL); + wxString s(wxTheApp->GetAppName()); + if (m_pFrame) + m_pFrame->SetTitle(s); +// SetFrame(NULL); Activate(false); if (deleteWindow) { - delete m_frame; - return true; + m_pFrame->Show(false); + m_pFrame->Destroy(); +// delete m_pFrame; + m_pFrame = NULL; } return true; } @@ -2521,12 +2524,7 @@ PlotFileCanvas::PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& PlotFileCanvas::~PlotFileCanvas () { - if (m_pView) { - wxMenu* pMenu = m_pView->getFileMenu(); - theApp->getDocManager()->FileHistoryRemoveMenu (pMenu); - m_pView->canvasClosed(); m_pView = NULL; - } } void @@ -2549,7 +2547,7 @@ EVT_MENU(PLOTMENU_VIEW_SCALE_FULL, PlotFileView::OnScaleFull) END_EVENT_TABLE() PlotFileView::PlotFileView() -: wxView(), m_canvas(NULL), m_frame(NULL), m_pEZPlot(NULL), m_pFileMenu(0) +: wxView(), m_canvas(NULL), m_pFrame(NULL), m_pEZPlot(NULL), m_pFileMenu(0) { m_bMinSpecified = false; m_bMaxSpecified = false; @@ -2560,7 +2558,7 @@ PlotFileView::~PlotFileView() if (m_pEZPlot) delete m_pEZPlot; - + theApp->getDocManager()->FileHistoryRemoveMenu (m_pFileMenu); } void @@ -2653,7 +2651,11 @@ PlotFileView::CreateCanvas (wxView *view, wxFrame *parent) return pCanvas; } -wxFrame* +#if CTSIM_MDI +wxDocMDIChildFrame* +#else +wxDocChildFrame* +#endif PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view) { #ifdef CTSIM_MDI @@ -2726,25 +2728,25 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { - m_frame = CreateChildFrame(doc, this); - SetFrame(m_frame); + m_pFrame = CreateChildFrame(doc, this); + SetFrame(m_pFrame); m_bMinSpecified = false; m_bMaxSpecified = false; m_dAutoScaleFactor = 1.; int width, height; - m_frame->GetClientSize(&width, &height); - m_frame->SetTitle ("Plot File"); - m_canvas = CreateCanvas (this, m_frame); + m_pFrame->GetClientSize(&width, &height); + m_pFrame->SetTitle ("Plot File"); + m_canvas = CreateCanvas (this, m_pFrame); #ifdef __X__ int x, y; // X requires a forced resize - m_frame->GetSize(&x, &y); - m_frame->SetSize(-1, -1, x, y); + m_pFrame->GetSize(&x, &y); + m_pFrame->SetSize(-1, -1, x, y); #endif - m_frame->Show(true); + m_pFrame->Show(true); Activate(true); return true; @@ -2822,20 +2824,23 @@ PlotFileView::OnClose (bool deleteWindow) return false; if (m_canvas) { - //m_canvas->Clear(); + m_canvas->Clear(); m_canvas->setView (NULL); + m_canvas->Show(false); m_canvas = NULL; } -// wxString s(wxTheApp->GetAppName()); -// if (m_frame) -// m_frame->SetTitle(s); + wxString s(wxTheApp->GetAppName()); + if (m_pFrame) + m_pFrame->SetTitle(s); SetFrame(NULL); Activate(false); if (deleteWindow) { - delete m_frame; - return true; + m_pFrame->Show(false); + m_pFrame->Destroy(); +// delete m_pFrame; + m_pFrame = NULL; } return true; } @@ -2848,7 +2853,7 @@ IMPLEMENT_DYNAMIC_CLASS(TextFileView, wxView) TextFileView::~TextFileView() { - + theApp->getDocManager()->FileHistoryRemoveMenu (m_pFileMenu); } bool TextFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) @@ -2892,19 +2897,25 @@ TextFileView::OnClose (bool deleteWindow) if (! GetDocument() || ! GetDocument()->Close()) return false; - + + m_pCanvas->Show(false); Activate(false); - if (deleteWindow) - { - delete m_pFrame; + if (deleteWindow) { + m_pFrame->Show(false); + m_pFrame->Destroy(); +// delete m_pFrame; m_pFrame = NULL; } return TRUE; } -wxFrame* +#if CTSIM_MDI +wxDocMDIChildFrame* +#else +wxDocChildFrame* +#endif TextFileView::CreateChildFrame (wxDocument *doc, wxView *view) { #if CTSIM_MDI @@ -2968,10 +2979,5 @@ TextFileCanvas::TextFileCanvas (TextFileView* v, wxFrame* frame, const wxPoint& TextFileCanvas::~TextFileCanvas () { - if (m_pView) { - wxMenu* pMenu = m_pView->getFileMenu(); - theApp->getDocManager()->FileHistoryRemoveMenu (pMenu); - m_pView->canvasClosed(); - m_pView = NULL; - } + m_pView = NULL; } diff --git a/src/views.h b/src/views.h index f395c94..de216d8 100644 --- a/src/views.h +++ b/src/views.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.h,v 1.31 2001/01/26 21:33:06 kevin Exp $ +** $Id: views.h,v 1.32 2001/01/26 23:23:00 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 @@ -46,11 +46,16 @@ private: wxBitmap m_bitmap; ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent); - wxFrame *CreateChildFrame(wxDocument *doc, wxView *view); +#if CTSIM_MDI + wxDocMDIChildFrame* m_pFrame; + wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#else + wxDocChildFrame* m_pFrame; + wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#endif wxMenu* m_pFileMenu; ImageFileCanvas *m_canvas; - wxFrame *m_frame; bool m_bMinSpecified; bool m_bMaxSpecified; double m_dMinPixel; @@ -63,14 +68,14 @@ private: #if CTSIM_MDI { return theApp->getMainFrame()->GetClientWindow(); } #else - { return m_frame; } + { return m_pFrame; } #endif public: ImageFileView(); virtual ~ImageFileView(); void canvasClosed() - { m_canvas = NULL; m_frame = NULL; } + { m_canvas = NULL; m_pFrame = NULL; } wxMenu* getFileMenu() { return m_pFileMenu; } @@ -126,7 +131,7 @@ public: void OnCompareCol (wxCommandEvent& event); wxFrame* getFrame() - { return m_frame; } + { return m_pFrame; } ImageFileDocument* GetDocument() { return dynamic_cast(wxView::GetDocument()); } @@ -170,10 +175,15 @@ class ProjectionFileView : public wxView private: ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent); - wxFrame *CreateChildFrame(wxDocument *doc, wxView *view); +#if CTSIM_MDI + wxDocMDIChildFrame* m_pFrame; + wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#else + wxDocChildFrame* m_pFrame; + wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#endif ProjectionFileCanvas *m_canvas; - wxFrame *m_frame; wxMenu* m_pFileMenu; int m_iDefaultNX; @@ -197,14 +207,14 @@ private: #if CTSIM_MDI { return theApp->getMainFrame()->GetClientWindow(); } #else - { return m_frame; } + { return m_pFrame; } #endif public: ProjectionFileView(); virtual ~ProjectionFileView(); void canvasClosed() - { m_canvas = NULL; m_frame = NULL; } + { m_canvas = NULL; m_pFrame = NULL; } bool OnCreate(wxDocument *doc, long flags); void OnDraw(wxDC* dc); @@ -216,7 +226,7 @@ public: void OnConvertPolar (wxCommandEvent& event); void OnConvertFFTPolar (wxCommandEvent& event); - wxFrame* getFrame () { return m_frame; } + wxFrame* getFrame () { return m_pFrame; } wxMenu* getFileMenu() { return m_pFileMenu; } @@ -249,10 +259,15 @@ private: DECLARE_EVENT_TABLE() PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent); - wxFrame *CreateChildFrame(wxDocument *doc, wxView *view); +#if CTSIM_MDI + wxDocMDIChildFrame* m_pFrame; + wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#else + wxDocChildFrame* m_pFrame; + wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#endif PhantomCanvas *m_canvas; - wxFrame *m_frame; wxMenu* m_pFileMenu; int m_iDefaultNDet; @@ -272,14 +287,14 @@ private: #if CTSIM_MDI { return theApp->getMainFrame()->GetClientWindow(); } #else - { return m_frame; } + { return m_pFrame; } #endif public: PhantomFileView(); virtual ~PhantomFileView(); void canvasClosed() - { m_canvas = NULL; m_frame = NULL; } + { m_canvas = NULL; m_pFrame = NULL; } bool OnCreate(wxDocument *doc, long flags); void OnUpdate(wxView *sender, wxObject *hint = NULL); @@ -293,7 +308,7 @@ public: { return dynamic_cast(wxView::GetDocument()); } wxMenu* getFileMenu() { return m_pFileMenu; } - wxFrame* getFrame() { return m_frame; } + wxFrame* getFrame() { return m_pFrame; } }; class PhantomCanvas: public wxScrolledWindow @@ -317,10 +332,15 @@ class PlotFileView : public wxView private: PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent); - wxFrame *CreateChildFrame(wxDocument *doc, wxView *view); +#if CTSIM_MDI + wxDocMDIChildFrame* m_pFrame; + wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#else + wxDocChildFrame* m_pFrame; + wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#endif PlotFileCanvas *m_canvas; - wxFrame *m_frame; wxMenu* m_pFileMenu; EZPlot* m_pEZPlot; @@ -334,14 +354,14 @@ private: #if CTSIM_MDI { return theApp->getMainFrame()->GetClientWindow(); } #else - { return m_frame; } + { return m_pFrame; } #endif public: PlotFileView(); virtual ~PlotFileView(); void canvasClosed() - { m_canvas = NULL; m_frame = NULL; } + { m_canvas = NULL; m_pFrame = NULL; } bool OnCreate(wxDocument *doc, long flags); void OnDraw(wxDC* dc); @@ -354,7 +374,7 @@ public: void OnScaleFull (wxCommandEvent& event); wxFrame* getFrame () - { return m_frame; } + { return m_pFrame; } wxMenu* getFileMenu() { return m_pFileMenu; } PlotFileDocument* GetDocument() @@ -385,7 +405,13 @@ class TextFileView: public wxView private: DECLARE_DYNAMIC_CLASS(TextFileView) - wxFrame *m_pFrame; +#if CTSIM_MDI + wxDocMDIChildFrame* m_pFrame; + wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#else + wxDocChildFrame* m_pFrame; + wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view); +#endif wxMenu* m_pFileMenu; TextFileCanvas *m_pCanvas; @@ -397,8 +423,6 @@ public: void canvasClosed() { m_pFrame = NULL; } - wxFrame *CreateChildFrame(wxDocument *doc, wxView *view); - bool OnCreate (wxDocument *doc, long flags); void OnDraw (wxDC *dc); void OnUpdate (wxView *sender, wxObject *hint = (wxObject *) NULL);