Applied initial patches for wx2.8 compatibility
[ctsim.git] / src / graph3dview.cpp
index 9d27729bcd41f9d22d1f2ed7f069377baab2a1fc..747e983d39a419e20282f0055cdcaad92191a4f9 100644 (file)
@@ -154,7 +154,7 @@ Graph3dFileView::Graph3dFileView ()
 Graph3dFileView::~Graph3dFileView()
 {
   GetDocumentManager()->FileHistoryRemoveMenu (m_pFileMenu);
-  GetDocumentManager()->ActivateView(this, false, true);
+  GetDocumentManager()->ActivateView(this, false);
 }
 
 bool
@@ -166,7 +166,7 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
 
   m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
   m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
-  m_pFrame->SetTitle("Graph3dFileView");
+  m_pFrame->SetTitle(_T("Graph3dFileView"));
 
   m_pCanvas->SetCurrent();
   InitGL();
@@ -190,7 +190,7 @@ Graph3dFileView::CreateCanvas (wxFrame* parent)
   Graph3dFileCanvas* pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(-1,-1), wxSize(-1,-1), 0);
 
   pCanvas->SetBackgroundColour(*wxWHITE);
-  pCanvas->Clear();
+  pCanvas->ClearBackground();
 
   return pCanvas;
 }
@@ -362,10 +362,11 @@ Graph3dFileView::CreateDisplayList()
 void
 Graph3dFileView::OnProperties (wxCommandEvent& event)
 {
-  std::ostringstream os;
-  *theApp->getLog() << ">>>>\n" << os.str().c_str() << "<<<<\n";
-  wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(),
-                             "Imagefile Properties", wxOK | wxICON_INFORMATION);
+  wxString os;
+  *theApp->getLog() << _T(">>>>\n") << os << _T("<<<<\n");
+  wxMessageDialog dialogMsg (getFrameForChild(), os,
+                             _T("Imagefile Properties"), 
+                             wxOK | wxICON_INFORMATION);
   dialogMsg.ShowModal();
 }
 
@@ -409,17 +410,17 @@ Graph3dFileView::OnDraw (wxDC* dc)
   if (m_pCanvas) {
     m_pCanvas->SetCurrent();
 #ifdef DEBUG
-        *theApp->getLog() << "Drawing 3d surface\n";
+    *theApp->getLog() << _T("Drawing 3d surface\n");
 #endif
     Draw();
     m_pCanvas->SwapBuffers();
   }
 
   if (m_pStatusBar) {
-    std::ostringstream os;
-    os << "Xangle=" << m_dXRotate << ", Yangle=" << m_dYRotate
-       << ", Zangle=" << m_dZRotate;
-    m_pStatusBar->SetStatusText (os.str().c_str());
+    wxString os;
+    os << _T("Xangle=") << m_dXRotate << _T(", Yangle=") << m_dYRotate
+       << _T(", Zangle=") << m_dZRotate;
+    m_pStatusBar->SetStatusText (os);
   }
 }
 
@@ -726,7 +727,7 @@ Graph3dFileView::OnScaleSet (wxCommandEvent& event)
   if (m_bColorScaleMaxSet)
     dMax = m_dColorScaleMax;
 
-  DialogGetMinMax dialogMinMax (getFrameForChild(), "Set Color Scale Minimum & Maximum", dMin, dMax);
+  DialogGetMinMax dialogMinMax (getFrameForChild(), _T("Set Color Scale Minimum & Maximum"), dMin, dMax);
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
     m_bColorScaleMinSet = true;
