r427: Changes for MDI support
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 20 Jan 2001 08:10:33 +0000 (08:10 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 20 Jan 2001 08:10:33 +0000 (08:10 +0000)
ChangeLog
libctsupport/syserror.cpp
msvc/ctsim/ctsim.dsp
msvc/ctsim/ctsim.plg
msvc/libctsim/libctsim.dsp
src/ctsim.cpp
src/ctsim.h
src/docs.cpp
src/docs.h
src/views.cpp
src/views.h

index 132539473e5550c000b4cf3457147dae9a93054a..8e4e56953da31a2964ce4129e01aadcaf0a47613 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 3.0.0beta1 - Released
 
 3.0.0beta1 - Released
 
+       * ctsim: Added MDI interface for Windows version
+
+       * ctsim: Added graphical About box
+       
        * ctsim: Added accelerator (hotkeys) to windows
 
        * ctsim: Online help added as well as HTML help
        * ctsim: Added accelerator (hotkeys) to windows
 
        * ctsim: Online help added as well as HTML help
index 7707b3071b2612b02c9c7c826a407f9e36e1218a..dfce52808afbad9e34b0d0eb9455f26e8d53102d 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: syserror.cpp,v 1.17 2001/01/19 22:29:15 kevin Exp $
+**  $Id: syserror.cpp,v 1.18 2001/01/20 08:10:33 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
 **
 **  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
@@ -55,7 +55,7 @@ void sys_error (int severity, const char *msg, ...)
  
 #ifdef HAVE_WXWINDOWS
   if (g_bRunningWXWindows)
  
 #ifdef HAVE_WXWINDOWS
   if (g_bRunningWXWindows)
-    *theApp->getLog() << strOutput.c_str();
+    wxLog::OnLog (wxLOG_Message, strOutput.c_str(), time(NULL));
   else
 #endif
     std::cout << strOutput;
   else
 #endif
     std::cout << strOutput;
index 3f1e78647f75dfed0a00e09f8a7d8ef698b60c57..120c4d1f3bd20783dd38295de0d20c017fd9f549 100644 (file)
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 kernel32.lib user32.lib wsock32.lib comctl32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libpng.lib zlib.lib  xpm.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" /libpath:"..\..\..\wx2\lib"
+# ADD LINK32 kernel32.lib user32.lib wsock32.lib comctl32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libpng.lib zlib.lib xpm.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" /libpath:"..\..\..\wx2\lib"
 
 !ELSEIF  "$(CFG)" == "ctsim - Win32 Debug"
 
 
 !ELSEIF  "$(CFG)" == "ctsim - Win32 Debug"
 
@@ -69,7 +69,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /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.0beta1\" /FR /YX /FD /GZ /c
+# ADD CPP /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.0beta1\" /FR /YX /FD /GZ /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 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 /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" /libpath:"..\..\..\wx2\lib"
+# ADD LINK32 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 /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" /libpath:"..\..\..\wx2\lib"
 # SUBTRACT LINK32 /nodefaultlib
 
 !ENDIF 
 # SUBTRACT LINK32 /nodefaultlib
 
 !ENDIF 
index dddb54266dfc2b777eaae739387924f2facffefc..810db81a7554e5299c4cef2ded40b3d00af8a16c 100644 (file)
@@ -6,13 +6,13 @@
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2D6.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 
-"C:\ctsim\src\ctsim.cpp"
+/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 
+"C:\ctsim\src\views.cpp"
 ]
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFF.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2D6.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2D7.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
 [
 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
@@ -28,10 +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
 ]
 \wx2\lib\wxd.lib
 \wx2\lib\xpmd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFF.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP2D7.tmp"
 <h3>Output Window</h3>
 Compiling...
 <h3>Output Window</h3>
 Compiling...
-ctsim.cpp
+views.cpp
 Linking...
 
 
 Linking...
 
 
index 504a97288501382cd51db810aa45b606f1e7e5ec..89332dd3bc471ce82c996920ee56d2bb9d876aaa 100644 (file)
@@ -67,7 +67,7 @@ LIB32=link.exe -lib
 # PROP Target_Dir ""
 MTL=midl.exe
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
 # PROP Target_Dir ""
 MTL=midl.exe
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /FR /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /GR /GX /Zi /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /FR /YX /FD /GZ /c
 # SUBTRACT CPP /X
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
 # SUBTRACT CPP /X
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
index a34339ca2e1c7cb7ce04de0893a1eeb7c8d0d7cd..906112df640364bf41b5f11d955b30358f5953f5 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.38 2001/01/20 02:25:45 kevin Exp $
+**  $Id: ctsim.cpp,v 1.39 2001/01/20 08:10:33 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
 **
 **  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
@@ -48,6 +48,7 @@
 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
 #endif
 
 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
 #endif
 
+
 #include "ct.h"
 #include "ctsim.h"
 #include "ctsim-map.h"
 #include "ct.h"
 #include "ctsim.h"
 #include "ctsim-map.h"
@@ -69,7 +70,7 @@
 #endif
 #endif
 
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.38 2001/01/20 02:25:45 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.39 2001/01/20 08:10:33 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -127,7 +128,7 @@ CTSimApp::OnInit()
     }
   }
   
     }
   }
   
-  m_docManager = new wxDocManager;
+  m_docManager = new wxDocManager (wxDEFAULT_DOCMAN_FLAGS, true);
   
   new wxDocTemplate (m_docManager, "ImageFile", "*.if", "", "if", "ImageFile doc", "ImageFile View", CLASSINFO(ImageFileDocument), CLASSINFO(ImageFileView));
   new wxDocTemplate (m_docManager, "ProjectionFile", "*.pj", "", "pj", "ProjectionFile doc", "ProjectionFile View", CLASSINFO(ProjectionFileDocument), CLASSINFO(ProjectionFileView));
   
   new wxDocTemplate (m_docManager, "ImageFile", "*.if", "", "if", "ImageFile doc", "ImageFile View", CLASSINFO(ImageFileDocument), CLASSINFO(ImageFileView));
   new wxDocTemplate (m_docManager, "ProjectionFile", "*.pj", "", "pj", "ProjectionFile doc", "ProjectionFile View", CLASSINFO(ProjectionFileDocument), CLASSINFO(ProjectionFileView));
@@ -225,12 +226,15 @@ BEGIN_EVENT_TABLE(MainFrame, wxDocParentFrame)
 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
 EVT_MENU(MAINMENU_HELP_CONTENTS, MainFrame::OnHelpContents)
 EVT_MENU(MAINMENU_HELP_TOPICS, MainFrame::OnHelpTopics)
 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
 EVT_MENU(MAINMENU_HELP_CONTENTS, MainFrame::OnHelpContents)
 EVT_MENU(MAINMENU_HELP_TOPICS, MainFrame::OnHelpTopics)
