X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcreaDevManagerLib%2FwxCDMMainFrame.cpp;h=5aa7997b0b6314a14098558a9c3c5d5644c3efa8;hb=dfde248b7e6bb2c1706a6b1229a17ee2aa19ed9c;hp=441d99e89050c728f347cd41239a1bdb095e1e69;hpb=e6d99bba438e086b10239a42492532ff194edb88;p=crea.git diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 441d99e..5aa7997 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -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) @@ -110,6 +114,9 @@ wxCDMMainFrame::wxCDMMainFrame( wxCDMMainFrame::~wxCDMMainFrame() { + wxConfigBase* pConfig = wxConfigBase::Get(); + pConfig->Write(wxT("HELP"), this->help); + auiManager.UnInit(); } @@ -123,8 +130,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) != 0; + + this->model = new modelCDMMain(); + CreateMenus(); CreateControls(); return TRUE; @@ -176,6 +188,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 +509,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; @@ -868,7 +894,7 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) //this->tree_Projects->Expand(this->model->GetProject()->GetId()); //this->tree_Projects->Unselect(); this->actualTreeItem.Unset(); - description = new wxCDMPackageManagerPanel( + description = new wxCDMPackageManagerPanel( this, this->model->GetProject(), ID_WINDOW_PROPERTIES, @@ -893,7 +919,8 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) else if(event.GetString() == wxT("blackbox")) { modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData(); - this->actualTreeItem.Unset(); + this->actualTreeItem.Unset(); + this->tree_Projects->SelectItem(bb->GetHeaderFile()->GetId().GetWxId()); description = new wxCDMBlackBoxDescriptionPanel( this, bb, @@ -903,6 +930,7 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) wxSize(600, 400), 0 ); + } @@ -920,7 +948,8 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) auiManager.Update(); break; default: - event.Skip(); + event.Skip(); + break; } }