]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMMainFrame.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.cpp
index 441d99e89050c728f347cd41239a1bdb095e1e69..98dfb28b1d64ed9874e926db18124a265c61fe09 100755 (executable)
@@ -38,6 +38,7 @@
 #include "wx/tooltip.h"
 #include "wx/wxhtml.h"
 #include "wx/statline.h"
+#include "wx/config.h"
 #include "CDMUtilities.h"
 
 #include "creaDevManagerIds.h"
@@ -54,6 +55,8 @@
 #include "wxCDMFileDescriptionPanel.h"
 #include "wxCDMPackageManagerPanel.h"
 
+#include "wxCDMSettingsDialog.h"
+
 #include "wxCDMProjectActionsPanel.h"
 #include "wxCDMNewProjectDialog.h"
 
@@ -66,6 +69,7 @@ EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
 EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
 EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
 EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
+EVT_MENU(ID_MENU_SETTINGS, wxCDMMainFrame::OnMenuSettings)
 EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
 EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
 EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
@@ -123,8 +127,13 @@ bool wxCDMMainFrame::Create(
 )
 {
   wxFrame::Create(parent, id, caption, pos, size, style);
-  this->model = new modelCDMMain();
   this->help = true;
+
+  wxConfigBase* pConfig = wxConfigBase::Get();
+  this->help = pConfig->Read(wxT("HELP"), this->help);
+
+  this->model = new modelCDMMain();
+
   CreateMenus();
   CreateControls();
   return TRUE;
@@ -176,6 +185,7 @@ void wxCDMMainFrame::CreateMenus()
   //EditMenu
   menu_Edit = new wxMenu();
   menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
+  menu_Edit->Append(ID_MENU_SETTINGS, wxT("&Settings"));
 
   menuBar->Append(menu_Edit, wxT("&Edit"));
 
@@ -496,6 +506,19 @@ void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
   event.Skip();
 }
 
+void wxCDMMainFrame::OnMenuSettings(wxCommandEvent& event)
+{
+  wxCDMSettingsDialog* settingsDialog = new wxCDMSettingsDialog(this, -1);
+  settingsDialog->SetHelpEnabled(this->help);
+
+  int res = settingsDialog->ShowModal();
+  if(res == wxID_OK)
+    {
+      this->help = settingsDialog->IsHelpEnabled();
+      this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help);
+    }
+}
+
 void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
 {
   std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
@@ -920,7 +943,8 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
     auiManager.Update();
     break;
   default:
-         event.Skip();
+    event.Skip();
+    break;
   }
   
 }