+EVT_SIZE(MainFrame::OnSize)
+
 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
 EVT_MENU(MAINMENU_HELP_SECONDARY, MainFrame::OnHelpSecondary)
 #endif
 EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)
 EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)
 EVT_MENU(MAINMENU_FILE_EXIT, MainFrame::OnExit)
 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
 EVT_MENU(MAINMENU_HELP_SECONDARY, MainFrame::OnHelpSecondary)
 #endif
 EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)
 EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)
 EVT_MENU(MAINMENU_FILE_EXIT, MainFrame::OnExit)
+EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, MainFrame::OnMRUFile)
 EVT_MENU(MAINMENU_WINDOW_BASE, MainFrame::OnWindowMenu0)
 EVT_MENU(MAINMENU_WINDOW_BASE+1, MainFrame::OnWindowMenu1)
 EVT_MENU(MAINMENU_WINDOW_BASE+2, MainFrame::OnWindowMenu2)
 EVT_MENU(MAINMENU_WINDOW_BASE, MainFrame::OnWindowMenu0)
 EVT_MENU(MAINMENU_WINDOW_BASE+1, MainFrame::OnWindowMenu1)
 EVT_MENU(MAINMENU_WINDOW_BASE+2, MainFrame::OnWindowMenu2)
@@ -264,11 +268,16 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
 : wxDocParentFrame(manager, frame, id, title, pos, size, type), m_pLog(NULL)
 #endif
 {
 : wxDocParentFrame(manager, frame, id, title, pos, size, type), m_pLog(NULL)
 #endif
 {
-  m_pLog = new wxTextCtrl (this, -1, "Log Window\n", wxPoint(0, 250), wxSize(100,50), wxTE_MULTILINE | wxTE_READONLY);
-  wxLog::SetActiveTarget(new wxLogTextCtrl(m_pLog));
-  CreateStatusBar();
-  SetStatusText ("Welcome to CTSim");
-  
+#if 0
+//#if CTSIM_MDI
+  m_pLog = new wxLogWindow (this, "Log");
+  //std::cout = new ostream (m_pLog->GetTextCtrl());
+  wxLog::SetActiveTarget(m_pLog);
+#else
+  m_pLog = new wxTextCtrl (this, -1, "Log Window\n", wxPoint(0, 0), wxSize(0,0), wxTE_MULTILINE | wxTE_READONLY);
+  wxLog::SetActiveTarget (new wxLogTextCtrl(m_pLog));
+#endif
+
   //// Make a menubar
   wxMenu *file_menu = new wxMenu;
   
   //// Make a menubar
   wxMenu *file_menu = new wxMenu;
   
@@ -281,10 +290,12 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   
   //  history of files visited
   theApp->getDocManager()->FileHistoryUseMenu(file_menu);
   
   //  history of files visited
   theApp->getDocManager()->FileHistoryUseMenu(file_menu);
-  
+
+#ifndef CTSIM_MDI
   m_pWindowMenu = new wxMenu;
   m_pWindowMenu->UpdateUI (this);
   m_pWindowMenu = new wxMenu;
   m_pWindowMenu->UpdateUI (this);
-  
+#endif
+
   wxMenu* help_menu = new wxMenu;
   help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
   help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-T");
   wxMenu* help_menu = new wxMenu;
   help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
   help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-T");
@@ -296,17 +307,21 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   wxMenuBar* menu_bar = new wxMenuBar;
   
   menu_bar->Append(file_menu, "&File");
   wxMenuBar* menu_bar = new wxMenuBar;
   
   menu_bar->Append(file_menu, "&File");
+#ifndef CTSIM_MDI
   menu_bar->Append(m_pWindowMenu, "&Window");
   menu_bar->Append(m_pWindowMenu, "&Window");
+#endif
   menu_bar->Append(help_menu, "&Help");
   
   SetMenuBar(menu_bar);
   
   menu_bar->Append(help_menu, "&Help");
   
   SetMenuBar(menu_bar);
   
+#ifndef CTSIM_MDI
   for (int i = 0; i < MAX_WINDOW_MENUITEMS; i++) {
     m_apWindowMenuItems[i] = new wxMenuItem (m_pWindowMenu, MAINMENU_WINDOW_BASE+i, wxString("<Empty>"));
     m_pWindowMenu->Append (m_apWindowMenuItems[i]);
     m_pWindowMenu->Enable (MAINMENU_WINDOW_BASE+i, false);
   }
   for (int i = 0; i < MAX_WINDOW_MENUITEMS; i++) {
     m_apWindowMenuItems[i] = new wxMenuItem (m_pWindowMenu, MAINMENU_WINDOW_BASE+i, wxString("<Empty>"));
     m_pWindowMenu->Append (m_apWindowMenuItems[i]);
     m_pWindowMenu->Enable (MAINMENU_WINDOW_BASE+i, false);
   }
-  
+#endif
+
   m_iDefaultPhantomID = Phantom::PHM_HERMAN;
   m_iDefaultFilterID = SignalFilter::FILTER_BANDLIMIT;
   m_iDefaultFilterDomainID = SignalFilter::DOMAIN_FREQUENCY;
   m_iDefaultPhantomID = Phantom::PHM_HERMAN;
   m_iDefaultFilterID = SignalFilter::FILTER_BANDLIMIT;
   m_iDefaultFilterDomainID = SignalFilter::DOMAIN_FREQUENCY;
@@ -317,18 +332,43 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   m_dDefaultFilterInputScale = 1.;
   m_dDefaultFilterOutputScale = 1.;
   
   m_dDefaultFilterInputScale = 1.;
   m_dDefaultFilterOutputScale = 1.;
   
-  wxAcceleratorEntry accelEntries[14];
+  wxAcceleratorEntry accelEntries[15];
   accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('O'), wxID_OPEN);
   accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('H'), MAINMENU_HELP_TOPICS);
   accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('P'), MAINMENU_FILE_CREATE_PHANTOM);
   accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('F'), MAINMENU_FILE_CREATE_FILTER);
   accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('O'), wxID_OPEN);
   accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('H'), MAINMENU_HELP_TOPICS);
   accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('P'), MAINMENU_FILE_CREATE_PHANTOM);
   accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('F'), MAINMENU_FILE_CREATE_FILTER);
+#ifndef CTSIM_MDI
   accelEntries[4].Set (wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
   for (i = 0; i < 10; i++)
     accelEntries[i+4].Set (wxACCEL_CTRL, static_cast<int>('0'+i), MAINMENU_WINDOW_BASE+i);
   accelEntries[4].Set (wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
   for (i = 0; i < 10; i++)
     accelEntries[i+4].Set (wxACCEL_CTRL, static_cast<int>('0'+i), MAINMENU_WINDOW_BASE+i);
-  wxAcceleratorTable accelTable (16, accelEntries);
+  wxAcceleratorTable accelTable (15, accelEntries);
+#else
+  wxAcceleratorTable accelTable (4, accelEntries);
+#endif
+
   SetAcceleratorTable (accelTable);
 }
 
   SetAcceleratorTable (accelTable);
 }
 
