#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_ */
{
}
+const std::vector<modelCDMApplication*>& modelCDMAppli::GetApplications() const
+{
+ return this->applications;
+}
+
modelCDMApplication* modelCDMAppli::CreateApplication(
const std::string& name,
std::string*& result,
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,
{
}
+const std::vector<modelCDMLibrary*>& modelCDMLib::GetLibraries() const
+{
+ return this->libraries;
+}
+
modelCDMLibrary* modelCDMLib::CreateLibrary(
const std::string& name,
std::string*& result,
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);
//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;
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
*/
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
/**
#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()
{
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);
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);
+}
#include <creaWx.h>
#include <wx/panel.h>
+#include <wx/hyperlink.h>
#include "modelCDMAppli.h"
protected:
void OnBtnCreateApplication(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
+ void OnLnkApplicationSelect(wxHyperlinkEvent& event);
+ void OnBtnReturn(wxCommandEvent& event);
};
#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(
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);
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
//handlers
protected:
+ void OnBtnCreateClass(wxCommandEvent& event);
void OnBtnCreateFolder(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
#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()
{
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);
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"),
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);
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
newEvent->SetInt(library->GetId());
wxPostEvent(this->GetParent(), *newEvent);
- event.Skip();
}
}
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);
+}
#include <creaWx.h>
#include <wx/panel.h>
+#include <wx/hyperlink.h>
#include "modelCDMLib.h"
protected:
void OnBtnCreateLibrary(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
+ void OnLnkLibrarySelect(wxHyperlinkEvent& event);
+ void OnBtnReturn(wxCommandEvent& event);
};
#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(
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);
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
//handlers
protected:
+ void OnBtnCreateClass(wxCommandEvent& event);
void OnBtnCreateFolder(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
#include "wxCDMCMakeListsDescriptionPanel.h"
#include "wxCDMFolderDescriptionPanel.h"
#include "wxCDMFileDescriptionPanel.h"
+#include "wxCDMPackageManagerPanel.h"
#include "wxCDMProjectActionsPanel.h"
#include "wxCDMNewProjectDialog.h"
return TRUE;
}
+modelCDMMain* wxCDMMainFrame::GetModel() const
+{
+ return this->model;
+}
+
void wxCDMMainFrame::RefreshProject()
{
std::string* result;
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();
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();
}
long style = wxDEFAULT_FRAME_STYLE
);
+ modelCDMMain* GetModel() const;
+
void RefreshProject();
protected:
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# 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);
+}
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# 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_ */
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)
#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(
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);
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)
{
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();
}
//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_ */