From: Daniel Gonzalez Date: Thu, 3 Jan 2013 12:36:19 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=43a86caa77956a7638494a69499c17cff2b79538;p=crea.git Feature #1711 CreaDevManager application implementation -Help disable implemented (true by default). -Project help implemented --- diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index fe1b1a0..509822f 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -60,14 +60,15 @@ #define ID_MENU_CODE_EDITOR 10218 #define ID_MENU_COMMAND_LINE 10219 -#define ID_MENU_HELP 10220 -#define ID_MENU_REPORT_BUG 10221 -#define ID_MENU_ABOUT_CREADEVMANAGER 10222 -#define ID_MENU_ABOUT_CREATIS 10223 +#define ID_MENU_TOGGLE_HELP 10220 +#define ID_MENU_HELP 10221 +#define ID_MENU_REPORT_BUG 10222 +#define ID_MENU_ABOUT_CREADEVMANAGER 10223 +#define ID_MENU_ABOUT_CREATIS 10224 -#define ID_TREE_PROJECTS 10224 -#define ID_WINDOW_PROPERTIES 10225 -#define ID_WINDOW_PROJ_ACTIONS 10226 +#define ID_TREE_PROJECTS 10225 +#define ID_WINDOW_PROPERTIES 10226 +#define ID_WINDOW_PROJ_ACTIONS 10227 #define ID_BUTTON_NEXT 10300 #define ID_BUTTON_PREV 10301 @@ -110,4 +111,8 @@ #define ID_LINK_SELECT_APPLICATION 10332 #define ID_LINK_SELECT_BLACKBOX 10333 +#define ID_CHECKBOX_ENABLE_HELP 10334 +#define ID_CHECKBOX_DISABLE_HELP 10335 +#define ID_CHECKBOX_TOGGLE_HELP 10335 + #endif /* CREADEVMANAGERIDS_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index f26d956..07ea080 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -53,6 +53,8 @@ #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" +#include "wxCDMProjectHelpDialog.h" + BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame) EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject) @@ -74,16 +76,18 @@ EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEdito EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools) EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor) EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine) +EVT_MENU(ID_MENU_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp) EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp) EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug) EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager) EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis) EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject) EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject) -EVT_TREE_SEL_CHANGING(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged) +EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged) EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp) END_EVENT_TABLE() wxCDMMainFrame::wxCDMMainFrame( @@ -114,6 +118,7 @@ bool wxCDMMainFrame::Create( { wxFrame::Create(parent, id, caption, pos, size, style); this->model = new modelCDMMain(); + this->help = true; CreateMenus(); CreateControls(); return TRUE; @@ -178,6 +183,8 @@ void wxCDMMainFrame::CreateMenus() //HelpMenu menu_Help = new wxMenu(); + menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs")); + menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); menu_Help->Append(ID_MENU_HELP, wxT("&Help")); menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug")); menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager")); @@ -274,25 +281,11 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) //populate tree control tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject()); - tree_Projects->SelectItem(this->model->GetProject()->GetId()); + tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); + tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); - //change description panel - if(this->panel_Properties != NULL) - { - auiManager.DetachPane(this->panel_Properties); - this->panel_Properties->Destroy(); - this->panel_Properties = NULL; - } - this->panel_Properties = new wxCDMProjectDescriptionPanel( - this, - this->model->GetProject(), - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0); - //show projectactions panel + //show project actions panel if(this->panel_ProjectActions != NULL) { auiManager.DetachPane(this->panel_Properties); @@ -312,12 +305,12 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) panel_ProjectActions->SetMinSize(wxSize(500, 100)); - auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false)); auiManager.Update(); - wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION); + //wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION); + } event.Skip(); @@ -364,25 +357,9 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) //populate tree control tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); - tree_Projects->SelectItem(this->model->GetProject()->GetId()); + tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); + tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); - //change description panel - if(this->panel_Properties != NULL) - { - auiManager.DetachPane(this->panel_Properties); - this->panel_Properties->Destroy(); - this->panel_Properties = NULL; - } - - this->panel_Properties = new wxCDMProjectDescriptionPanel( - this, - this->model->GetProject(), - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0 - ); //change project's actions panel if(this->panel_ProjectActions!= NULL) @@ -403,10 +380,11 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) panel_ProjectActions->SetMinSize(wxSize(500, 100)); - auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false)); auiManager.Update(); + + } event.Skip(); @@ -637,58 +615,49 @@ void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event) void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) { + //get selected element wxTreeItemId elementId = event.GetItem(); - - //get element from model - modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId]; - std::cout << "Tree Selection: " << element->GetName() << std::endl; - - //TODO get element type - //project - modelCDMProject* elementProject = dynamic_cast(element); - wxPanel* description; - if(elementProject != NULL) - { - //create element description - description = new wxCDMProjectDescriptionPanel( - this, - elementProject, - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0 - ); - - } - else + if(this->tree_Projects->IsSelected(elementId)) { - //appli - modelCDMAppli* elementAppli = dynamic_cast(element); - if(elementAppli != NULL) + std::cout << "Tree Selection id: " << elementId << std::endl; + //get element from model + modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId]; + std::cout << "Tree Selection: " << element->GetName() << std::endl; + + //TODO get element type + //project + modelCDMProject* elementProject = dynamic_cast(element); + wxPanel* description; + wxDialog* helpDialog = NULL; + if(elementProject != NULL) { //create element description - description = new wxCDMAppliDescriptionPanel( + description = new wxCDMProjectDescriptionPanel( this, - elementAppli, + elementProject, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, wxSize(600, 400), 0 ); + + if(this->help) + { + helpDialog = new wxCDMProjectHelpDialog(this, wxID_ANY); + } } else { - //application - modelCDMApplication* elementApplication = dynamic_cast(element); - if(elementApplication != NULL) + //appli + modelCDMAppli* elementAppli = dynamic_cast(element); + if(elementAppli != NULL) { //create element description - description = new wxCDMApplicationDescriptionPanel( + description = new wxCDMAppliDescriptionPanel( this, - elementApplication, + elementAppli, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -698,14 +667,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //lib - modelCDMLib* elementLib = dynamic_cast(element); - if(elementLib != NULL) + //application + modelCDMApplication* elementApplication = dynamic_cast(element); + if(elementApplication != NULL) { //create element description - description = new wxCDMLibDescriptionPanel( + description = new wxCDMApplicationDescriptionPanel( this, - elementLib, + elementApplication, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -715,14 +684,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //library - modelCDMLibrary* elementLibrary = dynamic_cast(element); - if(elementLibrary != NULL) + //lib + modelCDMLib* elementLib = dynamic_cast(element); + if(elementLib != NULL) { //create element description - description = new wxCDMLibraryDescriptionPanel( + description = new wxCDMLibDescriptionPanel( this, - elementLibrary, + elementLib, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -732,14 +701,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //package - modelCDMPackage* elementPackage = dynamic_cast(element); - if(elementPackage != NULL) + //library + modelCDMLibrary* elementLibrary = dynamic_cast(element); + if(elementLibrary != NULL) { //create element description - description = new wxCDMPackageDescriptionPanel( + description = new wxCDMLibraryDescriptionPanel( this, - elementPackage, + elementLibrary, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -749,14 +718,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //black box - modelCDMBlackBox* elementBlackBox = dynamic_cast(element); - if(elementBlackBox != NULL) + //package + modelCDMPackage* elementPackage = dynamic_cast(element); + if(elementPackage != NULL) { //create element description - description = new wxCDMBlackBoxDescriptionPanel( + description = new wxCDMPackageDescriptionPanel( this, - elementBlackBox, + elementPackage, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -766,14 +735,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //CMakeLists - modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast(element); - if(elementCMakeLists != NULL) + //black box + modelCDMBlackBox* elementBlackBox = dynamic_cast(element); + if(elementBlackBox != NULL) { //create element description - description = new wxCDMCMakeListsDescriptionPanel( + description = new wxCDMBlackBoxDescriptionPanel( this, - elementCMakeLists, + elementBlackBox, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -783,14 +752,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //folder - modelCDMFolder* elementFolder = dynamic_cast(element); - if(elementFolder != NULL) + //CMakeLists + modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast(element); + if(elementCMakeLists != NULL) { //create element description - description = new wxCDMFolderDescriptionPanel( + description = new wxCDMCMakeListsDescriptionPanel( this, - elementFolder, + elementCMakeLists, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -800,14 +769,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //file - modelCDMFile* elementFile = dynamic_cast(element); - if(elementFile != NULL) + //folder + modelCDMFolder* elementFolder = dynamic_cast(element); + if(elementFolder != NULL) { //create element description - description = new wxCDMFileDescriptionPanel( + description = new wxCDMFolderDescriptionPanel( this, - elementFile, + elementFolder, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -817,17 +786,35 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - - //main if not any - //create element description - description = new wxCDMMainDescriptionPanel( - this, - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0 - ); + //file + modelCDMFile* elementFile = dynamic_cast(element); + if(elementFile != NULL) + { + //create element description + description = new wxCDMFileDescriptionPanel( + this, + elementFile, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + + //main if not any + //create element description + description = new wxCDMMainDescriptionPanel( + this, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } } } } @@ -837,27 +824,32 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } } } - } - if(this->panel_Properties!= NULL) - this->panel_Properties->Hide(); + if(this->panel_Properties!= NULL) + this->panel_Properties->Hide(); - auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); - auiManager.Update(); + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); + auiManager.Update(); - //delete old view - if(this->panel_Properties!= NULL) - { - auiManager.DetachPane(this->panel_Properties); - this->panel_Properties->Destroy(); - this->panel_Properties = NULL; + //delete old view + if(this->panel_Properties!= NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Destroy(); + this->panel_Properties = NULL; + } + //set new view + + this->panel_Properties = description; + if(this->help && helpDialog != NULL) + { + helpDialog->Show(true); + } + //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false)); + auiManager.Update(); + event.Skip(); } - //set new view - this->panel_Properties = description; - //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false)); - auiManager.Update(); - event.Skip(); return; } @@ -953,3 +945,19 @@ void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event) this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE); auiManager.Update(); } + +void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event) +{ + this->help = !this->help; + this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); +} + +void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event) +{ + if (event.GetInt()) + this->help = false; + else + this->help = true; + + this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); +} diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index 18f00a0..fbca81a 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -85,6 +85,9 @@ private: //Model modelCDMMain* model; + //Help enabled + bool help; + //events protected: //File @@ -113,6 +116,7 @@ protected: void OnMenuCommandLine(wxCommandEvent& event); //Help + void OnMenuToggleHelp(wxCommandEvent& event); void OnMenuHelp(wxCommandEvent& event); void OnMenuReportBug(wxCommandEvent& event); void OnMenuAboutCreaDevManager(wxCommandEvent& event); @@ -127,6 +131,9 @@ protected: //Element higlighted void OnElementSelected(wxCommandEvent& event); void OnElementDeselected(wxCommandEvent& event); + + //Enable/Disable help + void OnDisableHelp(wxCommandEvent& event); }; #endif diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp new file mode 100644 index 0000000..e676a55 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp @@ -0,0 +1,252 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMProjectReadyDialog.cpp + * + * Created on: 3/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMProjectHelpDialog.h" + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMProjectHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectHelpDialog::OnManagePackages) +EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectHelpDialog::OnManageLibraries) +EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectHelpDialog::OnManageApplications) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMProjectHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMProjectHelpDialog::wxCDMProjectHelpDialog( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style); +} + +wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog() +{ +} + +bool wxCDMProjectHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMProjectHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Your project is ready!"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx("When you create a project it comes with a default package. If you need to work in it or you want to create more " + "packages you can do it by clicking the \"Manage Packages\" button bellow. You can also work with Libraries and " + "Applications, just click in the \"Manage Libraries\" button or \"Manage Applications\" button to start working " + "with them.\n" + "\n" + "Select an action or click Finish to continue working on the project."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxFlexGridSizer* formItems = new wxFlexGridSizer(2,2,9,15); + + wxButton* managePackagesBtn = new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, wxT("Manage Packages")); + wxButton* manageLibrariesBtn = new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, wxT("Manage Libraries")); + manageLibrariesBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseEnter,NULL,this); + manageLibrariesBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseExit,NULL,this); + wxButton* manageApplicationsBtn = new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, wxT("Manage Applications")); + manageApplicationsBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseEnter,NULL,this); + manageApplicationsBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseExit,NULL,this); + + formItems->Add(managePackagesBtn, 1, wxALIGN_CENTER_VERTICAL); + formItems->Add(manageLibrariesBtn, 1, wxALIGN_CENTER_VERTICAL); + formItems->Add(manageApplicationsBtn, 1, wxALIGN_CENTER_VERTICAL); + + formItems->AddGrowableCol(0,1); + formItems->AddGrowableCol(1,1); + + v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Cancel")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMProjectHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMProjectHelpDialog::OnManagePackages(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_packages")); + newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMProjectHelpDialog::OnManageLibraries(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_libraries")); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + { + int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + newEvent1->SetInt(CMId); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMProjectHelpDialog::OnManageApplications(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_applications")); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + { + int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + newEvent1->SetInt(CMId); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMProjectHelpDialog::OnAppliMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + { + int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + newEvent->SetInt(AppId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectHelpDialog::OnAppliMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + { + int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + newEvent->SetInt(AppId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectHelpDialog::OnLibMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + { + int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + newEvent->SetInt(LbId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectHelpDialog::OnLibMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + { + int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + newEvent->SetInt(LbId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h new file mode 100644 index 0000000..13fbee3 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h @@ -0,0 +1,83 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMProjectHelpDialog.h + * + * Created on: 3/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPROJECTHELPDIALOG_H_ +#define WXCDMPROJECTHELPDIALOG_H_ + +#include +#include + +class wxCDMProjectHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + wxCDMProjectHelpDialog( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Ready"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + ~wxCDMProjectHelpDialog(); + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Ready"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + void CreateControls(); + +//handlers +protected: + void OnFinish(wxCommandEvent& event); + + void OnManagePackages(wxCommandEvent& event); + void OnManageLibraries(wxCommandEvent& event); + void OnManageApplications(wxCommandEvent& event); + + void OnAppliMouseEnter(wxMouseEvent& event); + void OnAppliMouseExit(wxMouseEvent& event); + void OnLibMouseEnter(wxMouseEvent& event); + void OnLibMouseExit(wxMouseEvent& event); + + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPROJECTHELPDIALOG_H_ */