+++ /dev/null
-/*
-# ---------------------------------------------------------------------
-#
-# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
-# pour la Sant�)
-# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
-# Previous Authors : Laurent Guigues, Jean-Pierre Roux
-# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
-#
-# This software is governed by the CeCILL-B license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL-B
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-# or in the file LICENSE.txt.
-#
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-#
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL-B license and that you accept its terms.
-# ------------------------------------------------------------------------
-*/
-
-
-/*
- * ControlCreaDevManagerProject.cpp
- *
- * Created on: 5/11/2012
- * Author: Daniel Felipe Gonzalez Obando
- */
-
-#include "ControlCreaDevManagerProject.h"
-
-#include <creaWx.h>
-#include <wx/dirdlg.h>
-#include <stdlib.h> // for getenv
-
-ControlCreaDevManagerProject::ControlCreaDevManagerProject()
-{
- // TODO Auto-generated constructor stub
-
-}
-
-ControlCreaDevManagerProject::~ControlCreaDevManagerProject()
-{
- // TODO Auto-generated destructor stub
-}
-
-bool ControlCreaDevManagerProject::CreateProject(const std::string& name, const std::string& dir, const std::string& author, const std::string& description)
-{
- // ------ Windows
-#if(_WIN32)
-
- std::string command("creaNewProject.bat ");
- std::string command1("creaSed.exe ");
- std::string command2("del ");
-
- command += "\"" + dir + "\" \"" + name + "\"";
- command1 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + dir + "\\" + name + "\\CMakeLists.txt\"";
- command2 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\"";
- if ( ! system ( command.c_str() ) )
- {
- system ( command1.c_str() );
- system ( command2.c_str() );
-
- // Create a Package at the same time. JPR
- char *author = author.c_str();
- std::string nomDirectory = dir + "\\" + name;
- std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
- std::string bbCreatePackage("bbCreatePackage ");
- bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
- system (bbCreatePackage.c_str());
- std::string add;
- add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
- system(add.c_str());
-
- wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
- }
- else
- {
- wxString err(_T("An error occured while running '"));
- err += crea::std2wx(command) + _T("'");
- wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);
- return false;
- }
-
-#else
- // ------ LINUX / MacOS
- std::string command("creaNewProject.sh ");
- command += "\"" + dir + "\"" +" " + name;
- std::cout << "executing " << command << std::endl;
- if ( ! system ( command.c_str() ) )
- {
- //wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
-
- std::string nomDirectory = dir + "/" + name;
- std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
-
- std::string bbCreatePackage("bbCreatePackage ");
- bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
- std::cout << "executing " << bbCreatePackage << std::endl;
- system (bbCreatePackage.c_str());
-
- std::string add;
- add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
- //std::cout << add << std::endl;
- std::cout << "executing " << add << std::endl;
- system(add.c_str());
-
- }
- else
- {
- wxString err(_T("An error occured while running '"));
- err += crea::std2wx(command) + _T("'");
- wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);
- return false;
- }
-
-#endif
-
- return true;
-}
+++ /dev/null
-/*
-# ---------------------------------------------------------------------
-#
-# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
-# pour la Sant�)
-# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
-# Previous Authors : Laurent Guigues, Jean-Pierre Roux
-# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
-#
-# This software is governed by the CeCILL-B license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL-B
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-# or in the file LICENSE.txt.
-#
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-#
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL-B license and that you accept its terms.
-# ------------------------------------------------------------------------
-*/
-
-
-/*
- * ControlCreaDevManagerProject.h
- *
- * Created on: 5/11/2012
- * Author: Daniel Felipe Gonzalez Obando
- */
-
-#ifndef CONTROLCREADEVMANAGERPROJECT_H_
-#define CONTROLCREADEVMANAGERPROJECT_H_
-
-#include <iostream>
-
-class ControlCreaDevManagerProject
-{
-public:
- ControlCreaDevManagerProject();
- ~ControlCreaDevManagerProject();
- static bool CreateProject(const std::string& name, const std::string& location, const std::string& author, const std::string& description);
-};
-
-#endif /* CONTROLCREADEVMANAGERPROJECT_H_ */
return true;
}
-bool modelCDMAppli::Refresh(std::string*& result)
+const bool modelCDMAppli::Refresh(std::string*& result)
{
//TODO: implement method
return true;
const std::string& path = "/"
);
bool OpenCMakeListsFile(std::string*& result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
private:
std::vector<modelCDMApplication*> applications;
return true;
}
-bool modelCDMApplication::Refresh(std::string*& result)
+const bool modelCDMApplication::Refresh(std::string*& result)
{
//TODO: implement method
return true;
const std::string& path = "/"
);
bool OpenCMakeListsFile(std::string* & result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
private:
std::string name;
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+/*
+ * modelCDMIProjectTreeNode.cpp
+ *
+ * Created on: Nov 26, 2012
+ * Author: Daniel Felipe Gonzalez Obando
+ */
+#include "modelCDMIProjectTreeNode.h"
+
+bool modelCDMIProjectTreeNode::CompareNodeItem(const modelCDMIProjectTreeNode& x, const modelCDMIProjectTreeNode& y)
+{
+ bool returnValue;
+ bool noWinner = true;
+ unsigned int i = 0;
+ std::string xName = x.GetName();
+ std::string yName = y.GetName();
+ unsigned char xType = x.GetType();
+ unsigned char yType = y.GetType();
+
+ while ((i < xName.length()) && (i < yName.length()))
+ {
+ if (tolower (xName[i]) < tolower (yName[i]))
+ {
+ noWinner = false;
+ returnValue = true;
+ break;
+ }
+ else if (tolower (xName[i]) > tolower (yName[i]))
+ {
+ noWinner = false;
+ returnValue = false;
+ break;
+ }
+ i++;
+ }
+
+ if(noWinner)
+ {
+ if (xName.length() < yName.length())
+ returnValue = true;
+ else
+ returnValue = false;
+ }
+
+ if(xType != yType)
+ {
+ if(xType == DT_DIR)
+ returnValue = true;
+ else
+ returnValue = false;
+ }
+
+ return returnValue;
+}
+
+const wxTreeItemId& modelCDMIProjectTreeNode::GetId() const
+{
+ return this->id;
+}
+
+const std::string& modelCDMIProjectTreeNode::GetPath() const
+{
+ return this->path;
+}
+
+const std::string& modelCDMIProjectTreeNode::GetName() const
+{
+ return this->name;
+}
+
+const unsigned char& modelCDMIProjectTreeNode::GetType() const
+{
+ return this->type;
+}
+
+const int& modelCDMIProjectTreeNode::GetLevel() const
+{
+ return this->level;
+}
+
+const std::vector<modelCDMIProjectTreeNode*>& modelCDMIProjectTreeNode::GetChildren() const
+{
+ return this->children;
+}
+
+void modelCDMIProjectTreeNode::SetId(const wxTreeItemId& id)
+{
+ this->id = id;
+}
+
+void modelCDMIProjectTreeNode::SetChildren(
+ const std::vector<modelCDMIProjectTreeNode*>& children)
+{
+ this->children.clear();
+ this->children = children;
+}
+
+const bool modelCDMIProjectTreeNode::Refresh(std::string*& result)
+{
+ //TODO: implement method
+ return false;
+}
+
+const bool modelCDMIProjectTreeNode::OpenInFileExplorer(std::string*& result) const
+{
+ //TODO: implement method
+ return false;
+}
#include <iostream>
#include <vector>
+#include <creaWx.h>
+#include "wx/treectrl.h"
class modelCDMIProjectTreeNode
{
public:
- virtual ~modelCDMIProjectTreeNode(){}
+ virtual ~modelCDMIProjectTreeNode() {}
+ static bool CompareNodeItem(const modelCDMIProjectTreeNode& x, const modelCDMIProjectTreeNode& y);
+
+ const wxTreeItemId& GetId() const;
const std::string& GetPath() const;
const std::string& GetName() const;
const unsigned char& GetType() const;
const int& GetLevel() const;
const std::vector<modelCDMIProjectTreeNode*>& GetChildren() const;
+ void SetId(const wxTreeItemId& id);
void SetChildren(const std::vector<modelCDMIProjectTreeNode*>& children);
- const bool& Refresh(std::string*& result);
- const bool& OpenInFileExplorer(std::string*& result) const;
+ virtual const bool Refresh(std::string*& result);
+ const bool OpenInFileExplorer(std::string*& result) const;
protected:
+ wxTreeItemId id;
std::string path;
std::string name;
unsigned char type;
return true;
}
-bool modelCDMLib::Refresh(std::string*& result)
+const bool modelCDMLib::Refresh(std::string*& result)
{
//TODO: implement method
return true;
const std::string& path = "/"
);
bool OpenCMakeListsFile(std::string*& result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
private:
std::vector<modelCDMLibrary*> libraries;
return true;
}
-bool modelCDMLibrary::Refresh(std::string*& result)
+const bool modelCDMLibrary::Refresh(std::string*& result)
{
//TODO: implement method
return true;
const std::string& path = "/"
);
bool OpenCMakeListsFile(std::string*& result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
private:
std::string name;
#include <fstream>
#include "CDMUtilities.h"
+#include "modelCDMProject.h"
modelCDMMain::modelCDMMain()
{
- //TODO: implement method
+ this->project = NULL;
}
modelCDMMain::~modelCDMMain()
{
- //TODO: implement method
+ if(project != NULL)
+ {
+ delete this->project;
+ this->project = NULL;
+ }
}
-const modelCDMProject* modelCDMMain::GetProject() const
+modelCDMProject* modelCDMMain::GetProject() const
{
- //TODO: implement method
return this->project;
}
std::string locationFixed = CDMUtilities::fixPath(location);
std::cout << "Opening path: "<< locationFixed << std::endl;
- //TODO: create Project given the source folder
-
+ //creates project in disk
#if(_WIN32)
std::string command("creaNewProject.bat ");
command += "\"" + locationFixed + "\" \"" + name + "\"";
command1 += "\"" + locationFixed +"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + locationFixed + "\\" + name + "\\CMakeLists.txt\"";
command2 += "\"" + locationFixed +"\\"+name+"\\CMakeLists.txt.in\"";
- if ( ! system ( command.c_str() ) )
- {
- system ( command1.c_str() );
- system ( command2.c_str() );
-
- // Create a Package at the same time. JPR
- char *author = author.c_str();
- std::string nomDirectory = locationFixed + "\\" + name;
- std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
- std::string bbCreatePackage("bbCreatePackage ");
- bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
- system (bbCreatePackage.c_str());
- std::string add;
- add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
- system(add.c_str());
- }
- else
+
+
+ if (system (command.c_str()))
{
result = new std::string("An error occured while running '" + command + "'.");
return false;
}
+ system ( command1.c_str() );
+ system ( command2.c_str() );
+
+ char *author = author.c_str();
+ std::string nomDirectory = locationFixed + "\\" + name;
+ std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
+ std::string bbCreatePackage("bbCreatePackage ");
+ bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
+ system (bbCreatePackage.c_str());
+ std::string add;
+ add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
+ system(add.c_str());
+
+ this->project = new modelCDMProject(nomDirectory);
+
#else
// ------ LINUX / MacOS
std::string command("creaNewProject.sh ");
command += "\"" + locationFixed + "\"" +" " + name;
- std::cout << "executing " << command << std::endl;
- if ( ! system ( command.c_str() ) )
- {
- std::string nomDirectory = locationFixed + "/" + name;
- std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
-
- std::string bbCreatePackage("bbCreatePackage ");
- bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
- std::cout << "executing " << bbCreatePackage << std::endl;
- system (bbCreatePackage.c_str());
-
- std::string add;
- add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
- //std::cout << add << std::endl;
- std::cout << "executing " << add << std::endl;
- system(add.c_str());
- }
- else
+ //std::cout << "executing " << command << std::endl;
+ if (system ( command.c_str() ) )
{
result = new std::string("An error occured while running '" + command + "'.");
return false;
}
-#endif
+ std::string nomDirectory = locationFixed + "/" + name;
+ std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
+
+ std::string bbCreatePackage("bbCreatePackage ");
+ bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
+ //std::cout << "executing " << bbCreatePackage << std::endl;
+ system (bbCreatePackage.c_str());
+
+ std::string add;
+ add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
+
+ //std::cout << "executing " << add << std::endl;
+ system(add.c_str());
+
+ this->project = new modelCDMProject(nomDirectory);
+#endif
return true;
}
std::string*& result
)
{
- std::cout << "Open selection path: "<< path << std::endl;
+ //std::cout << "Open selection path: "<< path << std::endl;
//get fixed path
std::string pathFixed = CDMUtilities::fixPath(path);
std::cout << "Opening path: "<< pathFixed << std::endl;
readFile.ignore();
getline(readFile, word, '\n');
pathBuild = pathFixed;
- pathFixed = word;
+ pathFixed = CDMUtilities::fixPath(word);
isBinary = true;
}
}
while(!isSource && !readFile.eof())
{
- std::getline(readFile,word,'\n');
- int pos = word.find("PROJECT");
- if(pos != std::string::npos)
+ std::getline(readFile,word,'(');
+ std::vector<std::string> wordBits;
+ CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties);
+
+ if(wordBits[wordBits.size()-1] == "PROJECT")
{
- pathSource = pathFixed;
isSource = true;
+ pathSource = pathFixed;
}
}
readFile.close();
//if is source folder
if(isSource)
{
- std::cout << "Project sources at: " << pathSource;
+ std::cout << "Project sources at: " << pathSource << std::endl;
if(isBinary)
{
- std::cout << ", and built in: " << pathBuild;
+ std::cout << ", and built in: " << pathBuild << std::endl;
+ this->project = new modelCDMProject(pathSource, pathBuild);
+ }
+ else
+ {
+ this->project = new modelCDMProject(pathSource);
}
- std::cout << std::endl;
}
else
{
return false;
}
- //TODO: create Project given the source folder
return true;
}
modelCDMMain();
~modelCDMMain();
- const modelCDMProject* GetProject() const;
+ modelCDMProject* GetProject() const;
bool CreateProject(
const std::string& name,
return true;
}
-bool modelCDMPackage::Refresh(std::string*& result)
+const bool modelCDMPackage::Refresh(std::string*& result)
{
//TODO: implement method
return true;
const std::string& description = "no description"
);
bool OpenCMakeListsFile(std::string*& result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
private:
std::string name;
#include "modelCDMProject.h"
+#include <iostream>
+#include <vector>
+#include <fstream>
+
+#include "CDMUtilities.h"
+#include "creaWx.h"
+#include "wx/dir.h"
+
modelCDMProject::modelCDMProject()
{
- //TODO: implement method
+ std::cout << "in constructor1" << std::endl;
+ this->appli = NULL;
+ this->lib = NULL;
}
modelCDMProject::modelCDMProject(
- const std::string& name,
const std::string& path,
- const unsigned char& type,
- const int& level
+ const std::string& buildPath
)
{
+ this->path = CDMUtilities::fixPath(path);
+ //open makelists file
+ std::string pathFixed(CDMUtilities::fixPath(path));
+
+ //TODO: set pathMakeLists for windows
+ std::string pathMakeLists = pathFixed + "/CMakeLists.txt";
+
+ std::ifstream confFile;
+ confFile.open((pathMakeLists).c_str());
+
+ std::string word;
+ while(confFile.is_open() && !confFile.eof())
+ {
+ //std::cout << "leyendo " << word << std::endl;
+ //get project name
+ std::getline(confFile,word,'(');
+ std::vector<std::string> wordBits;
+ CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties);
+
+ if(wordBits[wordBits.size()-1] == "PROJECT")
+ {
+ std::getline(confFile,word,')');
+ std::vector<std::string> nameBits;
+ CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties);
+
+ this->name = "";
+ for (int i = 0; i < nameBits.size(); i++)
+ {
+ if(i != 0)
+ this->name += " ";
+ this->name += nameBits[i];
+ }
+
+ }
+
+
+ if(wordBits[wordBits.size()-1] == "SET")
+ {
+ //get project version
+ std::getline(confFile,word,')');
+ if(word.find("PROJECT_MAJOR_VERSION") != std::string::npos)
+ {
+ std::vector<std::string> versionBits;
+ CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
+ version = versionBits[versionBits.size()-1];
+ }
+ if(word.find("PROJECT_MINOR_VERSION") != std::string::npos)
+ {
+ std::vector<std::string> versionBits;
+ CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
+ version += "." + versionBits[versionBits.size()-1];
+ }
+ if(word.find("PROJECT_BUILD_VERSION") != std::string::npos)
+ {
+ std::vector<std::string> versionBits;
+ CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
+ version += "." + versionBits[versionBits.size()-1];
+ }
+
+ //get project versionDate
+ if(word.find("PROJECT_VERSION_DATE") != std::string::npos)
+ {
+ std::vector<std::string> versionBits;
+ CDMUtilities::splitter::split(versionBits, word, " \"", CDMUtilities::splitter::no_empties);
+ versionDate = versionBits[versionBits.size()-1];
+ }
+ //get project buildPath
+
+ if (buildPath != "")
+ {
+ this->buildPath = buildPath;
+ }
+ else
+ {
+ this->buildPath = this->path + "Bin";
+ }
+ }
+ }
+ confFile.close();
+
+ this->type = wxDIR_DIRS;
+ this->level = 0;
+
//TODO: implement method
+ //if appli exist create Appli
+ this->appli = NULL;
+ //if lib exist create Lib
+ this->lib = NULL;
+ //if bbtk_* exist create Packages
+
+
+}
+
+modelCDMProject::~modelCDMProject()
+{
+ if(this->appli != NULL)
+ {
+ delete this->appli;
+ this->appli = NULL;
+ }
+ if(this->lib != NULL)
+ {
+ delete this->lib;
+ this->lib = NULL;
+ }
+ for (int i = 0; i < this->packages.size(); i++)
+ {
+ if(this->packages[i] != NULL)
+ {
+ delete this->packages[i];
+ this->packages[i] = NULL;
+ }
+ }
}
const std::string&
return true;
}
-bool modelCDMProject::Refresh(std::string*& result)
+const bool modelCDMProject::Refresh(std::string*& result)
{
//TODO: implement method
return true;
{
public:
modelCDMProject();
- modelCDMProject(const std::string& name, const std::string& path, const unsigned char& type, const int& level);
- ~modelCDMProject(){}
+ modelCDMProject(const std::string& path, const std::string& buildPath = "");
+ ~modelCDMProject();
+
+ void PopulateProject();
const std::string& GetName() const;
const std::string& GetVersion() const;
const std::string& description = "no description"
);
bool OpenCMakeListsFile(std::string*& result);
- bool Refresh(std::string*& result);
+ virtual const bool Refresh(std::string*& result);
bool ConfigureBuild(std::string*& result);
bool Build(std::string*& result);
bool Connect(std::string*& result);
if(userResponse == wxID_FORWARD)
{
+ //create project
std::string* result;
if(!this->model->CreateProject(
crea::wx2std(dialog->GetProjectName()),
{
wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
}
- wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
-
- //TODO: populate model
- //TODO: populate tree control
- //tree_Projects->BuildTree(this->model->GetActiveProjects());
+ //populate tree control
+ tree_Projects->BuildTree(this->model->GetProject());
auiManager.Update();
+
+ wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
}
event.Skip();
{
long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
- long userResponse;
- userResponse = FD->ShowModal();
+ long userResponse = FD->ShowModal();
if(userResponse == wxID_OK)
{
- std::cout << "Selection to open: " << crea::wx2std (FD->GetPath()) << std::endl;
std::string path = crea::wx2std (FD->GetPath());
+ FD -> Destroy();
+ FD = NULL;
+
+ std::cout << "Selection to open: " << path << std::endl;
+
+ //populate model
std::string* result;
if (!this->model->OpenProject(path, result))
{
wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
- event.Skip();
};
- //TODO: populate model
- //TODO: populate tree control
-
- //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
+ //populate tree control
+ tree_Projects->BuildTree(this->model->GetProject());
auiManager.Update();
}
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------
-*/
+ */
/*
return TRUE;
}
-void wxCDMProjectsTreeCtrl::BuildTree(const modelCDMProjectsTree& projectsTree)
+void wxCDMProjectsTreeCtrl::BuildTree(modelCDMProject* projectTree)
{
- this->DeleteAllItems();
- wxTreeItemId rootIndex = this-> AddRoot(_("Open Projects"));
- std::cout << "Building TreeCtrl for " << projectsTree.projectRoot.GetName() << std::endl;
- wxTreeItemId parentIndex = this-> AppendItem(rootIndex, wxString(projectsTree.projectRoot.GetName().c_str(), wxConvUTF8));
- this->BuildTree(projectsTree.projectRoot.GetChildren(), parentIndex);
+ if(projectTree != NULL)
+ {
+ this->DeleteAllItems();
+ wxTreeItemId rootIndex;
+ rootIndex= this-> AddRoot(crea::std2wx(projectTree->GetName()));
+ projectTree->SetId(rootIndex);
- this->Expand(rootIndex);
+ std::cout << "Building TreeCtrl for " << projectTree->GetName() << std::endl;
+ this->BuildTree(projectTree->GetChildren(), rootIndex);
- this->Update();
+ this->Expand(rootIndex);
+
+ this->Update();
+ }
}
-void wxCDMProjectsTreeCtrl::BuildTree(const std::vector<modelCDMProjectsTreeNode>& projectsTree, wxTreeItemId parent)
+void wxCDMProjectsTreeCtrl::BuildTree(const std::vector<modelCDMIProjectTreeNode*>& treeNodes, wxTreeItemId parent)
{
- for (int i = 0; i < projectsTree.size(); i++)
- {
- //cout << projectsTree[i].GetName() << endl;
- wxTreeItemId parentNodeIndex;
- wxString nodeName((projectsTree[i].GetName()).c_str(), wxConvUTF8);
- parentNodeIndex = this->AppendItem(parent, nodeName);
-
- std::vector<modelCDMProjectsTreeNode> innerChildren = projectsTree[i].GetChildren();
- if(innerChildren.size() > 0)
+ for (int i = 0; i < treeNodes.size(); i++)
{
- this->BuildTree(innerChildren, parentNodeIndex);
+ //cout << projectsTree[i].GetName() << endl;
+ wxTreeItemId parentNodeIndex;
+ if(treeNodes[i] != NULL)
+ {
+ wxString nodeName((treeNodes[i]->GetName()).c_str(), wxConvUTF8);
+ parentNodeIndex = this->AppendItem(parent, nodeName);
+ treeNodes[i]->SetId(parentNodeIndex);
+
+ std::vector<modelCDMIProjectTreeNode*> innerChildren = treeNodes[i]->GetChildren();
+ if(innerChildren.size() > 0)
+ {
+ this->BuildTree(innerChildren, parentNodeIndex);
+ }
+ }
+
}
- }
}
#include <creaWx.h>
#include <wx/treectrl.h>
-#include "modelCDMProjectsTree.h"
+#include "modelCDMProject.h"
+#include "modelCDMIProjectTreeNode.h"
#include <vector>
const wxString &name=_("Projects tree")
);
- void BuildTree(const modelCDMProjectsTree& tree);
+ void BuildTree(modelCDMProject* tree = NULL);
private:
- void BuildTree(const std::vector<modelCDMProjectsTreeNode>& tree, wxTreeItemId parent);
+ void BuildTree(const std::vector<modelCDMIProjectTreeNode*>& tree, wxTreeItemId parent);
};
#endif /* WXCDMPROJECTSTREECTRL_H_ */