r3876: Auto commit for Debian build
[ctsim.git] / src / views.cpp
index 6f6222086c7bf72adb8cabdf0391656dcb8cedc9..c2d5e06dd75c5b5eb52c49578504b161947a6e8b 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.157 2002/06/02 17:57:02 kevin Exp $
+**  $Id: views.cpp,v 1.166 2003/01/29 07:11:17 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
@@ -184,7 +184,7 @@ ImageFileCanvas::OnChar (wxKeyEvent& event)
     if (m_pView)
       m_pView->OnUpdate (NULL);
   } else
-    wxScrolledWindow::OnChar (event);
+    event.Skip();
 }
 
 wxSize
@@ -268,10 +268,10 @@ EVT_MENU(IFMENU_PLOT_HISTOGRAM, ImageFileView::OnPlotHistogram)
 END_EVENT_TABLE()
 
 ImageFileView::ImageFileView() 
-: wxView(), m_pFrame(NULL), m_pCanvas(NULL), m_pFileMenu(0), m_pFilterMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false)
-{
-  m_iDefaultExportFormatID = ImageFile::EXPORT_FORMAT_PNG;
-}
+  :  wxView(), m_pBitmap(0), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0),
+     m_pFilterMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false),
+     m_iDefaultExportFormatID(ImageFile::EXPORT_FORMAT_PNG)
+{}
 
 ImageFileView::~ImageFileView()
 {
@@ -867,8 +867,8 @@ ImageFileView::OnImaginary (wxCommandEvent& event)
 ImageFileCanvas* 
 ImageFileView::CreateCanvas (wxFrame* parent)
 {
-  ImageFileCanvas* pCanvas = new ImageFileCanvas (this, parent, wxPoint(0, 0), 
-                                                 wxSize(0,0), 0);
+  ImageFileCanvas* pCanvas = new ImageFileCanvas (this, parent, wxPoint(-1,-1),
+                                                 wxSize(-1,-1), 0);
   pCanvas->SetBackgroundColour(*wxWHITE);
   pCanvas->Clear();
   
@@ -883,9 +883,9 @@ wxDocChildFrame*
 ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(10,10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #else
-  wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
 
@@ -908,11 +908,9 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
   
@@ -1019,8 +1017,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 #if wxUSE_GLCANVAS
   accelEntries[iEntry++].Set (wxACCEL_CTRL, static_cast<int>('3'), IFMENU_IMAGE_CONVERT3D);
 #endif
+
   wxAcceleratorTable accelTable (iEntry, accelEntries);
-  
   subframe->SetAcceleratorTable (accelTable);
   
   return subframe;
@@ -1062,8 +1060,10 @@ ImageFileView::setInitialClientSize ()
 void 
 ImageFileView::OnDraw (wxDC* dc)
 {
-  if (m_bitmap.Ok())
-    dc->DrawBitmap(m_bitmap, 0, 0, false);
+  if (m_pBitmap && m_pBitmap->Ok()) {
+    *theApp->getLog() << "Drawing bitmap";
+    dc->DrawBitmap(*m_pBitmap, 0, 0, false);
+  }
   
   int xCursor, yCursor;
   if (m_pCanvas->GetCurrentCursor (xCursor, yCursor))
@@ -1113,7 +1113,12 @@ ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
       }
     }
     wxImage image (nx, ny, imageData, true);
-    m_bitmap = image.ConvertToBitmap();
+    if (m_pBitmap) {
+      delete m_pBitmap;
+      m_pBitmap = NULL;
+    }
+    *theApp->getLog() << "Making new bitmap bitmap";
+    m_pBitmap = new wxBitmap (image);
     delete imageData;
     m_pCanvas->SetScrollbars(20, 20, nx/20, ny/20);
     m_pCanvas->SetBackgroundColour(*wxWHITE);
@@ -1154,8 +1159,9 @@ void
 ImageFileView::OnEditCopy (wxCommandEvent& event)
 {
   wxBitmapDataObject *pBitmapObject = new wxBitmapDataObject;
-  
-  pBitmapObject->SetBitmap (m_bitmap);
+
+  if (m_pBitmap)
+    pBitmapObject->SetBitmap (*m_pBitmap);
   
   if (wxTheClipboard->Open()) {
     wxTheClipboard->SetData (pBitmapObject);
@@ -1198,7 +1204,7 @@ ImageFileView::OnEditPaste (wxCommandEvent& event)
     bool bMonochrome = false;
 
     if (bitmap.Ok() == true && bitmap.GetWidth() == nx && bitmap.GetHeight() == ny) {
-      wxImage image (bitmap);
+      wxImage image (bitmap.ConvertToImage());
       double dScale3 = 3 * 255;
       unsigned char* pixels = image.GetData();
       ImageFileArray v = rIF.getArray();
@@ -1322,13 +1328,12 @@ ImageFileView::OnConvert3d (wxCommandEvent& event)
 {
   ImageFile& rIF = GetDocument()->getImageFile();
   Graph3dFileDocument* pGraph3d = theApp->newGraph3dDoc();
+  pGraph3d->getView()->getFrame()->Show (false);
   pGraph3d->setBadFileOpen();
   pGraph3d->createFromImageFile (rIF);
-  pGraph3d->getView()->OnUpdate (this, NULL);
   pGraph3d->UpdateAllViews();
-  pGraph3d->getView()->getFrame()->SetClientSize (400, 400);
   pGraph3d->getView()->getFrame()->Show (true);
-  GetDocumentManager()->ActivateView (pGraph3d->getView(), true, false);
+  pGraph3d->getView()->Activate(true);
   ::wxYield();
   pGraph3d->getView()->getCanvas()->SetFocus();
 }
@@ -2261,8 +2266,8 @@ PhantomFileView::OnRasterize (wxCommandEvent& event)
 PhantomCanvas* 
 PhantomFileView::CreateCanvas (wxFrame *parent)
 {
-  PhantomCanvas* pCanvas = new PhantomCanvas (this, parent, wxPoint(0, 0), 
-                                             wxSize(0,0), 0);
+  PhantomCanvas* pCanvas = new PhantomCanvas (this, parent, wxPoint(-1,-1), 
+                                             wxSize(-1,-1), 0);
   pCanvas->SetBackgroundColour(*wxWHITE);
   pCanvas->Clear();
   
@@ -2277,9 +2282,9 @@ wxDocChildFrame*
 PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #else
-  wxDocChildFrame *subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame *subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
   
@@ -2300,11 +2305,9 @@ PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
   
@@ -2432,10 +2435,15 @@ ProjectionFileCanvas::GetBestSize () const
     bestSize.Set (rProj.nDet(), rProj.nView());
   }
   
-  if (bestSize.y < iMinY)
-    bestSize.y = iMinY;
+  if (bestSize.x > 800)
+    bestSize.x = 800;
+  if (bestSize.y > 800)
+    bestSize.y = 800;
+
   if (bestSize.x < iMinX)
     bestSize.x = iMinX;
+  if (bestSize.y < iMinY)
+    bestSize.y = iMinY;
 
   return bestSize;
 }
@@ -2461,7 +2469,7 @@ END_EVENT_TABLE()
 
 
 ProjectionFileView::ProjectionFileView() 
-: wxView(), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0)
+  : wxView(), m_pBitmap(0), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0)
 {
 #ifdef DEBUG
   m_iDefaultNX = 115;
@@ -2975,7 +2983,7 @@ ProjectionFileView::CreateCanvas (wxFrame *parent)
   int width, height;
   parent->GetClientSize(&width, &height);
   
-  pCanvas = new ProjectionFileCanvas (this, parent, wxPoint(0, 0), wxSize(width, height), 0);
+  pCanvas = new ProjectionFileCanvas (this, parent, wxPoint(-1,-1), wxSize(width, height), 0);
   
   pCanvas->SetScrollbars(20, 20, 50, 50);
   pCanvas->SetBackgroundColour(*wxWHITE);
@@ -2992,9 +3000,9 @@ wxDocChildFrame*
 ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
-  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, 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(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #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(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
   
@@ -3016,11 +3024,9 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
   
@@ -3082,12 +3088,11 @@ ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
 {
   m_pFrame = CreateChildFrame(doc, this);
   SetFrame(m_pFrame);
-  
-  int width, height;
-  m_pFrame->GetClientSize (&width, &height);
-  m_pFrame->SetTitle ("ProjectionFileView");
   m_pCanvas = CreateCanvas (m_pFrame);
-  
+  m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
+  m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
+  m_pFrame->SetTitle ("ProjectionFileView");
+
   m_pFrame->Show(true);
   Activate(true);
   
@@ -3097,24 +3102,21 @@ ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
 void 
 ProjectionFileView::OnDraw (wxDC* dc)
 {
-  if (m_bitmap.Ok())
-    dc->DrawBitmap (m_bitmap, 0, 0, false);
+  if (m_pBitmap && m_pBitmap->Ok())
+    dc->DrawBitmap (*m_pBitmap, 0, 0, false);
 }
 
 
 void 
 ProjectionFileView::setInitialClientSize ()
 {
-  wxSize bestSize = m_pCanvas->GetBestSize();
-
-  if (bestSize.x > 800)
-    bestSize.x = 800;
-  if (bestSize.y > 800)
-    bestSize.y = 800;
+  if (m_pFrame && m_pCanvas) {
+    wxSize bestSize = m_pCanvas->GetBestSize();
 
-  m_pFrame->SetClientSize (bestSize);
-  m_pFrame->Show (true);
-  m_pFrame->SetFocus();
+    m_pFrame->SetClientSize (bestSize);
+    m_pFrame->Show (true);
+    m_pFrame->SetFocus();
+  }
 }  
 
 void 
@@ -3156,7 +3158,11 @@ ProjectionFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)
       }
     }
     wxImage image (nDet, nView, imageData, true);
-    m_bitmap = image.ConvertToBitmap();
+    if (m_pBitmap) {
+      delete m_pBitmap;
+      m_pBitmap = NULL;
+    }
+    m_pBitmap = new wxBitmap (image);
     delete imageData;
   }
   
@@ -3199,33 +3205,21 @@ ProjectionFileView::OnClose (bool deleteWindow)
 
 // PlotFileCanvas
 PlotFileCanvas::PlotFileCanvas (PlotFileView* 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_pView = v;
 }
 
-wxSize
-PlotFileCanvas::GetBestSize() const
+PlotFileCanvas::~PlotFileCanvas ()
 {
-  if (! m_pView)
-    return wxSize(0,0);
-  
-  int xSize, ySize;
-  theApp->getMainFrame()->GetClientSize (&xSize, &ySize);
-  xSize = maxValue<int> (xSize, ySize);
-#ifdef CTSIM_MDI
-  ySize = xSize = (xSize / 4);
-#else
-  ySize = xSize;
-#endif
-  return wxSize (xSize, ySize);
 }
 
-PlotFileCanvas::~PlotFileCanvas ()
+wxSize
+PlotFileCanvas::GetBestSize() const
 {
-  m_pView = NULL;
+  return wxSize (500, 300);
 }
 
+
 void 
 PlotFileCanvas::OnDraw(wxDC& dc)
 {
@@ -3246,7 +3240,8 @@ EVT_MENU(PLOTMENU_VIEW_SCALE_FULL, PlotFileView::OnScaleFull)
 END_EVENT_TABLE()
 
 PlotFileView::PlotFileView() 
-: wxView(), m_pFrame(NULL), m_pCanvas(NULL), m_pEZPlot(NULL), m_pFileMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false)
+: wxView(), m_pFrame(0), m_pCanvas(0), m_pEZPlot(0), m_pFileMenu(0), 
+  m_bMinSpecified(false), m_bMaxSpecified(false)
 {
 }
 
@@ -3256,6 +3251,7 @@ PlotFileView::~PlotFileView()
     delete m_pEZPlot;
   
   GetDocumentManager()->FileHistoryRemoveMenu (m_pFileMenu);  
+  GetDocumentManager()->ActivateView(this, FALSE, TRUE);
 }
 
 void