+void
+MainFrame::OnSize (wxSizeEvent& event)
+{
+  wxSize sizeClient = GetClientSize();
+  wxSize sizeLog = sizeClient;
+  if (sizeClient.y < 100) {
+    sizeLog.y = 0;
+    sizeLog.x = 0;
+  } else {
+    sizeLog.x = sizeClient.x;
+    sizeLog.y = 100;
+  }
+  sizeClient.x -= sizeLog.x;
+  sizeClient.y -= sizeLog.y;
+//  m_pLog->SetSize (0, sizeClient.y, sizeLog.x, sizeLog.y);
+//  GetClientWindow()->SetSize (0, 0, sizeClient.x, sizeClient.y);
+//    GetClientWindow()->Refresh();
+  wxMDIParentFrame::OnSize (event);
+}
+
 void 
 MainFrame::OnCreatePhantom(wxCommandEvent& event)
 {
 void 
 MainFrame::OnCreatePhantom(wxCommandEvent& event)
 {
@@ -487,6 +527,13 @@ MainFrame::OnUpdateUI (wxUpdateUIEvent& rEvent)
   
 }
 
   
 }
 
+void MainFrame::OnMRUFile(wxCommandEvent& event)
+{
+   wxString fileName (theApp->getDocManager()->GetHistoryFile(event.GetSelection()));
+   if (fileName != "")
+     theApp->getDocManager()->CreateDocument(fileName, wxDOC_SILENT);
+}
+
 void 
 MainFrame::DoWindowMenu (int iMenuPosition, wxCommandEvent& event)
 {
 void 
 MainFrame::DoWindowMenu (int iMenuPosition, wxCommandEvent& event)
 {
index 90a0b29693bfb1cfe6acc8eef1dfce9caa048273..103f08aa195d1113ef91eeaf813fcf52f18414b0 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.28 2001/01/20 02:25:45 kevin Exp $
+**  $Id: ctsim.h,v 1.29 2001/01/20 08:10:33 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
 **
 **  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
 
 #ifdef MSVC
 #endif
 
 #ifdef MSVC
-// #define CTSIM_MDI 1
+#define CTSIM_MDI 1
 #endif
 
 #endif
 
+#if defined(CTSIM_MDI) && !wxUSE_MDI_ARCHITECTURE
+#error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h!
+#endif
+#ifdef CTSIM_MDI
+#include "wx/docmdi.h"
+#endif
 
 class wxMenu;
 class wxDocument;
 
 class wxMenu;
 class wxDocument;
@@ -96,7 +102,11 @@ private:
   
 public:
   MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
   
 public:
   MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
-  
+
+  void OnMRUFile (wxCommandEvent& event);
+
+  void OnSize (wxSizeEvent& event);
+
 #if CTSIM_WINHELP
   wxWinHelpController&   getWinHelpController()
   {return m_winHelp; }
 #if CTSIM_WINHELP
   wxWinHelpController&   getWinHelpController()
   {return m_winHelp; }
@@ -122,7 +132,7 @@ public:
   
   wxTextCtrl* getLog() 
   { return m_pLog; }
   
   wxTextCtrl* getLog() 
   { return m_pLog; }
-  
+
   void OnWindowMenu0 (wxCommandEvent& event);
   void OnWindowMenu1 (wxCommandEvent& event);
   void OnWindowMenu2 (wxCommandEvent& event);
   void OnWindowMenu0 (wxCommandEvent& event);
   void OnWindowMenu1 (wxCommandEvent& event);
   void OnWindowMenu2 (wxCommandEvent& event);
@@ -159,8 +169,10 @@ public:
   int OnExit();
   MainFrame* getMainFrame() const
   { return m_pFrame; }
   int OnExit();
   MainFrame* getMainFrame() const
   { return m_pFrame; }
+
   wxTextCtrl* getLog()
   { return m_pFrame->getLog(); }
   wxTextCtrl* getLog()
   { return m_pFrame->getLog(); }
+
   wxDocManager* getDocManager() 
   { return m_docManager; }
   
   wxDocManager* getDocManager() 
   { return m_docManager; }
   
index e458a0204f2b7d473d00a16ee20e8b036635d569..4520551adca8ecf90b27465828894c51b0e00474 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.12 2001/01/06 15:33:15 kevin Exp $
+**  $Id: docs.cpp,v 1.13 2001/01/20 08:10:33 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
 **
 **  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
@@ -96,11 +96,6 @@ void ImageFileDocument::Modify(bool mod)
     wxDocument::Modify(mod);
 }
 
     wxDocument::Modify(mod);
 }
 
-bool ImageFileDocument::OnCloseDocument ()
-{
-  bool bReturn = wxDocument::OnCloseDocument();
-  return bReturn;
-}
 
 // ProjectionFileDocument
 
 
 // ProjectionFileDocument
 
@@ -148,11 +143,6 @@ void ProjectionFileDocument::Modify(bool mod)
 }
 
 
 }
 
 
-bool ProjectionFileDocument::OnCloseDocument ()
-{
-  bool bReturn = wxDocument::OnCloseDocument();
-  return bReturn;
-}
 
 // PhantomDocument
 
 
 // PhantomDocument
 
@@ -193,15 +183,9 @@ bool PhantomDocument::OnSaveDocument(const wxString& filename)
   return true;
 }
 
   return true;
 }
 
-bool PhantomDocument::OnCloseDocument ()
-{
-  bool bReturn = wxDocument::OnCloseDocument();
-  return bReturn;
-}
-
 bool PhantomDocument::IsModified(void) const
 {
 bool PhantomDocument::IsModified(void) const
 {
-  return wxDocument::IsModified();
+  return false;
 }
 
 void PhantomDocument::Modify(bool mod)
 }
 
 void PhantomDocument::Modify(bool mod)
@@ -247,11 +231,6 @@ bool PlotFileDocument::OnOpenDocument(const wxString& filename)
   return true;
 }
 
   return true;
 }
 
-bool PlotFileDocument::OnCloseDocument ()
-{
-  bool bReturn = wxDocument::OnCloseDocument();
-  return bReturn;
-}
 
 bool PlotFileDocument::IsModified(void) const
 {
 
 bool PlotFileDocument::IsModified(void) const
 {
index 8da87b3c76a9b3e25a036673e09c2d22c6f3eb4f..d4c1ca2bdfd96f8e2b4533bf2e3f5ad3662cb9a1 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: docs.h,v 1.11 2001/01/03 22:01:50 kevin Exp $
+**  $Id: docs.h,v 1.12 2001/01/20 08:10:33 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
 **
 **  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
@@ -49,7 +49,6 @@ public:
     virtual bool OnSaveDocument (const wxString& filename);
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool IsModified () const;
     virtual bool OnSaveDocument (const wxString& filename);
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool IsModified () const;
-    virtual bool OnCloseDocument ();
     virtual void Modify (bool mod);
     
     ImageFileDocument () {}
     virtual void Modify (bool mod);
     
     ImageFileDocument () {}
@@ -73,7 +72,6 @@ public:
     virtual bool OnSaveDocument (const wxString& filename);
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool IsModified () const;
     virtual bool OnSaveDocument (const wxString& filename);
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool IsModified () const;
-    virtual bool OnCloseDocument ();
     virtual void Modify (bool mod);
     
     ProjectionFileDocument () {}
     virtual void Modify (bool mod);
     
     ProjectionFileDocument () {}
@@ -118,7 +116,6 @@ public:
 
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool OnSaveDocument (const wxString& filename);
 
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool OnSaveDocument (const wxString& filename);
-    virtual bool OnCloseDocument ();
     virtual bool IsModified () const;
     virtual void Modify (bool mod);
 };
     virtual bool IsModified () const;
     virtual void Modify (bool mod);
 };