@@ -755,9 +756,9 @@ wxDocChildFrame*
 Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
 {
 #if CTSIM_MDI
-  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
+  wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, _T("Graph3dFile Frame"), wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #else
-  wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
+  wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, _T("Graph3dFile Frame"), wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
 
@@ -770,45 +771,45 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
 
   m_pFileMenu = new wxMenu;
 
-  m_pFileMenu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...\tCtrl-P");
-  m_pFileMenu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...\tCtrl-F");
-  m_pFileMenu->Append(wxID_OPEN, "&Open...\tCtrl-O");
-  m_pFileMenu->Append(wxID_CLOSE, "&Close\tCtrl-W");
+  m_pFileMenu->Append(MAINMENU_FILE_CREATE_PHANTOM, _T("Cr&eate Phantom...\tCtrl-P"));
+  m_pFileMenu->Append(MAINMENU_FILE_CREATE_FILTER, _T("Create &Filter...\tCtrl-F"));
+  m_pFileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl-O"));
+  m_pFileMenu->Append(wxID_CLOSE, _T("&Close\tCtrl-W"));
 
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(IFMENU_FILE_PROPERTIES, "P&roperties");
+  m_pFileMenu->Append(IFMENU_FILE_PROPERTIES, _T("P&roperties"));
 
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append(wxID_PRINT, "&Print...");
-  m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
-  m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
+  m_pFileMenu->Append(wxID_PRINT, _T("&Print..."));
+  m_pFileMenu->Append(wxID_PRINT_SETUP, _T("Print &Setup..."));
+  m_pFileMenu->Append(wxID_PREVIEW, _T("Print Preview"));
   m_pFileMenu->AppendSeparator();
-  m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
-  m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
+  m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, _T("Prefere&nces..."));
+  m_pFileMenu->Append(MAINMENU_FILE_EXIT, _T("E&xit"));
 
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
 
   m_pViewMenu = new wxMenu;
-  m_pViewMenu->Append(GRAPH3D_VIEW_WIREFRAME, "Wi&reframe\tCtrl-R", "", true);
-  m_pViewMenu->Append(GRAPH3D_VIEW_SMOOTH, "S&mooth\tCtrl-M", "", true);
-  m_pViewMenu->Append(GRAPH3D_VIEW_COLOR, "Co&lor\tCtrl-L", "", true);
-  m_pViewMenu->Append(GRAPH3D_VIEW_LIGHTING, "Li&ghting\tCtrl-G", "", true);
+  m_pViewMenu->Append(GRAPH3D_VIEW_WIREFRAME, _T("Wi&reframe\tCtrl-R"), _T(""), true);
+  m_pViewMenu->Append(GRAPH3D_VIEW_SMOOTH, _T("S&mooth\tCtrl-M"), _T(""), true);
+  m_pViewMenu->Append(GRAPH3D_VIEW_COLOR, _T("Co&lor\tCtrl-L"), _T(""), true);
+  m_pViewMenu->Append(GRAPH3D_VIEW_LIGHTING, _T("Li&ghting\tCtrl-G"), _T(""), true);
   m_pViewMenu->AppendSeparator();
-  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_MINMAX, "Color Scale S&et Min/Max...\tCtrl-E");
-  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_AUTO, "Color Scale &Auto...\tCtrl-A");
-  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_FULL, "Color F&ull Scale\tCtrl-U");
+  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_MINMAX, _T("Color Scale S&et Min/Max...\tCtrl-E"));
+  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_AUTO, _T("Color Scale &Auto...\tCtrl-A"));
+  m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_FULL, _T("Color F&ull Scale\tCtrl-U"));
 
 
   wxMenu *help_menu = new wxMenu;
-  help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
-  help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
+  help_menu->Append(MAINMENU_HELP_CONTENTS, _T("&Contents\tF1"));
+  help_menu->Append(MAINMENU_HELP_ABOUT, _T("&About"));
 
   wxMenuBar *menu_bar = new wxMenuBar;
 
-  menu_bar->Append(m_pFileMenu, "&File");
-  menu_bar->Append(m_pViewMenu, "&View");
-  menu_bar->Append(help_menu, "&Help");
+  menu_bar->Append(m_pFileMenu, _T("&File"));
+  menu_bar->Append(m_pViewMenu, _T("&View"));
+  menu_bar->Append(help_menu, _T("&Help"));
 
   subframe->SetMenuBar(menu_bar);
 
@@ -894,7 +895,7 @@ Graph3dFileCanvas::OnChar(wxKeyEvent& event)
     return;
 
   wxCommandEvent dummyEvent;
-  switch (event.KeyCode()) {
+  switch (event.GetKeyCode()) {
   case WXK_LEFT:
         m_pView->m_dZRotate += 15.0;
     Refresh (false);