@@ -3341,11 +3337,8 @@ PlotFileCanvas*
 PlotFileView::CreateCanvas (wxFrame* parent)
 {
   PlotFileCanvas* pCanvas;
-  int width, height;
-  parent->GetClientSize(&width, &height);
-  
-  pCanvas = new PlotFileCanvas (this, parent, wxPoint(0, 0), wxSize(width, height), 0);
   
+  pCanvas = new PlotFileCanvas (this, parent, wxPoint(-1,-1), wxSize(-1,-1), 0);  
   pCanvas->SetBackgroundColour(*wxWHITE);
   pCanvas->Clear();
   
@@ -3360,9 +3353,9 @@ wxDocChildFrame*
 PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 {
 #ifdef CTSIM_MDI
-  wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame (doc, view, 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(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #else
-  wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
   
@@ -3384,11 +3377,9 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
   
@@ -3427,17 +3418,16 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 bool 
 PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
 {
-  m_pFrame = CreateChildFrame(doc, this);
-  SetFrame(m_pFrame);
-  
   m_bMinSpecified = false;
   m_bMaxSpecified = false;
   m_dAutoScaleFactor = 1.;
   
-  int width, height;
-  m_pFrame->GetClientSize(&width, &height);
-  m_pFrame->SetTitle ("Plot File");
+  m_pFrame = CreateChildFrame(doc, this);
+  SetFrame(m_pFrame);
   m_pCanvas = CreateCanvas (m_pFrame);
+  m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
+  m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
+  m_pFrame->SetTitle ("Plot File");
   
   m_pFrame->Show(true);
   Activate(true);
@@ -3445,6 +3435,19 @@ PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
   return true;
 }
 
+void 
+PlotFileView::setInitialClientSize ()
+{
+  if (m_pFrame && m_pCanvas) {
+    wxSize bestSize = m_pCanvas->GetBestSize();
+    
+    m_pFrame->SetClientSize (bestSize);
+    m_pFrame->Show (true);
+    m_pFrame->SetFocus();
+  }
+}  
+
+
 void 
 PlotFileView::OnDraw (wxDC* dc)
 {
@@ -3519,7 +3522,6 @@ PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 bool 
 PlotFileView::OnClose (bool deleteWindow)
 {
-  //GetDocumentManager()->ActivateView (this, false, true);
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
   
@@ -3563,7 +3565,7 @@ bool TextFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
   int width, height;
   m_pFrame->GetClientSize(&width, &height);
   m_pFrame->SetTitle("TextFile");
-  m_pCanvas = new TextFileCanvas (this, m_pFrame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE | wxTE_READONLY);
+  m_pCanvas = new TextFileCanvas (this, m_pFrame, wxPoint(-1,-1), wxSize(width, height), wxTE_MULTILINE | wxTE_READONLY);
   m_pFrame->SetTitle("Log");
   
   m_pFrame->Show (true);
@@ -3611,7 +3613,7 @@ wxDocChildFrame*
 TextFileView::CreateChildFrame (wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "TextFile Frame", wxPoint(-1, -1), wxSize(0,0), wxDEFAULT_FRAME_STYLE, "Log");
+  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "TextFile Frame", wxPoint(-1, -1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE, "Log");
 #else
   wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "TextFile Frame", wxPoint(-1, -1), wxSize(300, 150), wxDEFAULT_FRAME_STYLE, "Log");
 #endif
@@ -3632,11 +3634,9 @@ TextFileView::CreateChildFrame (wxDocument *doc, wxView *view)
   m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
   m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);