@@ -150,7 +147,6 @@ public:
 
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool OnSaveDocument (const wxString& filename);
 
     virtual bool OnOpenDocument (const wxString& filename);
     virtual bool OnSaveDocument (const wxString& filename);
-    virtual bool OnCloseDocument ();
     virtual bool IsModified () const;
     virtual void Modify (bool mod);
 };
     virtual bool IsModified () const;
     virtual void Modify (bool mod);
 };
index bc58da2dd3667a509058ed812574de1e7d0eafac..0b8290d0005465c89a5db873ae17384e6c544134 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.67 2001/01/18 23:34:01 kevin Exp $
+**  $Id: views.cpp,v 1.68 2001/01/20 08:10:33 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
 **
 **  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
@@ -121,7 +121,10 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
   
   wxPoint pt(event.GetLogicalPosition(dc));
   
   
   wxPoint pt(event.GetLogicalPosition(dc));
   
-  const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
+  const ImageFileDocument* pIFDoc = m_pView->GetDocument();
+  if (! pIFDoc)
+    return;
+  const ImageFile& rIF = pIFDoc->getImageFile();
   ImageFileArrayConst v = rIF.getArray();
   int nx = rIF.nx();
   int ny = rIF.ny();
   ImageFileArrayConst v = rIF.getArray();
   int nx = rIF.nx();
   int ny = rIF.ny();
@@ -161,6 +164,17 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
   }
 }
 
   }
 }
 
+wxSize
+ImageFileCanvas::GetBestSize() const
+{
+  if (! m_pView)
+    return wxSize(0,0);
+  
+  const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
+  return wxSize (rIF.nx(), rIF.ny());
+}
+
+
 // ImageFileView
 
 IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView)
 // ImageFileView
 
 IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView)
@@ -245,7 +259,7 @@ ImageFileView::OnProperties (wxCommandEvent& event)
       rIF.printLabelsBrief (os);
     }
     *theApp->getLog() << os.str().c_str();
       rIF.printLabelsBrief (os);
     }
     *theApp->getLog() << os.str().c_str();
-    wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION);
+    wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION);
     dialogMsg.ShowModal();
   }
 }
     dialogMsg.ShowModal();
   }
 }
@@ -256,7 +270,7 @@ ImageFileView::OnScaleAuto (wxCommandEvent& event)
   const ImageFile& rIF = GetDocument()->getImageFile();
   double min, max, mean, mode, median, stddev;
   rIF.statistics(min, max, mean, mode, median, stddev);
   const ImageFile& rIF = GetDocument()->getImageFile();
   double min, max, mean, mode, median, stddev;
   rIF.statistics(min, max, mean, mode, median, stddev);
