From: Daniel Gonzalez Date: Mon, 10 Dec 2012 15:23:20 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5413640f931dc9bc9b3c24a27f42c3cf40c35072;p=crea.git Feature #1711 CreaDevManager application implementation December 6, 2012 With: - Daniel Gonzalez - Eduardo Davila Meeting Record: In general - Instead of text controls use static text controls. (Done) - When an attribute can be changed use button "Set" or "Choose" (Done in: project) - The package name should be shown with its prefix and suffix. (Done) In Project Description: - Delete "create Black Box" button. (Done) - Show "Edit CMakeLists" button. (Done) In General Project Actions: - Adjust order and name of buttons: (Done) 1. Configure project 2. Compile Project 3. Plug Packages (BBTK) - Remove EditCMakeLists Button. (Done) - Show hints on MouseOver for indicate the order of the actions: (Done) "This step should be executed after ...". New Views: - Package Manager Panel (Done) 1. List all existing packages. 2. Create Package. 3. Edit Project's CMakeLists file. - Application Manager Panel (Done) 1. List all existing applications. 2. Create application. 3. Edit Appli's CMakeLists file. - Library Manager Panel (Done) 1. List all existing libraries. 2. Create library. 3. Edit Lib's CMakeLists file. In Library Description: - Create Class Button (Done) In Application Description: - Create Class Button (Done) All Description and Manager Panels: - Create a button to return to the project's description panel. (Except in the project description panel) Aside: - Put subtitles on project route in website. (Done) - Create Google account for CREATIS (named CREATIS or CREATIS-INSA). (Done - account: creatis.insa@gmail.com pass: cr34t1s1ns4) - Mount videos in CREATIS account and give credentials to Eduardo. - Update Project Planning. --- diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index eacee90..a9d5979 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -70,26 +70,38 @@ #define ID_WINDOW_PROJ_ACTIONS 10226 #define ID_BUTTON_NEXT 10300 -#define ID_BUTTON_CANCEL 10301 -#define ID_BUTTON_CHOOSE 10302 - -#define ID_BUTTON_NEWPROJECT 10303 -#define ID_BUTTON_OPENPROJECT 10304 - -#define ID_BUTTON_CREATE_PACKAGE 10305 -#define ID_BUTTON_CREATE_BLACKBOX 10306 -#define ID_BUTTON_CREATE_LIBRARY 10307 -#define ID_BUTTON_CREATE_APPLICATION 10308 -#define ID_BUTTON_EDIT_CMAKELISTSFILE 10309 -#define ID_BUTTON_CREATE_FOLDER 10310 -#define ID_BUTTON_OPEN_CXX 10311 -#define ID_BUTTON_OPEN_HXX 10312 -#define ID_BUTTON_OPEN_FOLDER 10313 -#define ID_BUTTON_OPEN_FILE 10314 -#define ID_BUTTON_OPEN_COMMAND 10315 - -#define ID_BUTTON_BUILD_PROJECT 10316 -#define ID_BUTTON_CONFIGURE_BUILD 10317 -#define ID_BUTTON_CONNECT_PROJECT 10318 +#define ID_BUTTON_PREV 10301 +#define ID_BUTTON_CANCEL 10302 +#define ID_BUTTON_CHOOSE 10303 + +#define ID_BUTTON_NEWPROJECT 10304 +#define ID_BUTTON_OPENPROJECT 10305 + +#define ID_BUTTON_CREATE_PACKAGE 10306 +#define ID_BUTTON_CREATE_BLACKBOX 10307 +#define ID_BUTTON_CREATE_LIBRARY 10308 +#define ID_BUTTON_CREATE_APPLICATION 10309 +#define ID_BUTTON_EDIT_CMAKELISTSFILE 10310 +#define ID_BUTTON_CREATE_FOLDER 10311 +#define ID_BUTTON_CREATE_CLASS 10312 +#define ID_BUTTON_OPEN_CXX 10313 +#define ID_BUTTON_OPEN_HXX 10314 +#define ID_BUTTON_OPEN_FOLDER 10315 +#define ID_BUTTON_OPEN_FILE 10316 +#define ID_BUTTON_OPEN_COMMAND 10317 +#define ID_BUTTON_SET_VERSION 10318 +#define ID_BUTTON_SET_BUILD_PATH 10319 + +#define ID_BUTTON_BUILD_PROJECT 10320 +#define ID_BUTTON_CONFIGURE_BUILD 10321 +#define ID_BUTTON_CONNECT_PROJECT 10322 + +#define ID_BUTTON_GOTO_PACKAGE_MANAGER 10323 +#define ID_BUTTON_GOTO_APPLI_MANAGER 10324 +#define ID_BUTTON_GOTO_LIB_MANAGER 10325 + +#define ID_LINK_SELECT_PACKAGE 10326 +#define ID_LINK_SELECT_LIBRARY 10327 +#define ID_LINK_SELECT_APPLICATION 10328 #endif /* CREADEVMANAGERIDS_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 9740917..d370a17 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -82,6 +82,11 @@ modelCDMAppli::~modelCDMAppli() { } +const std::vector& modelCDMAppli::GetApplications() const +{ + return this->applications; +} + modelCDMApplication* modelCDMAppli::CreateApplication( const std::string& name, std::string*& result, diff --git a/lib/creaDevManagerLib/modelCDMAppli.h b/lib/creaDevManagerLib/modelCDMAppli.h index 8b8ecbe..f239426 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.h +++ b/lib/creaDevManagerLib/modelCDMAppli.h @@ -48,6 +48,8 @@ public: modelCDMAppli(const std::string& path, const int& level = 1); ~modelCDMAppli(); + const std::vector& GetApplications() const; + modelCDMApplication* CreateApplication( const std::string& name, std::string*& result, diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 236f7a3..21f2167 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -103,6 +103,11 @@ modelCDMLib::~modelCDMLib() { } +const std::vector& modelCDMLib::GetLibraries() const +{ + return this->libraries; +} + modelCDMLibrary* modelCDMLib::CreateLibrary( const std::string& name, std::string*& result, diff --git a/lib/creaDevManagerLib/modelCDMLib.h b/lib/creaDevManagerLib/modelCDMLib.h index 71ed033..8f4fc74 100644 --- a/lib/creaDevManagerLib/modelCDMLib.h +++ b/lib/creaDevManagerLib/modelCDMLib.h @@ -48,11 +48,14 @@ public: modelCDMLib(const std::string& path, const int& level = 1); ~modelCDMLib(); + const std::vector& GetLibraries() const; + modelCDMLibrary* CreateLibrary( const std::string& name, std::string*& result, const std::string& path = "/" ); + bool OpenCMakeListsFile(std::string*& result); virtual const bool Refresh(std::string*& result); diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 044171b..c589a8e 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -51,7 +51,7 @@ modelCDMPackage::modelCDMPackage(const std::string& path, const int& level) //TODO::fix for windows delimiters = "/"; CDMUtilities::splitter::split(words, path, delimiters, CDMUtilities::splitter::no_empties); - this->name = words[words.size()-1].substr(5, words[words.size()-1].size()-9); + this->name = words[words.size()-1]; this->namePackage = this->name; this->level = level; this->path = path; diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 23dd166..a961f62 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -227,6 +227,21 @@ const std::string& modelCDMProject::GetBuildPath() const return this->buildPath; } +const std::vector& modelCDMProject::GetPackages() const +{ + return this->packages; +} + +modelCDMAppli* modelCDMProject::GetAppli() const +{ + return this->appli; +} + +modelCDMLib* modelCDMProject::GetLib() const +{ + return this->lib; +} + bool modelCDMProject::SetVersion(const std::string& version, std::string*& result) { //TODO: implement method diff --git a/lib/creaDevManagerLib/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index fe10702..e3ba19a 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -99,6 +99,24 @@ public: */ const std::string& GetBuildPath() const; + /** + * Retrieves the package vector containing the packages present in the project. + * @return The package vector containing references to the packages of the project. + */ + const std::vector& GetPackages() const; + + /** + * Retrieves the appli containing the applications present in the project. + * @return The appli object present in the project. + */ + modelCDMAppli* GetAppli() const; + + /** + * Retrieves the lib containing the libraries present in the project. + * @return The lib object present in the project. + */ + modelCDMLib* GetLib() const; + //Setters /** diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp index 9d815d2..a7045a7 100644 --- a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp @@ -40,6 +40,8 @@ #include "images/ApIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMAppliDescriptionPanel, wxPanel) +EVT_BUTTON(ID_BUTTON_PREV, wxCDMAppliDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_LINK_SELECT_APPLICATION, wxCDMAppliDescriptionPanel::OnLnkApplicationSelect) EVT_BUTTON(ID_BUTTON_CREATE_APPLICATION, wxCDMAppliDescriptionPanel::OnBtnCreateApplication) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMAppliDescriptionPanel::OnBtnEditCMakeLists) END_EVENT_TABLE() @@ -81,12 +83,28 @@ void wxCDMAppliDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Welcome + //Link to return + sizer->Add(new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")), 0, wxALIGN_CENTER | wxALL, 5); + + //Title sizer->Add(new wxStaticText(this, -1, _("Applications")),0, wxALIGN_CENTER, 0); //Image sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(ApIcon64)),0, wxALIGN_CENTER, 0); + //Applications + wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Available Applications")); + wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL); + + std::vector applications = this->appli->GetApplications(); + for (int i = 0; i < applications.size(); i++) + { + wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(this,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str())); + propertiesBoxInnerSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5); + } + + sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10); + //Actions wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); @@ -143,3 +161,30 @@ void wxCDMAppliDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl; event.Skip(); } + +void wxCDMAppliDescriptionPanel::OnLnkApplicationSelect(wxHyperlinkEvent& event) +{ + int applicationId = 0; + std::vector applications = this->appli->GetApplications(); + for (int i = 0; i < applications.size(); i++) + { + if(applications[i]->GetName() == crea::wx2std(event.GetURL())) + { + applicationId = applications[i]->GetId(); + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(applicationId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} + +void wxCDMAppliDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h index 6b655f3..b77b3fd 100644 --- a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMAppli.h" @@ -75,6 +76,8 @@ private: protected: void OnBtnCreateApplication(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); + void OnLnkApplicationSelect(wxHyperlinkEvent& event); + void OnBtnReturn(wxCommandEvent& event); }; diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp index f19dbcf..23f9916 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp @@ -38,8 +38,9 @@ #include "images/AIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMApplicationDescriptionPanel, wxPanel) -EVT_MENU(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder) -EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMApplicationDescriptionPanel::OnBtnCreateClass) +EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists) END_EVENT_TABLE() wxCDMApplicationDescriptionPanel::wxCDMApplicationDescriptionPanel( @@ -109,6 +110,7 @@ void wxCDMApplicationDescriptionPanel::CreateControls() wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_CLASS, _T("Create Class")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_FOLDER, _T("Create Folder")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); @@ -119,6 +121,13 @@ void wxCDMApplicationDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } +void wxCDMApplicationDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnCreateClass not implemented" << std::endl; + event.Skip(); +} + void wxCDMApplicationDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event) { //TODO: implement method diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h index 37306b8..c827fbd 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h @@ -73,6 +73,7 @@ private: //handlers protected: + void OnBtnCreateClass(wxCommandEvent& event); void OnBtnCreateFolder(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index d9392aa..653c769 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -40,6 +40,8 @@ #include "images/LbIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMLibDescriptionPanel, wxPanel) +EVT_BUTTON(ID_BUTTON_PREV, wxCDMLibDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_LINK_SELECT_LIBRARY, wxCDMLibDescriptionPanel::OnLnkLibrarySelect) EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMLibDescriptionPanel::OnBtnCreateLibrary) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibDescriptionPanel::OnBtnEditCMakeLists) END_EVENT_TABLE() @@ -81,12 +83,28 @@ void wxCDMLibDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Welcome - sizer->Add(new wxStaticText(this, -1, _("Libraries")),0, wxALIGN_CENTER, 0); + //Link to return + sizer->Add(new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")), 0, wxALIGN_CENTER | wxALL, 5); + + //Title + sizer->Add(new wxStaticText(this, -1, _("Library Management")),0, wxALIGN_CENTER, 0); //Image sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LbIcon64)),0, wxALIGN_CENTER, 0); + //Libraries + wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Available Libraries")); + wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL); + + std::vector libraries = this->lib->GetLibraries(); + for (int i = 0; i < libraries.size(); i++) + { + wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(this,ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str())); + propertiesBoxInnerSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5); + } + + sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10); + //Actions wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); @@ -104,11 +122,6 @@ void wxCDMLibDescriptionPanel::CreateControls() void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) { - //TODO: implement method - std::cerr << "Event OnBtnCreateLibrary not implemented" << std::endl; - event.Skip(); - - //get name wxString libraryName = wxGetTextFromUser( _T("Enter the new library name"), @@ -125,7 +138,6 @@ void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) if(library == NULL) { wxMessageBox(crea::std2wx(*result),_T("New Library - Error!"),wxOK | wxICON_ERROR); - event.Skip(); return; } wxMessageBox(crea::std2wx("Library successfully created."),_T("New Library - Success!"),wxOK | wxICON_INFORMATION); @@ -138,7 +150,6 @@ void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); newEvent->SetInt(library->GetId()); wxPostEvent(this->GetParent(), *newEvent); - event.Skip(); } } @@ -148,3 +159,31 @@ void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl; event.Skip(); } + +void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) +{ + int libraryId = 0; + std::vector libraries = this->lib->GetLibraries(); + for (int i = 0; i < libraries.size(); i++) + { + if(libraries[i]->GetName() == crea::wx2std(event.GetURL())) + { + libraryId = libraries[i]->GetId(); + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(libraryId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + +} + +void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h index bf324e9..039ca73 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMLib.h" @@ -75,6 +76,8 @@ private: protected: void OnBtnCreateLibrary(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); + void OnLnkLibrarySelect(wxHyperlinkEvent& event); + void OnBtnReturn(wxCommandEvent& event); }; diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp index 5ef919b..ac47c51 100644 --- a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp @@ -38,8 +38,9 @@ #include "images/LIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMLibraryDescriptionPanel, wxPanel) -EVT_MENU(ID_BUTTON_CREATE_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnCreateFolder) -EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMLibraryDescriptionPanel::OnBtnCreateClass) +EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnCreateFolder) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists) END_EVENT_TABLE() wxCDMLibraryDescriptionPanel::wxCDMLibraryDescriptionPanel( @@ -93,9 +94,11 @@ void wxCDMLibraryDescriptionPanel::CreateControls() wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_CLASS, _T("Create Class")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_FOLDER, _T("Create Folder")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + //Assign sizer actionsBoxInnerSizer->SetSizeHints(this); @@ -103,6 +106,13 @@ void wxCDMLibraryDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } +void wxCDMLibraryDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnCreateClass not implemented" << std::endl; + event.Skip(); +} + void wxCDMLibraryDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event) { //TODO: implement method diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h index d96e5d3..1b45877 100644 --- a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h @@ -73,6 +73,7 @@ private: //handlers protected: + void OnBtnCreateClass(wxCommandEvent& event); void OnBtnCreateFolder(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 94a7a38..98ff113 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -47,6 +47,7 @@ #include "wxCDMCMakeListsDescriptionPanel.h" #include "wxCDMFolderDescriptionPanel.h" #include "wxCDMFileDescriptionPanel.h" +#include "wxCDMPackageManagerPanel.h" #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" @@ -115,6 +116,11 @@ bool wxCDMMainFrame::Create( return TRUE; } +modelCDMMain* wxCDMMainFrame::GetModel() const +{ + return this->model; +} + void wxCDMMainFrame::RefreshProject() { std::string* result; @@ -607,6 +613,13 @@ void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event) void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) { std::cout << "New Tree Selection" << std::endl; + + if(event.GetId() != 0) + { + event.Skip(); + } + + //get selected element wxTreeItemId elementId = event.GetItem(); @@ -833,7 +846,69 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event) { - std::cout << "inMainFrame " << event.GetInt() << std::endl; - this->tree_Projects->SelectItem(event.GetInt()); + std::cout << "inMainFrame id: " << event.GetId() << ", tree element: "<< event.GetInt() << std::endl; + switch(event.GetId() != 0) + { + case 0: + this->tree_Projects->SelectItem(event.GetInt(), false); + this->tree_Projects->SelectItem(event.GetInt(), true); + break; + case 1: + wxPanel* description = NULL; + if(event.GetString() == wxT("manage_packages")) + { + description = new wxCDMPackageManagerPanel( + this, + this->model->GetProject(), + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else if(event.GetString() == wxT("manage_libraries")) + { + description = new wxCDMLibDescriptionPanel( + this, + this->model->GetProject()->GetLib(), + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else if(event.GetString() == wxT("manage_applications")) + { + description = new wxCDMAppliDescriptionPanel( + this, + this->model->GetProject()->GetAppli(), + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + + if(this->panel_Properties!= NULL) + this->panel_Properties->Hide(); + + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400)); + auiManager.Update(); + + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Destroy(); + auiManager.DetachPane(this->panel_Properties); + } + //set new view + + this->panel_Properties = description; + auiManager.Update(); + break; + } event.Skip(); } diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index c3e578d..a29fdd6 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -60,6 +60,8 @@ public: long style = wxDEFAULT_FRAME_STYLE ); + modelCDMMain* GetModel() const; + void RefreshProject(); protected: diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp new file mode 100644 index 0000000..a82f2e3 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -0,0 +1,198 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageManagerPanel.cpp + * + * Created on: Dec 10, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageManagerPanel.h" + +#include "wxCDMMainFrame.h" +#include "wxCDMNewPackageDialog.h" + +#include "creaDevManagerIds.h" +#include "images/PkIcon64.xpm" + +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_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) +END_EVENT_TABLE() + +wxCDMPackageManagerPanel::wxCDMPackageManagerPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMPackageManagerPanel::Create(parent, project, id, caption, pos, size, style); +} + +wxCDMPackageManagerPanel::~wxCDMPackageManagerPanel() +{ +} + +bool wxCDMPackageManagerPanel::Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->project = project; + CreateControls(); + return TRUE; +} + +void wxCDMPackageManagerPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Link to return + sizer->Add(new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")), 0, wxALIGN_CENTER | wxALL, 5); + + //Title + sizer->Add(new wxStaticText(this, -1, _("Package Management")),0, wxALIGN_CENTER, 0); + + //Image + sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PkIcon64)),0, wxALIGN_CENTER, 0); + + //Packages + wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Available Packages")); + wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL); + + std::vector packages = this->project->GetPackages(); + for (int i = 0; i < packages.size(); i++) + { + wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(this,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str())); + propertiesBoxInnerSizer -> Add(pPackagelk, 0, wxALIGN_LEFT | wxALL, 5); + } + + sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10); + + //Actions + wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); + wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxHORIZONTAL); + sizer -> Add(actionsBoxInnerSizer, 0, wxEXPAND | wxALL, 10); + + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_PACKAGE, _T("Create Package")), 0, wxALL, 5); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxALL, 5); + + //Assign sizer + actionsBoxInnerSizer->SetSizeHints(this); + + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +void wxCDMPackageManagerPanel::OnBtnCreatePackage(wxCommandEvent& event) +{ + std::string* result; + + wxCDMNewPackageDialog* dialog = new wxCDMNewPackageDialog(this); + long userResponse; + userResponse = dialog->ShowModal(); + + if(userResponse == wxID_FORWARD) + { + modelCDMIProjectTreeNode* package = this->project->CreatePackage( + crea::wx2std(dialog->GetPackageName()), + result, + crea::wx2std(dialog->GetPackageAuthor()), + crea::wx2std(dialog->GetPackageAuthorEmail()), + crea::wx2std(dialog->GetPackageDescription()) + ); + if(package == NULL) + { + std::cout << "error creating package: " << *result << std::endl; + wxMessageBox(crea::std2wx(*result),_T("New Package - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + wxMessageBox(crea::std2wx("Package successfully created."),_T("New Package - Success!"),wxOK | wxICON_INFORMATION); + + //refreshing tree and description + //send event instead of calling parent to avoid crashing + + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(package->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); + } + + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + //TODO: implement method + std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl; + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnLnkPackageSelect(wxHyperlinkEvent& event) +{ + int packageId = 0; + std::vector packages = this->project->GetPackages(); + for (int i = 0; i < packages.size(); i++) + { + if(packages[i]->GetName() == crea::wx2std(event.GetURL())) + { + packageId = packages[i]->GetId(); + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(packageId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + +} + +void wxCDMPackageManagerPanel::OnBtnReturn(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(project->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h new file mode 100644 index 0000000..a8634cb --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h @@ -0,0 +1,86 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageManagerPanel.h + * + * Created on: Dec 10, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEMANAGERPANEL_H_ +#define WXCDMPACKAGEMANAGERPANEL_H_ + +#include +#include +#include + +#include "modelCDMProject.h" + +class wxCDMPackageManagerPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + + wxCDMPackageManagerPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + ~wxCDMPackageManagerPanel(); + + bool Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + void CreateControls(); + +private: + modelCDMProject* project; + + //handlers +protected: + void OnBtnCreatePackage(wxCommandEvent& event); + void OnBtnEditCMakeLists(wxCommandEvent& event); + + void OnLnkPackageSelect(wxHyperlinkEvent& event); + + void OnBtnReturn(wxCommandEvent& event); +}; + +#endif /* WXCDMPACKAGEMANAGERPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp index c4e2b0f..ea9062f 100755 --- a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp @@ -78,10 +78,15 @@ bool wxCDMProjectActionsPanel::Create( void wxCDMProjectActionsPanel::CreateControls() { - this->GetSizer()->Add(new wxButton(this, ID_BUTTON_BUILD_PROJECT, _T("Build Project (make)")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, ID_BUTTON_CONFIGURE_BUILD, _T("Configure Build (ccmake)")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, ID_BUTTON_CONNECT_PROJECT, _T("Connect Project")), 0, wxALL, 5); + wxButton* configurebt = new wxButton(this, ID_BUTTON_CONFIGURE_BUILD, _T("1. Configure Project")); + configurebt->SetToolTip(wxT("This is the first step in order to execute the project.")); + wxButton* compilebt = new wxButton(this, ID_BUTTON_BUILD_PROJECT, _T("2. Compile Project")); + compilebt->SetToolTip(wxT("This step should be done after configuring the project. This will create the executables")); + wxButton* plugbt = new wxButton(this, ID_BUTTON_CONNECT_PROJECT, _T("3. Plug Packages (BBTK)")); + plugbt->SetToolTip(wxT("This step should be done after compiling the project. This will allow to use the boxes in this project to be available in the bbEditor.")); + this->GetSizer()->Add(configurebt, 0, wxALL, 5); + this->GetSizer()->Add(compilebt, 0, wxALL, 5); + this->GetSizer()->Add(plugbt, 0, wxALL, 5); } void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp index a624244..e69c388 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -41,12 +41,11 @@ #include "images/PrIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMProjectDescriptionPanel::OnBtnCreatePackage) -EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox) -EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMProjectDescriptionPanel::OnBtnCreateLibrary) -EVT_BUTTON(ID_BUTTON_CREATE_APPLICATION, wxCDMProjectDescriptionPanel::OnBtnCreateApplication) +EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManagePackages) +EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageLibraries) +EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageApplications) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists) -EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMProjectDescriptionPanel::OnCreationComplete) + END_EVENT_TABLE() wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel( @@ -101,39 +100,53 @@ void wxCDMProjectDescriptionPanel::CreateControls() wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15); - wxStaticText *pVersion = new wxStaticText(this, -1, wxT("Version")); - wxStaticText *pVersionDate = new wxStaticText(this, -1, wxT("Version Date")); - wxStaticText *pSourceLocation = new wxStaticText(this, -1, wxT("Source Location")); - wxStaticText *pBuildLocation = new wxStaticText(this, -1, wxT("Build Location")); + wxStaticText* pVersion = new wxStaticText(this, -1, wxT("Version")); + wxStaticText* pVersionDate = new wxStaticText(this, -1, wxT("Version Date")); + wxStaticText* pSourceLocation = new wxStaticText(this, -1, wxT("Source Location")); + wxStaticText* pBuildLocation = new wxStaticText(this, -1, wxT("Build Location")); + + wxStaticText* pVersiontc = new wxStaticText(this, -1, crea::std2wx(this->project->GetVersion())); + wxStaticText* pVersionDatetc = new wxStaticText(this, -1, crea::std2wx(this->project->GetVersionDate())); + wxStaticText* pSourceLocationtc = new wxStaticText(this, -1, crea::std2wx(this->project->GetPath())); + wxStaticText* pBuildLocationtc = new wxStaticText(this, -1, crea::std2wx(this->project->GetBuildPath())); + + wxButton* pVersionbt = new wxButton(this, ID_BUTTON_SET_VERSION, wxT("Set")); + wxButton* pBuildLocationbt = new wxButton(this, ID_BUTTON_SET_BUILD_PATH, wxT("Choose")); - wxTextCtrl *pVersiontc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetVersion())); - wxTextCtrl *pVersionDatetc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetVersionDate())); - wxTextCtrl *pSourceLocationtc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetPath())); - wxTextCtrl *pBuildLocationtc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetBuildPath())); + wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL); + + pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0); + pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10); + pBuildLocationsz->Add(pBuildLocationtc, 0, wxALIGN_CENTER, 0); + pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); flexGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - flexGridSizer->Add(pVersiontc, 1, wxEXPAND); + flexGridSizer->Add(pVersionsz, 1, wxEXPAND); flexGridSizer->Add(pVersionDate, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); flexGridSizer->Add(pVersionDatetc, 1, wxEXPAND); flexGridSizer->Add(pSourceLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); flexGridSizer->Add(pSourceLocationtc, 1, wxEXPAND); flexGridSizer->Add(pBuildLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - flexGridSizer->Add(pBuildLocationtc, 1, wxEXPAND); + flexGridSizer->Add(pBuildLocationsz, 1, wxEXPAND); + + flexGridSizer->AddGrowableCol(1,1); - propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxEXPAND); - sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxALL | wxEXPAND, 5); + sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10); //Actions wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); - wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); - sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20); + wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxHORIZONTAL); + sizer -> Add(actionsBoxInnerSizer, 0, wxEXPAND | wxALL, 10); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_PACKAGE, _T("Create Package")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_BLACKBOX, _T("Create Black Box")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_LIBRARY, _T("Create Library")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_APPLICATION, _T("Create Application")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("Package Manager")), 0, wxALL, 5); + //TODO: show only if there is a lib folder + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, _T("Library Manager")), 0, wxALL, 5); + //TODO: show only if there is a appli folder + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, _T("Application Manager")), 0, wxALL, 5); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20); + actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxALL, 5); //Assign sizer actionsBoxInnerSizer->SetSizeHints(this); @@ -142,52 +155,6 @@ void wxCDMProjectDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } -void wxCDMProjectDescriptionPanel::OnBtnCreatePackage(wxCommandEvent& event) -{ - std::string* result; - - wxCDMNewPackageDialog* dialog = new wxCDMNewPackageDialog(this); - long userResponse; - userResponse = dialog->ShowModal(); - - if(userResponse == wxID_FORWARD) - { - modelCDMIProjectTreeNode* package = this->project->CreatePackage( - crea::wx2std(dialog->GetPackageName()), - result, - crea::wx2std(dialog->GetPackageAuthor()), - crea::wx2std(dialog->GetPackageAuthorEmail()), - crea::wx2std(dialog->GetPackageDescription()) - ); - if(package == NULL) - { - std::cout << "error creating package: " << *result << std::endl; - wxMessageBox(crea::std2wx(*result),_T("New Package - Error!"),wxOK | wxICON_ERROR); - event.Skip(); - return; - } - wxMessageBox(crea::std2wx("Package successfully created."),_T("New Package - Success!"),wxOK | wxICON_INFORMATION); - - //refreshing tree and description - //send event instead of calling parent to avoid crashing - - ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); - - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(package->GetId()); - wxPostEvent(this->GetParent(), *newEvent); - event.Skip(); - } - - event.Skip(); -} - -void wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event) -{ - //TODO: implement method - std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl; - event.Skip(); -} void wxCDMProjectDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) { @@ -266,8 +233,37 @@ void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) event.Skip(); } -void wxCDMProjectDescriptionPanel::OnCreationComplete(wxCommandEvent& event) +void +wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_packages")); + newEvent->SetInt(this->project->GetId()); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void +wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event) { - std::cout << "catched" << std::endl; + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_libraries")); + //TODO: implement GetLib in project + //newEvent->SetInt(this->project->GetLib()->GetId()); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} +void +wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_applications")); + //TODO: implement GetAppli in project + //newEvent->SetInt(this->project->GetAppli->GetId()); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); } diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h index f96063d..1b2c63b 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -74,12 +74,13 @@ private: //handlers protected: - void OnBtnCreatePackage(wxCommandEvent& event); - void OnBtnCreateBlackBox(wxCommandEvent& event); void OnBtnCreateLibrary(wxCommandEvent& event); void OnBtnCreateApplication(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); - void OnCreationComplete(wxCommandEvent& event); + + void OnBtnManagePackages(wxCommandEvent& event); + void OnBtnManageLibraries(wxCommandEvent& event); + void OnBtnManageApplications(wxCommandEvent& event); }; #endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */