wxCDMMainFrame* mainWindow = new wxCDMMainFrame(NULL);
SetTopWindow(mainWindow);
- mainWindow->SetSize(900, 700);
+ mainWindow->SetSize(750, 700);
mainWindow->Show(true);
std::cout << "Crea DevManager opened." << std::endl;
#include<vector>
#include<string>
-#include <cstdlib>
+#include<iostream>
+#include<fstream>
+#include<algorithm>
+#include<cstdlib>
namespace CDMUtilities
{
return system(comm.c_str());
}
+ bool createEmptyClass(const std::string& name, const std::string& path)
+ {
+ std::vector<std::string> words;
+ splitter::split(words,name," \\/\",.'`",splitter::no_empties);
+ std::string fixedName = "";
+ for (int i = 0; i < words.size(); i++)
+ {
+ fixedName += words[i];
+ }
+
+ if(fixedName == "" || path == "")
+ {
+ return false;
+ }
+
+ std::string nameupper = fixedName;
+ std::transform(nameupper.begin(), nameupper.end(),nameupper.begin(),::toupper);
+
+ std::ofstream out((path + SLASH + fixedName + ".h").c_str());
+ if( !out.is_open())
+ {
+ return false;
+ }
+
+ out << "/*" << std::endl;
+ out << "# ---------------------------------------------------------------------" << std::endl;
+ out << "#" << std::endl;
+ out << "# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image" << std::endl;
+ out << "# pour la Sante)" << std::endl;
+ out << "# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton" << std::endl;
+ out << "# Previous Authors : Laurent Guigues, Jean-Pierre Roux" << std::endl;
+ out << "# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil" << std::endl;
+ out << "#" << std::endl;
+ out << "# This software is governed by the CeCILL-B license under French law and" << std::endl;
+ out << "# abiding by the rules of distribution of free software. You can use," << std::endl;
+ out << "# modify and/ or redistribute the software under the terms of the CeCILL-B" << std::endl;
+ out << "# license as circulated by CEA, CNRS and INRIA at the following URL" << std::endl;
+ out << "# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" << std::endl;
+ out << "# or in the file LICENSE.txt." << std::endl;
+ out << "#" << std::endl;
+ out << "# As a counterpart to the access to the source code and rights to copy," << std::endl;
+ out << "# modify and redistribute granted by the license, users are provided only" << std::endl;
+ out << "# with a limited warranty and the software's author, the holder of the" << std::endl;
+ out << "# economic rights, and the successive licensors have only limited" << std::endl;
+ out << "# liability." << std::endl;
+ out << "#" << std::endl;
+ out << "# The fact that you are presently reading this means that you have had" << std::endl;
+ out << "# knowledge of the CeCILL-B license and that you accept its terms." << std::endl;
+ out << "# ------------------------------------------------------------------------" << std::endl;
+ out << "*/" << std::endl;
+ out << "" << std::endl;
+ out << "#ifndef _" << nameupper << "_H_" << std::endl;
+ out << "#define _" << nameupper << "_H_" << std::endl;
+ out << "" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "// Class Name: " << fixedName << "" << std::endl;
+ out << "// [classdescription]" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "" << std::endl;
+ out << "class " << fixedName << "" << std::endl;
+ out << "{" << std::endl;
+ out << "" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "//Methods and attributes exposed to other classes" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "public :" << std::endl;
+ out << " " << fixedName << "();" << std::endl;
+ out << " ~" << fixedName << "();" << std::endl;
+ out << "" << std::endl;
+ out << "//--Method template----------------------------" << std::endl;
+ out << "// void FunctionName(int& parameterA);" << std::endl;
+ out << "" << std::endl;
+ out << "" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "//Methods and attributes exposed only to classes" << std::endl;
+ out << "//that are derived from this class" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "protected:" << std::endl;
+ out << "" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "//Methods and attributes only visible by this class" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "private:" << std::endl;
+ out << "" << std::endl;
+ out << "};" << std::endl;
+ out << "" << std::endl;
+ out << "//-end of _" << nameupper << "_H_------------------------------------------------------" << std::endl;
+ out << "#endif" << std::endl;
+
+ out.close();
+
+ out.open((path + CDMUtilities::SLASH + fixedName + ".cpp").c_str());
+ if( !out.is_open())
+ {
+ return false;
+ }
+
+ out << "/*" << std::endl;
+ out << "# ---------------------------------------------------------------------" << std::endl;
+ out << "#" << std::endl;
+ out << "# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image" << std::endl;
+ out << "# pour la Sante)" << std::endl;
+ out << "# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton" << std::endl;
+ out << "# Previous Authors : Laurent Guigues, Jean-Pierre Roux" << std::endl;
+ out << "# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil" << std::endl;
+ out << "#" << std::endl;
+ out << "# This software is governed by the CeCILL-B license under French law and" << std::endl;
+ out << "# abiding by the rules of distribution of free software. You can use," << std::endl;
+ out << "# modify and/ or redistribute the software under the terms of the CeCILL-B" << std::endl;
+ out << "# license as circulated by CEA, CNRS and INRIA at the following URL" << std::endl;
+ out << "# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" << std::endl;
+ out << "# or in the file LICENSE.txt." << std::endl;
+ out << "#" << std::endl;
+ out << "# As a counterpart to the access to the source code and rights to copy," << std::endl;
+ out << "# modify and redistribute granted by the license, users are provided only" << std::endl;
+ out << "# with a limited warranty and the software's author, the holder of the" << std::endl;
+ out << "# economic rights, and the successive licensors have only limited" << std::endl;
+ out << "# liability." << std::endl;
+ out << "#" << std::endl;
+ out << "# The fact that you are presently reading this means that you have had" << std::endl;
+ out << "# knowledge of the CeCILL-B license and that you accept its terms." << std::endl;
+ out << "# ------------------------------------------------------------------------" << std::endl;
+ out << "*/" << std::endl;
+ out << "" << std::endl;
+ out << "#include \"" << fixedName << ".h\"" << std::endl;
+ out << "" << std::endl;
+ out << "" << fixedName << "::" << fixedName << "()" << std::endl;
+ out << "{" << std::endl;
+ out << "}" << std::endl;
+ out << "" << std::endl;
+ out << "" << fixedName << "::~" << fixedName << "()" << std::endl;
+ out << "{" << std::endl;
+ out << "}" << std::endl;
+ out << "" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "//Method template" << std::endl;
+ out << "//---------------------------------------------" << std::endl;
+ out << "/*" << std::endl;
+ out << "void " << fixedName << "::FunctionName(int& parameterA)" << std::endl;
+ out << "{" << std::endl;
+ out << " parameterA = 2 * parameterA;" << std::endl;
+ out << " return;" << std::endl;
+ out << "}" << std::endl;
+ out << "*/" << std::endl;
+
+ return true;
+ }
+
}
int openBBEditor();
int openCreaToolsTools();
int openTerminal(const std::string& command = "");
+ bool createEmptyClass(const std::string& name, const std::string& path);
};
#endif /* CDMUTILITIES_H_ */
{
std::string stdfileName = crea::wx2std(fileName);
- modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->applications.push_back(application);
- this->children.push_back(application);
+ if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
+ {
+ modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->applications.push_back(application);
+ this->children.push_back(application);
+ }
+ else
+ {
+ modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
cont = dir.GetNext(&fileName);
}
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
- std::string applicationName = stdfileName;
- //check if they already exist
- bool found = false;
- for (int i = 0; !found && i < this->applications.size(); i++)
+
+ if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
{
- if (this->applications[i]->GetName() == applicationName)
+ std::string applicationName = stdfileName;
+ //check if application already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->applications.size(); i++)
{
- found = true;
- int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
- checked[pos] = true;
- checkedApplications[i] = true;
- if(!this->applications[i]->Refresh(result))
- return false;
+ if (this->applications[i]->GetName() == applicationName)
+ {
+ found = true;
+ int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
+ checked[pos] = true;
+ checkedApplications[i] = true;
+ if(!this->applications[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->applications.push_back(application);
+ this->children.push_back(application);
}
}
- if(!found)
+ else
{
- modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->applications.push_back(application);
- this->children.push_back(application);
+ //check if folder already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->children.size(); i++)
+ {
+ if (this->children[i]->GetName() == stdfileName)
+ {
+ found = true;
+ checked[i] = true;
+
+ if(!this->children[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
}
cont = dir.GetNext(&fileName);
}
this->children.clear();
}
+bool modelCDMFolder::CreateClass(const std::string& name)
+{
+ if (!CDMUtilities::createEmptyClass(name, this->path))
+ {
+ return false;
+ }
+ else
+ {
+ this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
+ this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
+ this->SortChildren();
+ return true;
+ }
+}
+
modelCDMFolder* modelCDMFolder::CreateFolder(const std::string& name, std::string*& result)
{
//TODO:: mkdir depending on OS
modelCDMCMakeListsFile* GetCMakeLists() const;
std::vector<modelCDMFolder*> GetFolders() const;
+ bool CreateClass(const std::string& name);
+
modelCDMFolder* CreateFolder(
const std::string& name,
std::string*& result
{
std::string stdfileName = crea::wx2std(fileName);
- modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->libraries.push_back(library);
- this->children.push_back(library);
+ if(stdfileName != "template_lib")
+ {
+ modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->libraries.push_back(library);
+ this->children.push_back(library);
+ }
+ else
+ {
+ modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
cont = dir.GetNext(&fileName);
}
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
- std::string libraryName = stdfileName;
- //check if they already exist
- bool found = false;
- for (int i = 0; !found && i < this->libraries.size(); i++)
+
+ if(stdfileName != "template_lib")
{
- if (this->libraries[i]->GetName() == libraryName)
+ std::string libraryName = stdfileName;
+ //check if library already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->libraries.size(); i++)
{
- found = true;
- int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
- checked[pos] = true;
- checkedLibraries[i] = true;
- if(!this->libraries[i]->Refresh(result))
- return false;
+ if (this->libraries[i]->GetName() == libraryName)
+ {
+ found = true;
+ int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
+ checked[pos] = true;
+ checkedLibraries[i] = true;
+ if(!this->libraries[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->libraries.push_back(library);
+ this->children.push_back(library);
}
}
- if(!found)
+ else
{
- modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->libraries.push_back(library);
- this->children.push_back(library);
+ //check if folder already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->children.size(); i++)
+ {
+ if (this->children[i]->GetName() == stdfileName)
+ {
+ found = true;
+ checked[i] = true;
+ if(!this->children[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
}
cont = dir.GetNext(&fileName);
}
for (int i = 0; i < 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);
std::string tt = "Name: " + applications[i]->GetName() + "\n";
tt += "Location: " + applications[i]->GetPath();
pApplicationlk->SetToolTip(crea::std2wx(tt.c_str()));
pApplicationlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseEnter,NULL,this);
pApplicationlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseExit,NULL,this);
- propertiesPanelSizer -> Add(pApplicationlk, 0, wxALIGN_LEFT | wxALL, 5);
+ propertiesPanelSizer -> Add(pApplicationlk, 1, wxEXPAND | wxALL, 5);
}
propertiesPanel->SetSizer(propertiesPanelSizer);
propertiesPanelSizer->Fit(propertiesPanel);
- propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+ propertiesBox->Add(propertiesPanel, 1, wxEXPAND | wxALL, 5);
sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
//Actions
//actionsGrid Sizer
wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
- wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("A. Create Class"));
+ wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("Create Class (Optional)"));
createClassbt->SetToolTip(wxT("Create a new Class (.h and .cxx files)."));
wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder (Optional)"));
createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder."));
editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file inside this application."));
editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter,NULL,this);
editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseExit,NULL,this);
- wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Application Folder"));
+ wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("A. Open Application Folder"));
openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer."));
- actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
- actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
+ actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
+ actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5);
//SetPanel sizer and box
this->authortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetAuthors()));
wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_AUTHOR, wxT("Change"));
pAuthorbt->SetToolTip(wxT("Update the author/s of the package."));
- pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER_VERTICAL, 0);
- pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+ pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER, 0);
+ pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
// description
wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL);
this->descriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetDescription()));
wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_DESCRIPTION, wxT("Change"));
pDescriptionbt->SetToolTip(wxT("Update the description of the project."));
- pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER_VERTICAL, 0);
- pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+ pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER, 1);
+ pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
// categories
wxBoxSizer* pCategoriessz = new wxBoxSizer(wxHORIZONTAL);
this->categoriestc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetCategories()));
wxButton* pCategoriesbt = new wxButton(propertiesPanel, ID_BUTTON_SET_CATEGORY, wxT("Change"));
pCategoriesbt->SetToolTip(wxT("Update the categories of the project."));
- pCategoriessz->Add(this->categoriestc, 1, wxALIGN_CENTER_VERTICAL, 0);
- pCategoriessz->Add(pCategoriesbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+ pCategoriessz->Add(this->categoriestc, 1, wxALIGN_CENTER, 0);
+ pCategoriessz->Add(pCategoriesbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
propertiesGridSizer->Add(pAuthorsz, 1, wxEXPAND);
propertiesGridSizer->AddGrowableCol(1,1);
- propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
+ propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND | wxALL, 5);
propertiesPanel->SetSizer(propertiesPanelSizer);
propertiesPanelSizer->Fit(propertiesPanel);
- propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+ propertiesBox->Add(propertiesPanel, 1, wxEXPAND, 5);
sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
propertiesPanel->SetSizer(propertiesPanelSizer);
propertiesPanelSizer->Fit(propertiesPanel);
- propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+ propertiesBox->Add(propertiesPanel, 1, wxALL|wxEXPAND, 5);
sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMFolderDescriptionPanel::OnBtnCreateClass)
EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMFolderDescriptionPanel::OnBtnCreateFolder)
END_EVENT_TABLE()
}
}
+void wxCDMFolderDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
+{
+ //get class name from user
+ wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
+ this,
+ wxT("Please enter the new class name."),
+ wxT("New Class - creaDevManager"),
+ wxT(""),
+ wxOK | wxCANCEL
+ );
+
+ if (newClassDlg->ShowModal() == wxID_OK)
+ {
+ std::string className = crea::wx2std(newClassDlg->GetValue());
+ //check class name
+ if(className.size() > 0)
+ {
+ if(!this->folder->CreateClass(className))
+ wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+
+ ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
+
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetId(0);
+ newEvent->SetInt(folder->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+
+ wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+ }
+ }
+}
+
void wxCDMFolderDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
{
//get name
protected:
void OnBtnReturn(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
+ void OnBtnCreateClass(wxCommandEvent& event);
void OnBtnCreateFolder(wxCommandEvent& event);
void OnBtnOpenInExplorer(wxCommandEvent& event);
for (int i = 0; i < 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);
std::string tt = "Name: " + libraries[i]->GetName() + "\n";
tt += "Location: " + libraries[i]->GetPath();
pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
pLibrarylk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseEnter,NULL,this);
pLibrarylk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseExit,NULL,this);
- propertiesPanelSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
+ propertiesPanelSizer -> Add(pLibrarylk, 0, wxEXPAND | wxALL, 5);
}
propertiesPanel->SetSizer(propertiesPanelSizer);
propertiesPanelSizer->Fit(propertiesPanel);
- propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+ propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5);
sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
//Actions
void wxCDMLibraryDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
{
- //TODO: implement method
- std::cerr << "Event OnBtnCreateClass not implemented" << std::endl;
- event.Skip();
+ //get class name from user
+ wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
+ this,
+ wxT("Please enter the new class name."),
+ wxT("New Class - creaDevManager"),
+ wxT(""),
+ wxOK | wxCANCEL
+ );
+
+ if (newClassDlg->ShowModal() == wxID_OK)
+ {
+ std::string className = crea::wx2std(newClassDlg->GetValue());
+ //check class name
+ if(className.size() > 0)
+ {
+ if(!this->library->CreateClass(className))
+ wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+
+ ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
+
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetId(0);
+ newEvent->SetInt(library->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+
+ wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+ }
+ }
}
void wxCDMLibraryDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
{
case 0:
//select out old one to generate selection event
+ this->tree_Projects->SelectItem(event.GetInt(), false);
this->tree_Projects->SelectItem(event.GetInt(), true);
this->tree_Projects->Expand(event.GetInt());
break;
this->tree_Projects->EnsureVisible(event.GetInt());
this->tree_Projects->SetItemBold(event.GetInt(), true);
this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
+ this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(230,230,255));
this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
auiManager.Update();
}
{
this->tree_Projects->SetItemBold(event.GetInt(), false);
this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
+ this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(255,255,255));
this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
auiManager.Update();
}
{
wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()));
+ pBBlk->SetWindowStyle(wxALIGN_LEFT);
std::string tt = "Author: " + blackBoxes[i]->GetAuthors() + "\nDescription: " + blackBoxes[i]->GetDescription() + "\nCategories: " + blackBoxes[i]->GetCategories();
pBBlk->SetToolTip(crea::std2wx(tt));
pBBlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseEnter,NULL,this);
pBBlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseExit,NULL,this);
- BBPanelSizer -> Add(pBBlk, 0, wxALIGN_LEFT | wxALL, 5);
+ BBPanelSizer -> Add(pBBlk, 0, wxEXPAND | wxALL, 5);
}
}
BBPanel->SetSizer(BBPanelSizer);
BBPanelSizer->Fit(BBPanel);
- BBBox->Add(BBPanel, 0, wxALL, 5);
-
+ BBBox->Add(BBPanel, 1, wxEXPAND | wxALL, 5);
sizer -> Add(BBBox, 0, wxEXPAND | wxALL, 10);
//Actions
for (int i = 0; i < 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);
std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription();
pPackagelk->SetToolTip(crea::std2wx(tt));
- propertiesPanelSizer -> Add(pPackagelk, 0, wxALIGN_LEFT | wxALL, 5);
+ propertiesPanelSizer -> Add(pPackagelk, 0, wxEXPAND | wxALL, 5);
pPackagelk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseEnter,NULL,this);
pPackagelk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseExit,NULL,this);
}
propertiesPanel->SetSizer(propertiesPanelSizer);
propertiesPanelSizer->Fit(propertiesPanel);
- propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+ propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5);
sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);