From 11150e550ff03ee658e90cda4b475b4c24da0a7f Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Tue, 15 Jan 2013 11:59:19 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation -Breadcrumbs implemented in all children views. --- lib/creaDevManagerLib/modelCDMAppli.cpp | 21 +++++----- lib/creaDevManagerLib/modelCDMAppli.h | 2 +- lib/creaDevManagerLib/modelCDMApplication.cpp | 17 ++++---- lib/creaDevManagerLib/modelCDMApplication.h | 2 +- lib/creaDevManagerLib/modelCDMBlackBox.cpp | 3 +- lib/creaDevManagerLib/modelCDMBlackBox.h | 2 +- .../modelCDMCMakeListsFile.cpp | 3 +- .../modelCDMCMakeListsFile.h | 2 +- lib/creaDevManagerLib/modelCDMFile.cpp | 3 +- lib/creaDevManagerLib/modelCDMFile.h | 2 +- lib/creaDevManagerLib/modelCDMFolder.cpp | 21 +++++----- lib/creaDevManagerLib/modelCDMFolder.h | 2 +- .../modelCDMIProjectTreeNode.cpp | 18 +++++++++ .../modelCDMIProjectTreeNode.h | 3 ++ lib/creaDevManagerLib/modelCDMLib.cpp | 21 +++++----- lib/creaDevManagerLib/modelCDMLib.h | 2 +- lib/creaDevManagerLib/modelCDMLibrary.cpp | 17 ++++---- lib/creaDevManagerLib/modelCDMLibrary.h | 2 +- lib/creaDevManagerLib/modelCDMMain.cpp | 6 +-- lib/creaDevManagerLib/modelCDMPackage.cpp | 19 ++++----- lib/creaDevManagerLib/modelCDMPackage.h | 2 +- lib/creaDevManagerLib/modelCDMPackageSrc.cpp | 27 +++++++------ lib/creaDevManagerLib/modelCDMPackageSrc.h | 2 +- lib/creaDevManagerLib/modelCDMProject.cpp | 28 +++++++------ lib/creaDevManagerLib/modelCDMProject.h | 2 +- .../wxCDMAppliDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMAppliDescriptionPanel.h | 2 +- .../wxCDMApplicationDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMApplicationDescriptionPanel.h | 3 +- .../wxCDMBlackBoxDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMBlackBoxDescriptionPanel.h | 3 +- .../wxCDMCMakeListsDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMCMakeListsDescriptionPanel.h | 3 +- .../wxCDMFileDescriptionPanel.cpp | 39 +++++++++++++----- .../wxCDMFileDescriptionPanel.h | 3 +- .../wxCDMFolderDescriptionPanel.cpp | 39 +++++++++++++----- .../wxCDMFolderDescriptionPanel.h | 3 +- .../wxCDMLibDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMLibDescriptionPanel.h | 2 +- .../wxCDMLibraryDescriptionPanel.cpp | 40 ++++++++++++++----- .../wxCDMLibraryDescriptionPanel.h | 3 +- .../wxCDMPackageDescriptionPanel.cpp | 39 +++++++++++++----- .../wxCDMPackageDescriptionPanel.h | 2 +- .../wxCDMPackageManagerPanel.cpp | 10 ++--- .../wxCDMPackageManagerPanel.h | 2 +- 45 files changed, 419 insertions(+), 203 deletions(-) diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 4173927..7669853 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -46,9 +46,10 @@ modelCDMAppli::modelCDMAppli() { } -modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, const int& level) +modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating appli\n"; + this->parent = parent; this->type = wxDIR_DIRS; this->name = name; this->level = level; @@ -71,13 +72,13 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, c if(stdfileName != "template_appli" && stdfileName != "template_wx_appli") { - modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMApplication* application = new modelCDMApplication(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->applications.push_back(application); this->children.push_back(application); } else { - modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } @@ -92,13 +93,13 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, c //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } //if is an unknown file, create file else { - this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } cont = dir.GetNext(&fileName); @@ -156,7 +157,7 @@ modelCDMApplication* modelCDMAppli::CreateApplication( } //add application to model - modelCDMApplication* application = new modelCDMApplication(this->path + CDMUtilities::SLASH + name, name, this->level + 1); + modelCDMApplication* application = new modelCDMApplication(this, this->path + CDMUtilities::SLASH + name, name, this->level + 1); this->applications.push_back(application); this->children.push_back(application); @@ -203,7 +204,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) } if(!found) { - modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMApplication* application= new modelCDMApplication(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->applications.push_back(application); this->children.push_back(application); } @@ -225,7 +226,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder= new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } } @@ -242,7 +243,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -270,7 +271,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMAppli.h b/lib/creaDevManagerLib/modelCDMAppli.h index 5d378b9..d5df81e 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.h +++ b/lib/creaDevManagerLib/modelCDMAppli.h @@ -45,7 +45,7 @@ class modelCDMAppli : public modelCDMFolder { public: modelCDMAppli(); - modelCDMAppli(const std::string& path, const std::string& name = "appli", const int& level = 1); + modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "appli", const int& level = 1); ~modelCDMAppli(); const std::vector& GetApplications() const; diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index d88e257..19cc293 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -46,9 +46,10 @@ modelCDMApplication::modelCDMApplication() mainFile = NULL; } -modelCDMApplication::modelCDMApplication(const std::string& path, const std::string& name, const int& level) +modelCDMApplication::modelCDMApplication(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating application: " + path + "\n"; + this->parent = parent; this->mainFile = NULL; //folder name this->name = name; @@ -104,7 +105,7 @@ modelCDMApplication::modelCDMApplication(const std::string& path, const std::str { std::string stdfileName = crea::wx2std(fileName); - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->folders.push_back(folder); this->children.push_back(folder); @@ -119,13 +120,13 @@ modelCDMApplication::modelCDMApplication(const std::string& path, const std::str //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } //if is an unknown file, create file else { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); std::string extension = stdfileName.substr(stdfileName.size()-4); if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) { @@ -224,7 +225,7 @@ modelCDMFolder* modelCDMApplication::CreateFolder(const std::string& name, std:: result = new std::string("Error executing: " + command + "."); return NULL; } - modelCDMFolder* folder = new modelCDMFolder(path + CDMUtilities::SLASH + name, name, level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); this->folders.push_back(folder); this->children.push_back(folder); @@ -302,7 +303,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->folders.push_back(folder); this->children.push_back(folder); } @@ -319,7 +320,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -368,7 +369,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); std::string extension = stdfileName.substr(stdfileName.size()-4); if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) diff --git a/lib/creaDevManagerLib/modelCDMApplication.h b/lib/creaDevManagerLib/modelCDMApplication.h index 9839948..4935676 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.h +++ b/lib/creaDevManagerLib/modelCDMApplication.h @@ -45,7 +45,7 @@ class modelCDMApplication : public modelCDMFolder { public: modelCDMApplication(); - modelCDMApplication(const std::string& path, const std::string& name, const int& level = 2); + modelCDMApplication(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 2); ~modelCDMApplication(); const std::string& GetExecutableName() const; diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.cpp b/lib/creaDevManagerLib/modelCDMBlackBox.cpp index daec9d4..c92c677 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.cpp +++ b/lib/creaDevManagerLib/modelCDMBlackBox.cpp @@ -47,9 +47,10 @@ modelCDMBlackBox::modelCDMBlackBox() this->header = NULL; } -modelCDMBlackBox::modelCDMBlackBox(const std::string& path, const std::string& name, const int& level) +modelCDMBlackBox::modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating black box: " + name + " in " + path + "\n"; + this->parent = parent; this->name = name; this->path = path; this->level = level; diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.h b/lib/creaDevManagerLib/modelCDMBlackBox.h index c58b167..ff8ed18 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.h +++ b/lib/creaDevManagerLib/modelCDMBlackBox.h @@ -43,7 +43,7 @@ class modelCDMBlackBox : public modelCDMFolder { public: modelCDMBlackBox(); - modelCDMBlackBox(const std::string& path, const std::string& name, const int& level = 1); + modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1); ~modelCDMBlackBox(); const std::string& GetNameBlackBox() const; diff --git a/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp index 72b1cdf..2dc48b4 100644 --- a/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp +++ b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp @@ -45,9 +45,10 @@ modelCDMCMakeListsFile::modelCDMCMakeListsFile() { } -modelCDMCMakeListsFile::modelCDMCMakeListsFile(const std::string& path, const std::string& name, const int& level) +modelCDMCMakeListsFile::modelCDMCMakeListsFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating cmakelist file: " + path + "\n"; + this->parent = parent; this->children.clear(); this->level = level; this->type = wxDIR_FILES; diff --git a/lib/creaDevManagerLib/modelCDMCMakeListsFile.h b/lib/creaDevManagerLib/modelCDMCMakeListsFile.h index 65f034f..ac9ce71 100644 --- a/lib/creaDevManagerLib/modelCDMCMakeListsFile.h +++ b/lib/creaDevManagerLib/modelCDMCMakeListsFile.h @@ -41,7 +41,7 @@ class modelCDMCMakeListsFile : public modelCDMFile { public: modelCDMCMakeListsFile(); - modelCDMCMakeListsFile(const std::string& path, const std::string& name = "CMakeLists.txt", const int& level = 1); + modelCDMCMakeListsFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "CMakeLists.txt", const int& level = 1); ~modelCDMCMakeListsFile(); bool OpenFile(std::string*& result); diff --git a/lib/creaDevManagerLib/modelCDMFile.cpp b/lib/creaDevManagerLib/modelCDMFile.cpp index 3f92ffe..dcafc8e 100644 --- a/lib/creaDevManagerLib/modelCDMFile.cpp +++ b/lib/creaDevManagerLib/modelCDMFile.cpp @@ -44,9 +44,10 @@ modelCDMFile::modelCDMFile() { } -modelCDMFile::modelCDMFile(const std::string& path, const std::string& name, const int& level) +modelCDMFile::modelCDMFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating file: " + path + "\n"; + this->parent = parent; this->children.clear(); this->level = level; this->name = name; diff --git a/lib/creaDevManagerLib/modelCDMFile.h b/lib/creaDevManagerLib/modelCDMFile.h index f521608..3f03f29 100644 --- a/lib/creaDevManagerLib/modelCDMFile.h +++ b/lib/creaDevManagerLib/modelCDMFile.h @@ -44,7 +44,7 @@ class modelCDMFile : public modelCDMIProjectTreeNode { public: modelCDMFile(); - modelCDMFile(const std::string& path, const std::string& name, const int& level = 3); + modelCDMFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 3); ~modelCDMFile(); bool OpenFile(std::string* & result, const std::string& command = ""); diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index c97b129..ca83e05 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -47,10 +47,11 @@ modelCDMFolder::modelCDMFolder() this->CMakeLists = NULL; } -modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name, const int& level) +modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating folder: " + path + "\n"; //set attributes + this->parent = parent; this->children.clear(); this->level = level; this->CMakeLists = NULL; @@ -71,7 +72,7 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name, std::string stdfileName = crea::wx2std(fileName); //if is an unknown folder, create folder - modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); this->folders.push_back(folder); @@ -86,12 +87,12 @@ modelCDMFolder::modelCDMFolder(const std::string& path, const std::string& name, //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else { - this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } //if is an unknown file, create file cont = dir.GetNext(&fileName); @@ -125,8 +126,8 @@ bool modelCDMFolder::CreateClass(const std::string& name) } else { - this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1)); - this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1)); + this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1)); + this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1)); this->SortChildren(); return true; } @@ -141,7 +142,7 @@ modelCDMFolder* modelCDMFolder::CreateFolder(const std::string& name, std::strin result = new std::string("Error executing: " + command + "."); return NULL; } - modelCDMFolder* folder = new modelCDMFolder(path + CDMUtilities::SLASH + name, name, level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); this->folders.push_back(folder); this->children.push_back(folder); @@ -199,7 +200,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->folders.push_back(folder); this->children.push_back(folder); } @@ -216,7 +217,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -245,7 +246,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMFolder.h b/lib/creaDevManagerLib/modelCDMFolder.h index 0756500..e3c8afc 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.h +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -45,7 +45,7 @@ class modelCDMFolder : public modelCDMIProjectTreeNode { public: modelCDMFolder(); - modelCDMFolder(const std::string& path, const std::string& name, const int& level = 3); + modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 3); ~modelCDMFolder(); modelCDMCMakeListsFile* GetCMakeLists() const; diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp index fb02b71..e7edd2b 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp @@ -109,6 +109,24 @@ const int& modelCDMIProjectTreeNode::GetLevel() const return this->level; } +modelCDMIProjectTreeNode* modelCDMIProjectTreeNode::GetParent() const +{ + return this->parent; +} + +std::vector modelCDMIProjectTreeNode::GetParents() const +{ + std::vector family; + modelCDMIProjectTreeNode* someFamily = this->parent; + while(someFamily != NULL) + { + family.push_back(someFamily); + someFamily = someFamily->GetParent(); + } + return family; + +} + const std::vector& modelCDMIProjectTreeNode::GetChildren() const { return this->children; diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h index 6d5c680..eca8088 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h @@ -52,6 +52,8 @@ public: const std::string& GetName() const; const unsigned char& GetType() const; const int& GetLevel() const; + modelCDMIProjectTreeNode* GetParent() const; + std::vector GetParents() const; const std::vector& GetChildren() const; const int& GetLength(); void SetId(const wxTreeItemId& id); @@ -68,6 +70,7 @@ protected: unsigned char type; int level; int length; + modelCDMIProjectTreeNode* parent; std::vector children; }; diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 16211ee..a040ae8 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -45,9 +45,10 @@ modelCDMLib::modelCDMLib() { } -modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const int& level) +modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating lib\n"; + this->parent = parent; this->type = wxDIR_DIRS; this->name = name; this->level = level; @@ -72,13 +73,13 @@ modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const if(stdfileName != "template_lib") { - modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMLibrary* library = new modelCDMLibrary(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->libraries.push_back(library); this->children.push_back(library); } else { - modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } @@ -93,13 +94,13 @@ modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } //if is an unknown file, create file else { - this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } cont = dir.GetNext(&fileName); @@ -156,7 +157,7 @@ modelCDMLibrary* modelCDMLib::CreateLibrary( } //add library to model - modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + name, name, this->level + 1); + modelCDMLibrary* library = new modelCDMLibrary(this, this->path + CDMUtilities::SLASH + name, name, this->level + 1); this->libraries.push_back(library); this->children.push_back(library); @@ -205,7 +206,7 @@ const bool modelCDMLib::Refresh(std::string*& result) } if(!found) { - modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMLibrary* library = new modelCDMLibrary(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->libraries.push_back(library); this->children.push_back(library); } @@ -226,7 +227,7 @@ const bool modelCDMLib::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder= new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } } @@ -243,7 +244,7 @@ const bool modelCDMLib::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -271,7 +272,7 @@ const bool modelCDMLib::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMLib.h b/lib/creaDevManagerLib/modelCDMLib.h index 59d1196..49722b1 100644 --- a/lib/creaDevManagerLib/modelCDMLib.h +++ b/lib/creaDevManagerLib/modelCDMLib.h @@ -45,7 +45,7 @@ class modelCDMLib : public modelCDMFolder { public: modelCDMLib(); - modelCDMLib(const std::string& path, const std::string& name = "lib", const int& level = 1); + modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "lib", const int& level = 1); ~modelCDMLib(); const std::vector& GetLibraries() const; diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index 1964e88..3e47717 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -45,9 +45,10 @@ modelCDMLibrary::modelCDMLibrary() { } -modelCDMLibrary::modelCDMLibrary(const std::string& path, const std::string& name, const int& level) +modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating library: " + path + "\n"; + this->parent = parent; //folder name this->name = name; //path @@ -104,7 +105,7 @@ modelCDMLibrary::modelCDMLibrary(const std::string& path, const std::string& nam { std::string stdfileName = crea::wx2std(fileName); - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->folders.push_back(folder); this->children.push_back(folder); @@ -119,13 +120,13 @@ modelCDMLibrary::modelCDMLibrary(const std::string& path, const std::string& nam //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } //if is an unknown file, create file else { - this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } cont = dir.GetNext(&fileName); @@ -199,7 +200,7 @@ modelCDMFolder* modelCDMLibrary::CreateFolder(const std::string& name, std::stri result = new std::string("Error executing: " + command + "."); return NULL; } - modelCDMFolder* folder = new modelCDMFolder(path + CDMUtilities::SLASH + name, name, level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); this->folders.push_back(folder); this->children.push_back(folder); @@ -275,7 +276,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->folders.push_back(folder); this->children.push_back(folder); } @@ -292,7 +293,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -320,7 +321,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMLibrary.h b/lib/creaDevManagerLib/modelCDMLibrary.h index 728b5c9..fb3b7d9 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.h +++ b/lib/creaDevManagerLib/modelCDMLibrary.h @@ -44,7 +44,7 @@ class modelCDMLibrary : public modelCDMFolder { public: modelCDMLibrary(); - modelCDMLibrary(const std::string& path, const std::string& name, const int& level = 2); + modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 2); ~modelCDMLibrary(); const std::string& GetNameLibrary() const; diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index 7537c46..e856fd2 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -139,7 +139,7 @@ bool modelCDMMain::CreateProject( return false; } - this->project = new modelCDMProject(nomDirectory, name); + this->project = new modelCDMProject(NULL, nomDirectory, name); #endif @@ -234,11 +234,11 @@ bool modelCDMMain::OpenProject( { std::cout << ", and built in: " << pathBuild << std::endl; - this->project = new modelCDMProject(pathSource, words[words.size()-1], pathBuild); + this->project = new modelCDMProject(NULL, pathSource, words[words.size()-1], pathBuild); } else { - this->project = new modelCDMProject(pathSource, words[words.size()-1]); + this->project = new modelCDMProject(NULL, pathSource, words[words.size()-1]); } } else diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index cd24c04..093d610 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -46,9 +46,10 @@ modelCDMPackage::modelCDMPackage() this->src = NULL; } -modelCDMPackage::modelCDMPackage(const std::string& path, const std::string& name, const int& level) +modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating package: " + path + "\n"; + this->parent = parent; this->type = wxDIR_DIRS; this->name = name; //Get Package Name @@ -139,12 +140,12 @@ modelCDMPackage::modelCDMPackage(const std::string& path, const std::string& nam //if src, check for black boxes if(stdfileName == "src") { - this->src = new modelCDMPackageSrc(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->src = new modelCDMPackageSrc(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->src); } else { - this->children.push_back(new modelCDMFolder(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFolder(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } cont = dir.GetNext(&fileName); @@ -159,12 +160,12 @@ modelCDMPackage::modelCDMPackage(const std::string& path, const std::string& nam //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else { - this->children.push_back(new modelCDMFile(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } //if is an unknown file, create file cont = dir.GetNext(&fileName); @@ -473,7 +474,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) } else { - this->src = new modelCDMPackageSrc(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level +1); + this->src = new modelCDMPackageSrc(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level +1); this->children.push_back(this->src); } } @@ -494,7 +495,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } } @@ -512,7 +513,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -540,7 +541,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMPackage.h b/lib/creaDevManagerLib/modelCDMPackage.h index 67e6957..de1b0a9 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.h +++ b/lib/creaDevManagerLib/modelCDMPackage.h @@ -45,7 +45,7 @@ class modelCDMPackage : public modelCDMFolder { public: modelCDMPackage(); - modelCDMPackage(const std::string& path, const std::string& name, const int& level = 1); + modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1); ~modelCDMPackage(); const std::string& GetNamePackage() const; diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index 6aa9c53..4448187 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -47,9 +47,10 @@ modelCDMPackageSrc::modelCDMPackageSrc() this->CMakeLists = NULL; } -modelCDMPackageSrc::modelCDMPackageSrc(const std::string& path, const std::string& name, const int& level) +modelCDMPackageSrc::modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { std::cout << "creating package src: " + path + "\n"; + this->parent = parent; //set attributes this->children.clear(); this->level = level; @@ -70,7 +71,7 @@ modelCDMPackageSrc::modelCDMPackageSrc(const std::string& path, const std::strin std::string stdfileName = crea::wx2std(fileName); //if is an unknown folder, create folder - this->children.push_back(new modelCDMFolder(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFolder(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); cont = dir.GetNext(&fileName); } @@ -79,7 +80,7 @@ modelCDMPackageSrc::modelCDMPackageSrc(const std::string& path, const std::strin if (cont) { std::string stdfileName = crea::wx2std(fileName); - this->CMakeLists = new modelCDMCMakeListsFile(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } @@ -91,15 +92,15 @@ modelCDMPackageSrc::modelCDMPackageSrc(const std::string& path, const std::strin if(stdfileName.substr(0,2) == "bb") { - file = new modelCDMFile(path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + file = new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); - modelCDMBlackBox* blackBox = new modelCDMBlackBox(path, stdfileName.substr(2,stdfileName.size()-4), level + 1); + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, path, stdfileName.substr(2,stdfileName.size()-4), level + 1); blackBox->SetHeaderFile(file); wxDir dir2(crea::std2wx(path)); cont = dir2.GetFirst(&fileName, crea::std2wx(stdfileName.substr(0,stdfileName.size()-2) + ".cxx"), wxDIR_FILES); if (cont) { - file = new modelCDMFile(path + CDMUtilities::SLASH + crea::wx2std(fileName), crea::wx2std(fileName), this->level + 1); + file = new modelCDMFile(this, path + CDMUtilities::SLASH + crea::wx2std(fileName), crea::wx2std(fileName), this->level + 1); this->children.push_back(file); blackBox->SetSourceFile(file); } @@ -237,20 +238,20 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( if (cont) { std::string stdfileName = crea::wx2std(fileName); - header = new modelCDMFile(this->path + stdfileName, stdfileName, this->level+1); + header = new modelCDMFile(this, this->path + stdfileName, stdfileName, this->level+1); } cont = dir.GetFirst(&fileName, crea::std2wx("bb"+package+bbName+".cxx"), wxDIR_FILES); if (cont) { std::string stdfileName = crea::wx2std(fileName); - source = new modelCDMFile(this->path + stdfileName, stdfileName, this->level+1); + source = new modelCDMFile(this, this->path + stdfileName, stdfileName, this->level+1); } } //if source and header exist if (header != NULL && source != NULL) { //create black box - modelCDMBlackBox* blackBox = new modelCDMBlackBox(this->path, package+bbName); + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, this->path, package+bbName); //associate header and source blackBox->SetHeaderFile(header); @@ -308,7 +309,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) } if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } cont = dir.GetNext(&fileName); @@ -324,7 +325,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -352,7 +353,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } @@ -375,7 +376,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) if (!found) { - modelCDMBlackBox* blackBox = new modelCDMBlackBox(path, stdfileName.substr(2,stdfileName.size()-4), level + 1); + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, path, stdfileName.substr(2,stdfileName.size()-4), level + 1); this->blackBoxes.push_back(blackBox); } diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.h b/lib/creaDevManagerLib/modelCDMPackageSrc.h index bb799c3..e86e7a4 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.h +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.h @@ -45,7 +45,7 @@ class modelCDMPackageSrc : public modelCDMFolder { public: modelCDMPackageSrc(); - modelCDMPackageSrc(const std::string& path, const std::string& name = "src", const int& level = 3); + modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "src", const int& level = 3); ~modelCDMPackageSrc(); const std::vector& GetBlackBoxes() const; diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 00d846e..50f6cc2 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -54,12 +54,14 @@ modelCDMProject::modelCDMProject() } modelCDMProject::modelCDMProject( + modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const std::string& buildPath ) { std::cout << "creating project: " + name + " in " + path + "\n"; + this->parent = parent; this->path = CDMUtilities::fixPath(path); //open makelists file std::string pathFixed(CDMUtilities::fixPath(path)); @@ -157,26 +159,26 @@ modelCDMProject::modelCDMProject( //if appli, create appli if(stdfileName == "appli") { - this->appli = new modelCDMAppli(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->appli = new modelCDMAppli(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->appli); } //if lib, create lib else if(stdfileName == "lib") { - this->lib = new modelCDMLib(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->lib = new modelCDMLib(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->lib); } //if package , create package else if(stdfileName.size() > 9 && stdfileName.substr(0,5) == "bbtk_" && stdfileName.substr(stdfileName.size()-4,4) == "_PKG") { - modelCDMPackage* package = new modelCDMPackage(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMPackage* package = new modelCDMPackage(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->packages.push_back(package); this->children.push_back(package); } //if is an unknown folder, create folder else { - this->children.push_back(new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } cont = dir.GetNext(&fileName); @@ -190,12 +192,12 @@ modelCDMProject::modelCDMProject( //if CMakeLists, create CMakeLists if(stdfileName == "CMakeLists.txt") { - this->CMakeLists = new modelCDMCMakeListsFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else { - this->children.push_back(new modelCDMFile(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } //if is an unknown file, create file cont = dir.GetNext(&fileName); @@ -366,7 +368,7 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( } //add library to model - modelCDMPackage* package = new modelCDMPackage(this->path + CDMUtilities::SLASH + "bbtk_" + nameFixed + "_PKG", "bbtk_" + nameFixed + "_PKG", this->level + 1); + modelCDMPackage* package = new modelCDMPackage(this, this->path + CDMUtilities::SLASH + "bbtk_" + nameFixed + "_PKG", "bbtk_" + nameFixed + "_PKG", this->level + 1); this->packages.push_back(package); this->children.push_back(package); @@ -516,7 +518,7 @@ const bool modelCDMProject::Refresh(std::string*& result) { if (this->appli == NULL) { - this->appli = new modelCDMAppli(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->appli = new modelCDMAppli(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->appli); } else @@ -532,7 +534,7 @@ const bool modelCDMProject::Refresh(std::string*& result) { if (this->lib == NULL) { - this->lib = new modelCDMLib(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->lib = new modelCDMLib(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->lib); } else @@ -562,7 +564,7 @@ const bool modelCDMProject::Refresh(std::string*& result) } if(!found) { - modelCDMPackage* package = new modelCDMPackage(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMPackage* package = new modelCDMPackage(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->packages.push_back(package); this->children.push_back(package); } @@ -585,7 +587,7 @@ const bool modelCDMProject::Refresh(std::string*& result) if(!found) { - modelCDMFolder* folder = new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(folder); } } @@ -603,7 +605,7 @@ const bool modelCDMProject::Refresh(std::string*& result) { if (this->CMakeLists == NULL) { - this->CMakeLists = new modelCDMCMakeListsFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(this->CMakeLists); } else @@ -631,7 +633,7 @@ const bool modelCDMProject::Refresh(std::string*& result) if(!found) { - modelCDMFile* file = new modelCDMFile(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } } diff --git a/lib/creaDevManagerLib/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index b2a2a11..e4ab0ca 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -61,7 +61,7 @@ public: * @param path The source path. * @param buildPath The build path. By default it's an empty string. */ - modelCDMProject(const std::string& path, const std::string& name, const std::string& buildPath = ""); + modelCDMProject(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const std::string& buildPath = ""); /** * Destructor. diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp index ec0dc04..109e9db 100644 --- a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp @@ -44,7 +44,7 @@ #include "images/ApIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMAppliDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMAppliDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(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) @@ -88,10 +88,21 @@ void wxCDMAppliDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->appli->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); { @@ -244,12 +255,21 @@ void wxCDMAppliDescriptionPanel::OnLnkApplicationSelect(wxHyperlinkEvent& event) wxPostEvent(this->GetParent(), *newEvent); } -void wxCDMAppliDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMAppliDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->appli->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMAppliDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h index 6e350a0..2a1a9fe 100644 --- a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h @@ -77,7 +77,7 @@ protected: void OnBtnCreateApplication(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); void OnLnkApplicationSelect(wxHyperlinkEvent& event); - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); void OnMouseEnter(wxMouseEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp index 60fbdf6..ff3d207 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp @@ -43,8 +43,8 @@ #include "images/AIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMApplicationDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMApplicationDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMApplicationDescriptionPanel::OnBtnSetExeName) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMApplicationDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMApplicationDescriptionPanel::OnBtnCreateClass) EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists) @@ -89,10 +89,20 @@ void wxCDMApplicationDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->application->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -188,12 +198,22 @@ void wxCDMApplicationDescriptionPanel::CreateControls() } } -void wxCDMApplicationDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMApplicationDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->application->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } void wxCDMApplicationDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h index 995d2be..823272b 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMApplication.h" @@ -74,7 +75,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnSetExeName(wxCommandEvent& event); void OnBtnCreateClass(wxCommandEvent& event); void OnBtnCreateFolder(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp index 006ca3d..6db4e2b 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp @@ -42,7 +42,7 @@ #include "images/BBIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMBlackBoxDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMBlackBoxDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMBlackBoxDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMBlackBoxDescriptionPanel::OnBtnSetAuthor) EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMBlackBoxDescriptionPanel::OnBtnSetDescription) EVT_BUTTON(ID_BUTTON_SET_CATEGORY, wxCDMBlackBoxDescriptionPanel::OnBtnSetCategories) @@ -88,10 +88,20 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->blackBox->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -195,12 +205,22 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls() } } -void wxCDMBlackBoxDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMBlackBoxDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->blackBox->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } void wxCDMBlackBoxDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h index c4be2fb..27c8dab 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMBlackBox.h" @@ -76,7 +77,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnSetAuthor(wxCommandEvent& event); void OnBtnSetDescription(wxCommandEvent& event); void OnBtnSetCategories(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp index 565a861..b5ee362 100644 --- a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp @@ -40,7 +40,7 @@ #include "images/CMIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMCMakeListsDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMCMakeListsDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMCMakeListsDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor) EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMCMakeListsDescriptionPanel::OnBtnOpenFolder) END_EVENT_TABLE() @@ -82,10 +82,21 @@ void wxCDMCMakeListsDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->cMakeLists->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); { @@ -128,12 +139,21 @@ void wxCDMCMakeListsDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } -void wxCDMCMakeListsDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMCMakeListsDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->cMakeLists->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h index b37d338..67ac0cc 100644 --- a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMCMakeListsFile.h" @@ -73,7 +74,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnOpenInEditor(wxCommandEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); }; diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp index 9e01585..dad7ea8 100644 --- a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp @@ -42,7 +42,7 @@ #include "images/FlIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMFileDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMFileDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMFileDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFileDescriptionPanel::OnBtnOpenFolder) EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMFileDescriptionPanel::OnBtnOpenWithCommand) END_EVENT_TABLE() @@ -84,10 +84,20 @@ void wxCDMFileDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->file->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -163,12 +173,21 @@ void wxCDMFileDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } -void wxCDMFileDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->file->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h index dd4e366..01ad444 100644 --- a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMFile.h" @@ -74,7 +75,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); void OnBtnOpenWithCommand(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp index e0669cf..19627ed 100644 --- a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp @@ -41,7 +41,7 @@ #include "images/FdIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists) EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMFolderDescriptionPanel::OnBtnCreateClass) @@ -85,10 +85,20 @@ void wxCDMFolderDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->folder->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -146,12 +156,21 @@ void wxCDMFolderDescriptionPanel::CreateControls() sizer->SetSizeHints(this); } -void wxCDMFolderDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMFolderDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->folder->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h index e273114..b4f6083 100644 --- a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMFolder.h" @@ -73,7 +74,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); void OnBtnCreateClass(wxCommandEvent& event); void OnBtnCreateFolder(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index 6167c17..56c2615 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -42,7 +42,7 @@ #include "images/LbIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMLibDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMLibDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(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) @@ -86,10 +86,21 @@ void wxCDMLibDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->lib->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); { @@ -243,12 +254,21 @@ void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) } -void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMLibDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->lib->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h index bcf23ff..dca3cea 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h @@ -77,7 +77,7 @@ protected: void OnBtnCreateLibrary(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); void OnLnkLibrarySelect(wxHyperlinkEvent& event); - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); void OnMouseEnter(wxMouseEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp index 8d72c28..f24d4d4 100644 --- a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp @@ -43,7 +43,7 @@ #include "images/LIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMLibraryDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMLibraryDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMLibraryDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMLibraryDescriptionPanel::OnBtnSetExeName) EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMLibraryDescriptionPanel::OnBtnCreateClass) EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnCreateFolder) @@ -88,10 +88,21 @@ void wxCDMLibraryDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->library->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); { @@ -175,12 +186,21 @@ void wxCDMLibraryDescriptionPanel::CreateControls() } } -void wxCDMLibraryDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMLibraryDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->library->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMLibraryDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h index c6c60e3..66e3063 100644 --- a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h @@ -37,6 +37,7 @@ #include #include +#include #include "modelCDMLibrary.h" @@ -74,7 +75,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnSetExeName(wxCommandEvent& event); void OnBtnCreateClass(wxCommandEvent& event); void OnBtnCreateFolder(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp index d4348fa..12b9152 100644 --- a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp @@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE(wxCDMPackageDescriptionPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMPackageDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMPackageDescriptionPanel::OnBtnReturn) EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMPackageDescriptionPanel::OnBtnSetAuthor) EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMPackageDescriptionPanel::OnBtnSetVersion) EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMPackageDescriptionPanel::OnBtnSetDescription) @@ -96,10 +96,20 @@ void wxCDMPackageDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->package->GetParents(); + for (int i = 0; i < parents.size(); i++) + { + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < parents.size()-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -233,12 +243,21 @@ void wxCDMPackageDescriptionPanel::CreateControls() } } -void wxCDMPackageDescriptionPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMPackageDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) { - wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); - newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId()); - newEvent->SetId(0); - wxPostEvent(this->GetParent(), *newEvent); + std::vector parents = this->package->GetParents(); + std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + //std::cout << parentURL << std::endl; + for (int i = 0; i < parents.size(); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetInt(parents[i]->GetId()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } } void wxCDMPackageDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h index 2f9d937..1601f04 100644 --- a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h @@ -77,7 +77,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnBtnSetAuthor(wxCommandEvent& event); void OnBtnSetVersion(wxCommandEvent& event); diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp index a888f8b..cc6b9fc 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -43,7 +43,7 @@ #include "images/PkIcon64.xpm" BEGIN_EVENT_TABLE(wxCDMPackageManagerPanel, wxPanel) -EVT_BUTTON(ID_BUTTON_PREV, wxCDMPackageManagerPanel::OnBtnReturn) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMPackageManagerPanel::OnBtnReturn) EVT_HYPERLINK(ID_LINK_SELECT_PACKAGE, wxCDMPackageManagerPanel::OnLnkPackageSelect) EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerPanel::OnBtnCreatePackage) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_CLICKED, wxCDMPackageManagerPanel::OnBtnCreatePackage) @@ -89,9 +89,9 @@ void wxCDMPackageManagerPanel::CreateControls() wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); //Link to return - wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project")); - returnbt->SetToolTip(wxT("Return to the active project description.")); - sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5); + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(this->project->GetName()), crea::std2wx(this->project->GetPath())); + returnLnk->SetToolTip(wxT("Return to the active project description.")); + sizer->Add(returnLnk, 0, wxALIGN_CENTER | wxALL, 5); //Header wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); @@ -172,7 +172,7 @@ modelCDMProject* wxCDMPackageManagerPanel::GetProject() const return this->project; } -void wxCDMPackageManagerPanel::OnBtnReturn(wxCommandEvent& event) +void wxCDMPackageManagerPanel::OnBtnReturn(wxHyperlinkEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); newEvent->SetInt(project->GetId()); diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h index 7c59cea..8990868 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h @@ -79,7 +79,7 @@ private: //handlers protected: - void OnBtnReturn(wxCommandEvent& event); + void OnBtnReturn(wxHyperlinkEvent& event); void OnLnkPackageSelect(wxHyperlinkEvent& event); void OnBtnCreatePackage(wxCommandEvent& event); void OnBtnEditCMakeLists(wxCommandEvent& event); -- 2.45.1