X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FwxCDMMainFrame.cpp;h=019c0ac25c47e0cf39236f433c59b33b8b606f79;hb=5a17d994576296f2a5a85f3a01ad5631786a0c56;hp=441d99e89050c728f347cd41239a1bdb095e1e69;hpb=e6d99bba438e086b10239a42492532ff194edb88;p=crea.git diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 441d99e..019c0ac 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")); @@ -233,7 +246,7 @@ void wxCDMMainFrame::CreateControls() ); auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false)); - auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false)); + auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Left().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false)); auiManager.Update(); //auiManager.LoadPerspective(pers,true); wxToolTip::Enable(true); @@ -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; } }