#include <stdlib.h>
#include <iostream> // for std::cout
#include "creaDevManager.h"
-#include "wxCDMMainFrame.h"
IMPLEMENT_APP(wxCreaDevManagerApp)
bool wxCreaDevManagerApp::OnInit()
{
wxApp::OnInit();
-
- wxCDMMainFrame* mainWindow = new wxCDMMainFrame(NULL);
+ mainWindow = new wxCDMMainFrame(NULL);
SetTopWindow(mainWindow);
mainWindow->SetSize(750, 700);
mainWindow->Show(true);
-
std::cout << "Crea DevManager opened." << std::endl;
return true;
int wxCreaDevManagerApp::OnExit()
{
+ mainWindow->Destroy();
wxApp::OnExit();
std::cout << "Crea DevManager closed." << std::endl;
return 0;
#ifndef CREADEVMANAGER_H_
#define CREADEVMANAGER_H_
+#include "wxCDMMainFrame.h"
+
/**
* Crea Development Manager
* Developed by Daniel Felipe González Obando for CREATIS.
*/
virtual int OnExit();
+private:
+ wxCDMMainFrame* mainWindow;
+
};
DECLARE_APP(wxCreaDevManagerApp)
#if(_WIN32)
// ------ Windows
- //TODO: implementation for windows
+ std::vector<std::string> pathSplit;
+
+ splitter::split(pathSplit, path, CDMUtilities::SLASH, splitter::no_empties);
+
+ if(0 < pathSplit.size())
+ pathFixed = pathSplit[0];
+
+ for (int i = 1; i < pathSplit.size(); i++)
+ {
+ pathFixed += CDMUtilities::SLASH + pathSplit[i];
+ }
#else
// ------ LINUX / MacOS
//break path into folders
- std::vector<std::string> pathSlpit;
+ std::vector<std::string> pathSplit;
- splitter::split(pathSlpit, path, CDMUtilities::SLASH, splitter::no_empties);
+ splitter::split(pathSplit, path, CDMUtilities::SLASH, splitter::no_empties);
- for (int i = 0; i < pathSlpit.size(); i++)
+ for (int i = 0; i < pathSplit.size(); i++)
{
- pathFixed += CDMUtilities::SLASH + pathSlpit[i];
+ pathFixed += CDMUtilities::SLASH + pathSplit[i];
}
#endif
return pathFixed;
*/
#ifdef _WIN32
// ------ Windows
- //TODO: implementation for windows
+ static std::string TEXT_EDITOR = "notepad";
#elif __APPLE__
// ------ Apple
//TODO: implementation for apple
*/
#ifdef _WIN32
// ------ Windows
- //TODO: implementation for windows
+ static std::string FILE_EXPLORER = "explorer";
#elif __APPLE__
// ------ Apple
//TODO: implementation for apple
*/
#ifdef _WIN32
// ------ Windows
- //TODO: implementation for windows
+ static std::string TERMINAL = "start cmd.exe";
#elif __APPLE__
// ------ Apple
//TODO: implementation for apple
std::string command2("del ");
command += "\"" + locationFixed + "\" \"" + name + "\"";
- command1 += "\"" + locationFixed +CDMUtilities::SLASH+name+CDMUtilities::SLASH+"CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + locationFixed + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\"";
- command2 += "\"" + locationFixed +CDMUtilities::SLASH+name+CDMUtilities::SLASH+"CMakeLists.txt.in\"";
-
+ command1 += "\"" + locationFixed + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.in\" " + "PROJECT_NAME " + name + "> \"" + locationFixed + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\"";
+ command2 += "\"" + locationFixed + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.in\"";
if (system (command.c_str()))
{
return false;
}
- system ( command1.c_str() );
- system ( command2.c_str() );
+ if (system (command1.c_str()))
+ {
+ result = new std::string("An error occurred while running '" + command1 + "'.");
+ return false;
+ }
+ if (system (command2.c_str()))
+ {
+ result = new std::string("An error occurred while running '" + command2 + "'.");
+ return false;
+ }
- char *author = author.c_str();
std::string nomDirectory = locationFixed + CDMUtilities::SLASH + name;
std::string nomPackageDirectory = nomDirectory + CDMUtilities::SLASH + "bbtk_" + name + "_PKG";
std::string bbCreatePackage("bbCreatePackage ");
bbCreatePackage += "\"" + nomDirectory + "\" \"" + name + "\" \"" + author + "\" \"" + description + "\"";
- system (bbCreatePackage.c_str());
+ if (!system (bbCreatePackage.c_str()))
+ {
+ result = new std::string("An error occurred while running '" + bbCreatePackage + "'.");
+ return false;
+ }
std::string add;
add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> \"" + nomDirectory + CDMUtilities::SLASH + "CMakeLists.txt\"";
- system(add.c_str());
+ if (system (add.c_str()))
+ {
+ result = new std::string("An error occurred while running '" + add + "'.");
+ return false;
+ }
- this->project = new modelCDMProject(nomDirectory, name);
+ this->project = new modelCDMProject(NULL, nomDirectory, name);
#else
// ------ LINUX / MacOS
if(xType != yType)
{
- if(xType == DT_DIR)
+ if(xType == wxDIR_DIRS)
returnValue = true;
else
returnValue = false;
if(!projectFound)
{
- this->projectRoot = modelCDMProjectsTreeNode(path,name,DT_DIR,0);
+ this->projectRoot = modelCDMProjectsTreeNode(path,name,wxDIR_DIRS ,0);
}else{
std::cout << "already existing ";
}
long style
)
{
+ this->menu_File = NULL;
+ this->menu_Edit = NULL;
+ this->menu_Tools = NULL;
+ this->menu_Help = NULL;
+ this->panel_Properties = NULL;
+ this->panel_ProjectActions = NULL;
+ this->tree_Projects = NULL;
Create(parent, id, caption, pos, size, style);
}
ID_TREE_PROJECTS,
wxDefaultPosition,
wxSize(200,400),
- wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
+ wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
);
panel_Properties = new wxCDMMainDescriptionPanel(
0
);
-
-
-
-
-
-
auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
-
- wxString pers = auiManager.SavePerspective();
-
auiManager.Update();
- auiManager.LoadPerspective(pers,true);
+ //auiManager.LoadPerspective(pers,true);
wxToolTip::Enable(true);
wxToolTip::SetDelay(0);
}
}
}
+
if(!this->model->CreateProject(
crea::wx2std(dialog->GetProjectName()),
crea::wx2std(dialog->GetProjectLocation()),
if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
{
std::cout << "error closing project: " << *result << std::endl;
- wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
}
tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
-
if(this->panel_Properties != NULL)
{
auiManager.DetachPane(this->panel_Properties);
this->panel_Properties->Destroy();
this->panel_Properties = NULL;
}
-
+
if(this->panel_ProjectActions != NULL)
{
auiManager.DetachPane(this->panel_ProjectActions);
this->panel_ProjectActions->Destroy();
this->panel_ProjectActions = NULL;
}
-
+
Close();
- event.Skip();
}
//Edit Menu
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<modelCDMProject*>(element);
{
wxTreeCtrl::Create (parent, id, pos, size, style, validator, name);
+ this->DeleteAllItems();
+
wxImageList* images = new wxImageList(20, 20, true);
this->ID_AIcon = images->Add(wxIcon(AIcon20));
this->ID_ApIcon = images->Add(wxIcon(ApIcon20));
this->ID_PkIcon = images->Add(wxIcon(PkIcon20));
this->AssignImageList(images);
- wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"), this->ID_Cicon, this->ID_Cicon);
+ wxTreeItemId rootId = AddRoot(wxT("Root"), 0, 0);
+/*
+ wxTreeItemId rootIndex = this->AddRoot(wxT("No Open Project"), this->ID_Cicon, this->ID_Cicon);*/
this->Update();
return TRUE;
}