]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel@daniel.creatis>
Mon, 10 Dec 2012 15:23:20 +0000 (16:23 +0100)
committerDaniel Gonzalez <daniel@daniel.creatis>
Mon, 10 Dec 2012 15:23:20 +0000 (16:23 +0100)
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.

23 files changed:
lib/creaDevManagerLib/creaDevManagerIds.h
lib/creaDevManagerLib/modelCDMAppli.cpp
lib/creaDevManagerLib/modelCDMAppli.h
lib/creaDevManagerLib/modelCDMLib.cpp
lib/creaDevManagerLib/modelCDMLib.h
lib/creaDevManagerLib/modelCDMPackage.cpp
lib/creaDevManagerLib/modelCDMProject.cpp
lib/creaDevManagerLib/modelCDMProject.h
lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h
lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h
lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h
lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMMainFrame.h
lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp [new file with mode: 0644]
lib/creaDevManagerLib/wxCDMPackageManagerPanel.h [new file with mode: 0644]
lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h

index eacee9003c203f55b5ea58493e4ed4ad989bc06e..a9d5979d6b95a42e5a95a69f6966803571c9b0dd 100644 (file)
 #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_ */
index 9740917aae5f5cce588dc3dc0318853c3d5e2ec8..d370a17d0caa4491c55fb0657517604ee480978f 100644 (file)
@@ -82,6 +82,11 @@ modelCDMAppli::~modelCDMAppli()
 {
 }
 
+const std::vector<modelCDMApplication*>& modelCDMAppli::GetApplications() const
+{
+  return this->applications;
+}
+
 modelCDMApplication* modelCDMAppli::CreateApplication(
     const std::string& name,
     std::string*& result,
index 8b8ecbe355cc884de0c44ac51d3ffeb3026913cb..f23942642b61f9a31cc49e77e4cb7eeb9f67a58d 100644 (file)
@@ -48,6 +48,8 @@ public:
   modelCDMAppli(const std::string& path, const int& level = 1);
   ~modelCDMAppli();
 
+  const std::vector<modelCDMApplication*>& GetApplications() const;
+
   modelCDMApplication* CreateApplication(
       const std::string& name,
       std::string*& result,
index 236f7a311e6d57035ba7f4ebcfe85380be020d2b..21f2167606772ec9f9487a710416ca17cd746bf6 100644 (file)
@@ -103,6 +103,11 @@ modelCDMLib::~modelCDMLib()
 {
 }
 
+const std::vector<modelCDMLibrary*>& modelCDMLib::GetLibraries() const
+{
+  return this->libraries;
+}
+
 modelCDMLibrary* modelCDMLib::CreateLibrary(
     const std::string& name,
     std::string*& result,
index 71ed033237785aa705ae51ef15a266a565de11b9..8f4fc74c3a8371ad0952f14b3f5c5190acfd1b2b 100644 (file)
@@ -48,11 +48,14 @@ public:
   modelCDMLib(const std::string& path, const int& level = 1);
   ~modelCDMLib();
 
+  const std::vector<modelCDMLibrary*>& 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);
 
index 044171b9eea1e0ebe5e51f5df480f48af33df96f..c589a8e5fb7206c676fa00231433139d87a3f241 100644 (file)
@@ -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;
index 23dd1666d041bbc0a186c7628e0adebcb00d9914..a961f62268b00433e6eaa0f5eadec1f6ee61bf75 100644 (file)
@@ -227,6 +227,21 @@ const std::string& modelCDMProject::GetBuildPath() const
   return this->buildPath;
 }
 
+const std::vector<modelCDMPackage*>& 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
index fe10702894b688f8365173ff604719433baccc18..e3ba19a69d56eaa3a082a5dcd11f577b67dbec80 100644 (file)
@@ -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<modelCDMPackage*>& 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
   /**
index 9d815d224db30a7d351e20426e27317f3529a00b..a7045a7523143b9e3b9a4eb3c260bf44de6f7fe8 100644 (file)
@@ -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<modelCDMApplication*> 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<modelCDMApplication*> 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);
+}
index 6b655f3112c2391be6efdbe38344d9761e634b14..b77b3fdcd9fa7ad239bb18b5fe88fe9199fbe506 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <creaWx.h>
 #include <wx/panel.h>
+#include <wx/hyperlink.h>
 
 #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);
 
 };
 
index f19dbcfb4d23fdcf76d8e087d216c624006236a9..23f9916a23228c4b0a17879dfdde627c36dc64cf 100644 (file)
@@ -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
index 37306b8cd0e2e181b65ca4cd59a341175e550695..c827fbd719821e490750c051394dd109dc23768f 100644 (file)
@@ -73,6 +73,7 @@ private:
 
   //handlers
 protected:
+  void OnBtnCreateClass(wxCommandEvent& event);
   void OnBtnCreateFolder(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
 
index d9392aac288aa60cc473d0ebe084bad8e6270174..653c769e1baaeb3fc62ff1ab86b5484f00fbcba1 100644 (file)
@@ -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<modelCDMLibrary*> 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<modelCDMLibrary*> 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);
+}
index bf324e966fd45b9cff19f09451a99c72bf5b99b6..039ca73b5b48f67f559839c48d0fa86d202cb07d 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <creaWx.h>
 #include <wx/panel.h>
+#include <wx/hyperlink.h>
 
 #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);
 
 };
 
index 5ef919b24437202f26b2110a51ee1773b36830ee..ac47c517a2327bb01d50bb55e41680f257538202 100644 (file)
@@ -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
index d96e5d3b87072df42b8edec43bbde1fb76b34814..1b45877c739f08c955da25a88055cac2e00ae69c 100644 (file)
@@ -73,6 +73,7 @@ private:
 
   //handlers
 protected:
+  void OnBtnCreateClass(wxCommandEvent& event);
   void OnBtnCreateFolder(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
 
index 94a7a38cd77f1569e217b4fb9160e9ec21d6d0f7..98ff113ef689c82150b9145d44fd993bef9ce14f 100755 (executable)
@@ -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();
 }
index c3e578d27603ea4a2653689a88d0f6420ed1a9e9..a29fdd6109230d0ab4502fecb15e479831379f79 100755 (executable)
@@ -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 (file)
index 0000000..a82f2e3
--- /dev/null
@@ -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<modelCDMPackage*> 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<modelCDMPackage*> 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 (file)
index 0000000..a8634cb
--- /dev/null
@@ -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 <creaWx.h>
+#include <wx/panel.h>
+#include <wx/hyperlink.h>
+
+#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_ */
index c4e2b0ff88ef900a946cbc3579cf0fc618876bc9..ea9062f8f20d924eccdf7293a9db417cd2258562 100755 (executable)
@@ -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)
index a624244ff57c66a256dc307981509bd87e1da13b..e69c3889ebf18ce5d88b6f9603258c9bb13d18b9 100644 (file)
 #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();
 }
index f96063dfced47c9f84c3f055a697d54e69008ec4..1b2c63bece54de3209a8f01a5c02c3884e4f1015 100644 (file)
@@ -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_ */