From: Daniel Gonzalez Date: Tue, 27 Nov 2012 15:22:32 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=62dfbfc86db5ed98a2272d0b6620af1711791c27;p=crea.git Feature #1711 CreaDevManager application implementation Project description panel enabled when creating project or opening project --- diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index d631080..916f5da 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -76,4 +76,10 @@ #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_ */ diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 002a38e..c0f3774 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -34,10 +34,21 @@ #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() { } diff --git a/lib/creaDevManagerLib/modelCDMAppli.h b/lib/creaDevManagerLib/modelCDMAppli.h index 00f4d66..b97c012 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.h +++ b/lib/creaDevManagerLib/modelCDMAppli.h @@ -45,6 +45,7 @@ class modelCDMAppli : public modelCDMIProjectTreeNode { public: modelCDMAppli(); + modelCDMAppli(const std::string& path, const int& level = 1); ~modelCDMAppli(); bool CreateApplication( diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp index 8026b41..b444af2 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp @@ -32,16 +32,17 @@ * Author: Daniel Felipe Gonzalez Obando */ #include "modelCDMIProjectTreeNode.h" +#include -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())) { @@ -114,6 +115,11 @@ void modelCDMIProjectTreeNode::SetId(const wxTreeItemId& id) this->id = id; } +void modelCDMIProjectTreeNode::SortChildren() +{ + std::sort(this->children.begin(), this->children.end(), CompareNodeItem); +} + void modelCDMIProjectTreeNode::SetChildren( const std::vector& children) { diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h index b74c6f1..c07986d 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h @@ -45,7 +45,7 @@ class modelCDMIProjectTreeNode 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; @@ -54,6 +54,7 @@ public: const int& GetLevel() const; const std::vector& GetChildren() const; void SetId(const wxTreeItemId& id); + void SortChildren(); void SetChildren(const std::vector& children); virtual const bool Refresh(std::string*& result); diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index e8a4ac9..2324eb9 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -34,10 +34,21 @@ #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() { } diff --git a/lib/creaDevManagerLib/modelCDMLib.h b/lib/creaDevManagerLib/modelCDMLib.h index 2a7e164..f93752e 100644 --- a/lib/creaDevManagerLib/modelCDMLib.h +++ b/lib/creaDevManagerLib/modelCDMLib.h @@ -45,6 +45,7 @@ class modelCDMLib : public modelCDMIProjectTreeNode { public: modelCDMLib(); + modelCDMLib(const std::string& path, const int& level = 1); ~modelCDMLib(); bool CreateLibrary( diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 8d33e17..4902367 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -34,17 +34,30 @@ #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 diff --git a/lib/creaDevManagerLib/modelCDMPackage.h b/lib/creaDevManagerLib/modelCDMPackage.h index 5af9210..a644aae 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.h +++ b/lib/creaDevManagerLib/modelCDMPackage.h @@ -45,9 +45,10 @@ class modelCDMPackage : public modelCDMIProjectTreeNode { 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; @@ -70,7 +71,7 @@ public: virtual const bool Refresh(std::string*& result); private: - std::string name; + std::string namePackage; std::string authors; std::string authorsEmail; std::string version; diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 25bba8d..3966c7c 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -140,10 +140,45 @@ modelCDMProject::modelCDMProject( //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(); } diff --git a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp index e50abba..aecfaaa 100644 --- a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp @@ -34,9 +34,14 @@ */ #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, diff --git a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h index e2efa88..0e384fd 100644 --- a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h @@ -41,6 +41,8 @@ class wxCDMMainDescriptionPanel : public wxPanel { + DECLARE_EVENT_TABLE() + public: wxCDMMainDescriptionPanel( wxWindow* parent, diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 775cfc7..8050bf9 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -36,6 +36,7 @@ #include "creaDevManagerIds.h" #include "wxCDMMainDescriptionPanel.h" +#include "wxCDMProjectDescriptionPanel.h" #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" @@ -205,7 +206,6 @@ void wxCDMMainFrame::CreateControls() auiManager.Update(); auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true); - auiManager.GetPane(panel_Properties).CloseButton(false); } //Event Handlers @@ -236,7 +236,20 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) //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(); @@ -269,6 +282,22 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) //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(); } @@ -286,6 +315,8 @@ void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event) { 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) diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp index 0fadfeb..ff5d01b 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -23,7 +23,7 @@ # 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 @@ -34,16 +34,28 @@ #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() @@ -52,6 +64,7 @@ wxCDMProjectDescriptionPanel::~wxCDMProjectDescriptionPanel() bool wxCDMProjectDescriptionPanel::Create( wxWindow* parent, + modelCDMProject* project, wxWindowID id, const wxString& caption, const wxPoint& pos, @@ -59,8 +72,103 @@ bool wxCDMProjectDescriptionPanel::Create( 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(); } diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h index e91dca0..85aed83 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -38,11 +38,15 @@ #include #include +#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, @@ -54,6 +58,7 @@ public: bool Create( wxWindow* parent, + modelCDMProject* project, wxWindowID id = -1, const wxString& caption = _("Description Frame"), const wxPoint& pos = wxDefaultPosition, @@ -63,8 +68,17 @@ public: 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_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index 8337e48..61bd7e7 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -65,16 +65,16 @@ bool wxCDMProjectsTreeCtrl::Create( ) { 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); @@ -86,6 +86,10 @@ void wxCDMProjectsTreeCtrl::BuildTree(modelCDMProject* projectTree) this->Update(); } + else + { + wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project")); + } } void wxCDMProjectsTreeCtrl::BuildTree(const std::vector& treeNodes, wxTreeItemId parent)