#include "modelCDMMain.h"
-#include<iostream>
-#include<string>
+
+#include <cstdlib>
+#include <iostream>
+#include <string>
#include <cstdio>
#include <fstream>
const std::string& author,
const std::string& description)
{
- //TODO: implement method
+ std::cout << "Open selection path: "<< location << std::endl;
+ //get fixed location
+ std::string locationFixed = CDMUtilities::fixPath(location);
+ std::cout << "Opening path: "<< locationFixed << std::endl;
+
+ //TODO: create Project given the source folder
+
+#if(_WIN32)
+
+ std::string command("creaNewProject.bat ");
+ std::string command1("creaSed.exe ");
+ std::string command2("del ");
+
+ 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
+ {
+ result = new std::string("An error occured while running '" + command + "'.");
+ return false;
+ }
+
+#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
+ {
+ result = new std::string("An error occured while running '" + command + "'.");
+ return false;
+ }
+
+#endif
+
+
+
return true;
}
std::string*& result
)
{
- std::cout << "Selection path: "<< path << std::endl;
-
+ std::cout << "Open selection path: "<< path << std::endl;
//get fixed path
std::string pathFixed = CDMUtilities::fixPath(path);
- std::cout << "Fixed selection path: "<< pathFixed << std::endl;
+ std::cout << "Opening path: "<< pathFixed << std::endl;
//check if its binaries' folder
bool isBinary = false;
while(!isBinary && readFile >> word)
{
- //cout << word << endl;
if(word == "CMAKE_SOURCE_DIR")
{
readFile >> word;
# 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.
# ------------------------------------------------------------------------
-*/
+ */
#include "wxCDMMainFrame.h"
BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
- EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
- EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
- EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
- EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
- EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
- EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
- EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
- EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
- EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
- EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
- EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
- EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
- EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
- EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
- EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
- EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
- EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
- EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
- EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
- EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
- EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
- EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
- EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
- EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
- EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
+EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
+EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
+EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
+EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
+EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
+EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
+EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
+EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
+EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
+EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
+EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
+EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
+EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
+EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
+EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
+EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
+EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
+EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
+EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
+EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
+EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
+EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
+EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
+EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
+EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
END_EVENT_TABLE()
wxCDMMainFrame::wxCDMMainFrame(
- wxWindow* parent,
- wxWindowID id,
- const wxString& caption,
- const wxPoint& pos,
- const wxSize& size,
- long style
+ wxWindow* parent,
+ wxWindowID id,
+ const wxString& caption,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style
)
{
Create(parent, id, caption, pos, size, style);
}
bool wxCDMMainFrame::Create(
- wxWindow* parent,
- wxWindowID id,
- const wxString& caption,
- const wxPoint& pos,
- const wxSize& size,
- long style
+ wxWindow* parent,
+ wxWindowID id,
+ const wxString& caption,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style
)
{
wxFrame::Create(parent, id, caption, pos, size, style);
tree_Projects = new wxCDMProjectsTreeCtrl(
- this,
- ID_TREE_PROJECTS,
- wxDefaultPosition,
- wxSize(300,400),
- wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
+ this,
+ ID_TREE_PROJECTS,
+ wxDefaultPosition,
+ wxSize(300,400),
+ wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
);
tree_Projects->SetMinSize(wxSize(200,200));
panel_Properties = new wxCDMMainDescriptionPanel(
- this,
- ID_WINDOW_PROPERTIES,
- wxT("Description Panel"),
- wxDefaultPosition,
- wxSize(300, 400),
- 0
+ this,
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0
);
panel_ProjectActions = new wxCDMProjectActionsPanel(
- this,
- ID_WINDOW_PROJ_ACTIONS,
- wxT("Project Actions Panel"),
- wxDefaultPosition,
- wxSize(600,200),
- 0
+ this,
+ ID_WINDOW_PROJ_ACTIONS,
+ wxT("Project Actions Panel"),
+ wxDefaultPosition,
+ wxSize(600,200),
+ 0
);
panel_ProjectActions->SetMinSize(wxSize(500, 100));
userResponse = dialog->ShowModal();
if(userResponse == wxID_FORWARD)
- {
- //TODO createProject
- std::cerr << "should create Project here" << std::endl;
- //tree_Projects->BuildTree(this->model->GetActiveProjects());
- }
+ {
+ std::string* result;
+ if(!this->model->CreateProject(
+ crea::wx2std(dialog->GetProjectName()),
+ crea::wx2std(dialog->GetProjectLocation()),
+ result,
+ crea::wx2std(dialog->GetPackageAuthor()),
+ crea::wx2std(dialog->GetPackageDescription())
+ ))
+ {
+ 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());
+ auiManager.Update();
+ }
event.Skip();
}
long userResponse;
userResponse = FD->ShowModal();
if(userResponse == wxID_OK)
- {
- std::cout << "selection: " << crea::wx2std (FD->GetPath()) << std::endl;
- std::string path = CDMUtilities::fixPath(crea::wx2std (FD->GetPath()));
- std::cout << "fixed selection: " << path << std::endl;
- std::string* result;
- if (!this->model->OpenProject(path, result))
{
- wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
- event.Skip();
- };
- //TODO: Create tree control
- //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
-
- auiManager.Update();
- }
+ std::cout << "Selection to open: " << crea::wx2std (FD->GetPath()) << std::endl;
+ std::string path = crea::wx2std (FD->GetPath());
+
+ 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());
+ auiManager.Update();
+ }
event.Skip();
}