-  DialogAutoScaleParameters dialogAutoScale (m_frame, mean, mode, median, stddev, m_dAutoScaleFactor);
+  DialogAutoScaleParameters dialogAutoScale (getFrameForChild(), mean, mode, median, stddev, m_dAutoScaleFactor);
   int iRetVal = dialogAutoScale.ShowModal();
   if (iRetVal == wxID_OK) {
     m_bMinSpecified = true;
   int iRetVal = dialogAutoScale.ShowModal();
   if (iRetVal == wxID_OK) {
     m_bMinSpecified = true;
@@ -284,7 +298,7 @@ ImageFileView::OnScaleMinMax (wxCommandEvent& event)
   if (m_bMaxSpecified)
     max = m_dMaxPixel;
   
   if (m_bMaxSpecified)
     max = m_dMaxPixel;
   
-  DialogGetMinMax dialogMinMax (m_frame, "Set Image Minimum & Maximum", min, max);
+  DialogGetMinMax dialogMinMax (getFrameForChild(), "Set Image Minimum & Maximum", min, max);
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
     m_bMinSpecified = true;
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
     m_bMinSpecified = true;
@@ -314,7 +328,7 @@ ImageFileView::OnCompare (wxCommandEvent& event)
   if (vecIF.size() == 0) {
     wxMessageBox("There are no compatible image files open for comparision", "No comparison images");
   } else {
   if (vecIF.size() == 0) {
     wxMessageBox("There are no compatible image files open for comparision", "No comparison images");
   } else {
-    DialogGetComparisonImage dialogGetCompare(m_frame, "Get Comparison Image", vecIF, true);
+    DialogGetComparisonImage dialogGetCompare(getFrameForChild(), "Get Comparison Image", vecIF, true);
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       const ImageFile& rIF = GetDocument()->getImageFile();
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       const ImageFile& rIF = GetDocument()->getImageFile();
@@ -428,7 +442,7 @@ ImageFileView::OnAdd (wxCommandEvent& event)
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
-    DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Add", vecIF, false);
+    DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Image to Add", vecIF, false);
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
@@ -468,7 +482,7 @@ ImageFileView::OnSubtract (wxCommandEvent& event)
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
-    DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Subtract", vecIF, false);
+    DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Image to Subtract", vecIF, false);
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
@@ -508,7 +522,7 @@ ImageFileView::OnMultiply (wxCommandEvent& event)
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
-    DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Multiply", vecIF, false);
+    DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Image to Multiply", vecIF, false);
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
@@ -548,7 +562,7 @@ ImageFileView::OnDivide (wxCommandEvent& event)
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
   if (vecIF.size() == 0) {
     wxMessageBox ("There are no compatible image files open for comparision", "No comparison images");
   } else {
-    DialogGetComparisonImage dialogGetCompare (m_frame, "Get Image to Divide", vecIF, false);
+    DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Image to Divide", vecIF, false);
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
     
     if (dialogGetCompare.ShowModal() == wxID_OK) {
       ImageFile& rIF = GetDocument()->getImageFile();
@@ -664,7 +678,7 @@ void
 ImageFileView::OnFourier (wxCommandEvent& event)
 {
   ImageFile& rIF = GetDocument()->getImageFile();
 ImageFileView::OnFourier (wxCommandEvent& event)
 {
   ImageFile& rIF = GetDocument()->getImageFile();
-  wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, m_frame, wxPD_APP_MODAL);
+  wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
   rIF.fourier (rIF);
   rIF.labelAdd ("Fourier Image");
   m_bMinSpecified = false;
   rIF.fourier (rIF);
   rIF.labelAdd ("Fourier Image");
   m_bMinSpecified = false;
@@ -678,7 +692,7 @@ void
 ImageFileView::OnInverseFourier (wxCommandEvent& event)
 {
   ImageFile& rIF = GetDocument()->getImageFile();
 ImageFileView::OnInverseFourier (wxCommandEvent& event)
 {
   ImageFile& rIF = GetDocument()->getImageFile();
-  wxProgressDialog dlgProgress (wxString("Inverse Fourier"), wxString("Inverse Fourier Progress"), 1, m_frame, wxPD_APP_MODAL);
+  wxProgressDialog dlgProgress (wxString("Inverse Fourier"), wxString("Inverse Fourier Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
   rIF.inverseFourier (rIF);
   rIF.labelAdd ("Inverse Fourier Image");
   m_bMinSpecified = false;
   rIF.inverseFourier (rIF);
   rIF.labelAdd ("Inverse Fourier Image");
   m_bMinSpecified = false;
@@ -765,9 +779,9 @@ wxFrame*
 ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
 ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxMDIChildFrame *subframe = new wxMDIChildFrame (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(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
 #else
 #else
-  wxDocChildFrame *subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFramesubframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
 
 #endif
   theApp->setIconForFrame (subframe);
 
@@ -852,7 +866,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   menu_bar->Append(filter_menu, "Fi&lter");
   menu_bar->Append(analyze_menu, "&Analyze");
   menu_bar->Append(help_menu, "&Help");
   menu_bar->Append(filter_menu, "Fi&lter");
   menu_bar->Append(analyze_menu, "&Analyze");
   menu_bar->Append(help_menu, "&Help");
-  
+
   subframe->SetMenuBar(menu_bar);
   
   subframe->Centre(wxBOTH);
   subframe->SetMenuBar(menu_bar);
   
   subframe->Centre(wxBOTH);
@@ -903,6 +917,11 @@ ImageFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
 void 
 ImageFileView::OnDraw (wxDC* dc)
 {
 void 
 ImageFileView::OnDraw (wxDC* dc)
 {
+  wxSize sizeWindow = m_frame->GetClientSize();
+  wxSize sizeBest = m_canvas->GetBestSize();
+  if (sizeWindow.x > sizeBest.x || sizeWindow.y > sizeBest.y)
+    m_frame->SetClientSize (sizeBest);
+
   if (m_bitmap.Ok())
     dc->DrawBitmap(m_bitmap, 0, 0, false);
   
   if (m_bitmap.Ok())
     dc->DrawBitmap(m_bitmap, 0, 0, false);
   
@@ -962,8 +981,8 @@ ImageFileView::OnClose (bool deleteWindow)
   if (!GetDocument()->Close())
     return false;
   
   if (!GetDocument()->Close())
     return false;
   
-  // m_canvas->Clear();
-  m_canvas->m_pView = NULL;
+  m_canvas->Clear();
+  //m_canvas->m_pView = NULL;
   m_canvas = NULL;
   wxString s(theApp->GetAppName());
   if (m_frame)
   m_canvas = NULL;
   wxString s(theApp->GetAppName());
   if (m_frame)
@@ -996,7 +1015,7 @@ ImageFileView::OnExport (wxCommandEvent& event)
         m_dMaxPixel = max;
     }
 
         m_dMaxPixel = max;
     }
 
-    DialogExportParameters dialogExport (m_frame, m_iDefaultExportFormatID);
+    DialogExportParameters dialogExport (getFrameForChild(), m_iDefaultExportFormatID);
     if (dialogExport.ShowModal() == wxID_OK) {
       wxString strFormatName (dialogExport.getFormatName ());
       m_iDefaultExportFormatID = ImageFile::convertFormatNameToID (strFormatName.c_str());
     if (dialogExport.ShowModal() == wxID_OK) {
       wxString strFormatName (dialogExport.getFormatName ());
       m_iDefaultExportFormatID = ImageFile::convertFormatNameToID (strFormatName.c_str());
@@ -1031,7 +1050,7 @@ ImageFileView::OnScaleSize (wxCommandEvent& event)
   unsigned int iOldNX = rIF.nx();
   unsigned int iOldNY = rIF.ny();
 
   unsigned int iOldNX = rIF.nx();
   unsigned int iOldNY = rIF.ny();
 
-  DialogGetXYSize dialogGetXYSize (m_frame, "Set New X & Y Dimensions", iOldNX, iOldNY);
+  DialogGetXYSize dialogGetXYSize (getFrameForChild(), "Set New X & Y Dimensions", iOldNX, iOldNY);
   if (dialogGetXYSize.ShowModal() == wxID_OK) {
     unsigned int iNewNX = dialogGetXYSize.getXSize();
     unsigned int iNewNY = dialogGetXYSize.getYSize();
   if (dialogGetXYSize.ShowModal() == wxID_OK) {
     unsigned int iNewNX = dialogGetXYSize.getXSize();
     unsigned int iNewNY = dialogGetXYSize.getYSize();
@@ -1431,7 +1450,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
     wxMessageBox ("No compatible images for Column Comparison", "Error");
     return;
   }
     wxMessageBox ("No compatible images for Column Comparison", "Error");
     return;
   }
-  DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);
+  DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Comparison Image", vecIFDoc, false);
   
   if (dialogGetCompare.ShowModal() == wxID_OK) {
     ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();
   
   if (dialogGetCompare.ShowModal() == wxID_OK) {
     ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();
@@ -1522,7 +1541,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
     return;
   }
   
     return;
   }
   
-  DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);
+  DialogGetComparisonImage dialogGetCompare (getFrameForChild(), "Get Comparison Image", vecIFDoc, false);
   
   if (dialogGetCompare.ShowModal() == wxID_OK) {
     ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();
   
   if (dialogGetCompare.ShowModal() == wxID_OK) {
     ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();
@@ -1727,7 +1746,7 @@ PhantomView::OnProperties (wxCommandEvent& event)
 void
 PhantomView::OnProjections (wxCommandEvent& event)
 {
 void
 PhantomView::OnProjections (wxCommandEvent& event)
 {
-  DialogGetProjectionParameters dialogProjection (m_frame, m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView, m_iDefaultGeometry, m_iDefaultTrace);
+  DialogGetProjectionParameters dialogProjection (getFrameForChild(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView, m_iDefaultGeometry, m_iDefaultTrace);
   int retVal = dialogProjection.ShowModal();
   if (retVal == wxID_OK) {
     m_iDefaultNDet = dialogProjection.getNDet();
   int retVal = dialogProjection.ShowModal();
   if (retVal == wxID_OK) {
     m_iDefaultNDet = dialogProjection.getNDet();
@@ -1758,7 +1777,7 @@ PhantomView::OnProjections (wxCommandEvent& event)
       
       Timer timer;
       if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
       
       Timer timer;
       if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
-        ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(m_frame));
+        ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(getFrameForChild()));
         for (int iView = 0; iView < rProj.nView(); iView++) {
           ::wxYield();
           ::wxYield();
         for (int iView = 0; iView < rProj.nView(); iView++) {
           ::wxYield();
           ::wxYield();
@@ -1774,7 +1793,7 @@ PhantomView::OnProjections (wxCommandEvent& event)
           }
         }
       } else {
           }
         }
       } else {
-        wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
+        wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT);
         for (int i = 0; i < rProj.nView(); i++) {
           theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
           if (! dlgProgress.Update (i+1)) {
         for (int i = 0; i < rProj.nView(); i++) {
           theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
           if (! dlgProgress.Update (i+1)) {
@@ -1816,7 +1835,7 @@ PhantomView::OnProjections (wxCommandEvent& event)
 void
 PhantomView::OnRasterize (wxCommandEvent& event)
 {
 void
 PhantomView::OnRasterize (wxCommandEvent& event)
 {
-  DialogGetRasterParameters dialogRaster (m_frame, m_iDefaultRasterNX, m_iDefaultRasterNY, m_iDefaultRasterNSamples);
+  DialogGetRasterParameters dialogRaster (getFrameForChild(), m_iDefaultRasterNX, m_iDefaultRasterNY, m_iDefaultRasterNSamples);
   int retVal = dialogRaster.ShowModal();
   if (retVal == wxID_OK) {
     m_iDefaultRasterNX = dialogRaster.getXSize();
   int retVal = dialogRaster.ShowModal();
   if (retVal == wxID_OK) {
     m_iDefaultRasterNX = dialogRaster.getXSize();
@@ -1834,7 +1853,7 @@ PhantomView::OnRasterize (wxCommandEvent& event)
       ImageFile& imageFile = pRasterDoc->getImageFile();
       
       imageFile.setArraySize (m_iDefaultRasterNX, m_iDefaultRasterNX);
       ImageFile& imageFile = pRasterDoc->getImageFile();
       
       imageFile.setArraySize (m_iDefaultRasterNX, m_iDefaultRasterNX);
-      wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"), imageFile.nx() + 1, m_frame, wxPD_CAN_ABORT);
+      wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"), imageFile.nx() + 1, getFrameForChild(), wxPD_CAN_ABORT);
       Timer timer;
       for (unsigned int i = 0; i < imageFile.nx(); i++) {
         rPhantom.convertToImagefile (imageFile, m_iDefaultRasterNSamples, Trace::TRACE_NONE, i, 1, true);
       Timer timer;
       for (unsigned int i = 0; i < imageFile.nx(); i++) {
         rPhantom.convertToImagefile (imageFile, m_iDefaultRasterNSamples, Trace::TRACE_NONE, i, 1, true);
@@ -1881,9 +1900,9 @@ wxFrame*
 PhantomView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
 PhantomView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxMDIChildFrame *subframe = new wxMDIChildFrame(theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
 #else
 #else
-  wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame *subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
 
 #endif
   theApp->setIconForFrame (subframe);
 
@@ -1919,7 +1938,6 @@ PhantomView::CreateChildFrame(wxDocument *doc, wxView *view)
   menu_bar->Append(help_menu, "&Help");
   
   subframe->SetMenuBar(menu_bar);
   menu_bar->Append(help_menu, "&Help");
   
   subframe->SetMenuBar(menu_bar);
-  
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[8];
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[8];
@@ -1947,7 +1965,7 @@ PhantomView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
   int width, height;
   m_frame->GetClientSize(&width, &height);
   m_frame->SetTitle("PhantomView");
   int width, height;
   m_frame->GetClientSize(&width, &height);
   m_frame->SetTitle("PhantomView");
-  m_canvas = CreateCanvas(this, m_frame);
+  m_canvas = CreateCanvas (this, m_frame);
   
 #ifdef __X__
   int x, y;  // X requires a forced resize
   
 #ifdef __X__
   int x, y;  // X requires a forced resize
@@ -1961,7 +1979,6 @@ PhantomView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
   return true;
 }
 
   return true;
 }
 
-
 void 
 PhantomView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 {
 void 
 PhantomView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 {
@@ -1975,21 +1992,19 @@ PhantomView::OnClose (bool deleteWindow)
   if (!GetDocument()->Close())
     return false;
   
   if (!GetDocument()->Close())
     return false;
   
-//  m_canvas->Clear();
-  m_canvas->m_pView = NULL;
+  m_canvas->Clear();
+  //m_canvas->m_pView = NULL;
   m_canvas = NULL;
   m_canvas = NULL;
-//  wxString s(wxTheApp->GetAppName());
-//  if (m_frame)
-//    m_frame->SetTitle(s);
+  wxString s(wxTheApp->GetAppName());
+  if (m_frame)
+    m_frame->SetTitle(s);
   SetFrame(NULL);
   
   Activate(false);
   
   SetFrame(NULL);
   
   Activate(false);
   
-  if (deleteWindow) {
-
+  if (deleteWindow)
     delete m_frame;
     delete m_frame;
-    return true;
-  }
+
   return true;
 }
 
   return true;
 }
 
@@ -2020,6 +2035,19 @@ ProjectionFileCanvas::OnDraw(wxDC& dc)
     m_pView->OnDraw(& dc);
 }
 
     m_pView->OnDraw(& dc);
 }
 
+wxSize
+ProjectionFileCanvas::GetBestSize () const
+{
+  wxSize best (0, 0);
+  if (m_pView) {
+    Projections& rProj = m_pView->GetDocument()->getProjections();
+    best.Set (rProj.nDet(), rProj.nView());
+  }
+
+  return best;
+}
+
+
 // ProjectionFileView
 
 IMPLEMENT_DYNAMIC_CLASS(ProjectionFileView, wxView)
 // ProjectionFileView
 
 IMPLEMENT_DYNAMIC_CLASS(ProjectionFileView, wxView)
@@ -2068,7 +2096,7 @@ ProjectionFileView::OnProperties (wxCommandEvent& event)
   std::ostringstream os;
   rProj.printScanInfo(os);
   *theApp->getLog() << os.str().c_str();
   std::ostringstream os;
   rProj.printScanInfo(os);
   *theApp->getLog() << os.str().c_str();
-  wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Projection File Properties", wxOK | wxICON_INFORMATION);
+  wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(), "Projection File Properties", wxOK | wxICON_INFORMATION);
   dialogMsg.ShowModal();
 }
 
   dialogMsg.ShowModal();
 }
 
@@ -2077,7 +2105,7 @@ void
 ProjectionFileView::OnConvertPolar (wxCommandEvent& event)
 {
   Projections& rProj = GetDocument()->getProjections();
 ProjectionFileView::OnConvertPolar (wxCommandEvent& event)
 {
   Projections& rProj = GetDocument()->getProjections();
-  DialogGetConvertPolarParameters dialogPolar (m_frame, "Convert Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
+  DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
     m_iDefaultPolarInterpolation, -1);
   if (dialogPolar.ShowModal() == wxID_OK) {
     wxString strInterpolation (dialogPolar.getInterpolationName());
     m_iDefaultPolarInterpolation, -1);
   if (dialogPolar.ShowModal() == wxID_OK) {
     wxString strInterpolation (dialogPolar.getInterpolationName());
@@ -2110,7 +2138,7 @@ void
 ProjectionFileView::OnConvertFFTPolar (wxCommandEvent& event)
 {
   Projections& rProj = GetDocument()->getProjections();
 ProjectionFileView::OnConvertFFTPolar (wxCommandEvent& event)
 {
   Projections& rProj = GetDocument()->getProjections();
-  DialogGetConvertPolarParameters dialogPolar (m_frame, "Convert to FFT Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
+  DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert to FFT Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
     m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
   if (dialogPolar.ShowModal() == wxID_OK) {
     wxString strInterpolation (dialogPolar.getInterpolationName());
     m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
   if (dialogPolar.ShowModal() == wxID_OK) {
     wxString strInterpolation (dialogPolar.getInterpolationName());
@@ -2148,7 +2176,7 @@ ProjectionFileView::OnReconstructFourier (wxCommandEvent& event)
 void
 ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
 {
 void
 ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
 {
-  DialogGetReconstructionParameters dialogReconstruction (m_frame, m_iDefaultNX, m_iDefaultNY, m_iDefaultFilter, m_dDefaultFilterParam, m_iDefaultFilterMethod, m_iDefaultFilterGeneration, m_iDefaultZeropad, m_iDefaultInterpolation, m_iDefaultInterpParam, m_iDefaultBackprojector, m_iDefaultTrace);
+  DialogGetReconstructionParameters dialogReconstruction (getFrameForChild(), m_iDefaultNX, m_iDefaultNY, m_iDefaultFilter, m_dDefaultFilterParam, m_iDefaultFilterMethod, m_iDefaultFilterGeneration, m_iDefaultZeropad, m_iDefaultInterpolation, m_iDefaultInterpParam, m_iDefaultBackprojector, m_iDefaultTrace);
   
   int retVal = dialogReconstruction.ShowModal();
   if (retVal == wxID_OK) {
   
   int retVal = dialogReconstruction.ShowModal();
   if (retVal == wxID_OK) {
@@ -2182,7 +2210,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
 
       Timer timerRecon;
       if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
 
       Timer timerRecon;
       if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
-        ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstruct, rProj, imageFile, m_iDefaultTrace, m_frame);
+        ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstruct, rProj, imageFile, m_iDefaultTrace, getFrameForChild());
         for (int iView = 0; iView < rProj.nView(); iView++) {
           ::wxYield();
           ::wxYield();
         for (int iView = 0; iView < rProj.nView(); iView++) {
           ::wxYield();
           ::wxYield();
@@ -2201,7 +2229,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
         }
         delete pDlgReconstruct;
       } else {
         }
         delete pDlgReconstruct;
       } else {
-        wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
+        wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT);
         for (int i = 0; i < rProj.nView(); i++) {
           pReconstruct->reconstructView (i, 1);
           if (! dlgProgress.Update(i + 1)) {
         for (int i = 0; i < rProj.nView(); i++) {
           pReconstruct->reconstructView (i, 1);
           if (! dlgProgress.Update(i + 1)) {
@@ -2250,9 +2278,9 @@ wxFrame*
 ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
 ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
-  wxMDIChildFrame *subframe = new wxMDIChildFrame (theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
 #else
 #else
-  wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame *subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
 
 #endif
   theApp->setIconForFrame (subframe);
 
@@ -2293,8 +2321,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   menu_bar->Append (reconstruct_menu, "&Reconstruct");
   menu_bar->Append (help_menu, "&Help");
   
   menu_bar->Append (reconstruct_menu, "&Reconstruct");
   menu_bar->Append (help_menu, "&Help");
   
-  subframe->SetMenuBar(menu_bar);
-  
+  subframe->SetMenuBar(menu_bar);  
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[11];
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[11];
@@ -2342,6 +2369,12 @@ ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
 void 
 ProjectionFileView::OnDraw (wxDC* dc)
 {
 void 
 ProjectionFileView::OnDraw (wxDC* dc)
 {
+  wxSize clientSize = m_frame->GetClientSize();
+  wxSize bestSize = m_canvas->GetBestSize();
+
+  if (clientSize.x > bestSize.x || clientSize.y > bestSize.y)
+    m_frame->SetClientSize (bestSize);
+
   if (m_bitmap.Ok())
     dc->DrawBitmap (m_bitmap, 0, 0, false);
 }
   if (m_bitmap.Ok())
     dc->DrawBitmap (m_bitmap, 0, 0, false);
 }
@@ -2402,8 +2435,8 @@ ProjectionFileView::OnClose (bool deleteWindow)
   if (!GetDocument()->Close())
     return false;
   
   if (!GetDocument()->Close())
     return false;
   
-  // m_canvas->Clear();
-  m_canvas->m_pView = NULL;
+  m_canvas->Clear();
+  // m_canvas->m_pView = NULL;
   m_canvas = NULL;
   wxString s(wxTheApp->GetAppName());
   if (m_frame)
   m_canvas = NULL;
   wxString s(wxTheApp->GetAppName());
   if (m_frame)
@@ -2468,7 +2501,7 @@ PlotFileView::OnProperties (wxCommandEvent& event)
   os << "Columns: " << rPlot.getNumColumns() << ", Records: " << rPlot.getNumRecords() << "\n";
   rPlot.printHeadersBrief (os);
   *theApp->getLog() << os.str().c_str();
   os << "Columns: " << rPlot.getNumColumns() << ", Records: " << rPlot.getNumRecords() << "\n";
   rPlot.printHeadersBrief (os);
   *theApp->getLog() << os.str().c_str();
-  wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION);
+  wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION);
   dialogMsg.ShowModal();
 }
 
   dialogMsg.ShowModal();
 }
 
@@ -2479,7 +2512,7 @@ PlotFileView::OnScaleAuto (wxCommandEvent& event)
   const PlotFile& rPlotFile = GetDocument()->getPlotFile();
   double min, max, mean, mode, median, stddev;
   rPlotFile.statistics (1, min, max, mean, mode, median, stddev);
   const PlotFile& rPlotFile = GetDocument()->getPlotFile();
   double min, max, mean, mode, median, stddev;
   rPlotFile.statistics (1, min, max, mean, mode, median, stddev);
-  DialogAutoScaleParameters dialogAutoScale (m_frame, mean, mode, median, stddev, m_dAutoScaleFactor);
+  DialogAutoScaleParameters dialogAutoScale (getFrameForChild(), mean, mode, median, stddev, m_dAutoScaleFactor);
   int iRetVal = dialogAutoScale.ShowModal();
   if (iRetVal == wxID_OK) {
     m_bMinSpecified = true;
   int iRetVal = dialogAutoScale.ShowModal();
   if (iRetVal == wxID_OK) {
     m_bMinSpecified = true;
@@ -2513,7 +2546,7 @@ PlotFileView::OnScaleMinMax (wxCommandEvent& event)
   if (m_bMaxSpecified)
     max = m_dMaxPixel;
   
   if (m_bMaxSpecified)
     max = m_dMaxPixel;
   
-  DialogGetMinMax dialogMinMax (m_frame, "Set Y-axis Minimum & Maximum", min, max);
+  DialogGetMinMax dialogMinMax (getFrameForChild(), "Set Y-axis Minimum & Maximum", min, max);
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
     m_bMinSpecified = true;
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
     m_bMinSpecified = true;
@@ -2554,7 +2587,7 @@ wxFrame*
 PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
 PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
-  wxMDIChildFrame *subframe = new wxMDIChildFrame (theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
 #else
   wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
 #endif
 #else
   wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
 #endif
@@ -2594,7 +2627,6 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   menu_bar->Append(help_menu, "&Help");
   
   subframe->SetMenuBar(menu_bar);
   menu_bar->Append(help_menu, "&Help");
   
   subframe->SetMenuBar(menu_bar);
-  
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[10];
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[10];
@@ -2713,8 +2745,8 @@ PlotFileView::OnClose (bool deleteWindow)
   if (!GetDocument()->Close())
     return false;
   
   if (!GetDocument()->Close())
     return false;
   
-  // m_canvas->Clear();
-  m_canvas->m_pView = NULL;
+  m_canvas->Clear();
+  // m_canvas->m_pView = NULL;
   m_canvas = NULL;
   wxString s(wxTheApp->GetAppName());
   if (m_frame)
   m_canvas = NULL;
   wxString s(wxTheApp->GetAppName());
   if (m_frame)
index eee1be8dc1b12c0318755709c2a5920cf5a579d7..ca998f2bdcb6adc793f9ae529655e382ac28344f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.h,v 1.26 2001/01/06 15:33:15 kevin Exp $
+**  $Id: views.h,v 1.27 2001/01/20 08:10:33 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
 **
 **  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
@@ -57,7 +57,14 @@ private:
   double m_dAutoScaleFactor;
   
   int m_iDefaultExportFormatID;
   double m_dAutoScaleFactor;
   
   int m_iDefaultExportFormatID;
-  
+
+  wxFrame* getFrameForChild() 
+#if CTSIM_MDI
+  { return theApp->getMainFrame(); }
+#else
+  { return m_frame; }
+#endif
+
 public:
   ImageFileView(void);
   virtual ~ImageFileView(void);
 public:
   ImageFileView(void);
   virtual ~ImageFileView(void);
@@ -127,16 +134,20 @@ private:
   
   int m_xCursor;
   int m_yCursor;
   
   int m_xCursor;
   int m_yCursor;
-  
-public:
   ImageFileView* m_pView;
   
   ImageFileView* m_pView;
   
+public:
   ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
   ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
+  virtual ~ImageFileCanvas()
+  {}
+
   virtual void OnDraw(wxDC& dc);
   void OnMouseEvent(wxMouseEvent& event);
   void DrawRubberBandCursor (wxDC& dc, int x, int y);
   bool GetCurrentCursor (int& x, int& y);
   virtual void OnDraw(wxDC& dc);
   void OnMouseEvent(wxMouseEvent& event);
   void DrawRubberBandCursor (wxDC& dc, int x, int y);
   bool GetCurrentCursor (int& x, int& y);
-  
+
+  virtual wxSize GetBestSize() const;
+
   DECLARE_EVENT_TABLE()
 };
 
   DECLARE_EVENT_TABLE()
 };
 
@@ -173,6 +184,13 @@ private:
   int m_iDefaultPolarInterpolation;
   int m_iDefaultPolarZeropad;
 
   int m_iDefaultPolarInterpolation;
   int m_iDefaultPolarZeropad;
 
+  wxFrame* getFrameForChild() 
+#if CTSIM_MDI
+  { return theApp->getMainFrame(); }
+#else
+  { return m_frame; }
+#endif
+
 public:
   ProjectionFileView(void);
   virtual ~ProjectionFileView(void);
 public:
   ProjectionFileView(void);
   virtual ~ProjectionFileView(void);
@@ -197,10 +215,16 @@ public:
 
 class ProjectionFileCanvas: public wxScrolledWindow
 {
 
 class ProjectionFileCanvas: public wxScrolledWindow
 {
-public:
+private:
   ProjectionFileView* m_pView;
   ProjectionFileView* m_pView;
-  
+
+public:  
   ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
   ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
+  virtual ~ProjectionFileCanvas() 
+  {}
+
+  virtual wxSize GetBestSize() const;
+
   virtual void OnDraw(wxDC& dc);
 };
 
   virtual void OnDraw(wxDC& dc);
 };
 
@@ -230,6 +254,13 @@ private:
   int m_iDefaultRasterNY;
   int m_iDefaultRasterNSamples;
 
   int m_iDefaultRasterNY;
   int m_iDefaultRasterNSamples;
 
+  wxFrame* getFrameForChild() 
+#if CTSIM_MDI
+  { return theApp->getMainFrame(); }
+#else
+  { return m_frame; }
+#endif
+
 public:
   PhantomView(void);
   virtual ~PhantomView(void);
 public:
   PhantomView(void);
   virtual ~PhantomView(void);
@@ -250,10 +281,14 @@ public:
 
 class PhantomCanvas: public wxScrolledWindow
 {
 
 class PhantomCanvas: public wxScrolledWindow
 {
-public:
+private:
   PhantomView* m_pView;
   PhantomView* m_pView;
-  
+
+public:  
   PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
   PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
+  virtual ~PhantomCanvas()
+  {}
+
   virtual void OnDraw(wxDC& dc);
 };
 
   virtual void OnDraw(wxDC& dc);
 };
 
@@ -276,6 +311,13 @@ private:
   double m_dMaxPixel;
   double m_dAutoScaleFactor;
   
   double m_dMaxPixel;
   double m_dAutoScaleFactor;
   
+  wxFrame* getFrameForChild() 
+#if CTSIM_MDI
+  { return theApp->getMainFrame(); }
+#else
+  { return m_frame; }
+#endif
+
 public:
   PlotFileView(void);
   virtual ~PlotFileView(void);
 public:
   PlotFileView(void);
   virtual ~PlotFileView(void);
@@ -301,10 +343,14 @@ public:
 
 class PlotFileCanvas: public wxScrolledWindow
 {
 
 class PlotFileCanvas: public wxScrolledWindow
 {
-public:
+private:
   PlotFileView* m_pView;
   
   PlotFileView* m_pView;
   
+public:
   PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
   PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
+  virtual ~PlotFileCanvas()
+  {}
+
   virtual void OnDraw(wxDC& dc);
 };
 
   virtual void OnDraw(wxDC& dc);
 };