#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
+
#endif /* CREADEVMANAGERIDS_H_ */
#include "modelCDMAppli.h"
+#include "creaWx.h"
+#include "wx/dir.h"
+
modelCDMAppli::modelCDMAppli()
{
}
+modelCDMAppli::modelCDMAppli(const std::string& path, const int& level)
+{
+ this->type = wxDIR_DIRS;
+ this->name = "appli";
+ this->level = level;
+ this->path = path;
+}
+
modelCDMAppli::~modelCDMAppli()
{
}
{
public:
modelCDMAppli();
+ modelCDMAppli(const std::string& path, const int& level = 1);
~modelCDMAppli();
bool CreateApplication(
* Author: Daniel Felipe Gonzalez Obando
*/
#include "modelCDMIProjectTreeNode.h"
+#include <algorithm>
-bool modelCDMIProjectTreeNode::CompareNodeItem(const modelCDMIProjectTreeNode& x, const modelCDMIProjectTreeNode& y)
+bool modelCDMIProjectTreeNode::CompareNodeItem(const modelCDMIProjectTreeNode* x, const modelCDMIProjectTreeNode* y)
{
bool returnValue;
bool noWinner = true;
unsigned int i = 0;
- std::string xName = x.GetName();
- std::string yName = y.GetName();
- unsigned char xType = x.GetType();
- unsigned char yType = y.GetType();
+ std::string xName = x->GetName();
+ std::string yName = y->GetName();
+ unsigned char xType = x->GetType();
+ unsigned char yType = y->GetType();
while ((i < xName.length()) && (i < yName.length()))
{
this->id = id;
}
+void modelCDMIProjectTreeNode::SortChildren()
+{
+ std::sort(this->children.begin(), this->children.end(), CompareNodeItem);
+}
+
void modelCDMIProjectTreeNode::SetChildren(
const std::vector<modelCDMIProjectTreeNode*>& children)
{
public:
virtual ~modelCDMIProjectTreeNode() {}
- static bool CompareNodeItem(const modelCDMIProjectTreeNode& x, const modelCDMIProjectTreeNode& y);
+ static bool CompareNodeItem(const modelCDMIProjectTreeNode* x, const modelCDMIProjectTreeNode* y);
const wxTreeItemId& GetId() const;
const std::string& GetPath() const;
const int& GetLevel() const;
const std::vector<modelCDMIProjectTreeNode*>& GetChildren() const;
void SetId(const wxTreeItemId& id);
+ void SortChildren();
void SetChildren(const std::vector<modelCDMIProjectTreeNode*>& children);
virtual const bool Refresh(std::string*& result);
#include "modelCDMLib.h"
+#include "creaWx.h"
+#include "wx/dir.h"
+
modelCDMLib::modelCDMLib()
{
}
+modelCDMLib::modelCDMLib(const std::string& path, const int& level)
+{
+ this->type = wxDIR_DIRS;
+ this->name = "lib";
+ this->level = level;
+ this->path = path;
+}
+
modelCDMLib::~modelCDMLib()
{
}
{
public:
modelCDMLib();
+ modelCDMLib(const std::string& path, const int& level = 1);
~modelCDMLib();
bool CreateLibrary(
#include "modelCDMPackage.h"
+#include "creaWx.h"
+#include "wx/dir.h"
+
modelCDMPackage::modelCDMPackage()
{
}
+modelCDMPackage::modelCDMPackage(const std::string& path, const int& level)
+{
+ this->type = wxDIR_DIRS;
+ //TODO: Get Package Name
+ this->name = "Package";
+ this->namePackage = this->name;
+ this->level = level;
+ this->path = path;
+}
+
modelCDMPackage::~modelCDMPackage()
{
}
-const std::string& modelCDMPackage::GetName() const
+const std::string& modelCDMPackage::GetNamePackage() const
{
- return this->name;
+ return this->namePackage;
}
const std::string& modelCDMPackage::GetAuthors() const
{
public:
modelCDMPackage();
+ modelCDMPackage(const std::string& path, const int& level = 1);
~modelCDMPackage();
- const std::string& GetName() const;
+ const std::string& GetNamePackage() const;
const std::string& GetAuthors() const;
const std::string& GetAuthorsEmail() const;
const std::string& GetVersion() const;
virtual const bool Refresh(std::string*& result);
private:
- std::string name;
+ std::string namePackage;
std::string authors;
std::string authorsEmail;
std::string version;
//TODO: implement method
//if appli exist create Appli
this->appli = NULL;
+ wxDir dir(crea::std2wx((pathFixed + "/appli").c_str()));
+ if (dir.IsOpened())
+ {
+ this->appli = new modelCDMAppli(pathFixed + "/appli", this->level + 1);
+ this->children.push_back(this->appli);
+ }
+
//if lib exist create Lib
this->lib = NULL;
+ dir.Open(crea::std2wx((pathFixed + "/lib").c_str()));
+ if (dir.IsOpened())
+ {
+ this->lib = new modelCDMLib(pathFixed + "/lib", this->level + 1);
+ this->children.push_back(this->lib);
+ }
+
//if bbtk_* exist create Packages
+ this->packages.clear();
+ dir.Open(crea::std2wx((pathFixed).c_str()));
+ if (dir.IsOpened())
+ {
+ wxString fileName;
+ bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS);
+ while (cont)
+ {
+ std::string stdfileName = crea::wx2std(fileName);
+
+ if(stdfileName.size() > 9 && stdfileName.substr(0,5) == "bbtk_" && stdfileName.substr(stdfileName.size()-4,4) == "_PKG")
+ {
+ modelCDMPackage* package = new modelCDMPackage(pathFixed + "/" + stdfileName, this->level + 1);
+ this->packages.push_back(package);
+ this->children.push_back(package);
+ }
+ cont = dir.GetNext(&fileName);
+ }
+
+ }
+ this->SortChildren();
}
*/
#include "wxCDMMainDescriptionPanel.h"
+
#include "creaDevManagerIds.h"
#include "images/Cicon64.xpm"
+BEGIN_EVENT_TABLE(wxCDMMainDescriptionPanel, wxPanel)
+EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainDescriptionPanel::OnBtnNewProject)
+EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainDescriptionPanel::OnBtnOpenProject)
+END_EVENT_TABLE()
wxCDMMainDescriptionPanel::wxCDMMainDescriptionPanel(
wxWindow* parent,
class wxCDMMainDescriptionPanel : public wxPanel
{
+ DECLARE_EVENT_TABLE()
+
public:
wxCDMMainDescriptionPanel(
wxWindow* parent,
#include "creaDevManagerIds.h"
#include "wxCDMMainDescriptionPanel.h"
+#include "wxCDMProjectDescriptionPanel.h"
#include "wxCDMProjectActionsPanel.h"
#include "wxCDMNewProjectDialog.h"
auiManager.Update();
auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
- auiManager.GetPane(panel_Properties).CloseButton(false);
}
//Event Handlers
//populate tree control
tree_Projects->BuildTree(this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId());
- //TODO: change description panel
+
+ //change description panel
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Destroy();
+ this->panel_Properties = new wxCDMProjectDescriptionPanel(
+ this,
+ this->model->GetProject(),
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0);
+ auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+
//TODO: change project's actions panel
auiManager.Update();
//populate tree control
tree_Projects->BuildTree(this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId());
+
+ //change description panel
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Destroy();
+ this->panel_Properties = new wxCDMProjectDescriptionPanel(
+ this,
+ this->model->GetProject(),
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0);
+
+ auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+
+ //TODO: change project's actions panel
auiManager.Update();
}
{
wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
}
+ tree_Projects->BuildTree(this->model->GetProject());
+ auiManager.Update();
event.Skip();
}
void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
# 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.
# ------------------------------------------------------------------------
-*/
+ */
/*
* wxCDMProjectDescriptionPanel.cpp
#include "wxCDMProjectDescriptionPanel.h"
+#include "creaDevManagerIds.h"
+#include "images/Cicon64.xpm"
+
+BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel)
+EVT_MENU(ID_BUTTON_CREATE_PACKAGE, wxCDMProjectDescriptionPanel::OnBtnCreatePackage)
+EVT_MENU(ID_BUTTON_CREATE_BLACKBOX, wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox)
+EVT_MENU(ID_BUTTON_CREATE_LIBRARY, wxCDMProjectDescriptionPanel::OnBtnCreateLibrary)
+EVT_MENU(ID_BUTTON_CREATE_APPLICATION, wxCDMProjectDescriptionPanel::OnBtnCreateApplication)
+EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists)
+END_EVENT_TABLE()
+
wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel(
wxWindow* parent,
+ modelCDMProject* project,
wxWindowID id,
- const wxString&
- caption,
+ const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style
)
{
+ wxCDMProjectDescriptionPanel::Create(parent, project, id, caption, pos, size, style);
}
wxCDMProjectDescriptionPanel::~wxCDMProjectDescriptionPanel()
bool wxCDMProjectDescriptionPanel::Create(
wxWindow* parent,
+ modelCDMProject* project,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
long style
)
{
+ wxPanel::Create(parent, id, pos, size, style);
+ this->project = project;
+ CreateControls();
+ return TRUE;
}
void wxCDMProjectDescriptionPanel::CreateControls()
{
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ //Welcome
+ sizer->Add(new wxStaticText(this, -1, _("Project")),0, wxALIGN_CENTER, 0);
+
+ //Image
+ sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(Cicon)),0, wxALIGN_CENTER, 0);
+
+ //Project Name
+ sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->project->GetName())),0, wxALIGN_CENTER, 0);
+
+ //Project Properties
+ wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Properties"));
+ wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxHORIZONTAL);
+ sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+
+ wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
+ propertiesBoxInnerSizer -> Add(flexGridSizer, 1, wxEXPAND | wxALL);
+
+ 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"));
+
+ 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()));
+
+ flexGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ flexGridSizer->Add(pVersiontc, 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->SetSizeHints(this);
+
+ //Actions
+ wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions"));
+ wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL);
+ sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_PACKAGE, _T("Create Package")), 0, wxRIGHT | wxLEFT, 20);
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_BLACKBOX, _T("Create Black Box")), 0, wxRIGHT | wxLEFT, 20);
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_LIBRARY, _T("Create Library")), 0, wxRIGHT | wxLEFT, 20);
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_APPLICATION, _T("Create Application")), 0, wxRIGHT | wxLEFT, 20);
+
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxRIGHT | wxLEFT, 20);
+
+ //Asign sizer
+ actionsBoxInnerSizer->SetSizeHints(this);
+ sizer->SetSizeHints(this);
+ SetSizer(sizer);
+}
+
+void wxCDMProjectDescriptionPanel::OnBtnCreatePackage(wxCommandEvent& event)
+{
+ //TODO: implement method
+ std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
+ 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)
+{
+ //TODO: implement method
+ std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
+ event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnBtnCreateApplication(wxCommandEvent& event)
+{
+ //TODO: implement method
+ std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
+ event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
+{
+ //TODO: implement method
+ std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
+ event.Skip();
}
#include <creaWx.h>
#include <wx/panel.h>
+#include "modelCDMProject.h"
+
class wxCDMProjectDescriptionPanel : public wxPanel
{
+ DECLARE_EVENT_TABLE()
public:
wxCDMProjectDescriptionPanel(
wxWindow* parent,
+ modelCDMProject* project,
wxWindowID id = -1,
const wxString& caption = _("Description Frame"),
const wxPoint& pos = wxDefaultPosition,
bool Create(
wxWindow* parent,
+ modelCDMProject* project,
wxWindowID id = -1,
const wxString& caption = _("Description Frame"),
const wxPoint& pos = wxDefaultPosition,
void CreateControls();
+private:
+ modelCDMProject* project;
+
//handlers
protected:
+ void OnBtnCreatePackage(wxCommandEvent& event);
+ void OnBtnCreateBlackBox(wxCommandEvent& event);
+ void OnBtnCreateLibrary(wxCommandEvent& event);
+ void OnBtnCreateApplication(wxCommandEvent& event);
+ void OnBtnEditCMakeLists(wxCommandEvent& event);
+
};
#endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */
)
{
wxTreeCtrl::Create (parent, id, pos, size, style, validator, name);
- wxTreeItemId rootIndex = this-> AddRoot(_("Open Projects"));
+ wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"));
this->Update();
return TRUE;
}
void wxCDMProjectsTreeCtrl::BuildTree(modelCDMProject* projectTree)
{
+ this->DeleteAllItems();
if(projectTree != NULL)
{
- this->DeleteAllItems();
wxTreeItemId rootIndex;
rootIndex= this-> AddRoot(crea::std2wx(projectTree->GetName()));
projectTree->SetId(rootIndex);
this->Update();
}
+ else
+ {
+ wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"));
+ }
}
void wxCDMProjectsTreeCtrl::BuildTree(const std::vector<modelCDMIProjectTreeNode*>& treeNodes, wxTreeItemId parent)