From 6a43a8cc1e5216f06e41799fbe154b2b1ef6d44b Mon Sep 17 00:00:00 2001 From: Daniel Felipe Gonzalez Date: Thu, 24 Jan 2013 21:37:08 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation - Changes for windows compatibility Tree hangs because of ids impossibility of recognition. - Fix warnings because of < operator. - Change to use of stable functions. --- appli/creaDevManager/creaDevManager.cpp | 1 + appli/creaSed/creaSed.cpp | 4 +- lib/creaDevManagerLib/CDMUtilities.cpp | 4 +- lib/creaDevManagerLib/modelCDMAppli.cpp | 16 ++++---- lib/creaDevManagerLib/modelCDMApplication.cpp | 20 +++++----- lib/creaDevManagerLib/modelCDMBlackBox.cpp | 6 +-- lib/creaDevManagerLib/modelCDMFolder.cpp | 10 ++--- lib/creaDevManagerLib/modelCDMLib.cpp | 16 ++++---- lib/creaDevManagerLib/modelCDMLibrary.cpp | 18 ++++----- lib/creaDevManagerLib/modelCDMMain.cpp | 18 +++++++-- lib/creaDevManagerLib/modelCDMPackage.cpp | 28 +++++++------- lib/creaDevManagerLib/modelCDMPackageSrc.cpp | 22 +++++------ lib/creaDevManagerLib/modelCDMProject.cpp | 38 +++++++++++-------- .../modelCDMProjectsTree.cpp | 2 +- .../wxCDMAppliDescriptionPanel.cpp | 14 +++---- .../wxCDMApplicationDescriptionPanel.cpp | 6 +-- .../wxCDMBlackBoxDescriptionPanel.cpp | 6 +-- .../wxCDMCMakeListsDescriptionPanel.cpp | 6 +-- .../wxCDMFileDescriptionPanel.cpp | 6 +-- .../wxCDMFolderDescriptionPanel.cpp | 6 +-- .../wxCDMLibDescriptionPanel.cpp | 14 +++---- .../wxCDMLibraryDescriptionPanel.cpp | 6 +-- lib/creaDevManagerLib/wxCDMMainFrame.cpp | 34 +++++++---------- .../wxCDMPackageDescriptionPanel.cpp | 14 +++---- .../wxCDMPackageManagerPanel.cpp | 8 ++-- .../wxCDMProjectsTreeCtrl.cxx | 27 +++++++------ lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h | 2 +- src/creaSystem.cxx | 2 +- 28 files changed, 182 insertions(+), 172 deletions(-) diff --git a/appli/creaDevManager/creaDevManager.cpp b/appli/creaDevManager/creaDevManager.cpp index 36c64ed..d47907a 100644 --- a/appli/creaDevManager/creaDevManager.cpp +++ b/appli/creaDevManager/creaDevManager.cpp @@ -30,6 +30,7 @@ #include "creaDevManager.h" IMPLEMENT_APP(wxCreaDevManagerApp) +CREA_WXMAIN_WITH_CONSOLE wxCreaDevManagerApp::wxCreaDevManagerApp():wxApp() { diff --git a/appli/creaSed/creaSed.cpp b/appli/creaSed/creaSed.cpp index 0f9927b..95ddc72 100644 --- a/appli/creaSed/creaSed.cpp +++ b/appli/creaSed/creaSed.cpp @@ -72,8 +72,8 @@ int main(int argc, char **argv) findstring = argv[2]; replacestring = argv[3]; - ffIn = fopen(fileIn.c_str(),"r"); - if (ffIn){ + errno_t errorOpen = fopen_s(&ffIn, fileIn.c_str(),"r"); + if (!errorOpen && ffIn){ while(!feof(ffIn)){ fgets( strTmp , 255, ffIn ); lineStr=strTmp; diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index 4d40954..29ed9c0 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -87,7 +87,7 @@ namespace CDMUtilities if(0 < pathSplit.size()) pathFixed = pathSplit[0]; - for (int i = 1; i < pathSplit.size(); i++) + for (int i = 1; i < (int)(pathSplit.size()); i++) { pathFixed += CDMUtilities::SLASH + pathSplit[i]; } @@ -162,7 +162,7 @@ namespace CDMUtilities std::vector words; splitter::split(words,name," \\/\",.'`",splitter::no_empties); std::string fixedName = ""; - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { fixedName += words[i]; } diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 586c550..4f61e13 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -191,7 +191,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) std::string applicationName = stdfileName; //check if application already exist bool found = false; - for (int i = 0; !found && i < this->applications.size(); i++) + for (int i = 0; !found && i < (int)(this->applications.size()); i++) { if (this->applications[i]->GetName() == applicationName) { @@ -214,7 +214,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) { //check if folder already exist bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -259,7 +259,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -281,7 +281,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) } } - for (int i = 0; i < checkedApplications.size(); i++) + for (int i = 0; i < (int)(checkedApplications.size()); i++) { if(!checkedApplications[i]) { @@ -290,7 +290,7 @@ const bool modelCDMAppli::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -311,7 +311,7 @@ void modelCDMAppli::CheckStructure(std::map& properties) if(this->CMakeLists != NULL) { //set properties parameters based on model - for (int i = 0; i < this->applications.size(); i++) + for (int i = 0; i < (int)(this->applications.size()); i++) properties["appli add " + this->applications[i]->GetName()] = false; //open cmakelists @@ -333,7 +333,7 @@ void modelCDMAppli::CheckStructure(std::map& properties) { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -371,7 +371,7 @@ void modelCDMAppli::CheckStructure(std::map& properties) } //check libraries' structure - for (int i = 0; i < this->applications.size(); i++) + for (int i = 0; i < (int)(this->applications.size()); i++) { properties["application " + this->applications[i]->GetName()] = true; this->applications[i]->CheckStructure(properties); diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index 56c9e08..40fb810 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -82,7 +82,7 @@ modelCDMApplication::modelCDMApplication(modelCDMIProjectTreeNode* parent, const if(wordBits[0] == "EXE_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -176,7 +176,7 @@ bool modelCDMApplication::SetExecutableName(const std::string& fileName, std::st std::vector words; CDMUtilities::splitter::split(words, fileName, ", /\\\"", CDMUtilities::splitter::no_empties); std::string fileNameReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { fileNameReal += "-" + words[i]; } @@ -262,7 +262,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) if(wordBits[0] == "EXE_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -290,7 +290,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) std::string applicationName = stdfileName; //check if they already exist bool found = false; - for (int i = 0; !found && i < this->folders.size(); i++) + for (int i = 0; !found && i < (int)(this->folders.size()); i++) { if (this->folders[i]->GetName() == applicationName) { @@ -336,7 +336,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -400,7 +400,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) } } - for (int i = 0; i < checkedFolders.size(); i++) + for (int i = 0; i < (int)(checkedFolders.size()); i++) { if(!checkedFolders[i]) { @@ -409,7 +409,7 @@ const bool modelCDMApplication::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -456,7 +456,7 @@ void modelCDMApplication::CheckStructure(std::map& properties { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -485,7 +485,7 @@ void modelCDMApplication::CheckStructure(std::map& properties { if (words[0] == "${EXE_NAME}_LINK_LIBRARIES") { - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { properties["application " + this->name + " lib " + words[i]] = true; } @@ -498,7 +498,7 @@ void modelCDMApplication::CheckStructure(std::map& properties CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { properties["application " + this->name + " dir " + words[i]] = true; } diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.cpp b/lib/creaDevManagerLib/modelCDMBlackBox.cpp index c92c677..295a433 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.cpp +++ b/lib/creaDevManagerLib/modelCDMBlackBox.cpp @@ -132,7 +132,7 @@ bool modelCDMBlackBox::SetAuthors(const std::string& authors, std::string*& resu std::vector words; CDMUtilities::splitter::split(words, authors, "/\\\"\n", CDMUtilities::splitter::no_empties); std::string authorsReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { authorsReal += "," + words[i]; } @@ -192,7 +192,7 @@ bool modelCDMBlackBox::SetCategories( std::vector words; CDMUtilities::splitter::split(words, categories, "\"\\/", CDMUtilities::splitter::no_empties); std::string catsReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { catsReal += "," + words[i]; } @@ -251,7 +251,7 @@ bool modelCDMBlackBox::SetDescription( std::vector words; CDMUtilities::splitter::split(words, description, "\"\n\\/", CDMUtilities::splitter::no_empties); std::string descReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { descReal += "-" + words[i]; } diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index ca83e05..bcef483 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -107,7 +107,7 @@ modelCDMFolder::~modelCDMFolder() { this->folders.clear(); this->CMakeLists = NULL; - for (int i = 0; i < this->children.size(); i++) + for (int i = 0; i < (int)(this->children.size()); i++) { if(this->children[i] != NULL) { @@ -186,7 +186,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) std::string stdfileName = crea::wx2std(fileName); //check if they already exist bool found = false; - for (int i = 0; !found && i < this->folders.size(); i++) + for (int i = 0; !found && i < (int)(this->folders.size()); i++) { if (this->folders[i]->GetName() == stdfileName) { @@ -233,7 +233,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) else { bool found = false; - for (int i = 0;!found && i < this->children.size(); i++) + for (int i = 0;!found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -255,7 +255,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) } } - for (int i = 0; i < checkedFolders.size(); i++) + for (int i = 0; i < (int)(checkedFolders.size()); i++) { if(!checkedFolders[i]) { @@ -264,7 +264,7 @@ const bool modelCDMFolder::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index e09cf2d..57411ec 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -193,7 +193,7 @@ const bool modelCDMLib::Refresh(std::string*& result) std::string libraryName = stdfileName; //check if library already exist bool found = false; - for (int i = 0; !found && i < this->libraries.size(); i++) + for (int i = 0; !found && i < (int)(this->libraries.size()); i++) { if (this->libraries[i]->GetName() == libraryName) { @@ -216,7 +216,7 @@ const bool modelCDMLib::Refresh(std::string*& result) { //check if folder already exist bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -260,7 +260,7 @@ const bool modelCDMLib::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -282,7 +282,7 @@ const bool modelCDMLib::Refresh(std::string*& result) } } - for (int i = 0; i < checkedLibraries.size(); i++) + for (int i = 0; i < (int)(checkedLibraries.size()); i++) { if(!checkedLibraries[i]) { @@ -291,7 +291,7 @@ const bool modelCDMLib::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -312,7 +312,7 @@ void modelCDMLib::CheckStructure(std::map& properties) if(this->CMakeLists != NULL) { //set properties parameters based on model - for (int i = 0; i < this->libraries.size(); i++) + for (int i = 0; i < (int)(this->libraries.size()); i++) properties["lib add " + libraries[i]->GetName()] = false; //open cmakelists @@ -334,7 +334,7 @@ void modelCDMLib::CheckStructure(std::map& properties) { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -372,7 +372,7 @@ void modelCDMLib::CheckStructure(std::map& properties) } //check libraries' structure - for (int i = 0; i < this->libraries.size(); i++) + for (int i = 0; i < (int)(this->libraries.size()); i++) { properties["library " + this->libraries[i]->GetName()] = true; this->libraries[i]->CheckStructure(properties); diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index f67999c..58cc892 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -81,7 +81,7 @@ modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::st if(wordBits[0] == "LIBRARY_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -151,7 +151,7 @@ bool modelCDMLibrary::SetNameLibrary(const std::string& fileName, std::string*& std::vector words; CDMUtilities::splitter::split(words, fileName, ", /\\\"", CDMUtilities::splitter::no_empties); std::string fileNameReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { fileNameReal += "-" + words[i]; } @@ -236,7 +236,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) if(wordBits[0] == "LIBRARY_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -263,7 +263,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) std::string stdfileName = crea::wx2std(fileName); //check if they already exist bool found = false; - for (int i = 0; !found && i < this->folders.size(); i++) + for (int i = 0; !found && i < (int)(this->folders.size()); i++) { if (this->folders[i]->GetName() == stdfileName) { @@ -309,7 +309,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -331,7 +331,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) } } - for (int i = 0; i < checkedFolders.size(); i++) + for (int i = 0; i < (int)(checkedFolders.size()); i++) { if(!checkedFolders[i]) { @@ -340,7 +340,7 @@ const bool modelCDMLibrary::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -389,7 +389,7 @@ void modelCDMLibrary::CheckStructure(std::map& properties) { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -418,7 +418,7 @@ void modelCDMLibrary::CheckStructure(std::map& properties) { if (words[0] == "${LIBRARY_NAME}_LINK_LIBRARIES") { - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { properties["library " + this->name + " lib " + words[i]] = true; } diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index 7b47e90..58469c2 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -176,10 +176,15 @@ bool modelCDMMain::OpenProject( //check if Makefile file exists std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile"; - FILE* pFile = fopen(pathMakefile.c_str(), "r"); - + FILE* pFile; +#ifdef _WIN32 + errno_t errorOpen = fopen_s(&pFile, pathMakefile.c_str(), "r"); +#else + pFile = fopen(pathMakefile.c_str(), "r"); + bool errorOpen = (pFile == NULL); +#endif //is the binary folder - if (pFile != NULL) + if (!errorOpen && pFile) { fclose(pFile); std::ifstream readFile; @@ -206,10 +211,15 @@ bool modelCDMMain::OpenProject( std::string pathSource = ""; //check if CMakeLists file exists std::string pathCMakeLists = pathFixed + CDMUtilities::SLASH + "CMakeLists.txt"; +#ifdef _WIN32 + errorOpen = fopen_s(&pFile, pathCMakeLists.c_str(), "r"); +#else pFile = fopen(pathCMakeLists.c_str(), "r"); + errorOpen = (pFile == NULL); +#endif //is the source folder - if (pFile != NULL) + if (!errorOpen && pFile) { fclose(pFile); std::ifstream readFile; diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 0f001bb..78b6adf 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -76,7 +76,7 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st if(wordBits[0] == "BBTK_PACKAGE_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -88,7 +88,7 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -100,7 +100,7 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -214,7 +214,7 @@ bool modelCDMPackage::SetAuthors(const std::string& authors, std::string*& resul std::vector words; CDMUtilities::splitter::split(words, authors, ",\n", CDMUtilities::splitter::no_empties); std::string authorsReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { authorsReal += "/" + words[i]; } @@ -312,7 +312,7 @@ bool modelCDMPackage::SetDescription(const std::string& description, std::string std::vector words; CDMUtilities::splitter::split(words, description, " \n", CDMUtilities::splitter::no_empties); std::string descriptionReal = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { descriptionReal += " " + words[i]; } @@ -395,7 +395,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) if(wordBits[0] == "BBTK_PACKAGE_NAME") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -407,7 +407,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -419,7 +419,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION") { word = wordBits[1]; - for (int i = 2; i < wordBits.size(); i++) + for (int i = 2; i < (int)(wordBits.size()); i++) { word += " " + wordBits[i]; } @@ -484,7 +484,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) //check if folder already exist bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -529,7 +529,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -556,7 +556,7 @@ const bool modelCDMPackage::Refresh(std::string*& result) this->src = NULL; } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -594,7 +594,7 @@ void modelCDMPackage::CheckStructure(std::map& properties) { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -655,7 +655,7 @@ void modelCDMPackage::CheckStructure(std::map& properties) } else if (words[0] == "${BBTK_PACKAGE_NAME}_INCLUDE_DIRS") { - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "${" || words[i].substr(0,2) == "..") properties["package " + this->name + " dir " + words[i]] = true; @@ -663,7 +663,7 @@ void modelCDMPackage::CheckStructure(std::map& properties) } else if (words[0] == "${BBTK_PACKAGE_NAME}_LIBS") { - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { properties["package " + this->name + " lib " + words[i]] = true; } diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index a5f3080..17c37a2 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -116,7 +116,7 @@ modelCDMPackageSrc::modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const s modelCDMPackageSrc::~modelCDMPackageSrc() { - for (int i = 0; i < this->blackBoxes.size(); i++) + for (int i = 0; i < (int)(this->blackBoxes.size()); i++) { if(this->blackBoxes[i] != NULL) { @@ -147,7 +147,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( std::vector words; CDMUtilities::splitter::split(words, name, " \n\",/\\'", CDMUtilities::splitter::no_empties); std::string bbName; - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { bbName += words[i]; } @@ -158,7 +158,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( if(words.size() > 0) { bbCategories = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { bbCategories += "," + words[i]; } @@ -172,7 +172,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( if(words.size() > 0) { bbAuthors = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { bbAuthors += "," + words[i]; } @@ -186,7 +186,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( if(words.size() > 0) { bbDescription = words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { bbDescription += "," + words[i]; } @@ -196,7 +196,7 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( if(words.size() > 0) { bbDescription += words[0]; - for (int i = 1; i < words.size(); i++) + for (int i = 1; i < (int)(words.size()); i++) { bbDescription += words[i]; } @@ -297,7 +297,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) std::string folderName = stdfileName; //check if they already exist bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == folderName) { @@ -340,7 +340,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -362,7 +362,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) if(stdfileName.substr(stdfileName.size() - 2, 2) == ".h" && stdfileName.substr(0,2) == "bb") { bool found = false; - for (int i = 0; i < this->blackBoxes.size(); i++) + for (int i = 0; i < (int)(this->blackBoxes.size()); i++) { if(this->blackBoxes[i]->GetHeaderFile()->GetName() == stdfileName) { @@ -386,7 +386,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) } } - for (int i = 0; i < checkedBoxes.size(); i++) + for (int i = 0; i < (int)(checkedBoxes.size()); i++) { if(!checkedBoxes[i]) { @@ -397,7 +397,7 @@ const bool modelCDMPackageSrc::Refresh(std::string*& result) } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 51f642a..2996910 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -87,7 +87,7 @@ modelCDMProject::modelCDMProject( CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); this->name = this->nameProject = ""; - for (int i = 0; i < nameBits.size(); i++) + for (int i = 0; i < (int)(nameBits.size()); i++) { if(i != 0) this->name += " "; @@ -261,10 +261,16 @@ bool modelCDMProject::SetVersion(const std::string& version, std::string*& resul CDMUtilities::splitter::split(vers, version, " .", CDMUtilities::splitter::no_empties); time_t now = time(0); - tm* ltm = localtime(&now); + + tm ltm; +#ifdef _WIN32 + localtime_s(<m, &now); +#else + ltm = *(localtime(&now)); +#endif std::stringstream date; - date << ltm->tm_mday << "/" << 1 + ltm->tm_mon << "/" << 1900 + ltm->tm_year; + date << ltm.tm_mday << "/" << 1 + ltm.tm_mon << "/" << 1900 + ltm.tm_year; //set name of library in CMakeLists inside copied folder std::string line; @@ -337,7 +343,7 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( CDMUtilities::splitter::split(words,name," ",CDMUtilities::splitter::no_empties); std::string nameFixed = ""; - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { nameFixed += words[i]; } @@ -345,7 +351,7 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( words.clear(); CDMUtilities::splitter::split(words,authors," ",CDMUtilities::splitter::no_empties); std::string authorFixed; - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { authorFixed += words[i]; } @@ -353,13 +359,13 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( words.clear(); std::string descriptionFixed; CDMUtilities::splitter::split(words,authorsEmail," ",CDMUtilities::splitter::no_empties); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { descriptionFixed += words[i]; } words.clear(); CDMUtilities::splitter::split(words,description," ",CDMUtilities::splitter::no_empties); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { descriptionFixed += "_" + words[i]; } @@ -463,7 +469,7 @@ const bool modelCDMProject::Refresh(std::string*& result) CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); this->name = this->nameProject = ""; - for (int i = 0; i < nameBits.size(); i++) + for (int i = 0; i < (int)(nameBits.size()); i++) { if(i != 0) this->name += " "; @@ -556,7 +562,7 @@ const bool modelCDMProject::Refresh(std::string*& result) else if(stdfileName.size() > 9 && stdfileName.substr(0,5) == "bbtk_" && stdfileName.substr(stdfileName.size()-4,4) == "_PKG") { bool found = false; - for (int i = 0; !found && i < this->packages.size(); i++) + for (int i = 0; !found && i < (int)(this->packages.size()); i++) { if (this->packages[i]->GetName() == stdfileName) { @@ -580,7 +586,7 @@ const bool modelCDMProject::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -626,7 +632,7 @@ const bool modelCDMProject::Refresh(std::string*& result) else { bool found = false; - for (int i = 0; !found && i < this->children.size(); i++) + for (int i = 0; !found && i < (int)(this->children.size()); i++) { if (this->children[i]->GetName() == stdfileName) { @@ -648,7 +654,7 @@ const bool modelCDMProject::Refresh(std::string*& result) } } - for (int i = 0; i < checkedPackages.size(); i++) + for (int i = 0; i < (int)(checkedPackages.size()); i++) { if(!checkedPackages[i]) { @@ -657,7 +663,7 @@ const bool modelCDMProject::Refresh(std::string*& result) i--; } } - for (int i = 0; i < checked.size(); i++) + for (int i = 0; i < (int)(checked.size()); i++) { if(!checked[i]) { @@ -802,7 +808,7 @@ void modelCDMProject::CheckStructure(std::map& properties) //set properties parameters based on model properties["project add appli"] = this->appli != NULL; properties["project add lib"] = this->lib != NULL; - for (int i = 0; i < this->packages.size(); i++) + for (int i = 0; i < (int)(this->packages.size()); i++) properties["project add " + packages[i]->GetName()] = false; //open cmakelists @@ -824,7 +830,7 @@ void modelCDMProject::CheckStructure(std::map& properties) { word = words[0]; CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); - for (int i = 0; i < words.size(); i++) + for (int i = 0; i < (int)(words.size()); i++) { if(words[i].substr(0,2) == "//") break; @@ -922,7 +928,7 @@ void modelCDMProject::CheckStructure(std::map& properties) //check lib's structure this->lib->CheckStructure(properties); //check packages' structure - for (int i = 0; i < this->packages.size(); i++) + for (int i = 0; i < (int)(this->packages.size()); i++) { properties["package " + this->packages[i]->GetName()] = true; this->packages[i]->CheckStructure(properties); diff --git a/lib/creaDevManagerLib/modelCDMProjectsTree.cpp b/lib/creaDevManagerLib/modelCDMProjectsTree.cpp index 06b9fb9..7e00d95 100755 --- a/lib/creaDevManagerLib/modelCDMProjectsTree.cpp +++ b/lib/creaDevManagerLib/modelCDMProjectsTree.cpp @@ -109,7 +109,7 @@ void modelCDMProjectsTree::SetRoot(std::string path) } path = "/"; - for (int i = 0; i < breadcrumbs.size()-1; i++) + for (int i = 0; i < (int)(breadcrumbs.size())-1; i++) { path += breadcrumbs[i] + "/"; } diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp index 7d59be0..7c087cb 100644 --- a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp @@ -91,12 +91,12 @@ void wxCDMAppliDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->appli->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -123,7 +123,7 @@ void wxCDMAppliDescriptionPanel::CreateControls() wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); std::vector applications = this->appli->GetApplications(); - for (int i = 0; i < applications.size(); i++) + for (int i = 0; i < (int)(applications.size()); i++) { wxHyperlinkCtrl* pApplicationlk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str())); pApplicationlk->SetWindowStyle(wxALIGN_LEFT); @@ -235,7 +235,7 @@ void wxCDMAppliDescriptionPanel::OnLnkApplicationSelect(wxHyperlinkEvent& event) { modelCDMApplication* applicationFound = NULL; std::vector applications = this->appli->GetApplications(); - for (int i = 0; i < applications.size(); i++) + for (int i = 0; i < (int)(applications.size()); i++) { if(applications[i]->GetName() == crea::wx2std(event.GetURL())) { @@ -259,7 +259,7 @@ void wxCDMAppliDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { @@ -284,7 +284,7 @@ void wxCDMAppliDescriptionPanel::OnMouseEnter(wxMouseEvent& event) std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMApplication* theApp = NULL; std::vector applications = this->appli->GetApplications(); - for (int i = 0; i < applications.size(); i++) + for (int i = 0; i < (int)(applications.size()); i++) { if(applications[i]->GetName() == AppName) { @@ -304,7 +304,7 @@ void wxCDMAppliDescriptionPanel::OnMouseExit(wxMouseEvent& event) std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMApplication* theApp = NULL; std::vector applications = this->appli->GetApplications(); - for (int i = 0; i < applications.size(); i++) + for (int i = 0; i < (int)(applications.size()); i++) { if(applications[i]->GetName() == AppName) { diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp index 1ccf435..ec904c7 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp @@ -92,12 +92,12 @@ void wxCDMApplicationDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->application->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -203,7 +203,7 @@ void wxCDMApplicationDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp index 19385fe..0d2eb5d 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp @@ -91,12 +91,12 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->blackBox->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -214,7 +214,7 @@ void wxCDMBlackBoxDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp index 6fd19d5..da4047d 100644 --- a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp @@ -85,12 +85,12 @@ void wxCDMCMakeListsDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->cMakeLists->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -144,7 +144,7 @@ void wxCDMCMakeListsDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp index 990f3ec..3f0e5f5 100644 --- a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp @@ -87,12 +87,12 @@ void wxCDMFileDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->file->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -178,7 +178,7 @@ void wxCDMFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp index 61a98cb..1da28aa 100644 --- a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp @@ -88,12 +88,12 @@ void wxCDMFolderDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->folder->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -161,7 +161,7 @@ void wxCDMFolderDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index 551d12c..4cb2837 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -89,12 +89,12 @@ void wxCDMLibDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->lib->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -120,7 +120,7 @@ void wxCDMLibDescriptionPanel::CreateControls() wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); std::vector libraries = this->lib->GetLibraries(); - for (int i = 0; i < libraries.size(); i++) + for (int i = 0; i < (int)(libraries.size()); i++) { wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str())); pLibrarylk->SetWindowStyle(wxALIGN_LEFT); @@ -232,7 +232,7 @@ void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) { modelCDMLibrary* theLibrary = NULL; std::vector libraries = this->lib->GetLibraries(); - for (int i = 0; i < libraries.size(); i++) + for (int i = 0; i < (int)(libraries.size()); i++) { if(libraries[i]->GetName() == crea::wx2std(event.GetURL())) { @@ -258,7 +258,7 @@ void wxCDMLibDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { @@ -283,7 +283,7 @@ void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event) std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMLibrary* theLibrary = NULL; std::vector libraries = this->lib->GetLibraries(); - for (int i = 0; i < libraries.size(); i++) + for (int i = 0; i < (int)(libraries.size()); i++) { if(libraries[i]->GetName() == LibName) { @@ -303,7 +303,7 @@ void wxCDMLibDescriptionPanel::OnMouseExit(wxMouseEvent& event) std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMLibrary* theLibrary = NULL; std::vector libraries = this->lib->GetLibraries(); - for (int i = 0; i < libraries.size(); i++) + for (int i = 0; i < (int)(libraries.size()); i++) { if(libraries[i]->GetName() == LibName) { diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp index 52d0d27..4bbf234 100644 --- a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp @@ -91,12 +91,12 @@ void wxCDMLibraryDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->library->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -191,7 +191,7 @@ void wxCDMLibraryDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index ad37e22..45dc8e5 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -29,6 +29,7 @@ #include "wxCDMMainFrame.h" #include +#include #include #include "creaSystem.h" @@ -274,13 +275,7 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) event.Skip(); return; } - - //populate tree control - tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject()); - tree_Projects->Unselect(); - tree_Projects->SelectItem(this->model->GetProject()->GetId()); - - + //show project actions panel if(this->panel_ProjectActions != NULL) { @@ -288,7 +283,7 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) this->panel_ProjectActions->Destroy(); this->panel_ProjectActions = NULL; } - + panel_ProjectActions = new wxCDMProjectActionsPanel( this, this->model->GetProject(), @@ -298,18 +293,16 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) wxSize(800,200), 0 ); - panel_ProjectActions->SetMinSize(wxSize(500, 100)); - - + auiManager.AddPane(panel_ProjectActions, wxAuiPaneInfo().Bottom().MinSize(800,50).Name(wxT("panel_ProjectActions")).Caption(wxT("General Project Actions")).BestSize(800,70).CloseButton(false)); - auiManager.Update(); - //wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION); - + //populate tree control + tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject()); + tree_Projects->Unselect(); + tree_Projects->SelectItem(this->model->GetProject()->GetId()); + wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR); } - - event.Skip(); } void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) { @@ -353,7 +346,7 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) //populate tree control tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); tree_Projects->Unselect(); - tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); + tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); @@ -597,15 +590,16 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) //get selected element wxTreeItemId elementId = event.GetItem(); - if(this->tree_Projects->IsSelected(elementId)) + if(elementId.IsOk() && this->tree_Projects->IsSelected(elementId)) { std::cout << "Tree Selection id: " << elementId << std::endl; //get element from model modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId]; + if (element == NULL) return; std::cout << "Tree Selection: " << element->GetName() << std::endl; - + //TODO get element type //project modelCDMProject* elementProject = dynamic_cast(element); @@ -646,7 +640,7 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) { //application modelCDMApplication* elementApplication = dynamic_cast(element); - if(elementApplication != NULL) + if(elementApplication != NULL) { //create element description description = new wxCDMApplicationDescriptionPanel( diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp index 2c8882e..a286867 100644 --- a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp @@ -99,12 +99,12 @@ void wxCDMPackageDescriptionPanel::CreateControls() //Links to return wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); std::vector parents = this->package->GetParents(); - for (int i = 0; i < parents.size(); i++) + for (int i = 0; i < (int)(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) + if (i < (int)(parents.size())-1) { linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } @@ -183,7 +183,7 @@ void wxCDMPackageDescriptionPanel::CreateControls() std::vector blackBoxes = this->package->GetSrc()->GetBlackBoxes(); - for (int i = 0; i < blackBoxes.size(); i++) + for (int i = 0; i < (int)(blackBoxes.size()); i++) { if(blackBoxes[i] != NULL) @@ -248,7 +248,7 @@ void wxCDMPackageDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) 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++) + for (int i = 0; i < (int)(parents.size()); i++) { if (parents[i]->GetPath() == parentURL) { @@ -341,7 +341,7 @@ void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event) { modelCDMBlackBox* bb; std::vector bbs = this->package->GetSrc()->GetBlackBoxes(); - for (int i = 0; i < bbs.size(); i++) + for (int i = 0; i < (int)(bbs.size()); i++) { if(bbs[i]->GetName() == crea::wx2std(event.GetURL())) { @@ -438,7 +438,7 @@ void wxCDMPackageDescriptionPanel::OnMouseEnter(wxMouseEvent& event) modelCDMFile* bbHeader = NULL; std::vector boxes = this->package->GetSrc()->GetBlackBoxes(); - for (int i = 0; i < boxes.size(); i++) + for (int i = 0; i < (int)(boxes.size()); i++) { if(boxes[i]->GetName() == BBName) { @@ -458,7 +458,7 @@ void wxCDMPackageDescriptionPanel::OnMouseExit(wxMouseEvent& event) std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMFile* bbHeader = NULL; std::vector boxes = this->package->GetSrc()->GetBlackBoxes(); - for (int i = 0; i < boxes.size(); i++) + for (int i = 0; i < (int)(boxes.size()); i++) { if(boxes[i]->GetName() == BBName) { diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp index cd3adf3..3176c56 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -113,7 +113,7 @@ void wxCDMPackageManagerPanel::CreateControls() wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); std::vector packages = this->project->GetPackages(); - for (int i = 0; i < packages.size(); i++) + for (int i = 0; i < (int)(packages.size()); i++) { wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str())); pPackagelk->SetWindowStyle(wxALIGN_LEFT); @@ -184,7 +184,7 @@ void wxCDMPackageManagerPanel::OnLnkPackageSelect(wxHyperlinkEvent& event) { modelCDMPackage* thePackage = NULL; std::vector packages = this->project->GetPackages(); - for (int i = 0; i < packages.size(); i++) + for (int i = 0; i < (int)(packages.size()); i++) { if(packages[i]->GetName() == crea::wx2std(event.GetURL())) { @@ -268,7 +268,7 @@ void wxCDMPackageManagerPanel::OnMouseEnter(wxMouseEvent& event) std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); modelCDMPackage* thePackage = NULL; std::vector packages = this->project->GetPackages(); - for (int i = 0; i < packages.size(); i++) + for (int i = 0; i < (int)(packages.size()); i++) { if(packages[i]->GetName() == PkgName) { @@ -289,7 +289,7 @@ void wxCDMPackageManagerPanel::OnMouseExit(wxMouseEvent& event) modelCDMPackage* thePackage = NULL; std::vector packages = this->project->GetPackages(); project->GetPackages(); - for (int i = 0; i < packages.size(); i++) + for (int i = 0; i < (int)(packages.size()); i++) { if(packages[i]->GetName() == PkgName) { diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index 3b47119..af393af 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -36,6 +36,7 @@ #include "wxCDMProjectsTreeCtrl.h" #include +#include #include @@ -109,42 +110,40 @@ void wxCDMProjectsTreeCtrl::BuildTree(std::map< wxTreeItemId, modelCDMIProjectTr modelElements.clear(); if(projectTree != NULL) { - wxTreeItemId rootIndex; - rootIndex= this-> AddRoot(crea::std2wx(projectTree->GetName()), this->ID_PrIcon, this->ID_PrIcon); - projectTree->SetId(rootIndex); - modelElements[rootIndex] = projectTree; + projectTree->SetId(this->AddRoot(crea::std2wx(projectTree->GetName()), this->ID_PrIcon)); + + modelElements[projectTree->GetId()] = projectTree; std::cout << "Building TreeCtrl for " << projectTree->GetName() << std::endl; - this->BuildTree(projectTree->GetChildren(), modelElements, rootIndex); + this->BuildTree(projectTree->GetChildren(), modelElements, projectTree->GetId()); - this->Expand(rootIndex); + this->Expand(projectTree->GetId()); this->Update(); } else { - wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"), this->ID_Cicon, this->ID_Cicon); + wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"), this->ID_Cicon); } } -void wxCDMProjectsTreeCtrl::BuildTree(const std::vector& treeNodes, std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, wxTreeItemId parent) +void wxCDMProjectsTreeCtrl::BuildTree(const std::vector& treeNodes, std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, const wxTreeItemId& parent) { - for (int i = 0; i < treeNodes.size(); i++) + for (int i = 0; i < (int)(treeNodes.size()); i++) { //cout << projectsTree[i].GetName() << endl; - wxTreeItemId parentNodeIndex; if(treeNodes[i] != NULL) { int idIcon = GetIconId(treeNodes[i]); wxString nodeName((treeNodes[i]->GetName()).c_str(), wxConvUTF8); - parentNodeIndex = this->AppendItem(parent, nodeName, idIcon, idIcon); - treeNodes[i]->SetId(parentNodeIndex); - modelElements[parentNodeIndex] = treeNodes[i]; + treeNodes[i]->SetId(this->AppendItem(parent, nodeName, idIcon)); + + modelElements[treeNodes[i]->GetId()] = treeNodes[i]; std::vector innerChildren = treeNodes[i]->GetChildren(); if(innerChildren.size() > 0) { - this->BuildTree(innerChildren, modelElements, parentNodeIndex); + this->BuildTree(innerChildren, modelElements, treeNodes[i]->GetId()); } } diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h index 87958dd..33f21f4 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -152,7 +152,7 @@ private: * @param modelElements Id->node map. * @param parent ID of the root node ID. */ - void BuildTree(const std::vector& tree, std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, wxTreeItemId parent); + void BuildTree(const std::vector& tree, std::map< wxTreeItemId, modelCDMIProjectTreeNode* >& modelElements, const wxTreeItemId& parent); /** * Retrieves the icon ID of the given node by its type. * @param node Node to search its icon. diff --git a/src/creaSystem.cxx b/src/creaSystem.cxx index eaac8f9..26a071e 100644 --- a/src/creaSystem.cxx +++ b/src/creaSystem.cxx @@ -117,7 +117,7 @@ int System::GetAppPath(char *pname, size_t pathsize) } } - if ((access(pname, 0) == 0)) + if ((_access(pname, 0) == 0)) return 0; /* file exists, return OK */ /*else name doesn't seem to exist, return FAIL (falls through) */ -- 2.45.0