From 82535c727c13786bc29fc0f0e73aca927d77b8fe Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Mon, 7 Jan 2013 17:44:57 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation -Project help starts from the project description -Main description help implemented -Package Manager help implemented --- lib/creaDevManagerLib/creaDevManagerIds.h | 2 +- lib/creaDevManagerLib/modelCDMPackageSrc.cpp | 10 +- .../wxCDMMainDescriptionPanel.cpp | 12 ++ lib/creaDevManagerLib/wxCDMMainFrame.cpp | 27 ++- lib/creaDevManagerLib/wxCDMMainFrame.h | 2 + lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp | 151 ++++++++++++++ lib/creaDevManagerLib/wxCDMMainHelpDialog.h | 84 ++++++++ .../wxCDMPackageManagerHelpDialog.cpp | 188 ++++++++++++++++++ .../wxCDMPackageManagerHelpDialog.h | 87 ++++++++ .../wxCDMPackageManagerPanel.cpp | 15 ++ .../wxCDMPackageManagerPanel.h | 3 + .../wxCDMProjectDescriptionPanel.cpp | 13 ++ .../wxCDMProjectDescriptionPanel.h | 2 + .../wxCDMProjectHelpDialog.cpp | 34 ++-- .../wxCDMProjectHelpDialog.h | 7 + 15 files changed, 605 insertions(+), 32 deletions(-) create mode 100644 lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp create mode 100644 lib/creaDevManagerLib/wxCDMMainHelpDialog.h create mode 100644 lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp create mode 100644 lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index 509822f..f595934 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -113,6 +113,6 @@ #define ID_CHECKBOX_ENABLE_HELP 10334 #define ID_CHECKBOX_DISABLE_HELP 10335 -#define ID_CHECKBOX_TOGGLE_HELP 10335 +#define ID_CHECKBOX_TOGGLE_HELP 10335 #endif /* CREADEVMANAGERIDS_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index 06d0c09..6aa9c53 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -144,7 +144,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( { //parse name std::vector words; - CDMUtilities::splitter::split(words, name, " \n\",/\\", CDMUtilities::splitter::no_empties); + CDMUtilities::splitter::split(words, name, " \n\",/\\'", CDMUtilities::splitter::no_empties); std::string bbName; for (int i = 0; i < words.size(); i++) { @@ -152,7 +152,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( } //parse categories - CDMUtilities::splitter::split(words, categories, " \n\",/\\", CDMUtilities::splitter::no_empties); + CDMUtilities::splitter::split(words, categories, " \n\",/\\'", CDMUtilities::splitter::no_empties); std::string bbCategories; if(words.size() > 0) { @@ -166,7 +166,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( bbCategories = "empty"; //parse authors - CDMUtilities::splitter::split(words, authors, "\n\",/\\", CDMUtilities::splitter::no_empties); + CDMUtilities::splitter::split(words, authors, "\n\",/\\'", CDMUtilities::splitter::no_empties); std::string bbAuthors; if(words.size() > 0) { @@ -180,7 +180,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( bbAuthors = "Unknown"; //parse description - CDMUtilities::splitter::split(words, authorsEmail, " \n\"/\\", CDMUtilities::splitter::no_empties); + CDMUtilities::splitter::split(words, authorsEmail, " \n\"/\\'", CDMUtilities::splitter::no_empties); std::string bbDescription; if(words.size() > 0) { @@ -191,7 +191,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( } bbDescription += " - "; } - CDMUtilities::splitter::split(words, description, "\n\"/\\", CDMUtilities::splitter::no_empties); + CDMUtilities::splitter::split(words, description, "\n\"/\\'", CDMUtilities::splitter::no_empties); if(words.size() > 0) { bbDescription += words[0]; diff --git a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp index bb2c3eb..73cda49 100644 --- a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp @@ -35,12 +35,17 @@ #include "wxCDMMainDescriptionPanel.h" +#include "wxCDMMainFrame.h" + +#include "wxCDMMainHelpDialog.h" + #include "creaDevManagerIds.h" #include "images/CIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMMainDescriptionPanel, wxPanel) EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainDescriptionPanel::OnBtnNewProject) EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainDescriptionPanel::OnBtnOpenProject) + END_EVENT_TABLE() wxCDMMainDescriptionPanel::wxCDMMainDescriptionPanel( @@ -107,6 +112,13 @@ void wxCDMMainDescriptionPanel::CreateControls() //Asign sizer sizer->SetSizeHints(this); SetSizer(sizer); + + if(((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxDialog* helpDialog = new wxCDMMainHelpDialog(this->GetParent(), this, wxID_ANY); + helpDialog->Show(true); + } + } void wxCDMMainDescriptionPanel::OnBtnNewProject(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 07ea080..6f0af46 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -53,7 +53,6 @@ #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" -#include "wxCDMProjectHelpDialog.h" BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame) @@ -81,12 +80,17 @@ 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_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() @@ -129,6 +133,16 @@ modelCDMMain* wxCDMMainFrame::GetModel() const return this->model; } +wxPanel* wxCDMMainFrame::GetPropertiesPanel() const +{ + return this->panel_Properties; +} + +bool wxCDMMainFrame::isHelp() const +{ + return this->help; +} + void wxCDMMainFrame::RefreshProject() { std::string* result; @@ -629,7 +643,6 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) //project modelCDMProject* elementProject = dynamic_cast(element); wxPanel* description; - wxDialog* helpDialog = NULL; if(elementProject != NULL) { //create element description @@ -643,10 +656,6 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) 0 ); - if(this->help) - { - helpDialog = new wxCDMProjectHelpDialog(this, wxID_ANY); - } } else { @@ -664,6 +673,7 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) wxSize(600, 400), 0 ); + } else { @@ -841,10 +851,7 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) //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(); diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index fbca81a..64a316f 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -61,6 +61,8 @@ public: ); modelCDMMain* GetModel() const; + wxPanel* GetPropertiesPanel() const; + bool isHelp() const; void RefreshProject(); diff --git a/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp new file mode 100644 index 0000000..6223d54 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp @@ -0,0 +1,151 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMMainHelpDialog.cpp + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMMainHelpDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMMainHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMMainHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainHelpDialog::OnNewProject) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainHelpDialog::OnOpenProject) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMMainHelpDialog::wxCDMMainHelpDialog( + wxWindow* parent, + wxCDMMainDescriptionPanel* mainDescription, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMMainHelpDialog::Create(parent, id, caption, position, size, style); + this->mainDescription = mainDescription; +} + +wxCDMMainHelpDialog::~wxCDMMainHelpDialog() +{ +} + +bool wxCDMMainHelpDialog::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 wxCDMMainHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Welcome to the Crea Development Manager"), 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( + "This application was made to help you in the creation process of Crea projects. This help dialogs will explain what " + "each part of the program does and will give you tips to get your project up and running in no time. You can disable " + "them by checking the \"Disable Help\" option, you can also enable it at any time checking the \"Help Dialogs\" " + "option in the Help menu.\n To begin working on your projects you can either create a new project or open an already " + "existing project.\n" + "\n" + "Select an action or click Close to continue working on the project."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15); + + wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_NEWPROJECT, wxT("New Project")); + wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project")); + + formItems->Add(createPackageBtn, 1, wxALIGN_CENTER); + formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER); + + 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("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMMainHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMMainHelpDialog::OnNewProject(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMMainHelpDialog::OnOpenProject(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMMainHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMMainHelpDialog.h b/lib/creaDevManagerLib/wxCDMMainHelpDialog.h new file mode 100644 index 0000000..7f9e5d2 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMMainHelpDialog.h @@ -0,0 +1,84 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMMainHelpDialog.h + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMMAINHELPDIALOG_H_ +#define WXCDMMAINHELPDIALOG_H_ + +#include +#include + +#include "wxCDMMainDescriptionPanel.h" + +class wxCDMMainHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + wxCDMMainHelpDialog( + wxWindow* parent, + wxCDMMainDescriptionPanel* packageManager, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Welcome"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + ~wxCDMMainHelpDialog(); + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Welcome"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + void CreateControls(); + +//attributes +private: + wxCDMMainDescriptionPanel* mainDescription; + +//handlers +protected: + void OnFinish(wxCommandEvent& event); + + void OnNewProject(wxCommandEvent& event); + void OnOpenProject(wxCommandEvent& event); + + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPACKAGEMANAGERHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp new file mode 100644 index 0000000..fe72272 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp @@ -0,0 +1,188 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMPackageManagerHelpDialog.cpp + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageManagerHelpDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMPackageManagerHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageManagerHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerHelpDialog::OnCreatePackage) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerHelpDialog::OnEditCMake) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageManagerHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMPackageManagerHelpDialog::wxCDMPackageManagerHelpDialog( + wxWindow* parent, + wxCDMPackageManagerPanel* packageManager, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMPackageManagerHelpDialog::Create(parent, id, caption, position, size, style); + this->packageManager = packageManager; +} + +wxCDMPackageManagerHelpDialog::~wxCDMPackageManagerHelpDialog() +{ +} + +bool wxCDMPackageManagerHelpDialog::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 wxCDMPackageManagerHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Managing your packages"), 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( + "In the package manager you can view a list of the available packages in the current project, as well as create " + "new packages. Remember that any package you make must be included in the CMakeLists file. You can do that by " + "clicking on the \"Edit CMakeLists File\" button and include the desired packages at the end of the file. You " + "should also include the libraries you are using on your black boxes in this file.\n" + "\n" + "Select an action or click Close to continue working on the project."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15); + + wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_CREATE_PACKAGE, wxT("Create a Package")); + wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit the CMakeLists File")); + editCMakeBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter,NULL,this); + editCMakeBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit,NULL,this); + + formItems->Add(createPackageBtn, 1, wxALIGN_CENTER); + formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER); + + 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("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMPackageManagerHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMPackageManagerHelpDialog::OnCreatePackage(wxCommandEvent& event) +{ + if(this->packageManager != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_CLICKED); + wxPostEvent(this->packageManager, *newEvent); + } + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMPackageManagerHelpDialog::OnEditCMake(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_ENTER); + if(this->packageManager != NULL) + wxPostEvent(this->packageManager, *newEvent); + event.Skip(); + + this->EndDialog(wxID_OK); +} + + +void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + + if(packageManager->GetProject()->GetCMakeLists() != NULL) + { + int CMId = packageManager->GetProject()->GetCMakeLists()->GetId(); + newEvent->SetInt(CMId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(packageManager->GetProject()->GetCMakeLists() != NULL) + { + int CMId = packageManager->GetProject()->GetCMakeLists()->GetId(); + newEvent->SetInt(CMId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + +void wxCDMPackageManagerHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h new file mode 100644 index 0000000..e20e377 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h @@ -0,0 +1,87 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMPackageManagerHelpDialog.h + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEMANAGERHELPDIALOG_H_ +#define WXCDMPACKAGEMANAGERHELPDIALOG_H_ + +#include +#include + +#include "wxCDMPackageManagerPanel.h" + +class wxCDMPackageManagerHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + wxCDMPackageManagerHelpDialog( + wxWindow* parent, + wxCDMPackageManagerPanel* packageManager, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + ~wxCDMPackageManagerHelpDialog(); + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + void CreateControls(); + +//attributes +private: + wxCDMPackageManagerPanel* packageManager; + +//handlers +protected: + void OnFinish(wxCommandEvent& event); + + void OnCreatePackage(wxCommandEvent& event); + void OnEditCMake(wxCommandEvent& event); + + void OnEditCMakeMouseEnter(wxMouseEvent& event); + void OnEditCMakeMouseExit(wxMouseEvent& event); + + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPACKAGEMANAGERHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp index 683d4ec..d114727 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -37,6 +37,8 @@ #include "wxCDMMainFrame.h" #include "wxCDMNewPackageDialog.h" +#include "wxCDMPackageManagerHelpDialog.h" + #include "creaDevManagerIds.h" #include "images/PkIcon64.xpm" @@ -44,7 +46,9 @@ BEGIN_EVENT_TABLE(wxCDMPackageManagerPanel, wxPanel) EVT_BUTTON(ID_BUTTON_PREV, wxCDMPackageManagerPanel::OnBtnReturn) EVT_HYPERLINK(ID_LINK_SELECT_PACKAGE, wxCDMPackageManagerPanel::OnLnkPackageSelect) EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerPanel::OnBtnCreatePackage) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_CLICKED, wxCDMPackageManagerPanel::OnBtnCreatePackage) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_ENTER, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) END_EVENT_TABLE() wxCDMPackageManagerPanel::wxCDMPackageManagerPanel( @@ -140,6 +144,17 @@ void wxCDMPackageManagerPanel::CreateControls() //Assign sizer SetSizer(sizer); sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMPackageManagerHelpDialog* helpDialog = new wxCDMPackageManagerHelpDialog(this->GetParent(), this, wxID_ANY); + helpDialog->Show(true); + } +} + +modelCDMProject* wxCDMPackageManagerPanel::GetProject() const +{ + return this->project; } void wxCDMPackageManagerPanel::OnBtnReturn(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h index 3ce319f..7c59cea 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h @@ -42,6 +42,7 @@ #include "modelCDMProject.h" + class wxCDMPackageManagerPanel : public wxPanel { DECLARE_EVENT_TABLE() @@ -71,6 +72,8 @@ public: void CreateControls(); + modelCDMProject* GetProject() const; + private: modelCDMProject* project; diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp index 1bc58e2..4d7679b 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -37,6 +37,8 @@ #include "wxCDMMainFrame.h" #include "wxCDMNewPackageDialog.h" +#include "wxCDMProjectHelpDialog.h" + #include "creaDevManagerIds.h" #include "images/PrIcon64.xpm" #include "CDMUtilities.h" @@ -208,6 +210,17 @@ void wxCDMProjectDescriptionPanel::CreateControls() //Assign sizer this->SetSizer(sizer); sizer->SetSizeHints(this); + + if(((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMProjectHelpDialog* helpDialog = new wxCDMProjectHelpDialog(this->GetParent(), this, wxID_ANY); + helpDialog->Show(true); + } +} + +modelCDMProject* wxCDMProjectDescriptionPanel::GetProject() const +{ + return this->project; } void wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h index 06c12bd..0341921 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -69,6 +69,8 @@ public: void CreateControls(); + modelCDMProject* GetProject() const; + private: modelCDMProject* project; wxStaticText* versiontc; diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp index e676a55..97b925a 100644 --- a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp @@ -35,7 +35,7 @@ #include "wxCDMProjectHelpDialog.h" -#include "wxCDMMainFrame.h" +#include "wxCDMProjectDescriptionPanel.h" #include "creaDevManagerIds.h" @@ -49,6 +49,7 @@ END_EVENT_TABLE() wxCDMProjectHelpDialog::wxCDMProjectHelpDialog( wxWindow* parent, + wxCDMProjectDescriptionPanel* projectDescription, wxWindowID id, const wxString& caption, const wxPoint& position, @@ -57,6 +58,7 @@ wxCDMProjectHelpDialog::wxCDMProjectHelpDialog( ) { wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style); + this->projectDescription = projectDescription; } wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog() @@ -95,7 +97,7 @@ void wxCDMProjectHelpDialog::CreateControls() "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."), + "Select an action or click Close to continue working on the project."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT @@ -123,7 +125,7 @@ void wxCDMProjectHelpDialog::CreateControls() 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); + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); SetSizer(v_sizer1); //v_sizer1->RecalcSizes(); @@ -139,7 +141,7 @@ 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()); + newEvent->SetInt(this->projectDescription->GetProject()->GetId()); wxPostEvent(this->GetParent(), *newEvent); event.Skip(); @@ -155,9 +157,9 @@ void wxCDMProjectHelpDialog::OnManageLibraries(wxCommandEvent& event) wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + if(this->projectDescription->GetProject()->GetLib() != NULL) { - int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + int CMId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent1->SetInt(CMId); newEvent1->SetId(0); wxPostEvent(this->GetParent(), *newEvent1); @@ -177,9 +179,9 @@ void wxCDMProjectHelpDialog::OnManageApplications(wxCommandEvent& event) wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + if(this->projectDescription->GetProject()->GetAppli() != NULL) { - int CMId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + int CMId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent1->SetInt(CMId); newEvent1->SetId(0); wxPostEvent(this->GetParent(), *newEvent1); @@ -194,9 +196,9 @@ void wxCDMProjectHelpDialog::OnAppliMouseEnter(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + if(this->projectDescription->GetProject()->GetAppli() != NULL) { - int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + int AppId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent->SetInt(AppId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); @@ -208,9 +210,9 @@ void wxCDMProjectHelpDialog::OnAppliMouseExit(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli() != NULL) + if(this->projectDescription->GetProject()->GetAppli() != NULL) { - int AppId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetAppli()->GetId(); + int AppId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent->SetInt(AppId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); @@ -222,9 +224,9 @@ void wxCDMProjectHelpDialog::OnLibMouseEnter(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + if(this->projectDescription->GetProject()->GetLib() != NULL) { - int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + int LbId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent->SetInt(LbId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); @@ -236,9 +238,9 @@ void wxCDMProjectHelpDialog::OnLibMouseExit(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); - if(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib() != NULL) + if(this->projectDescription->GetProject()->GetLib() != NULL) { - int LbId = ((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetLib()->GetId(); + int LbId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent->SetInt(LbId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h index 13fbee3..0bd33ec 100644 --- a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h @@ -39,12 +39,15 @@ #include #include +#include "wxCDMProjectDescriptionPanel.h" + class wxCDMProjectHelpDialog : public wxDialog { DECLARE_EVENT_TABLE() public: wxCDMProjectHelpDialog( wxWindow* parent, + wxCDMProjectDescriptionPanel* projectDescription, wxWindowID id = wxID_ANY, const wxString& caption = wxT("Project Ready"), const wxPoint& position = wxDefaultPosition, @@ -64,6 +67,10 @@ public: protected: void CreateControls(); +//attributes +private: + wxCDMProjectDescriptionPanel* projectDescription; + //handlers protected: void OnFinish(wxCommandEvent& event); -- 2.45.1