From: unknown Date: Mon, 11 Feb 2013 15:27:47 +0000 (+0100) Subject: Feature #1711 CreaDevManager application implementation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e6d99bba438e086b10239a42492532ff194edb88;hp=40891c11241f7f53202a28fb5d9b4367a287f979;p=crea.git Feature #1711 CreaDevManager application implementation Merge remote-tracking branch 'refs/remotes/origin/creaDevManager' Conflicts: appli/creaNewProject/NewProject/CMakeLists.txt.in (solved) lib/creaDevManagerLib/CDMUtilities.cpp (solved) lib/creaDevManagerLib/CDMUtilities.h (solved) lib/creaDevManagerLib/modelCDMMain.cpp (solved) lib/creaDevManagerLib/wxCDMMainFrame.cpp (solved) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4393e64..ca43033 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# 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 diff --git a/appli/creaDevManager/CMakeLists.txt b/appli/creaDevManager/CMakeLists.txt index bec75cd..8eca8df 100644 --- a/appli/creaDevManager/CMakeLists.txt +++ b/appli/creaDevManager/CMakeLists.txt @@ -71,3 +71,40 @@ SET ( ${EXE_NAME}_LINK_LIBRARIES #-Creates and installs the exe----------------------------------------------- CREA_ADD_EXECUTABLE( ${EXE_NAME} ) #============================================================================ + +#==sets additional files===================================================== +IF(WIN32) + +# Build tree + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/about.html + ${EXECUTABLE_OUTPUT_PATH}/Debug/about.html + COPYONLY + ) + + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/about.html + ${EXECUTABLE_OUTPUT_PATH}/Release/about.html + COPYONLY + ) + + INSTALL( + PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/Debug/about.html + DESTINATION bin + ) + +ELSE(WIN32) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/about.html + ${EXECUTABLE_OUTPUT_PATH}/about.html + @ONLY IMMEDIATE + ) + +INSTALL( + FILES ${EXECUTABLE_OUTPUT_PATH}/about.html + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + +ENDIF(WIN32) diff --git a/appli/creaDevManager/about.html b/appli/creaDevManager/about.html new file mode 100644 index 0000000..19d43e6 --- /dev/null +++ b/appli/creaDevManager/about.html @@ -0,0 +1,31 @@ + + + + + + + + + +
+
+ CREA Development Manager + +
+
+

Creatis 2012 - Lyon, France

+ + + + + +
+

Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr

+
+ +

This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software.

+
+
+
+ + diff --git a/appli/creaDevManager/creaDevManager.cpp b/appli/creaDevManager/creaDevManager.cpp index ea6af6a..0ff5bf2 100644 --- a/appli/creaDevManager/creaDevManager.cpp +++ b/appli/creaDevManager/creaDevManager.cpp @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# pour la Sant�) # # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # # This software is governed by the CeCILL-B license under French law and @@ -25,26 +25,27 @@ #include +#include #include #include // for std::cout #include "creaDevManager.h" -#include "wxCDMMainFrame.h" IMPLEMENT_APP(wxCreaDevManagerApp) +CREA_WXMAIN_WITH_CONSOLE wxCreaDevManagerApp::wxCreaDevManagerApp():wxApp() { + mainWindow = NULL; } bool wxCreaDevManagerApp::OnInit() { wxApp::OnInit(); - - wxCDMMainFrame* mainWindow = new wxCDMMainFrame(NULL); + mainWindow = new wxCDMMainFrame(NULL); SetTopWindow(mainWindow); - mainWindow->SetSize(800, 600); + mainWindow->SetSize(750, 700); + wxToolTip::SetDelay(700); mainWindow->Show(true); - std::cout << "Crea DevManager opened." << std::endl; return true; diff --git a/appli/creaDevManager/creaDevManager.h b/appli/creaDevManager/creaDevManager.h index 5e9081d..eaafbee 100644 --- a/appli/creaDevManager/creaDevManager.h +++ b/appli/creaDevManager/creaDevManager.h @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# 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 @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -36,13 +36,36 @@ #ifndef CREADEVMANAGER_H_ #define CREADEVMANAGER_H_ +#include "wxCDMMainFrame.h" + +/** + * Crea Development Manager + * Developed by Daniel Felipe González Obando for CREATIS. + * This software aims to help the creaTools developer on the process of building projects. + * It allows to work with existing projects as well as it allows to create a project from zero. + * It brings the user help on each step of the development, as well as it always shows the structure of a project. + * It can check the compilation structure to help the developer to compile faster. + */ class wxCreaDevManagerApp:public wxApp { - public: - wxCreaDevManagerApp(); +public: + /** + * Default constructor. + */ + wxCreaDevManagerApp(); + + /** + * Executed when the application starts, this method initializes the application creating a main frame and showing it to the user. + */ + virtual bool OnInit(); + + /** + * Executed when the application is closing, this method destroys the frames created and shuts the program down. + */ + virtual int OnExit(); - virtual bool OnInit(); - virtual int OnExit(); +private: + wxCDMMainFrame* mainWindow; }; DECLARE_APP(wxCreaDevManagerApp) diff --git a/appli/creaNewProject/NewProject/CMakeLists.txt.in b/appli/creaNewProject/NewProject/CMakeLists.txt.in index 93996e2..5fd59cc 100644 --- a/appli/creaNewProject/NewProject/CMakeLists.txt.in +++ b/appli/creaNewProject/NewProject/CMakeLists.txt.in @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# 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 @@ -22,7 +22,7 @@ # # 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. -# ------------------------------------------------------------------------ +# ------------------------------------------------------------------------ # --------------------------------- # 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/install/CMakeLists.txt b/install/CMakeLists.txt index d4620cd..f003414 100644 --- a/install/CMakeLists.txt +++ b/install/CMakeLists.txt @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# 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 @@ -92,6 +92,7 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt") SET(CPACK_PACKAGE_VERSION_MAJOR ${crea_MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MINOR ${crea_MINOR_VERSION}) SET(CPACK_PACKAGE_VERSION_PATCH ${crea_BUILD_VERSION}) + IF(WIN32) SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CreaTools\\\\crea-${crea_MAJOR_VERSION}.${crea_MINOR_VERSION}.${crea_BUILD_VERSION}") ELSE(WIN32) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6c6eded..2531113 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,5 +2,5 @@ # USER! : Add a ADD_SUBDIRECTORY command for each one of your libraries # ----- -#ADD_SUBDIRECTORY(creaDevManagerLib) +ADD_SUBDIRECTORY(creaDevManagerLib) diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index 0149e8d..ac1b532 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -36,6 +36,10 @@ #include #include +#include +#include +#include +#include namespace CDMUtilities { @@ -76,20 +80,251 @@ namespace CDMUtilities #if(_WIN32) // ------ Windows - //TODO: implementation for windows + std::vector pathSplit; + + splitter::split(pathSplit, path, CDMUtilities::SLASH, splitter::no_empties); + + if(0 < pathSplit.size()) + pathFixed = pathSplit[0]; + + for (int i = 1; i < (int)(pathSplit.size()); i++) + { + pathFixed += CDMUtilities::SLASH + pathSplit[i]; + } #else // ------ LINUX / MacOS //break path into folders - std::vector pathSlpit; + std::vector pathSplit; - splitter::split(pathSlpit, path, "/", 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 += "/" + pathSlpit[i]; + pathFixed += CDMUtilities::SLASH + pathSplit[i]; } #endif return pathFixed; } + + int openTextEditor(const std::string& file) + { + std::string command = TEXT_EDITOR; + + if(file != "") + command += " \"" + file + "\""; + command += " &"; + + return system(command.c_str()); + } + + int openFileExplorer(const std::string& file) + { + std::string command = FILE_EXPLORER; + + if(file != "") + command += " \"" + file + "\""; + command += " &"; + + return system(command.c_str()); + } + + int openFileWithCommand(const std::string& file, const std::string& command) + { + std::string comm = command; + if(file != "") + comm += " \"" + file + "\""; + comm += " &"; + + return system(comm.c_str()); + } + + int openBBEditor() + { + std::string comm = "bbEditor &"; + return system(comm.c_str()); + } + + int openCreaToolsTools() + { +#ifdef _WIN32 + std::string comm = "creaTools &"; +#else + std::string comm = "creaTools.sh &"; +#endif + + return system(comm.c_str()); + } + + int openTerminal(const std::string& command) + { + std::string comm = TERMINAL; + if (command != "") + comm += + " " + command; + comm += " &"; + return system(comm.c_str()); + } + + bool createEmptyClass(const std::string& name, const std::string& path) + { + std::vector words; + splitter::split(words,name," \\/\",.'`",splitter::no_empties); + std::string fixedName = ""; + for (int i = 0; i < (int)(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; + } + + std::string stringify(const std::string& line) + { + std::string res; + for (int i = 0; i < (int)(line.size()); i++) + { + if(line[i] == '\\') + res.push_back('\\'); + if(line[i] == '\"') + res.push_back('\\'); + res.push_back(line[i]); + } + return res; + } + } diff --git a/lib/creaDevManagerLib/CDMUtilities.h b/lib/creaDevManagerLib/CDMUtilities.h index 2b4f05b..99dd04c 100644 --- a/lib/creaDevManagerLib/CDMUtilities.h +++ b/lib/creaDevManagerLib/CDMUtilities.h @@ -40,20 +40,142 @@ namespace CDMUtilities { + /** + * Path slash + */ + #ifdef _WIN32 + // ------ Windows + static std::string SLASH = "\\"; + #elif __APPLE__ + // ------ Apple + static std::string SLASH = "/"; + #else + static std::string SLASH = "/"; + #endif + + /** + * Text editor program + */ +#ifdef _WIN32 + // ------ Windows + static std::string TEXT_EDITOR = "notepad"; +#elif __APPLE__ + // ------ Apple + //TODO: implementation for apple +#else + static std::string TEXT_EDITOR = "gedit"; +#endif + + /** + * File explorer program + */ +#ifdef _WIN32 + // ------ Windows + static std::string FILE_EXPLORER = "explorer"; +#elif __APPLE__ + // ------ Apple + //TODO: implementation for apple +#else + static std::string FILE_EXPLORER = "nautilus"; +#endif + + /** + * Terminal program + */ + #ifdef _WIN32 + // ------ Windows + static std::string TERMINAL = "start cmd.exe"; + #elif __APPLE__ + // ------ Apple + //TODO: implementation for apple + #else + static std::string TERMINAL = "gnome-terminal"; + #endif + + + /** + * Structure that handles the split method for c++ + * It calls the split method to split a string given certain delimiters. + */ struct splitter { + /** + * Enum to allow or not empty resulting strings after performing splits. + */ enum empties_t { empties_ok, no_empties }; + /** + * Method to split a string given a set of delimiter characters. + * @param result Resulting container. + * @param s String to be splitted. + * @param delimiters Delimiter characters to split the string. + * @param empties Either allow or not empty resulting strings after performing split. + * @return Resulting container. + */ template - static Container& split - ( - Container& result, - const typename Container::value_type& s, - const typename Container::value_type& delimiters, - empties_t empties = empties_ok - ); + static Container& split + ( + Container& result, + const typename Container::value_type& s, + const typename Container::value_type& delimiters, + empties_t empties = empties_ok + ); }; + /** + * Fixes a given path to avoid double slash directories + * @param path Unfixed path. + * @return Fixed path. + */ const std::string fixPath(const std::string& path); + + /** + * Opens the default text editor. If a file is given, then it tries to open the given file. + * @param file Full path to the file. + * @return True if there was an error on the execution of the operation. + */ + int openTextEditor(const std::string& file = ""); + /** + * Opens the system file explorer on the given file path + * @param file Path of the desired folder to open. + * @return True if there was an error on the execution of the operation. + */ + int openFileExplorer(const std::string& file = ""); + /** + * Opens a file with a given command. + * @param file Full path of the file to open. + * @param command Command to execute the file with. + * @return True if there was an error on the execution of the operation. + */ + int openFileWithCommand(const std::string& file, const std::string& command); + /** + * Opens the BBTK Graphical Editor + * @return True if there was an error on the execution of the operation. + */ + int openBBEditor(); + /** + * Opens the minitools or the creaTools + * @return True if there was an error on the execution of the operation. + */ + int openCreaToolsTools(); + /** + * Open a command line interpreter and executes the given command if any. + * @param command Command to execute. + * @return True if there was an error on the execution of the operation. + */ + int openTerminal(const std::string& command = ""); + /** + * Creates a blank class(.h and .cpp files). + * @param name Name of the new class. + * @param path Path where the class is to be created. + * @return True if the class was successfully created. + */ + bool createEmptyClass(const std::string& name, const std::string& path); + /** + * Creates a string replacing each \ by double \ . + * @param line String to stringify. + * @return line stringified. + */ + std::string stringify(const std::string& line); }; #endif /* CDMUTILITIES_H_ */ diff --git a/lib/creaDevManagerLib/ControlCreaDevManagerProject.cpp b/lib/creaDevManagerLib/ControlCreaDevManagerProject.cpp deleted file mode 100644 index cc66abe..0000000 --- a/lib/creaDevManagerLib/ControlCreaDevManagerProject.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* -# --------------------------------------------------------------------- -# -# 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 -#include -#include // 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; -} diff --git a/lib/creaDevManagerLib/creaDevManagerIds.h b/lib/creaDevManagerLib/creaDevManagerIds.h index d631080..4376d3e 100644 --- a/lib/creaDevManagerLib/creaDevManagerIds.h +++ b/lib/creaDevManagerLib/creaDevManagerIds.h @@ -60,20 +60,61 @@ #define ID_MENU_CODE_EDITOR 10218 #define ID_MENU_COMMAND_LINE 10219 -#define ID_MENU_HELP 10220 -#define ID_MENU_REPORT_BUG 10221 -#define ID_MENU_ABOUT_CREADEVMANAGER 10222 -#define ID_MENU_ABOUT_CREATIS 10223 +#define ID_MENU_TOGGLE_HELP 10220 +#define ID_MENU_HELP 10221 +#define ID_MENU_REPORT_BUG 10222 +#define ID_MENU_ABOUT_CREADEVMANAGER 10223 +#define ID_MENU_ABOUT_CREATIS 10224 -#define ID_TREE_PROJECTS 10224 -#define ID_WINDOW_PROPERTIES 10225 -#define ID_WINDOW_PROJ_ACTIONS 10226 +#define ID_TREE_PROJECTS 10225 +#define ID_WINDOW_PROPERTIES 10226 +#define ID_WINDOW_PROJ_ACTIONS 10227 #define ID_BUTTON_NEXT 10300 -#define ID_BUTTON_CANCEL 10301 -#define ID_BUTTON_CHOOSE 10302 +#define ID_BUTTON_PREV 10301 +#define ID_BUTTON_CANCEL 10302 +#define ID_BUTTON_CHOOSE 10303 -#define ID_BUTTON_NEWPROJECT 10303 -#define ID_BUTTON_OPENPROJECT 10304 +#define ID_BUTTON_NEWPROJECT 10304 +#define ID_BUTTON_OPENPROJECT 10305 + +#define ID_BUTTON_CREATE_PACKAGE 10306 +#define ID_BUTTON_CREATE_BLACKBOX 10307 +#define ID_BUTTON_CREATE_LIBRARY 10308 +#define ID_BUTTON_CREATE_APPLICATION 10309 +#define ID_BUTTON_EDIT_CMAKELISTSFILE 10310 +#define ID_BUTTON_CREATE_FOLDER 10311 +#define ID_BUTTON_CREATE_CLASS 10312 +#define ID_BUTTON_OPEN_CXX 10313 +#define ID_BUTTON_OPEN_HXX 10314 +#define ID_BUTTON_OPEN_FOLDER 10315 +#define ID_BUTTON_OPEN_FILE 10316 +#define ID_BUTTON_OPEN_COMMAND 10317 +#define ID_BUTTON_SET_VERSION 10318 +#define ID_BUTTON_SET_BUILD_PATH 10319 +#define ID_BUTTON_SET_AUTHOR 10320 +#define ID_BUTTON_SET_DESCRIPTION 10321 +#define ID_BUTTON_SET_NAME 10322 +#define ID_BUTTON_SET_CATEGORY 10323 + + +#define ID_BUTTON_BUILD_PROJECT 10324 +#define ID_BUTTON_CONFIGURE_BUILD 10325 +#define ID_BUTTON_CONNECT_PROJECT 10326 + +#define ID_BUTTON_GOTO_PACKAGE_MANAGER 10327 +#define ID_BUTTON_GOTO_APPLI_MANAGER 10328 +#define ID_BUTTON_GOTO_LIB_MANAGER 10329 + +#define ID_LINK_SELECT_PACKAGE 10330 +#define ID_LINK_SELECT_LIBRARY 10331 +#define ID_LINK_SELECT_APPLICATION 10332 +#define ID_LINK_SELECT_BLACKBOX 10333 + +#define ID_CHECKBOX_ENABLE_HELP 10334 +#define ID_CHECKBOX_DISABLE_HELP 10335 +#define ID_CHECKBOX_TOGGLE_HELP 10335 + +#define ID_BUTTON_CHECK_PROJECT 10336 #endif /* CREADEVMANAGERIDS_H_ */ diff --git a/lib/creaDevManagerLib/images/AIcon20.xpm b/lib/creaDevManagerLib/images/AIcon20.xpm new file mode 100644 index 0000000..bcc1a0b --- /dev/null +++ b/lib/creaDevManagerLib/images/AIcon20.xpm @@ -0,0 +1,138 @@ +/* XPM */ +const static char * AIcon20[] = { +"20 20 115 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111822", +"} c #272E36", +"| c #262C35", +"1 c #101820", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #182029", +"8 c #1C232C", +"9 c #1D242C", +"0 c #282F38", +"a c #F6F7F7", +"b c #D9DBDC", +"c c #222931", +"d c #181F28", +"e c #86898D", +"f c #7E8387", +"g c #192029", +"h c #1D242D", +"i c #161D27", +"j c #8A8E92", +"k c #FFFFFF", +"l c #373D45", +"m c #82858A", +"n c #7D8086", +"o c #161D26", +"p c #9A9DA1", +"q c #A7ABAE", +"r c #141C25", +"s c #7E8287", +"t c #7E8187", +"u c #5A5F65", +"v c #484D55", +"w c #AFB1B4", +"x c #232A33", +"y c #7C8186", +"z c #1B222B", +"A c #A4A6AA", +"B c #F5F5F6", +"C c #53585F", +"D c #6B6F75", +"E c #7D8186", +"F c #808489", +"G c #141B25", +"H c #EFF0F0", +"I c #E8E9EA", +"J c #7F8388", +"K c #8F9397", +"L c #FBFBFB", +"M c #B4B7BA", +"N c #1A212A", +"O c #808488", +"P c #5A5E65", +"Q c #19212A", +"R c #7B8085", +"S c #909499", +"T c #7F8389", +"U c #171E28", +"V c #D9DADC", +"W c #EDEEEF", +"X c #0C141D", +"Y c #5B5F66", +"Z c #7A7E83", +"` c #7D8286", +" . c #353B43", +".. c #F9F9F9", +"+. c #9EA1A5", +"@. c #E9EAEB", +"#. c #8D9196", +"$. c #141B24", +"%. c #474D54", +"&. c #C4C6C8", +"*. c #BCBEC1", +"=. c #2F353E", +"-. c #8D9195", +";. c #6B7075", +">. c #B3B5B9", +",. c #7A7F84", +"'. c #808389", +"). c #7F8488", +"!. c #80858A", +"~. c #797E83", +"{. c #B0B3B6", +"]. c #65696F", +"^. c #8C9095", +"/. c #8C9094", +"(. c #64686E", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 8 9 0 a b c 8 8 8 d e # ", +" # f g h h i j k k l 8 h h g m # ", +" # n g h h o k p k q r h h g s # ", +" - t g h h u k v w k x h h g y # ", +" # s g h z A B } C k D h h g E # ", +" # F g h G H I J K L M N h g E # ", +" # O g N P k k k k k L Q 8 g R S ", +" # T g U V W X : [ Y k Z g g ` # ", +" # s g ...+.z h 8 i @.I 8 g J # ", +" #.A $.%.&.%.g g g d s *.=.$.A -. ", +" ;.k >.,.E '.'.).!.J F F ~.{.k ]. ", +" N % ^.S # # # # # # # # S /.(.i ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/AIcon64.xpm b/lib/creaDevManagerLib/images/AIcon64.xpm new file mode 100644 index 0000000..c580dc4 --- /dev/null +++ b/lib/creaDevManagerLib/images/AIcon64.xpm @@ -0,0 +1,295 @@ +/* XPM */ +const static char * AIcon64[] = { +"64 64 228 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #545960", +"{. c #686D73", +"]. c #121922", +"^. c #F2F3F3", +"/. c #2B3139", +"(. c #A6A9AC", +"_. c #BBBDC0", +":. c #1E252E", +"<. c #2D333B", +"[. c #262C35", +"}. c #1E242D", +"|. c #2E353D", +"1. c #676C72", +"2. c #7C8085", +"3. c #252B34", +"4. c #BABCBE", +"5. c #F0F1F1", +"6. c #3E444C", +"7. c #292F38", +"8. c #7A7F84", +"9. c #E3E4E5", +"0. c #919499", +"a. c #ECEDED", +"b. c #CDCED0", +"c. c #F8F8F9", +"d. c #60656B", +"e. c #1E252D", +"f. c #FEFEFE", +"g. c #EAEBEB", +"h. c #3C424A", +"i. c #8E9296", +"j. c #6E7378", +"k. c #A0A3A7", +"l. c #A5A8AC", +"m. c #E0E0E2", +"n. c #555B61", +"o. c #232932", +"p. c #ECEDEE", +"q. c #4F545B", +"r. c #666B71", +"s. c #EDEEEE", +"t. c #A2A5A8", +"u. c #71757B", +"v. c #B9BBBE", +"w. c #1F262F", +"x. c #EFF0F0", +"y. c #2C323A", +"z. c #62676D", +"A. c #BEC0C2", +"B. c #B5B7BA", +"C. c #73787D", +"D. c #A4A6AA", +"E. c #FBFBFB", +"F. c #2C333B", +"G. c #585D64", +"H. c #767A80", +"I. c #C1C3C5", +"J. c #8F9397", +"K. c #C9CACC", +"L. c #E0E1E2", +"M. c #393F47", +"N. c #51565D", +"O. c #20272F", +"P. c #A3A5A9", +"Q. c #1F252E", +"R. c #282E37", +"S. c #DCDDDE", +"T. c #4B5057", +"U. c #64696F", +"V. c #262D36", +"W. c #9DA0A4", +"X. c #C2C4C7", +"Y. c #EBECEC", +"Z. c #6C7177", +"`. c #999CA0", +" + c #5E6369", +".+ c #434850", +"++ c #797D82", +"@+ c #B1B3B6", +"#+ c #A4A7AB", +"$+ c #CECFD1", +"%+ c #CBCDCF", +"&+ c #3C4249", +"*+ c #72767C", +"=+ c #8D9195", +"-+ c #C4C6C8", +";+ c #878A8F", +">+ c #ACAFB2", +",+ c #DFE0E1", +"'+ c #353B43", +")+ c #333A42", +"!+ c #121923", +"~+ c #51575E", +"{+ c #F2F2F2", +"]+ c #B6B8BB", +"^+ c #D8DADB", +"/+ c #9B9EA2", +"(+ c #121A23", +"_+ c #CED0D1", +":+ c #AEB0B3", +"<+ c #75797F", +"[+ c #40454E", +"}+ c #30363F", +"|+ c #9C9FA3", +"1+ c #131A23", +"2+ c #5C6167", +"3+ c #F7F7F7", +"4+ c #444951", +"5+ c #929699", +"6+ c #F3F3F3", +"7+ c #161E27", +"8+ c #5D6268", +"9+ c #ABADB1", +"0+ c #D6D6D8", +"a+ c #EBECED", +"b+ c #E7E8E9", +"c+ c #CDCFD0", +"d+ c #454B52", +"e+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . ~.3 3 3 3 3 {.. . . . . . . . . . . + . . . . ].!.).3 / > $ . ", +" . $ > / 3 ^./.+ . . . . . . . . . . . . . . . (.3 3 3 3 3 _.:.. . . . . . . . . . . . . . . & <.^.3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . }.../ 3 3 3 3 3 L |.. . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . 1.3 3 3 3 3 3 3 2.. . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / 3.. . . . . . . . . . . . . . . 4.3 3 3 3 3 3 3 ] . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 5.3.. . . . . . . . . . . . . . C L 3 3 3 3 3 3 3 3 6.. . . . . . . . . . . . . . + 7./ 3 / > $ . ", +" . $ > / 3 O 3.. . . . . . . . . . . . . . 8.3 3 3 3 9.3 3 3 3 0.. . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 a.[.. . . . . . . . . . . . . . b.3 3 3 c.d.3 3 3 3 T e.. . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / f.g.i + . . . . . . . . . . . . h.3 3 3 3 4.:.( 3 3 3 3 !.. . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / f.g.7.+ . . . . . . . . . . . . i.3 3 3 3 j.. k.3 3 3 3 l.. . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / f.g.7.+ . . . . . . . . . . . . m.3 3 3 M #.. n.3 3 3 3 5.o.. . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / f.p.i + . . . . . . . . . . . q.3 3 3 3 _.. . :.g.3 3 3 3 r.. . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 3 s.i . . . . . . . . . . . . t.3 3 3 3 u.. . . t.3 3 3 3 v.. . . . . . . . . . . . . w./ 3 / > $ . ", +" . $ > / 3 x.3.. . . . . . . . . . . ' Q 3 3 3 L y.. . . a 3 3 3 3 L C . . . . . . . . . . . . w./ 3 / > $ . ", +" . $ > / 3 5.o.. . . . . . . . . . . z.3 3 3 3 A.. . . . w.G 3 3 3 3 8.. . . . . . . . . . . . - 5.3 / > $ . ", +" . $ > / 3 / ..+ . . . . . . . . . . B.3 3 3 3 C.. . . . . D.3 3 3 3 b.. . . . . . . . . . . . o.5.3 / > $ . ", +" . $ > / 3 / i . . . . . . . . . . > c.3 3 3 E.F.. . . . . G.3 3 3 3 3 h.. . . . . . + . . . . ..x.3 / > $ . ", +" . $ > / 3 / r + . . . . . . . . . H.3 3 3 3 I.. . . . . . w.G 3 3 3 3 J.. . . . . + . . . . . +.x.3 / > $ . ", +" . $ > / 3 / i . . . . . . . . . . K.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 L.. . . . . . . . . . . o.x.3 / > $ . ", +" . $ > / 3 / t . . . . . . . . . M.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 N.. . . . . . . . . . O.5.3 / > $ . ", +" . $ > / 3 / ... . . . . . . . . e 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 P.. . . . . . . . . . Q.5.3 / > $ . ", +" . $ > / 3 / R.. . . . . . . . . S.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Q ' . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . . . . . T.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 U.. . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / V.+ . . . . . . . W.3 3 3 3 X.. . . . . . . . . . %.Y.3 3 3 3 ,.. . . . . . . . . w./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . . . . - Y.3 3 3 3 Z.. . . . . . . . . . . `.3 3 3 3 M F.. . . . . . . . %./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . +3 3 3 3 N -.. . . . . . . . . . . .+3 3 3 3 3 ++. . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . @+3 3 3 3 #+. . . . . . . . . . . . . $+3 3 3 3 %+. . . . . . . . [./ 3 / > $ . ", +" . $ > / 3 / 3.. . . . . . , 2 3 3 3 3 q.. . . . . . . . . . . . . 1 3 3 3 3 3 &+. . . . . . . i / 3 / > $ . ", +" . $ > / 3 / [.+ . . . . . *+3 3 3 3 S.. . . . . . . . . . . . . . B 2 3 3 3 3 =+. . . . . . . R./ 3 / > $ . ", +" . $ > / 3 ^.> + . . . . . -+3 3 3 3 ;+. . . . . . . . . . . . . . . >+3 3 3 3 ,+. . . . . . } X ^.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . '+8 3 3 3 ).)+. . . . . . . . . . . . . . . n.3 3 3 3 3 q.. . . + + !+~+).3 {+> $ . ", +" . $ B a.3 3 ]+| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| B.3 3 z , % . ", +" . & t ^+3 3 3 /+&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + (+-./+3 3 3 _+O.} . ", +" . + 5 :+3 3 3 3 s <+[+-.:.. w.%.-.[.[.[.[.[.[.+.-.7.F.C C 3.$.q [.[.i R.#.> i l w.. :.}+<+s 3 3 3 3 |+1+. . ", +" . . 1+2+3 3 3 3 3 3 c./ / / / / / / / / / / / / 5.P P P P 5./ / / / / / / / / / / / / c.3 3 3 3 3 3+4+k . . ", +" . + >.5+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6+j.= . . ", +" . @ 7+8+9+0+a+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / b+c+W.d+= + . ", +" . . + (+5 &.7.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > R.- (+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # e++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/ApIcon20.xpm b/lib/creaDevManagerLib/images/ApIcon20.xpm new file mode 100644 index 0000000..3549270 --- /dev/null +++ b/lib/creaDevManagerLib/images/ApIcon20.xpm @@ -0,0 +1,159 @@ +/* XPM */ +const static char * ApIcon20[] = { +"20 20 136 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #101721", +"< c #09111A", +"[ c #101821", +"} c #121923", +"| c #101720", +"1 c #0E161F", +"2 c #0F1620", +"3 c #353C43", +"4 c #84888D", +"5 c #182029", +"6 c #192029", +"7 c #7F8388", +"8 c #DFE0E1", +"9 c #171D26", +"0 c #1D242D", +"a c #1C232C", +"b c #181F28", +"c c #86898D", +"d c #7E8387", +"e c #FFFFFF", +"f c #4A4F57", +"g c #1B222B", +"h c #161D26", +"i c #161D27", +"j c #82858A", +"k c #7D8086", +"l c #42484F", +"m c #F9FAFA", +"n c #82858B", +"o c #CDCED0", +"p c #171E28", +"q c #2B313A", +"r c #979A9E", +"s c #63686F", +"t c #8E9196", +"u c #3C424A", +"v c #7E8287", +"w c #7E8187", +"x c #151C25", +"y c #8B8E93", +"z c #7D8187", +"A c #252B34", +"B c #FEFEFE", +"C c #313740", +"D c #373D45", +"E c #FDFDFD", +"F c #A3A6A9", +"G c #94979C", +"H c #62666C", +"I c #7C8085", +"J c #F0F0F1", +"K c #61666C", +"L c #353B43", +"M c #FCFDFD", +"N c #4B5158", +"O c #C9CACD", +"P c #BABCBF", +"Q c #808488", +"R c #585D63", +"S c #30363E", +"T c #272D36", +"U c #7C8186", +"V c #CDCED1", +"W c #2B323A", +"X c #494F56", +"Y c #1A212A", +"Z c #DCDDDE", +"` c #9EA1A5", +" . c #7C8185", +".. c #808589", +"+. c #CBCCCF", +"@. c #A9ACAF", +"#. c #262D35", +"$. c #52575E", +"%. c #F8F8F9", +"&. c #E9EAEB", +"*. c #F2F2F3", +"=. c #C9CBCD", +"-. c #222932", +";. c #7B8085", +">. c #909499", +",. c #7F8389", +"'. c #111922", +"). c #181F29", +"!. c #141B24", +"~. c #343A42", +"{. c #484D54", +"]. c #19202A", +"^. c #7D8286", +"/. c #FCFCFD", +"(. c #4E545A", +"_. c #8D9196", +":. c #A4A6AA", +"<. c #141C25", +"[. c #2C333B", +"}. c #BFC1C4", +"|. c #3E444B", +"1. c #8D9195", +"2. c #6B7075", +"3. c #B3B5B9", +"4. c #7A7F84", +"5. c #808389", +"6. c #7F8488", +"7. c #80848A", +"8. c #808489", +"9. c #818589", +"0. c #797E83", +"a. c #B0B3B6", +"b. c #65696F", +"c. c #8C9095", +"d. c #8C9094", +"e. c #64686E", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < _ [ } | 1 : 2 3 / > ", +" # 4 5 6 7 8 9 0 0 0 a a a b c # ", +" # d 6 0 = e f g a h 6 i g 6 j # ", +" # k 6 l m n o p q r s t u 6 v # ", +" - w x y z A B C D E F G e H I # ", +" # v 1 J e e e K L M N b O P I # ", +" # Q R ) S T U V W M X Y Z ` .# ", +" # ..+.@.a 0 #.e $.%.&.*.=.-.;.>. ", +" # ,.'.).0 0 a !.~.E {.!.6 ].^.# ", +" # v 6 0 0 0 0 0 ( /.(.0 0 6 7 # ", +" _.:.<.6 6 6 6 6 [.}.|.6 ].!.:.1. ", +" 2.e 3.4.v 5.5.6.7.v 8.9.0.a.e b. ", +" Y % c.>.# # # # # # # # >.d.e.i ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/ApIcon64.xpm b/lib/creaDevManagerLib/images/ApIcon64.xpm new file mode 100644 index 0000000..ffa278b --- /dev/null +++ b/lib/creaDevManagerLib/images/ApIcon64.xpm @@ -0,0 +1,314 @@ +/* XPM */ +const static char * ApIcon64[] = { +"64 64 247 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252D", +"/. c #E4E5E6", +"(. c #50555C", +"_. c #1E252E", +":. c #1F262F", +"<. c #1F262E", +"[. c #2D333B", +"}. c #262C35", +"|. c #555B61", +"1. c #A4A6AA", +"2. c #1E242D", +"3. c #A9ABAF", +"4. c #F0F1F1", +"5. c #232932", +"6. c #252B34", +"7. c #676C72", +"8. c #6C7177", +"9. c #E0E1E2", +"0. c #BABDBF", +"a. c #292F38", +"b. c #C0C2C4", +"c. c #AAACB0", +"d. c #8D9195", +"e. c #FBFBFB", +"f. c #30363F", +"g. c #ECEDED", +"h. c #333941", +"i. c #595E65", +"j. c #3C424A", +"k. c #7F8388", +"l. c #FEFEFE", +"m. c #EAEBEB", +"n. c #82868B", +"o. c #E8E9EA", +"p. c #CECFD1", +"q. c #D2D4D5", +"r. c #F7F8F8", +"s. c #3F454D", +"t. c #C5C7C9", +"u. c #E5E6E7", +"v. c #DCDDDE", +"w. c #BCBEC1", +"x. c #D6D7D9", +"y. c #9B9EA2", +"z. c #7C8085", +"A. c #434850", +"B. c #EFF0F0", +"C. c #6D7278", +"D. c #464C53", +"E. c #4A4F57", +"F. c #2F353E", +"G. c #96999E", +"H. c #73777C", +"I. c #ECEDEE", +"J. c #9A9DA1", +"K. c #BDBFC2", +"L. c #E7E8E9", +"M. c #B5B7BA", +"N. c #7E8287", +"O. c #696E73", +"P. c #7A7F84", +"Q. c #F4F4F4", +"R. c #363C44", +"S. c #EDEEEE", +"T. c #8B8F93", +"U. c #6C7076", +"V. c #5B6066", +"W. c #5C6168", +"X. c #AEB1B4", +"Y. c #83878C", +"Z. c #D0D1D3", +"`. c #F6F6F6", +" + c #3B4148", +".+ c #EBECEC", +"++ c #72767C", +"@+ c #73787D", +"#+ c #E7E7E8", +"$+ c #C7C8CB", +"%+ c #D5D6D8", +"&+ c #383E46", +"*+ c #6E7378", +"=+ c #BFC1C3", +"-+ c #A0A3A7", +";+ c #82858A", +">+ c #3D434B", +",+ c #787C81", +"'+ c #4D535A", +")+ c #323840", +"!+ c #DDDEDF", +"~+ c #60656B", +"{+ c #4C5259", +"]+ c #5D6269", +"^+ c #999CA0", +"/+ c #E3E4E5", +"(+ c #20272F", +"_+ c #DFE0E1", +":+ c #BEC0C2", +"<+ c #1F252E", +"[+ c #282E37", +"}+ c #8D9095", +"|+ c #6B6F75", +"1+ c #A1A4A7", +"2+ c #DEDFE0", +"3+ c #A6A9AC", +"4+ c #F5F5F5", +"5+ c #B4B7B9", +"6+ c #262D36", +"7+ c #121923", +"8+ c #51575E", +"9+ c #F2F2F2", +"0+ c #B6B8BB", +"a+ c #D8DADB", +"b+ c #121A23", +"c+ c #CED0D1", +"d+ c #AEB0B3", +"e+ c #75797F", +"f+ c #40454E", +"g+ c #2C333B", +"h+ c #9C9FA3", +"i+ c #131A23", +"j+ c #5C6167", +"k+ c #F8F8F9", +"l+ c #F7F7F7", +"m+ c #444951", +"n+ c #929699", +"o+ c #F3F3F3", +"p+ c #161E27", +"q+ c #5D6268", +"r+ c #ABADB1", +"s+ c #D6D6D8", +"t+ c #EBECED", +"u+ c #CDCFD0", +"v+ c #9DA0A4", +"w+ c #454B52", +"x+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . ^./.3 3 3 (.. . . _.:.<._._._._.. . . . . . . . . . . . . . . & [.{.3 / > $ . ", +" . $ > / 3 / }.. . . . . . . . |.3 3 3 3 1.2._.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / }.. . . . . . . . 3.3 3 3 3 4.5.. . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / 6.. . . . . . . h D 3 3 3 3 3 7.. . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 4.6.. . . . . . . 8.3 3 N 9.3 3 0.. . . . . . . . . . . . . . . . . . . . . . . . + a./ 3 / > $ . ", +" . $ > / 3 O 6.. . . . . . . b.3 3 c.d.3 3 e.f.. . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 g.}.. . . . . . h.).3 3 i.j.3 3 3 k.. . . . . . . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / l.m.i + . . . . . n.3 3 o._.. p.3 3 q.. . . . . . . 3 3 r.s.k.t.u.2 v.w.n.C . . . . . %./ 3 / > $ . ", +" . $ > / l.m.a.+ . . . . . x.3 3 y.. . z.3 3 3 A.. . . . . . 3 3 3 3 3 3 3 3 3 3 3 B.C.. . . . - / 3 / > $ . ", +" . $ > / l.m.a.+ . . . . D.3 3 3 E.. . F.e.3 3 G.. . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 H.. . . - / 3 / > $ . ", +" . $ > / l.I.i + . . . . J.3 3 v.. . . . K.3 3 L._.. . . . . 3 3 3 3 M.N.O.P.,.8 3 3 3 Q.R.. . - / 3 / > $ . ", +" . $ > / 3 S.i . . . . :.( 3 3 T.. . . . U.3 3 3 V.. . . . . 3 3 3 3 . . . . . 6 N 3 3 3 d.. . :./ 3 / > $ . ", +" . $ > / 3 B.6.. . . . W.3 3 3 3 3 3 3 3 3 3 3 3 X.. . . . . 3 3 3 3 . . . . . . Y.3 3 3 Z.. . :./ 3 / > $ . ", +" . $ > / 3 4.5.. . . . n 3 3 3 3 3 3 3 3 3 3 3 3 `., . . . . 3 3 3 3 . . . . . . +3 3 3 .+. . - 4.3 / > $ . ", +" . $ > / 3 / ..+ . . B 2 3 3 3 3 3 3 3 3 3 3 3 3 3 ++. . . . 3 3 3 3 . . . . . . 5.3 3 3 M . . 5.4.3 / > $ . ", +" . $ > / 3 / i . . . @+3 3 3 3 3 3 3 3 3 3 3 3 3 3 t.. . . . 3 3 3 3 . . . . . . F.3 3 3 #+. . ..B.3 / > $ . ", +" . $ > / 3 / r + . . $+3 3 R %.. . . . . . . %+3 3 3 &+. . . 3 3 3 3 . . . . . . *+3 3 3 =+. . +.B.3 / > $ . ", +" . $ > / 3 / i . . &+3 3 3 -+. . . . . . . . ;+3 3 3 e . . . 3 3 3 3 . . . . . >+R 3 3 3 ,+. . 5.B.3 / > $ . ", +" . $ > / 3 / t . . e 3 3 3 '+. . . . . . . . )+).3 3 !+. . . 3 3 3 3 d.~+{+]+^+/ 3 3 3 /+5.. . (+4.3 / > $ . ", +" . $ > / 3 / ... . !+3 3 _+. . . . . . . . . . :+3 3 3 '+. . 3 3 3 3 3 3 3 3 3 3 3 3 2 {+. . . <+4.3 / > $ . ", +" . $ > / 3 / [+. '+3 3 3 }+. . . . . . . . . . |+3 3 3 1+. . 3 3 3 3 3 3 3 3 3 3 3 2+E.. . . . . / 3 / > $ . ", +" . $ > / 3 / B + 1+3 3 3 +. . . . . . . . . . -.N 3 3 Q ' . 3 3 3 3 3+!+4+2 /+5+U.- . . . . . . / 3 / > $ . ", +" . $ > / 3 / 6++ . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 3 / }.. . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / }.. . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . }./ 3 / > $ . ", +" . $ > / 3 / 6.. . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / }.+ . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . + . . . . . . . . . . . [+/ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . + + 7+8+).3 9+> $ . ", +" . $ B g.3 3 0+| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| M.3 3 z , % . ", +" . & t a+3 3 3 y.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + b+-.y.3 3 3 c+(+} . ", +" . + 5 d+3 3 3 3 s e+f+-._.. :.%.-.}.}.}.}.}.}.+.-.a.g+C C 6.$.q }.}.i [+#.> i l :.. _.f.e+s 3 3 3 3 h+i+. . ", +" . . i+j+3 3 3 3 3 3 k+/ / / / / / / / / / / / / 4.P P P P 4./ / / / / / / / / / / / / k+3 3 3 3 3 l+m+k . . ", +" . + >.n+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 o+*+= . . ", +" . @ p+q+r+s+t+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / L.u+v+w+= + . ", +" . . + b+5 &.a.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > [+- b+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # x++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/BBIcon20.xpm b/lib/creaDevManagerLib/images/BBIcon20.xpm new file mode 100644 index 0000000..57e2110 --- /dev/null +++ b/lib/creaDevManagerLib/images/BBIcon20.xpm @@ -0,0 +1,158 @@ +/* XPM */ +const static char * BBIcon20[] = { +"20 20 135 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #182029", +"8 c #1C232C", +"9 c #1D232C", +"0 c #1D242D", +"a c #181F28", +"b c #86898D", +"c c #7E8387", +"d c #3E444B", +"e c #4E545A", +"f c #4E535A", +"g c #323840", +"h c #293038", +"i c #4E545B", +"j c #41464E", +"k c #19202A", +"l c #82858A", +"m c #7C7F85", +"n c #C4C6C8", +"o c #FFFFFF", +"p c #F5F5F6", +"q c #686D73", +"r c #1A212A", +"s c #585D64", +"t c #F4F4F4", +"u c #FDFDFD", +"v c #9FA2A6", +"w c #131A23", +"x c #7E8287", +"y c #7D8086", +"z c #C1C3C5", +"A c #C2C4C6", +"B c #131A24", +"C c #989BA0", +"D c #E4E5E6", +"E c #161D26", +"F c #575C63", +"G c #050C16", +"H c #3B424A", +"I c #09111B", +"J c #7C8186", +"K c #7D8186", +"L c #D9DADB", +"M c #7B7F84", +"N c #F2F2F3", +"O c #8D9196", +"P c #696E74", +"Q c #D3D5D6", +"R c #BFC1C3", +"S c #141B24", +"T c #7F8388", +"U c #C8CACC", +"V c #2D333C", +"W c #787C82", +"X c #FCFCFD", +"Y c #464C53", +"Z c #1F262E", +"` c #50555C", +" . c #EFF0F0", +".. c #909499", +"+. c #7C8185", +"@. c #7F8387", +"#. c #C5C7C9", +"$. c #1F262F", +"%. c #3E434B", +"&. c #4F545B", +"*. c #2F353D", +"=. c #DDDDDF", +"-. c #AAACB0", +";. c #7E8288", +">. c #BCBEC0", +",. c #FAFAFA", +"'. c #B4B6B9", +"). c #555A61", +"!. c #F8F9F9", +"~. c #D8DADB", +"{. c #7D8286", +"]. c #2C333B", +"^. c #2B313A", +"/. c #232A33", +"(. c #363D44", +"_. c #30363E", +":. c #192029", +"<. c #A4A6AA", +"[. c #141C25", +"}. c #8D9195", +"|. c #6B7075", +"1. c #B3B5B9", +"2. c #7A7F84", +"3. c #808389", +"4. c #7F8488", +"5. c #80858A", +"6. c #818489", +"7. c #818589", +"8. c #797E83", +"9. c #B0B3B6", +"0. c #65696F", +"a. c #8C9095", +"b. c #8C9094", +"c. c #64686E", +"d. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 8 8 9 0 0 0 8 8 8 a b # ", +" # c d e f g a 0 h i i j 7 k l # ", +" # m n o p o q r s o t u v w x # ", +" - y z A B C D E F o G H o I J # ", +" # K z L M N O r F o P Q R S K # ", +" # T z U V W X Y F o Z ` ...+.# ", +" # @.z #.$.%.o &.F o | *.=.-.M .. ", +" # ;.>.,.o u '.8 ).!.o u ~.r {.# ", +" # x ].( ( ^.. 8 /.(.( _.k :.T # ", +" O <.[.:.:.:.:.:.:.:.:.:.k S <.}. ", +" |.o 1.2.x 3.3.4.5.T 6.7.8.9.o 0. ", +" r % a...# # # # # # # # ..b.c.d. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/BBIcon64.xpm b/lib/creaDevManagerLib/images/BBIcon64.xpm new file mode 100644 index 0000000..8b39549 --- /dev/null +++ b/lib/creaDevManagerLib/images/BBIcon64.xpm @@ -0,0 +1,271 @@ +/* XPM */ +const static char * BBIcon64[] = { +"64 64 204 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #F0F1F1", +"|. c #292F38", +"1. c #E8E9EA", +"2. c #C8C9CC", +"3. c #888B90", +"4. c #2C333B", +"5. c #ECEDED", +"6. c #5D6269", +"7. c #FEFEFE", +"8. c #EAEBEB", +"9. c #F6F6F6", +"0. c #353B43", +"a. c #3E444C", +"b. c #75797F", +"c. c #A9ABAF", +"d. c #ECEDEE", +"e. c #EDEEEE", +"f. c #3A4048", +"g. c #BBBDC0", +"h. c #EFF0F0", +"i. c #1E252D", +"j. c #ABADB0", +"k. c #6D7278", +"l. c #232932", +"m. c #42484F", +"n. c #464C53", +"o. c #5C6168", +"p. c #85898E", +"q. c #D0D1D3", +"r. c #73787D", +"s. c #A6A9AC", +"t. c #3F454D", +"u. c #71757B", +"v. c #6C7177", +"w. c #CECFD1", +"x. c #20272F", +"y. c #363C44", +"z. c #DFE0E1", +"A. c #1F252E", +"B. c #282E37", +"C. c #B3B6B9", +"D. c #AEB1B4", +"E. c #5B6067", +"F. c #62666D", +"G. c #767A80", +"H. c #9EA1A5", +"I. c #FBFBFB", +"J. c #474D54", +"K. c #262D36", +"L. c #787C81", +"M. c #DDDEDF", +"N. c #F5F5F5", +"O. c #E5E6E7", +"P. c #9C9FA3", +"Q. c #60656B", +"R. c #121923", +"S. c #51575E", +"T. c #F2F2F2", +"U. c #B6B8BB", +"V. c #B5B7BA", +"W. c #D8DADB", +"X. c #9B9EA2", +"Y. c #121A23", +"Z. c #CED0D1", +"`. c #AEB0B3", +" + c #40454E", +".+ c #30363F", +"++ c #131A23", +"@+ c #5C6167", +"#+ c #F8F8F9", +"$+ c #F7F7F7", +"%+ c #444951", +"&+ c #929699", +"*+ c #F3F3F3", +"=+ c #6E7378", +"-+ c #161E27", +";+ c #5D6268", +">+ c #ABADB1", +",+ c #D6D6D8", +"'+ c #EBECED", +")+ c #E7E8E9", +"!+ c #CDCFD0", +"~+ c #9DA0A4", +"{+ c #454B52", +"]+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 }.[.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + |./ 3 / > $ . ", +" . $ > / 3 O [.. . 3 3 3 3 3 3 3 L 1.2.3.4.. . . . . . . . 3 3 3 3 3 3 3 L 1.2.3.4.. . . . . . i / 3 / > $ . ", +" . $ > / 3 5.:.. . 3 3 3 3 3 3 3 3 3 3 3 }.6.. . . . . . . 3 3 3 3 3 3 3 3 3 3 3 }.6.. . . . . -./ 3 / > $ . ", +" . $ > / 7.8.i + . 3 3 3 3 3 3 3 3 3 3 3 3 9.0.. . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 9.0.. . . . %./ 3 / > $ . ", +" . $ > / 7.8.|.+ . 3 3 3 3 /./.' a.b.R 3 3 3 c.. . . . . . 3 3 3 3 /./.' a.b.R 3 3 3 c.. . . . - / 3 / > $ . ", +" . $ > / 7.8.|.+ . 3 3 3 3 . . . . . F 3 3 3 T . . . . . . 3 3 3 3 . . . . . F 3 3 3 T . . . . - / 3 / > $ . ", +" . $ > / 7.d.i + . 3 3 3 3 . . . . . h 3 3 3 Q . . . . . . 3 3 3 3 . . . . . h 3 3 3 Q . . . . - / 3 / > $ . ", +" . $ > / 3 e.i . . 3 3 3 3 . . . . . f.3 3 3 g.. . . . . . 3 3 3 3 . . . . . f.3 3 3 g.. . . . /./ 3 / > $ . ", +" . $ > / 3 h.[.. . 3 3 3 3 . . . . i.j.3 3 3 k.. . . . . . 3 3 3 3 . . . . i.j.3 3 3 k.. . . . /./ 3 / > $ . ", +" . $ > / 3 }.l.. . 3 3 3 3 m.n.o.p.q.3 3 3 ,.. . . . . . . 3 3 3 3 m.n.o.p.q.3 3 3 ,.. . . . . - }.3 / > $ . ", +" . $ > / 3 / ..+ . 3 3 3 3 3 3 3 3 3 3 3 3 T r.i.. . . . . 3 3 3 3 3 3 3 3 3 3 3 3 T r.i.. . . l.}.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s.i.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s.i.. . ..h.3 / > $ . ", +" . $ > / 3 / r + . 3 3 3 3 . . . B t.u.y 3 3 3 3 v.. . . . 3 3 3 3 . . . B t.u.y 3 3 3 3 v.. . +.h.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . ^.: 3 3 3 w.. . . . 3 3 3 3 . . . . . . ^.: 3 3 3 w.. . l.h.3 / > $ . ", +" . $ > / 3 / t . . 3 3 3 3 . . . . . . . f.3 3 3 D . . . . 3 3 3 3 . . . . . . . f.3 3 3 D . . x.}.3 / > $ . ", +" . $ > / 3 / ... . 3 3 3 3 . . . . . . . y.3 3 3 z.. . . . 3 3 3 3 . . . . . . . y.3 3 3 z.. . A.}.3 / > $ . ", +" . $ > / 3 / B.. . 3 3 3 3 . . . . . . #.C.3 3 3 D.. . . . 3 3 3 3 . . . . . . #.C.3 3 3 D.. . . / 3 / > $ . ", +" . $ > / 3 / B + . 3 3 3 3 E.E.o.F.G.H.R 3 3 3 I.J.. . . . 3 3 3 3 E.E.o.F.G.H.R 3 3 3 I.J.. . . / 3 / > $ . ", +" . $ > / 3 / K.+ . 3 3 3 3 3 3 3 3 3 3 3 3 3 8 L.. . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 8 L.. . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . 3 3 3 3 3 3 3 3 3 3 3 3 M.o.. . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 M.o.. . . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 3 3 3 N.O.q.P.Q.^.. . . . . . . 3 3 3 3 3 3 3 N.O.q.P.Q.^.. . . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . B./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + R.S.).3 T.> $ . ", +" . $ B 5.3 3 U.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| V.3 3 z , % . ", +" . & t W.3 3 3 X.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + Y.-.X.3 3 3 Z.x.} . ", +" . + 5 `.3 3 3 3 s b. +-.^.. /.%.-.:.:.:.:.:.:.+.-.|.4.C C [.$.q :.:.i B.#.> i l /.. ^..+b.s 3 3 3 3 P.++. . ", +" . . ++@+3 3 3 3 3 3 #+/ / / / / / / / / / / / / }.P P P P }./ / / / / / / / / / / / / #+3 3 3 3 3 $+%+k . . ", +" . + >.&+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 *+=+= . . ", +" . @ -+;+>+,+'+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / )+!+~+{+= + . ", +" . . + Y.5 &.|.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > B.- Y.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # ]++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/CIcon20.xpm b/lib/creaDevManagerLib/images/CIcon20.xpm new file mode 100644 index 0000000..bff4129 --- /dev/null +++ b/lib/creaDevManagerLib/images/CIcon20.xpm @@ -0,0 +1,138 @@ +/* XPM */ +const static char * CIcon20[] = { +"20 20 115 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #101721", +"[ c #0E1620", +"} c #0B131C", +"| c #0B131D", +"1 c #0A111B", +"2 c #101821", +"3 c #0F1620", +"4 c #353C43", +"5 c #84888D", +"6 c #192029", +"7 c #1C232C", +"8 c #151C26", +"9 c #555A61", +"0 c #C4C6C8", +"a c #E8E9E9", +"b c #D4D5D7", +"c c #81858A", +"d c #232B33", +"e c #181F28", +"f c #86898D", +"g c #808389", +"h c #1D242D", +"i c #171F28", +"j c #BBBDBF", +"k c #FFFFFF", +"l c #E1E2E3", +"m c #BCBEC0", +"n c #C8CACC", +"o c #FEFEFE", +"p c #2B323A", +"q c #82858A", +"r c #A1A3A8", +"s c #8B8F94", +"t c #141C25", +"u c #182029", +"v c #151D26", +"w c #7E8287", +"x c #272D36", +"y c #F6F6F6", +"z c #BEC0C2", +"A c #7D8186", +"B c #7F8388", +"C c #343A43", +"D c #F7F8F8", +"E c #19202A", +"F c #7E8286", +"G c #81848A", +"H c #F5F6F6", +"I c #B0B2B5", +"J c #1A212A", +"K c #808489", +"L c #C5C6C9", +"M c #63686E", +"N c #121A23", +"O c #161D26", +"P c #7C8085", +"Q c #7F8389", +"R c #1B222B", +"S c #EDEEEF", +"T c #CFD0D1", +"U c #868A8F", +"V c #94989C", +"W c #293038", +"X c #7D8286", +"Y c #2C333B", +"Z c #92959A", +"` c #EFF0F0", +" . c #F5F5F6", +".. c #AEB0B3", +"+. c #383E46", +"@. c #1B222C", +"#. c #8D9196", +"$. c #A4A6AA", +"%. c #141B24", +"&. c #09111A", +"*. c #111922", +"=. c #8D9195", +"-. c #6B7075", +";. c #B3B5B9", +">. c #7A7F84", +",. c #7F8488", +"'. c #818589", +"). c #797E83", +"!. c #B0B3B6", +"~. c #65696F", +"{. c #8C9095", +"]. c #909499", +"^. c #8C9094", +"/. c #64686E", +"(. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 | 2 3 4 / > ", +" # 5 6 7 7 8 9 0 a b c d 7 e f # ", +" # g 6 h i j k l m n o p 7 6 q # ", +" # c 6 e r k s t 6 u v h h 6 w # ", +" # c 6 x y z 8 h h h h h h 6 A # ", +" # B 6 C D - 7 h h h h h 7 E F # ", +" # G 6 p H I J h h h h h 7 6 B # ", +" # K 6 e L k M N . O _ 7 h 6 P # ", +" # Q 6 7 R S k T U V = W 7 6 X # ", +" # w 6 h 7 Y Z ` k ...+.@.6 B # ", +" #.$.t 6 6 E %.| &.} *.u E %.$.=. ", +" -.k ;.>.w g g ,.c B G '.).!.k ~. ", +" J % {.].# # # # # # # # ].^./.(. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/Cicon64.xpm b/lib/creaDevManagerLib/images/CIcon64.xpm similarity index 99% rename from lib/creaDevManagerLib/images/Cicon64.xpm rename to lib/creaDevManagerLib/images/CIcon64.xpm index 6aa47f3..2b6ec23 100644 --- a/lib/creaDevManagerLib/images/Cicon64.xpm +++ b/lib/creaDevManagerLib/images/CIcon64.xpm @@ -1,5 +1,5 @@ /* XPM */ -const static char * Cicon[] = { +const static char * CIcon64[] = { "64 64 230 2", " c None", ". c #1D242D", diff --git a/lib/creaDevManagerLib/images/CMIcon20.xpm b/lib/creaDevManagerLib/images/CMIcon20.xpm new file mode 100644 index 0000000..3224569 --- /dev/null +++ b/lib/creaDevManagerLib/images/CMIcon20.xpm @@ -0,0 +1,157 @@ +/* XPM */ +const static char * CMIcon20[] = { +"20 20 134 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #182029", +"8 c #1C232C", +"9 c #1D232C", +"0 c #1D242D", +"a c #181F28", +"b c #86898D", +"c c #7E8387", +"d c #192029", +"e c #1A212A", +"f c #111822", +"g c #131A24", +"h c #0D141E", +"i c #131A23", +"j c #82858B", +"k c #7D8086", +"l c #4F555C", +"m c #DFE0E1", +"n c #FAFAFA", +"o c #BABCBE", +"p c #FFFFFF", +"q c #494E55", +"r c #1B222B", +"s c #C4C7C8", +"t c #C9CACD", +"u c #7D8186", +"v c #7E8187", +"w c #545960", +"x c #EEEFEF", +"y c #494F56", +"z c #373D45", +"A c #F1F1F2", +"B c #313840", +"C c #EEEEEF", +"D c #C2C4C6", +"E c #7B8085", +"F c #BBBDC0", +"G c #81858A", +"H c #0C131D", +"I c #F0F0F1", +"J c #AEB1B4", +"K c #73777D", +"L c #C9CACC", +"M c #8A8E92", +"N c #C9CBCD", +"O c #7C8085", +"P c #7F8388", +"Q c #B2B4B7", +"R c #909397", +"S c #F5F6F6", +"T c #1F262F", +"U c #EDEDED", +"V c #B4B6BA", +"W c #64686F", +"X c #7F8488", +"Y c #3D424B", +"Z c #F9F9F9", +"` c #787C81", +" . c #52575F", +".. c #74787E", +"+. c #121922", +"@. c #F6F6F6", +"#. c #232A32", +"$. c #363C45", +"%. c #20272F", +"&. c #686D73", +"*. c #7A7F84", +"=. c #909499", +"-. c #7F8389", +";. c #181F29", +">. c #3A4148", +",. c #CFD1D3", +"'. c #EBECED", +"). c #A3A5A9", +"!. c #161E27", +"~. c #E8E8E9", +"{. c #63686E", +"]. c #BEC0C2", +"^. c #7C8185", +"/. c #7E8287", +"(. c #161D26", +"_. c #141B24", +":. c #8D9196", +"<. c #A4A6AA", +"[. c #141C25", +"}. c #19202A", +"|. c #8D9195", +"1. c #6B7075", +"2. c #B3B5B9", +"3. c #808389", +"4. c #80858A", +"5. c #818489", +"6. c #818589", +"7. c #797E83", +"8. c #B0B3B6", +"9. c #65696F", +"0. c #8C9095", +"a. c #8C9094", +"b. c #64686E", +"c. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 8 8 9 0 0 0 8 8 8 a b # ", +" # c d e f 4 g 0 h e 0 8 i 2 j # ", +" # k a l m n o g p q r 0 s t u # ", +" - v w x y z q h p A . B C D E # ", +" # u F G 8 0 0 H I J K L M N O # ", +" # P Q R 8 0 0 H S T U V W N O # ", +" # X Y Z ` ...+.@.#.$.%.&.N *.=. ", +" # -.;.>.,.'.).!.~.#.0 8 {.].^.# ", +" # /.d r !.(.a 0 (.8 0 0 e _.P # ", +" :.<.[.d d d d d d d d d }._.<.|. ", +" 1.p 2.*./.3.3.X 4.P 5.6.7.8.p 9. ", +" e % 0.=.# # # # # # # # =.a.b.c. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/CMIcon64.xpm b/lib/creaDevManagerLib/images/CMIcon64.xpm new file mode 100644 index 0000000..b14b238 --- /dev/null +++ b/lib/creaDevManagerLib/images/CMIcon64.xpm @@ -0,0 +1,305 @@ +/* XPM */ +const static char * CMIcon64[] = { +"64 64 238 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #F0F1F1", +"|. c #292F38", +"1. c #ECEDED", +"2. c #1E252D", +"3. c #5D6269", +"4. c #A2A5A8", +"5. c #D8D9DA", +"6. c #EDEDEE", +"7. c #E6E6E7", +"8. c #D0D1D3", +"9. c #999CA0", +"0. c #575C63", +"a. c #DEDFE0", +"b. c #C0C2C4", +"c. c #FEFEFE", +"d. c #EAEBEB", +"e. c #4E545B", +"f. c #75797F", +"g. c #6E7378", +"h. c #82858A", +"i. c #E5E6E7", +"j. c #232932", +"k. c #555B61", +"l. c #F7F8F8", +"m. c #9B9EA2", +"n. c #4D535A", +"o. c #262D35", +"p. c #484D55", +"q. c #7E8287", +"r. c #31373F", +"s. c #808489", +"t. c #656A70", +"u. c #ECEDEE", +"v. c #DFE0E1", +"w. c #E0E1E2", +"x. c #40464D", +"y. c #DBDCDE", +"z. c #EDEEEE", +"A. c #4C5259", +"B. c #85898E", +"C. c #8B8F93", +"D. c #74797E", +"E. c #83878C", +"F. c #EFF0F0", +"G. c #B4B7B9", +"H. c #9C9FA3", +"I. c #E3E4E5", +"J. c #2C333B", +"K. c #595E65", +"L. c #6C7177", +"M. c #96999E", +"N. c #686D73", +"O. c #D1D2D4", +"P. c #333941", +"Q. c #CCCED0", +"R. c #373D45", +"S. c #545A60", +"T. c #A1A4A7", +"U. c #93969A", +"V. c #63686E", +"W. c #B9BBBE", +"X. c #F6F6F6", +"Y. c #B1B3B6", +"Z. c #ACAFB2", +"`. c #A9ABAF", +" + c #3F454D", +".+ c #FBFBFB", +"++ c #F8F8F9", +"@+ c #393F47", +"#+ c #94979B", +"$+ c #8A8E92", +"%+ c #20272F", +"&+ c #DADBDD", +"*+ c #5E6369", +"=+ c #1F252E", +"-+ c #282E37", +";+ c #4F545B", +">+ c #BEC0C2", +",+ c #6B6F75", +"'+ c #2F353E", +")+ c #494F56", +"!+ c #7D8186", +"~+ c #BBBDC0", +"{+ c #61666C", +"]+ c #6C7076", +"^+ c #C1C3C5", +"/+ c #262D36", +"(+ c #51565D", +"_+ c #E1E2E3", +":+ c #AAACB0", +"<+ c #DCDDDE", +"[+ c #919499", +"}+ c #121923", +"|+ c #51575E", +"1+ c #F2F2F2", +"2+ c #B6B8BB", +"3+ c #B5B7BA", +"4+ c #D8DADB", +"5+ c #121A23", +"6+ c #CED0D1", +"7+ c #AEB0B3", +"8+ c #40454E", +"9+ c #30363F", +"0+ c #131A23", +"a+ c #5C6167", +"b+ c #F7F7F7", +"c+ c #444951", +"d+ c #929699", +"e+ c #F3F3F3", +"f+ c #161E27", +"g+ c #5D6268", +"h+ c #ABADB1", +"i+ c #D6D6D8", +"j+ c #EBECED", +"k+ c #E7E8E9", +"l+ c #CDCFD0", +"m+ c #9DA0A4", +"n+ c #454B52", +"o+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 }.[.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + |./ 3 / > $ . ", +" . $ > / 3 O [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 1.:.. . . . . . 2.3.4.5.6.M 7.8.9.0.' . . . 3 3 3 a.- . . . . . . . . . b.3 3 3 . . -./ 3 / > $ . ", +" . $ > / c.d.i + . . . . e._ 3 3 3 3 3 3 3 3 3 y . . . 3 3 3 3 f.. . . . . . . . a 3 3 3 3 . . %./ 3 / > $ . ", +" . $ > / c.d.|.+ . . . g.M 3 3 3 3 3 ).3 3 3 3 h.. . . 3 3 3 3 i.j.. . . . . . . ] 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / c.d.|.+ . . k.L 3 3 l.m.n.o.. ..p.q.,.r.. . . 3 3 3 3 3 s.. . . . . . t.3 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / c.u.i + . - v.3 3 w.x.. . . . . . . . . . . . 3 3 3 / 3 G r . . . . /.y.3 / 3 3 3 . . - / 3 / > $ . ", +" . $ > / 3 z.i . . g.3 3 ).A.. . . . . . . . . . . . . 3 3 3 B.3 3 C.. . . . D.3 3 E.3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 F.[.. . G.3 3 H.. . . . . . . . . . . . . . 3 3 3 ..I.3 N J.. . ..7.3 w.j.3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 }.j.. . T 3 3 K.. . . . . . . . . . . . . . 3 3 3 . L.3 3 M.. . E.3 3 N.. 3 3 3 . . - }.3 / > $ . ", +" . $ > / 3 / ..+ . 2 3 3 C . . . . . . . . . . . . . . 3 3 3 . 2.O.3 2 P.#.Q 3 Q.. . 3 3 3 . . j.}.3 / > $ . ", +" . $ > / 3 / i . . D 3 3 R.. . . . . . . . . . . . . . 3 3 3 . . S.3 3 T.U.3 3 e.. . 3 3 3 . . ..F.3 / > $ . ", +" . $ > / 3 / r + . v.3 3 V.. . . . . . . . . . . . . . 3 3 3 . . . W.3 L X.3 Y.. . + 3 3 3 . . +.F.3 / > $ . ", +" . $ > / 3 / i . . Z.3 3 `.. . . . . . . . . . . . . . 3 3 3 . . . +.+3 3 ++@+. . . 3 3 3 . . j.F.3 / > $ . ", +" . $ > / 3 / t . . t.3 3 ).k.. . . . . . . . . . . . . 3 3 3 . . . . #+y.y.$+. . . . 3 3 3 . . %+}.3 / > $ . ", +" . $ > / 3 / ... . ^.&+3 3 / *+. . . . . . . . . . . . 3 3 3 . . . . . . . . . . . . 3 3 3 . . =+}.3 / > $ . ", +" . $ > / 3 / -+. . . ;+M 3 3 3 >+,+@+h '+)+!+~+{+. . . 3 3 3 . . . . . . . . . . . . 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . ]+M 3 3 3 3 3 3 3 3 3 3 ^+. . . 3 3 3 . . . . . . . . . . . . 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / /++ . . . . (+5.3 3 3 3 3 3 3 3 3 _+r . . 3 3 3 . . . . . . . . . . . . 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . . . ^.V.:+<+/ 2 v.u [+)+. . . . 3 3 3 . . . . . . . . . . . . 3 3 3 . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . -+/ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + }+|+).3 1+> $ . ", +" . $ B 1.3 3 2+| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| 3+3 3 z , % . ", +" . & t 4+3 3 3 m.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + 5+-.m.3 3 3 6+%+} . ", +" . + 5 7+3 3 3 3 s f.8+-.^.. /.%.-.:.:.:.:.:.:.+.-.|.J.C C [.$.q :.:.i -+#.> i l /.. ^.9+f.s 3 3 3 3 H.0+. . ", +" . . 0+a+3 3 3 3 3 3 ++/ / / / / / / / / / / / / }.P P P P }./ / / / / / / / / / / / / ++3 3 3 3 3 b+c+k . . ", +" . + >.d+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 e+g.= . . ", +" . @ f+g+h+i+j+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / k+l+m+n+= + . ", +" . . + 5+5 &.|.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -+- 5+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # o++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/FdIcon20.xpm b/lib/creaDevManagerLib/images/FdIcon20.xpm new file mode 100644 index 0000000..4cb8207 --- /dev/null +++ b/lib/creaDevManagerLib/images/FdIcon20.xpm @@ -0,0 +1,150 @@ +/* XPM */ +const static char * FdIcon20[] = { +"20 20 127 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #151C26", +"8 c #181F28", +"9 c #191F28", +"0 c #1C232C", +"a c #1D242D", +"b c #192029", +"c c #151C25", +"d c #86898D", +"e c #7E8287", +"f c #9C9FA3", +"g c #CFD1D2", +"h c #D4D6D7", +"i c #D3D5D7", +"j c #444A51", +"k c #A0A3A6", +"l c #81858A", +"m c #7C7F85", +"n c #C1C3C5", +"o c #DDDEDF", +"p c #7C8085", +"q c #7D8086", +"r c #313840", +"s c #1A222B", +"t c #C4C6C8", +"u c #7D8186", +"v c #BFC1C4", +"w c #070F19", +"x c #08101A", +"y c #09111B", +"z c #1B222B", +"A c #1B222C", +"B c #232A33", +"C c #A3A6AA", +"D c #C1C2C5", +"E c #E8E8E9", +"F c #7B8085", +"G c #FFFFFF", +"H c #2D343C", +"I c #272E37", +"J c #F7F7F7", +"K c #D9DADC", +"L c #A6A8AC", +"M c #EDEEEF", +"N c #7F8388", +"O c #C8CACC", +"P c #2A3139", +"Q c #2B323A", +"R c #50565C", +"S c #1F262F", +"T c #7F8387", +"U c #1B232C", +"V c #53595F", +"W c #1C222C", +"X c #161D27", +"Y c #C2C4C7", +"Z c #7A7F84", +"` c #909499", +" . c #7E8288", +".. c #C5C6C9", +"+. c #343B43", +"@. c #F4F4F5", +"#. c #D3D5D6", +"$. c #E6E6E7", +"%. c #C1C3C6", +"&. c #7C8185", +"*. c #7E8286", +"=. c #898D91", +"-. c #8C9094", +";. c #3E444B", +">. c #989B9F", +",. c #ABAEB1", +"'. c #85898E", +"). c #8D9196", +"!. c #A4A7AA", +"~. c #131A24", +"{. c #111922", +"]. c #0D151E", +"^. c #A4A6AA", +"/. c #8D9195", +"(. c #6B7075", +"_. c #B3B5B9", +":. c #808389", +"<. c #7F8488", +"[. c #80858A", +"}. c #818489", +"|. c #818589", +"1. c #797E83", +"2. c #B0B3B6", +"3. c #65696F", +"4. c #1A212A", +"5. c #8C9095", +"6. c #64686E", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 8 8 9 0 a a 0 a b c d # ", +" # e f g h h i j 0 0 a 0 k f l # ", +" # m n o p q p r a 0 0 s t n u # ", +" - q n v w x y z A B C D E n F # ", +" # u n G G G G H I J K L M n p # ", +" # N n O P Q P a R G S z t n p # ", +" # T n t U a a a V G W X Y n Z ` ", +" # .n ..U a a a +.@.#.N $.%.&.# ", +" # *.=.-.0 a a a z ;.>.,.'.-.e # ", +" ).!.2 ~.b b b b b b : {.7 ].^./. ", +" (.G _.Z e :.:.<.[.N }.|.1.2.G 3. ", +" 4.% 5.` # # # # # # # # ` -.6.X ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/FdIcon64.xpm b/lib/creaDevManagerLib/images/FdIcon64.xpm new file mode 100644 index 0000000..8f39e2d --- /dev/null +++ b/lib/creaDevManagerLib/images/FdIcon64.xpm @@ -0,0 +1,274 @@ +/* XPM */ +const static char * FdIcon64[] = { +"64 64 207 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #BFC1C3", +"|. c #F0F1F1", +"1. c #292F38", +"2. c #ECEDED", +"3. c #F4F4F4", +"4. c #B8BABD", +"5. c #FEFEFE", +"6. c #EAEBEB", +"7. c #ECEDEE", +"8. c #3A4048", +"9. c #93969A", +"0. c #CDCED0", +"a. c #EBECEC", +"b. c #EDEDEE", +"c. c #9C9FA3", +"d. c #EDEEEE", +"e. c #FBFBFB", +"f. c #EFF0F0", +"g. c #B4B7B9", +"h. c #C3C5C7", +"i. c #232932", +"j. c #9A9DA1", +"k. c #D1D3D5", +"l. c #B3B6B9", +"m. c #B2B4B7", +"n. c #C8C9CC", +"o. c #393F47", +"p. c #BCBEC1", +"q. c #41474E", +"r. c #8D9095", +"s. c #C9CBCD", +"t. c #62666D", +"u. c #E8E9EA", +"v. c #2F353E", +"w. c #20272F", +"x. c #363C44", +"y. c #1F252E", +"z. c #282E37", +"A. c #DCDDDE", +"B. c #73777C", +"C. c #AAACB0", +"D. c #E1E2E3", +"E. c #262D36", +"F. c #60656B", +"G. c #D8D9DA", +"H. c #1E252D", +"I. c #373D45", +"J. c #CBCDCF", +"K. c #C7C8CB", +"L. c #E0E1E2", +"M. c #3C4249", +"N. c #E7E8E9", +"O. c #3B4148", +"P. c #5C6168", +"Q. c #A9ABAF", +"R. c #DADBDD", +"S. c #656A70", +"T. c #121923", +"U. c #51575E", +"V. c #F2F2F2", +"W. c #B6B8BB", +"X. c #B5B7BA", +"Y. c #D8DADB", +"Z. c #9B9EA2", +"`. c #121A23", +" + c #CED0D1", +".+ c #AEB0B3", +"++ c #75797F", +"@+ c #40454E", +"#+ c #2C333B", +"$+ c #30363F", +"%+ c #131A23", +"&+ c #5C6167", +"*+ c #F8F8F9", +"=+ c #F7F7F7", +"-+ c #444951", +";+ c #929699", +">+ c #F3F3F3", +",+ c #6E7378", +"'+ c #161E27", +")+ c #5D6268", +"!+ c #ABADB1", +"~+ c #D6D6D8", +"{+ c #EBECED", +"]+ c #CDCFD0", +"^+ c #9DA0A4", +"/+ c #454B52", +"(+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 }.. . . . . . . . . . . . . . . . 3 3 3 3 . + > / 3 / > $ . ", +" . $ > / 3 |.[.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 }.. . . . . . . . . . . . . . . . 3 3 3 3 . + 1./ 3 / > $ . ", +" . $ > / 3 O [.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 }.. . . . . . . . . . . . . . . . 3 3 3 3 . . i / 3 / > $ . ", +" . $ > / 3 2.:.. . 3 3 3 3 3.3.3.3.3.3.3.3.3.3.3.4.. . . . . . . . . . . . . . . . 3 3 3 3 . . -./ 3 / > $ . ", +" . $ > / 5.6.i + . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . %./ 3 / > $ . ", +" . $ > / 5.6.1.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 5.6.1.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 5.7.i + . 3 3 3 3 . . . . . . . . . . . . . . . . . . . . 8.9.0.a.L b._ c.3 3 3 3 . . - / 3 / > $ . ", +" . $ > / 3 d.i . . 3 3 3 3 . . . . . . . . . . . . . . . . . . %.c.e.3 3 3 3 3 3 3 3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 f.[.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . . %.h.3 3 3 3 3 3 3 3 3 3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 |.i.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . . j.3 3 3 3 3 k.l.m.n.3.3 3 3 3 . . - |.3 / > $ . ", +" . $ > / 3 / ..+ . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . o.L 3 3 3 p.q.. . . . /.3 3 3 3 . . i.|.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 g.. . . . . r.3 3 3 0./.. . . . . . 3 3 3 3 . . ..f.3 / > $ . ", +" . $ > / 3 / r + . 3 3 3 3 . . . . . . . . . . . . . . . . s.3 3 3 t.. . . . . . . 3 3 3 3 . . +.f.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . . . . . . . . . . . u.3 3 3 v.. . . . . . . 3 3 3 3 . . i.f.3 / > $ . ", +" . $ > / 3 / t . . 3 3 3 3 . . . . . . . . . . . . . . . . M 3 3 3 ' . . . . . . . 3 3 3 3 . . w.|.3 / > $ . ", +" . $ > / 3 / ... . 3 3 3 3 . . . . . . . . . . . . . . . . |.3 3 3 x.. . . . . . . 3 3 3 3 . . y.|.3 / > $ . ", +" . $ > / 3 / z.. . 3 3 3 3 . . . . . . . . . . . . . . . . A.3 3 3 B.. . . . . . . 3 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / B + . 3 3 3 3 . . . . . . . . . . . . . . . . C.3 3 3 D.#.. . . . . . 3 3 3 3 . . . / 3 / > $ . ", +" . $ > / 3 / E.+ . 3 3 3 3 . . . . . . . . . . . . . . . . F.3 3 3 3 G.F.H.. . . I.3 3 3 3 . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . J.3 3 3 3 3 ( s.K.L.3 3 3 3 3 . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . M.N.3 3 3 3 3 3 3 3 3 3 3 3 3 . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . . O.s.3 3 3 3 3 3 3 3 M 3 3 3 . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . 3 3 3 3 . . . . . . . . . . . . . . . . . . . H.P.Q.J.G 3.R.g.S.I.3 3 3 . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . z./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + T.U.).3 V.> $ . ", +" . $ B 2.3 3 W.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| X.3 3 z , % . ", +" . & t Y.3 3 3 Z.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + `.-.Z.3 3 3 +w.} . ", +" . + 5 .+3 3 3 3 s ++@+-.^.. /.%.-.:.:.:.:.:.:.+.-.1.#+C C [.$.q :.:.i z.#.> i l /.. ^.$+++s 3 3 3 3 c.%+. . ", +" . . %+&+3 3 3 3 3 3 *+/ / / / / / / / / / / / / |.P P P P |./ / / / / / / / / / / / / *+3 3 3 3 3 =+-+k . . ", +" . + >.;+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 >+,+= . . ", +" . @ '+)+!+~+{+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / N.]+^+/+= + . ", +" . . + `.5 &.1.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > z.- `.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # (++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/FlIcon20.xpm b/lib/creaDevManagerLib/images/FlIcon20.xpm new file mode 100644 index 0000000..36fc442 --- /dev/null +++ b/lib/creaDevManagerLib/images/FlIcon20.xpm @@ -0,0 +1,141 @@ +/* XPM */ +const static char * FlIcon20[] = { +"20 20 118 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #192029", +"8 c #131A23", +"9 c #141B24", +"0 c #141B25", +"a c #1D242D", +"b c #151D26", +"c c #181F28", +"d c #86898D", +"e c #7E8387", +"f c #070F19", +"g c #FFFFFF", +"h c #A1A4A7", +"i c #D8DADB", +"j c #FDFDFD", +"k c #151C25", +"l c #82858A", +"m c #7D8086", +"n c #08101A", +"o c #A4A7AA", +"p c #2D343C", +"q c #343A42", +"r c #343A43", +"s c #283037", +"t c #CDCFD1", +"u c #F0F0F1", +"v c #7E8287", +"w c #7E8187", +"x c #95999D", +"y c #0C131D", +"z c #131A24", +"A c #1B222B", +"B c #7C8186", +"C c #DFDFE1", +"D c #B4B7BA", +"E c #B7B9BC", +"F c #C0C2C4", +"G c #272E37", +"H c #7D8186", +"I c #808489", +"J c #D2D3D5", +"K c #979A9E", +"L c #9A9DA1", +"M c #A1A5A8", +"N c #252D35", +"O c #808488", +"P c #969A9E", +"Q c #151C26", +"R c #1C232C", +"S c #7B8085", +"T c #909499", +"U c #7F8389", +"V c #999DA0", +"W c #CCCED0", +"X c #F4F4F4", +"Y c #393F47", +"Z c #1F262F", +"` c #7D8286", +" . c #A2A6A9", +".. c #252C34", +"+. c #7F8387", +"@. c #8D9196", +"#. c #A4A6AA", +"$. c #161D26", +"%. c #1A212A", +"&. c #09101A", +"*. c #0B121C", +"=. c #8D9195", +"-. c #6B7075", +";. c #B3B5B9", +">. c #7A7F84", +",. c #808389", +"'. c #7F8488", +"). c #80858A", +"!. c #7F8388", +"~. c #818489", +"{. c #818589", +"]. c #797E83", +"^. c #B0B3B6", +"/. c #65696F", +"(. c #8C9095", +"_. c #8C9094", +":. c #64686E", +"<. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 : : 9 0 7 a b 0 a c d # ", +" # e f g g g g g h . i j k 7 l # ", +" # m n g o p q r s c t u b 7 v # ", +" - w n g x y z 8 A c t u b 7 B # ", +" # v n g C D E F G c t u b 7 H # ", +" # I n g J K L M N c t u b 7 H # ", +" # O n g P 2 b Q R c t u 0 7 S T ", +" # U n g V b a a a c W X Y Z ` # ", +" # v f g .k a a a R I g g ..+.# ", +" @.#.$.f 3 %.7 7 7 7 9 &.*.z #.=. ", +" -.g ;.>.v ,.,.'.).!.~.{.].^.g /. ", +" %.% (.T # # # # # # # # T _.:.<. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/FlIcon64.xpm b/lib/creaDevManagerLib/images/FlIcon64.xpm new file mode 100644 index 0000000..79a1850 --- /dev/null +++ b/lib/creaDevManagerLib/images/FlIcon64.xpm @@ -0,0 +1,247 @@ +/* XPM */ +const static char * FlIcon64[] = { +"64 64 180 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #868A8E", +"}. c #252B34", +"|. c #F0F1F1", +"1. c #292F38", +"2. c #ECEDED", +"3. c #3C4249", +"4. c #FEFEFE", +"5. c #EAEBEB", +"6. c #ECEDEE", +"7. c #EDEEEE", +"8. c #EFF0F0", +"9. c #232932", +"0. c #6D7278", +"a. c #20272F", +"b. c #1F252E", +"c. c #282E37", +"d. c #262D36", +"e. c #2C333B", +"f. c #9C9FA3", +"g. c #2C323A", +"h. c #464C53", +"i. c #393F47", +"j. c #DEDFE0", +"k. c #74797E", +"l. c #A6A9AC", +"m. c #30363F", +"n. c #2F353E", +"o. c #DFE0E1", +"p. c #FBFBFB", +"q. c #E6E6E7", +"r. c #C3C5C7", +"s. c #83878C", +"t. c #121923", +"u. c #51575E", +"v. c #F2F2F2", +"w. c #B6B8BB", +"x. c #B5B7BA", +"y. c #D8DADB", +"z. c #9B9EA2", +"A. c #121A23", +"B. c #CED0D1", +"C. c #AEB0B3", +"D. c #75797F", +"E. c #40454E", +"F. c #131A23", +"G. c #5C6167", +"H. c #F8F8F9", +"I. c #F7F7F7", +"J. c #444951", +"K. c #929699", +"L. c #F3F3F3", +"M. c #6E7378", +"N. c #161E27", +"O. c #5D6268", +"P. c #ABADB1", +"Q. c #D6D6D8", +"R. c #EBECED", +"S. c #E7E8E9", +"T. c #CDCFD0", +"U. c #9DA0A4", +"V. c #454B52", +"W. c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / }.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 |.}.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . + 1./ 3 / > $ . ", +" . $ > / 3 O }.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [.. . . . . 3 3 3 3 3 . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 2.:.. . . . 3 3 3 3 3 F F F F F F F F F F F F 3.. . . . . 3 3 3 3 3 . . . . . . . . -./ 3 / > $ . ", +" . $ > / 4.5.i + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . %./ 3 / > $ . ", +" . $ > / 4.5.1.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 4.5.1.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 4.6.i + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . - / 3 / > $ . ", +" . $ > / 3 7.i . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 8.}.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 |.9.. . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . . . . . . - |.3 / > $ . ", +" . $ > / 3 / ..+ . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . . . . . . 9.|.3 / > $ . ", +" . $ > / 3 / i . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . . + . . . . ..8.3 / > $ . ", +" . $ > / 3 / r + . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0.. . . . . . 3 3 3 3 3 . . + . . . . . +.8.3 / > $ . ", +" . $ > / 3 / i . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . 9.8.3 / > $ . ", +" . $ > / 3 / t . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . a.|.3 / > $ . ", +" . $ > / 3 / ... . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . b.|.3 / > $ . ", +" . $ > / 3 / c.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / d.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 3 e.. . . . . . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . 8 3 3 3 3 f.g.%.h.i.. . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . j.3 3 3 3 3 3 ).3 k.. . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . l.3 3 3 3 3 3 3 3 k.. . . :./ 3 / > $ . ", +" . $ > / 3 / }.. . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . m.5.3 3 3 3 3 3 3 k.. . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . n.: o.p.N q.r.s.g.. . . c./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + t.u.).3 v.> $ . ", +" . $ B 2.3 3 w.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| x.3 3 z , % . ", +" . & t y.3 3 3 z.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + A.-.z.3 3 3 B.a.} . ", +" . + 5 C.3 3 3 3 s D.E.-.^.. /.%.-.:.:.:.:.:.:.+.-.1.e.C C }.$.q :.:.i c.#.> i l /.. ^.m.D.s 3 3 3 3 f.F.. . ", +" . . F.G.3 3 3 3 3 3 H./ / / / / / / / / / / / / |.P P P P |./ / / / / / / / / / / / / H.3 3 3 3 3 I.J.k . . ", +" . + >.K.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 L.M.= . . ", +" . @ N.O.P.Q.R./ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / S.T.U.V.= + . ", +" . . + A.5 &.1.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > c.- A.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # W.+ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/LIcon20.xpm b/lib/creaDevManagerLib/images/LIcon20.xpm new file mode 100644 index 0000000..591c5f6 --- /dev/null +++ b/lib/creaDevManagerLib/images/LIcon20.xpm @@ -0,0 +1,111 @@ +/* XPM */ +const static char * LIcon20[] = { +"20 20 88 1", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #121A23", +"< c #2B323B", +"[ c #1C232C", +"} c #101721", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #0F1620", +"4 c #353C43", +"5 c #84888D", +"6 c #182029", +"7 c #141B24", +"8 c #FFFFFF", +"9 c #7F8388", +"0 c #1A212A", +"a c #1D242D", +"b c #181F28", +"c c #86898D", +"d c #7E8387", +"e c #192029", +"f c #131B24", +"g c #82868B", +"h c #82858A", +"i c #7D8086", +"j c #7E8287", +"k c #7E8187", +"l c #7C8186", +"m c #7D8186", +"n c #808489", +"o c #808488", +"p c #7B8085", +"q c #909499", +"r c #7F8389", +"s c #858A8E", +"t c #1F262F", +"u c #232A33", +"v c #222931", +"w c #7D8286", +"x c #F0F0F1", +"y c #E3E4E5", +"z c #E4E5E6", +"A c #BDBFC2", +"B c #8D9196", +"C c #A4A6AA", +"D c #141C25", +"E c #CBCDCF", +"F c #C1C3C5", +"G c #A0A3A7", +"H c #151C26", +"I c #19202A", +"J c #8D9195", +"K c #6B7075", +"L c #B3B5B9", +"M c #7A7F84", +"N c #7F8288", +"O c #7F8489", +"P c #81858A", +"Q c #797E83", +"R c #B0B3B6", +"S c #65696F", +"T c #8C9095", +"U c #8C9094", +"V c #64686E", +"W c #161D27", +" ", +" ", +" .+@##########$%& ", +" *=-;>>>>>>>>;-,% ", +" *')!)~{))]~{!)'^ ", +" >/(_:<[}|12}34/> ", +" #56[7890aa[[[bc# ", +" #deaf8ge[[aaaeh# ", +" #ieaf8geaaaaaej# ", +" -keaf8geaaaaael# ", +" #jeaf8geaaaaaem# ", +" #neaf8geaaaaaem# ", +" #oeaf8geaaaaaepq ", +" #reaf8stuuv[aew# ", +" #jeaf8xyzzAbae9# ", +" BCDe:EFFFFGHI7CJ ", +" K8LMjNNdOjnPQR8S ", +" 0%Tq########qUVW ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/LIcon64.xpm b/lib/creaDevManagerLib/images/LIcon64.xpm new file mode 100644 index 0000000..a5369f5 --- /dev/null +++ b/lib/creaDevManagerLib/images/LIcon64.xpm @@ -0,0 +1,233 @@ +/* XPM */ +const static char * LIcon64[] = { +"64 64 166 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #252B34", +"[. c #F0F1F1", +"}. c #292F38", +"|. c #ECEDED", +"1. c #FEFEFE", +"2. c #EAEBEB", +"3. c #ECEDEE", +"4. c #EDEEEE", +"5. c #EFF0F0", +"6. c #232932", +"7. c #20272F", +"8. c #1F252E", +"9. c #282E37", +"0. c #262D36", +"a. c #F7F8F8", +"b. c #31373F", +"c. c #121923", +"d. c #51575E", +"e. c #F2F2F2", +"f. c #B6B8BB", +"g. c #B5B7BA", +"h. c #D8DADB", +"i. c #9B9EA2", +"j. c #121A23", +"k. c #CED0D1", +"l. c #AEB0B3", +"m. c #75797F", +"n. c #40454E", +"o. c #2C333B", +"p. c #30363F", +"q. c #9C9FA3", +"r. c #131A23", +"s. c #5C6167", +"t. c #F8F8F9", +"u. c #F7F7F7", +"v. c #444951", +"w. c #929699", +"x. c #F3F3F3", +"y. c #6E7378", +"z. c #161E27", +"A. c #5D6268", +"B. c #ABADB1", +"C. c #D6D6D8", +"D. c #EBECED", +"E. c #E7E8E9", +"F. c #CDCFD0", +"G. c #9DA0A4", +"H. c #454B52", +"I. c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . 3 3 3 3 3 . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . 3 3 3 3 3 ^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / <.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 [.<.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . + }./ 3 / > $ . ", +" . $ > / 3 O <.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 |.:.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 1.2.i + . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 1.2.}.+ . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 1.2.}.+ . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 1.3.i + . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 3 4.i . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 5.<.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 [.6.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . - [.3 / > $ . ", +" . $ > / 3 / ..+ . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . 6.[.3 / > $ . ", +" . $ > / 3 / i . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . + . . . . ..5.3 / > $ . ", +" . $ > / 3 / r + . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . + . . . . . +.5.3 / > $ . ", +" . $ > / 3 / i . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.3 / > $ . ", +" . $ > / 3 / t . . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . 7.[.3 / > $ . ", +" . $ > / 3 / ... . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . 8.[.3 / > $ . ", +" . $ > / 3 / 9.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / 0.+ . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . 3 3 3 3 3 a.a.a.a.a.a.a.a.a.a.a.a.a.a.b.. . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / <.. . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 b.. . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 b.. . . . . . . . . . 9./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 b.. . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 b.. . . . . . . + + c.d.).3 e.> $ . ", +" . $ B |.3 3 f.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| g.3 3 z , % . ", +" . & t h.3 3 3 i.&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + j.-.i.3 3 3 k.7.} . ", +" . + 5 l.3 3 3 3 s m.n.-.^.. /.%.-.:.:.:.:.:.:.+.-.}.o.C C <.$.q :.:.i 9.#.> i l /.. ^.p.m.s 3 3 3 3 q.r.. . ", +" . . r.s.3 3 3 3 3 3 t./ / / / / / / / / / / / / [.P P P P [./ / / / / / / / / / / / / t.3 3 3 3 3 u.v.k . . ", +" . + >.w.3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 x.y.= . . ", +" . @ z.A.B.C.D./ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / E.F.G.H.= + . ", +" . . + j.5 &.}.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 9.- j.) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # I.+ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/LbIcon20.xpm b/lib/creaDevManagerLib/images/LbIcon20.xpm new file mode 100644 index 0000000..3dc2f4c --- /dev/null +++ b/lib/creaDevManagerLib/images/LbIcon20.xpm @@ -0,0 +1,151 @@ +/* XPM */ +const static char * LbIcon20[] = { +"20 20 128 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #151C26", +"8 c #192029", +"9 c #1C232C", +"0 c #1D232C", +"a c #1D242D", +"b c #1A212B", +"c c #1A212A", +"d c #181F28", +"e c #86898D", +"f c #7E8287", +"g c #9C9FA3", +"h c #A0A3A6", +"i c #1C242D", +"j c #161D26", +"k c #95989C", +"l c #7F8388", +"m c #82858A", +"n c #7C7F85", +"o c #C1C3C5", +"p c #C4C6C8", +"q c #1B232C", +"r c #141B25", +"s c #B7B9BC", +"t c #9A9DA1", +"u c #141C25", +"v c #7D8086", +"w c #B5B7BA", +"x c #CBCCCE", +"y c #B8BABC", +"z c #ADAFB3", +"A c #434950", +"B c #7C8186", +"C c #7D8186", +"D c #B4B6B9", +"E c #EAEAEB", +"F c #AFB1B4", +"G c #D2D3D5", +"H c #FFFFFF", +"I c #444A51", +"J c #7C8086", +"K c #1F262F", +"L c #D2D4D5", +"M c #B2B4B7", +"N c #7C8185", +"O c #7F8387", +"P c #C2C4C7", +"Q c #151C25", +"R c #131A24", +"S c #979A9E", +"T c #CECFD1", +"U c #B0B3B6", +"V c #7B7F84", +"W c #909499", +"X c #7E8288", +"Y c #E4E4E5", +"Z c #94979C", +"` c #93969A", +" . c #293039", +".. c #B5B8BA", +"+. c #71767A", +"@. c #ADB0B3", +"#. c #444B51", +"$. c #7E8286", +"%. c #898D91", +"&. c #B4B7B9", +"*. c #B4B7BA", +"=. c #323941", +"-. c #83878C", +";. c #B0B2B6", +">. c #9CA0A3", +",. c #434951", +"'. c #8D9196", +"). c #A4A7AA", +"!. c #111822", +"~. c #111922", +"{. c #131A23", +"]. c #141B24", +"^. c #A4A6AA", +"/. c #8D9195", +"(. c #6B7075", +"_. c #B3B5B9", +":. c #7A7F84", +"<. c #808389", +"[. c #7F8488", +"}. c #80858A", +"|. c #818489", +"1. c #818589", +"2. c #797E83", +"3. c #65696F", +"4. c #8C9095", +"5. c #8C9094", +"6. c #64686E", +"7. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 9 9 0 a b c a 9 9 d e # ", +" # f g h 9 a i j k l . a a 8 m # ", +" # n o p q a a r s t u 9 9 8 f # ", +" - v o p q a a r w x y z A j B # ", +" # C o p q a a r D E F G H I J # ", +" # l o p q a a r s t u K L M N # ", +" # O o P Q j j R s S _ j T U V W ", +" # X o Y Z k ` ...G +.@.H #.C # ", +" # $.%.&.s s *.=.-.f ;.>.,.7 l # ", +" '.).2 !.!.!.!.d : j ~.{.8 ].^./. ", +" (.H _.:.f <.<.[.}.l |.1.2.U H 3. ", +" c % 4.W # # # # # # # # W 5.6.7. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/LbIcon64.xpm b/lib/creaDevManagerLib/images/LbIcon64.xpm new file mode 100644 index 0000000..53ac0bc --- /dev/null +++ b/lib/creaDevManagerLib/images/LbIcon64.xpm @@ -0,0 +1,274 @@ +/* XPM */ +const static char * LbIcon64[] = { +"64 64 207 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #F0F1F1", +"|. c #292F38", +"1. c #ECEDED", +"2. c #FEFEFE", +"3. c #EAEBEB", +"4. c #ECEDEE", +"5. c #767A80", +"6. c #B2B4B7", +"7. c #DBDCDE", +"8. c #F7F8F8", +"9. c #BDBFC2", +"0. c #919499", +"a. c #3E444C", +"b. c #EDEEEE", +"c. c #A6A9AC", +"d. c #EFF0F0", +"e. c #D2D4D5", +"f. c #2C333B", +"g. c #232932", +"h. c #E3E4E5", +"i. c #C9CACC", +"j. c #C3C5C7", +"k. c #D9DADC", +"l. c #B3B5B8", +"m. c #353B43", +"n. c #818589", +"o. c #51565D", +"p. c #3C424A", +"q. c #9FA2A6", +"r. c #84888D", +"s. c #D6D7D9", +"t. c #3D434B", +"u. c #F8F8F9", +"v. c #20272F", +"w. c #30363F", +"x. c #E5E6E7", +"y. c #1F252E", +"z. c #282E37", +"A. c #696E73", +"B. c #C4C6C8", +"C. c #82868B", +"D. c #262D36", +"E. c #D8D9DA", +"F. c #2E353D", +"G. c #F4F4F4", +"H. c #7A7F84", +"I. c #F5F5F5", +"J. c #B4B7B9", +"K. c #ACAFB2", +"L. c #C1C3C5", +"M. c #7F8388", +"N. c #EDEDEE", +"O. c #73777C", +"P. c #585D64", +"Q. c #8D9195", +"R. c #E0E0E2", +"S. c #E0E1E2", +"T. c #B3B6B9", +"U. c #75797F", +"V. c #121923", +"W. c #51575E", +"X. c #F2F2F2", +"Y. c #B6B8BB", +"Z. c #B5B7BA", +"`. c #D8DADB", +" + c #9B9EA2", +".+ c #121A23", +"++ c #CED0D1", +"@+ c #AEB0B3", +"#+ c #40454E", +"$+ c #9C9FA3", +"%+ c #131A23", +"&+ c #5C6167", +"*+ c #F7F7F7", +"=+ c #444951", +"-+ c #929699", +";+ c #F3F3F3", +">+ c #6E7378", +",+ c #161E27", +"'+ c #5D6268", +")+ c #ABADB1", +"!+ c #D6D6D8", +"~+ c #EBECED", +"{+ c #E7E8E9", +"]+ c #CDCFD0", +"^+ c #9DA0A4", +"/+ c #454B52", +"(+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 }.[.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . + |./ 3 / > $ . ", +" . $ > / 3 O [.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 1.:.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 2.3.i + . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 2.3.|.+ . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 2.3.|.+ . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / 2.4.i + . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 5.6.7.R 8.7.9.0.a.. . . . . . - / 3 / > $ . ", +" . $ > / 3 b.i . . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 c.#.. . . . /./ 3 / > $ . ", +" . $ > / 3 d.[.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 e.f.. . . /./ 3 / > $ . ", +" . $ > / 3 }.g.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 3 h.i.j.k.M 3 3 3 3 3 l.. . . - }.3 / > $ . ", +" . $ > / 3 / ..+ . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 m.. . . . C n.R 3 3 3 3 o.. . g.}.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . p./ 3 3 3 q.. . ..d.3 / > $ . ", +" . $ > / 3 / r + . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . r.3 3 3 s.. . +.d.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . t.3 3 3 G . . g.d.3 / > $ . ", +" . $ > / 3 / t . . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . ..3 3 3 u.. . v.}.3 / > $ . ", +" . $ > / 3 / ... . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . w.3 3 3 x.. . y.}.3 / > $ . ", +" . $ > / 3 / z.. . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . A.3 3 3 B.. . . / 3 / > $ . ", +" . $ > / 3 / B + . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . , 7.3 3 3 C.. . . / 3 / > $ . ", +" . $ > / 3 / D.+ . 3 3 3 3 . . . . . . . . . . . . . . . 3 3 3 3 /.. . . . /.F E.3 3 3 N F.. . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . 3 3 3 3 G.G.G.G.G.G.G.G.G.G.G.H.. . . 3 3 3 3 I.y J.K.L.( 3 3 3 3 3 M.. . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 M.. . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 q.. . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 M.. . . 3 3 3 3 3 3 3 3 3 3 3 3 N.O.. . . . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 M.. . . 3 3 3 P.Q.u R.2 D S.T.U.h . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . z./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + V.W.).3 X.> $ . ", +" . $ B 1.3 3 Y.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| Z.3 3 z , % . ", +" . & t `.3 3 3 +&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + .+-. +3 3 3 ++v.} . ", +" . + 5 @+3 3 3 3 s U.#+-.^.. /.%.-.:.:.:.:.:.:.+.-.|.f.C C [.$.q :.:.i z.#.> i l /.. ^.w.U.s 3 3 3 3 $+%+. . ", +" . . %+&+3 3 3 3 3 3 u./ / / / / / / / / / / / / }.P P P P }./ / / / / / / / / / / / / u.3 3 3 3 3 *+=+k . . ", +" . + >.-+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ;+>+= . . ", +" . @ ,+'+)+!+~+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / {+]+^+/+= + . ", +" . . + .+5 &.|.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > z.- .+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # (++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/PkIcon20.xpm b/lib/creaDevManagerLib/images/PkIcon20.xpm new file mode 100644 index 0000000..abc8e45 --- /dev/null +++ b/lib/creaDevManagerLib/images/PkIcon20.xpm @@ -0,0 +1,156 @@ +/* XPM */ +const static char * PkIcon20[] = { +"20 20 133 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #121922", +"8 c #141B24", +"9 c #181E27", +"0 c #1D242D", +"a c #1C232D", +"b c #1A222B", +"c c #1C232C", +"d c #181F28", +"e c #86898D", +"f c #7D8286", +"g c #CBCDCF", +"h c #FFFFFF", +"i c #DFDFE1", +"j c #3C424A", +"k c #373E45", +"l c #51575D", +"m c #192029", +"n c #82858A", +"o c #7C7F85", +"p c #C1C3C5", +"q c #C2C4C6", +"r c #131A24", +"s c #222932", +"t c #E7E7E8", +"u c #A2A4A8", +"v c #2F363E", +"w c #FCFCFD", +"x c #4E545A", +"y c #182029", +"z c #7E8287", +"A c #7D8086", +"B c #060E18", +"C c #BDBFC2", +"D c #4E545B", +"E c #B8BABD", +"F c #83868B", +"G c #7D8186", +"H c #B8BBBD", +"I c #DFE1E2", +"J c #4C5158", +"K c #FCFDFD", +"L c #565C62", +"M c #D0D1D4", +"N c #B1B3B6", +"O c #0C131C", +"P c #7F8388", +"Q c #E5E6E7", +"R c #94979B", +"S c #777A81", +"T c #2A3138", +"U c #F8F9F9", +"V c #F8F8F9", +"W c #ADAFB2", +"X c #7F8387", +"Y c #C2C4C7", +"Z c #151C25", +"` c #FCFCFC", +" . c #969A9E", +".. c #161D26", +"+. c #7B8085", +"@. c #909499", +"#. c #7E8288", +"$. c #C1C3C6", +"%. c #C5C7C9", +"&. c #1B232C", +"*. c #363D44", +"=. c #FDFDFD", +"-. c #494F56", +";. c #686D73", +">. c #444A52", +",. c #484D55", +"'. c #232A33", +"). c #565B62", +"!. c #293038", +"~. c #1B222B", +"{. c #4E535A", +"]. c #474D54", +"^. c #7F8488", +"/. c #8D9196", +"(. c #A4A6AA", +"_. c #141C25", +":. c #19202A", +"<. c #8D9195", +"[. c #6B7075", +"}. c #B3B5B9", +"|. c #7A7F84", +"1. c #808389", +"2. c #80858A", +"3. c #818489", +"4. c #818589", +"5. c #797E83", +"6. c #B0B3B6", +"7. c #65696F", +"8. c #1A212A", +"9. c #8C9095", +"0. c #8C9094", +"a. c #64686E", +"b. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 : : 8 9 0 a : b c c d e # ", +" # f g h h h i j k h l 0 0 m n # ", +" # o p q r s t u v w x c c y z # ", +" - A p q r B C ' v w D m E F G # ", +" # G p ~ H I h J ( K L M N O G # ", +" # P p Q R S T 0 ( U V W m m G # ", +" # X p Y Z d c 0 ( ` .h J ..+.@. ", +" # #.$.%.&.0 0 0 *.=.-.;.h ( f # ", +" # z >.,.c 0 0 0 '.).!.~.{.].^.# ", +" /.(._.m m m m m m m m m :.8 (.<. ", +" [.h }.|.z 1.1.^.2.P 3.4.5.6.h 7. ", +" 8.% 9.@.# # # # # # # # @.0.a.b. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/PkIcon64.xpm b/lib/creaDevManagerLib/images/PkIcon64.xpm new file mode 100644 index 0000000..6b2ffeb --- /dev/null +++ b/lib/creaDevManagerLib/images/PkIcon64.xpm @@ -0,0 +1,284 @@ +/* XPM */ +const static char * PkIcon64[] = { +"64 64 217 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #F8F8F9", +"}. c #EFF0F0", +"|. c #E5E6E7", +"1. c #C4C6C8", +"2. c #919499", +"3. c #434850", +"4. c #252B34", +"5. c #A4A6AA", +"6. c #232932", +"7. c #F0F1F1", +"8. c #B3B6B9", +"9. c #1E252D", +"0. c #292F38", +"a. c #DBDCDE", +"b. c #E0E1E2", +"c. c #5B6066", +"d. c #ECEDED", +"e. c #545A60", +"f. c #A6A9AC", +"g. c #B6B8BB", +"h. c #FEFEFE", +"i. c #EAEBEB", +"j. c #95989C", +"k. c #363C44", +"l. c #F6F6F6", +"m. c #EDEDEE", +"n. c #ECEDEE", +"o. c #4C5259", +"p. c #A0A3A7", +"q. c #595E65", +"r. c #EDEEEE", +"s. c #C7C8CB", +"t. c #ACAFB2", +"u. c #AAACB0", +"v. c #EBECEC", +"w. c #494F56", +"x. c #333941", +"y. c #5A5F65", +"z. c #8B8F93", +"A. c #3C4249", +"B. c #C5C7C9", +"C. c #BCBEC1", +"D. c #D3D4D6", +"E. c #31373F", +"F. c #2E353D", +"G. c #262D35", +"H. c #F7F8F8", +"I. c #9DA0A4", +"J. c #CCCED0", +"K. c #DDDEDF", +"L. c #CECFD1", +"M. c #75797F", +"N. c #2C323A", +"O. c #9FA2A6", +"P. c #454B52", +"Q. c #BBBDC0", +"R. c #20272F", +"S. c #CBCDCF", +"T. c #343B43", +"U. c #1F252E", +"V. c #282E37", +"W. c #D9DADC", +"X. c #353B43", +"Y. c #262D36", +"Z. c #41474E", +"`. c #4E545B", +" + c #B9BBBE", +".+ c #5E6369", +"++ c #FBFBFB", +"@+ c #ABADB0", +"#+ c #6F7379", +"$+ c #9C9FA3", +"%+ c #121923", +"&+ c #51575E", +"*+ c #F2F2F2", +"=+ c #B5B7BA", +"-+ c #D8DADB", +";+ c #9B9EA2", +">+ c #121A23", +",+ c #CED0D1", +"'+ c #AEB0B3", +")+ c #40454E", +"!+ c #2C333B", +"~+ c #30363F", +"{+ c #131A23", +"]+ c #5C6167", +"^+ c #F7F7F7", +"/+ c #444951", +"(+ c #929699", +"_+ c #F3F3F3", +":+ c #6E7378", +"<+ c #161E27", +"[+ c #5D6268", +"}+ c #ABADB1", +"|+ c #D6D6D8", +"1+ c #EBECED", +"2+ c #E7E8E9", +"3+ c #CDCFD0", +"4+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 3 3 3 3 [.}.|.1.2.3.. . . . . . . 3 3 3 3 . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / 4.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5.6.. . . . . 3 3 3 3 . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 7.4.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8.9.. . . . 3 3 3 3 . . . . . . . . . . . . + 0./ 3 / > $ . ", +" . $ > / 3 O 4.. . 3 3 3 3 a.a.a.b.G L 3 3 3 3 3 3 c.. . . . 3 3 3 3 . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 d.:.. . 3 3 3 3 . . . . . 6.e.f.3 3 3 3 g.. . . . 3 3 3 3 . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / h.i.i + . 3 3 3 3 . . . . . . . . j.3 3 3 a.. . . . 3 3 3 3 . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / h.i.0.+ . 3 3 3 3 . . . . . . . . k.3 3 3 l.. . . . 3 3 3 3 . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / h.i.0.+ . 3 3 3 3 . . . . . . . . -.3 3 3 m.. . . . 3 3 3 3 . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / h.n.i + . 3 3 3 3 . . . . . . . . o.3 3 3 _ . . . . 3 3 3 3 . . . . . 9.p.3 3 3 D q.. - / 3 / > $ . ", +" . $ > / 3 r.i . . 3 3 3 3 . . . . . . . -.s.3 3 3 t.. . . . 3 3 3 3 . . . . /.u.3 3 3 v.w.. . /./ 3 / > $ . ", +" . $ > / 3 }.4.. . 3 3 3 3 . . /.r x.y.z.b.3 3 3 3 a . . . . 3 3 3 3 . . . %.8.3 3 3 b.A.. . . /./ 3 / > $ . ", +" . $ > / 3 7.6.. . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 B.9.. . . . 3 3 3 3 . . ..C.3 3 3 D.E.. . . . - 7.3 / > $ . ", +" . $ > / 3 / ..+ . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 a.F.. . . . . 3 3 3 3 . G.1.3 3 3 1.B . . . . . 6.7.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 3 3 3 3 3 3 3 3 H.I.h . . . . . . 3 3 3 3 #.J.3 3 3 8.' . + . . . . ..}.3 / > $ . ", +" . $ > / 3 / r + . 3 3 3 3 3 3 2 i.K.L.: M.N.. . . . . . . . 3 3 3 3 D.3 3 3 O.^.. + . . . . . +.}.3 / > $ . ", +" . $ > / 3 / i . . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 3 3 3 [.P.. . . . . . . . 6.}.3 / > $ . ", +" . $ > / 3 / t . . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 Q.3 3 3 ( A.. . . . . . . R.7.3 / > $ . ", +" . $ > / 3 / ... . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 -.S.3 3 3 T T.. . . . . . U.7.3 / > $ . ", +" . $ > / 3 / V.. . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . N.W.3 3 3 W.C . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . . X.|.3 3 3 ] r . . . . . / 3 / > $ . ", +" . $ > / 3 / Y.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . . . Z.Q 3 3 3 1.6.. . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . `.l.3 3 3 +/.. . %./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . .+++3 3 3 @+9.. -./ 3 / > $ . ", +" . $ > / 3 / :.. . 3 3 3 3 . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . #+3 3 3 3 $+. :./ 3 / > $ . ", +" . $ > / 3 / 4.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . V./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + %+&+).3 *+> $ . ", +" . $ B d.3 3 g.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| =+3 3 z , % . ", +" . & t -+3 3 3 ;+&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + >+-.;+3 3 3 ,+R.} . ", +" . + 5 '+3 3 3 3 s M.)+-.^.. /.%.-.:.:.:.:.:.:.+.-.0.!+C C 4.$.q :.:.i V.#.> i l /.. ^.~+M.s 3 3 3 3 $+{+. . ", +" . . {+]+3 3 3 3 3 3 [./ / / / / / / / / / / / / 7.P P P P 7./ / / / / / / / / / / / / [.3 3 3 3 3 ^+/+k . . ", +" . + >.(+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 _+:+= . . ", +" . @ <+[+}+|+1+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 2+3+I.P.= + . ", +" . . + >+5 &.0.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > V.- >+) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # 4++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/PrIcon20.xpm b/lib/creaDevManagerLib/images/PrIcon20.xpm new file mode 100644 index 0000000..844a33c --- /dev/null +++ b/lib/creaDevManagerLib/images/PrIcon20.xpm @@ -0,0 +1,148 @@ +/* XPM */ +const static char * PrIcon20[] = { +"20 20 125 2", +" c None", +". c #171E27", +"+ c #666B71", +"@ c #8E9297", +"# c #909498", +"$ c #8F9297", +"% c #6A6F75", +"& c #191F29", +"* c #686C72", +"= c #ECECED", +"- c #909398", +"; c #868B8F", +"> c #878B8F", +", c #EBECEC", +"' c #A6A9AC", +") c #EAEBEB", +"! c #EBEDED", +"~ c #ECEDED", +"{ c #EAEBEC", +"] c #EBEBEC", +"^ c #686C73", +"/ c #ECEDEE", +"( c #363C44", +"_ c #111821", +": c #131B24", +"< c #0F1721", +"[ c #111721", +"} c #101821", +"| c #121923", +"1 c #101720", +"2 c #0E161F", +"3 c #101721", +"4 c #0F1620", +"5 c #353C43", +"6 c #84888D", +"7 c #181F28", +"8 c #1A2029", +"9 c #1D242D", +"0 c #1C232C", +"a c #86898D", +"b c #7E8287", +"c c #545A60", +"d c #D4D6D7", +"e c #D3D4D6", +"f c #BFC1C3", +"g c #686D73", +"h c #161D26", +"i c #192029", +"j c #82858A", +"k c #7D8085", +"l c #656A70", +"m c #F8F8F9", +"n c #818489", +"o c #84888C", +"p c #CACBCD", +"q c #FFFFFF", +"r c #393E46", +"s c #7E8186", +"t c #EDEDEE", +"u c #202730", +"v c #F2F3F3", +"w c #5E6369", +"x c #676C72", +"y c #999CA0", +"z c #ACAFB2", +"A c #BDBEC1", +"B c #4A5057", +"C c #7C8086", +"D c #7E8187", +"E c #F4F4F5", +"F c #5C6167", +"G c #63676D", +"H c #A8ABAE", +"I c #232A33", +"J c #82868A", +"K c #C5C6C9", +"L c #CDCFD1", +"M c #3A4048", +"N c #808488", +"O c #656A6F", +"P c #F8F8F8", +"Q c #BFC1C4", +"R c #383E46", +"S c #82868B", +"T c #D5D6D8", +"U c #171F28", +"V c #7D8186", +"W c #7F8388", +"X c #0F1720", +"Y c #131A24", +"Z c #1B222C", +"` c #7B8085", +" . c #909499", +".. c #EEEEEF", +"+. c #7D8286", +"@. c #4C5158", +"#. c #212831", +"$. c #1A212A", +"%. c #60656B", +"&. c #969A9E", +"*. c #19212A", +"=. c #8D9196", +"-. c #A4A7AA", +";. c #111922", +">. c #121922", +",. c #151D26", +"'. c #121A23", +"). c #19202A", +"!. c #141B24", +"~. c #A4A6AA", +"{. c #8D9195", +"]. c #6B7075", +"^. c #B3B5B9", +"/. c #7A7F84", +"(. c #808389", +"_. c #7F8488", +":. c #80858A", +"<. c #818589", +"[. c #797E83", +"}. c #B0B3B6", +"|. c #65696F", +"1. c #8C9095", +"2. c #8C9094", +"3. c #64686E", +"4. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 . 7 7 7 8 9 9 9 0 0 0 7 a # ", +" # b c d d e f g h 9 9 9 9 i j # ", +" # k l m n o p q r 0 0 0 0 i b # ", +" - s l t u 7 i v w x y z A B C # ", +" # D l E F G H q I J q K L M C # ", +" # N O q q P Q R 7 S T U 0 i V # ", +" # W O = h X Y Z i S d 7 9 i ` . ", +" # W l ..I 9 9 9 i S T 7 9 i +.# ", +" # b @.H #.9 9 9 $.%.&.*.9 i W # ", +" =.-.;.>.i i i i i ,.'.i ).!.~.{. ", +" ].q ^./.b (.(._.:.W n <.[.}.q |. ", +" $.% 1. .# # # # # # # # .2.3.4. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/PrIcon64.xpm b/lib/creaDevManagerLib/images/PrIcon64.xpm new file mode 100644 index 0000000..0398260 --- /dev/null +++ b/lib/creaDevManagerLib/images/PrIcon64.xpm @@ -0,0 +1,276 @@ +/* XPM */ +const static char * PrIcon64[] = { +"64 64 209 2", +" c None", +". c #1D242D", +"+ c #1C232C", +"@ c #1A212B", +"# c #19212A", +"$ c #192029", +"% c #19202A", +"& c #1A212A", +"* c #141C25", +"= c #131A24", +"- c #202730", +"; c #272E37", +"> c #2B313A", +", c #282F37", +"' c #222931", +") c #151C25", +"! c #131B24", +"~ c #4A5158", +"{ c #A0A4A7", +"] c #CFD0D2", +"^ c #E6E7E8", +"/ c #F1F2F2", +"( c #E9EAEB", +"_ c #D4D5D7", +": c #A8ABAE", +"< c #575D63", +"[ c #151D26", +"} c #1B222B", +"| c #141B25", +"1 c #777B81", +"2 c #F6F7F7", +"3 c #FFFFFF", +"4 c #898C91", +"5 c #161D26", +"6 c #4C5158", +"7 c #FBFBFC", +"8 c #FDFDFD", +"9 c #F4F4F5", +"0 c #F1F1F2", +"a c #565B62", +"b c #141B24", +"c c #A3A5AA", +"d c #E1E1E3", +"e c #898D92", +"f c #4E535A", +"g c #30373E", +"h c #252C35", +"i c #272D36", +"j c #AAADB0", +"k c #151C26", +"l c #222831", +"m c #D3D5D7", +"n c #B0B2B5", +"o c #252C34", +"p c #030A15", +"q c #232A33", +"r c #272E36", +"s c #D8D9DB", +"t c #232A32", +"u c #C6C8CA", +"v c #0F1720", +"w c #323940", +"x c #929599", +"y c #CACCCE", +"z c #E9E9EA", +"A c #F6F6F7", +"B c #293038", +"C c #2D343C", +"D c #F3F3F4", +"E c #52575F", +"F c #5F646A", +"G c #ECECED", +"H c #52575E", +"I c #2F353D", +"J c #DADCDD", +"K c #6D7177", +"L c #FAFAFA", +"M c #F9F9F9", +"N c #F2F2F3", +"O c #EEEFEF", +"P c #EDEEEF", +"Q c #EFEFF0", +"R c #EEEEEF", +"S c #2D333C", +"T c #E2E3E4", +"U c #D5D7D8", +"V c #777B80", +"W c #41474F", +"X c #2C323B", +"Y c #2A3139", +"Z c #2B323A", +"` c #30363E", +" . c #2A313A", +".. c #242A33", +"+. c #242B33", +"@. c #293039", +"#. c #2A3039", +"$. c #212830", +"%. c #212831", +"&. c #222932", +"*. c #F1F1F1", +"=. c #9B9FA2", +"-. c #242B34", +";. c #0F1620", +">. c #181F28", +",. c #B7B9BC", +"'. c #171E27", +"). c #FCFCFC", +"!. c #52585F", +"~. c #121922", +"{. c #F2F3F3", +"]. c #2B3139", +"^. c #1E252E", +"/. c #1F262F", +"(. c #1F262E", +"_. c #2D333B", +":. c #262C35", +"<. c #1E242D", +"[. c #252B34", +"}. c #F5F5F5", +"|. c #DEDFE0", +"1. c #BABDBF", +"2. c #818589", +"3. c #363C44", +"4. c #F0F1F1", +"5. c #F8F8F9", +"6. c #92959A", +"7. c #292F38", +"8. c #A4A6AA", +"9. c #ECEDED", +"0. c #F4F4F4", +"a. c #F6F6F6", +"b. c #51565D", +"c. c #FEFEFE", +"d. c #EAEBEB", +"e. c #1E252D", +"f. c #484D55", +"g. c #7A7E83", +"h. c #CECFD1", +"i. c #B1B3B6", +"j. c #D8DADB", +"k. c #3E444C", +"l. c #ECEDEE", +"m. c #DFE0E1", +"n. c #5B6066", +"o. c #A9ABAF", +"p. c #CCCED0", +"q. c #E7E8E9", +"r. c #C2C3C6", +"s. c #7D8186", +"t. c #2C333B", +"u. c #EDEEEE", +"v. c #4F545B", +"w. c #D2D4D5", +"x. c #4E545B", +"y. c #EFF0F0", +"z. c #2C323A", +"A. c #AAACB0", +"B. c #DDDEDF", +"C. c #232932", +"D. c #3F454D", +"E. c #6A6E74", +"F. c #999CA0", +"G. c #EDEDEE", +"H. c #4D535A", +"I. c #E0E1E2", +"J. c #B6B8BB", +"K. c #83878C", +"L. c #3C424A", +"M. c #333941", +"N. c #C8C9CC", +"O. c #7F8388", +"P. c #E1E2E3", +"Q. c #D5D6D8", +"R. c #BFC1C3", +"S. c #94979B", +"T. c #5B6067", +"U. c #20272F", +"V. c #1F252E", +"W. c #282E37", +"X. c #262D36", +"Y. c #121923", +"Z. c #51575E", +"`. c #F2F2F2", +" + c #B5B7BA", +".+ c #9B9EA2", +"++ c #121A23", +"@+ c #CED0D1", +"#+ c #AEB0B3", +"$+ c #75797F", +"%+ c #40454E", +"&+ c #30363F", +"*+ c #9C9FA3", +"=+ c #131A23", +"-+ c #5C6167", +";+ c #F7F7F7", +">+ c #444951", +",+ c #929699", +"'+ c #F3F3F3", +")+ c #6E7378", +"!+ c #161E27", +"~+ c #5D6268", +"{+ c #ABADB1", +"]+ c #D6D6D8", +"^+ c #EBECED", +"/+ c #CDCFD0", +"(+ c #9DA0A4", +"_+ c #454B52", +":+ c #1A222B", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & + . . ", +" . . . * = - ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ' ) = + . . ", +" . + ! ~ { ] ^ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ( _ : < [ } . ", +" . . | 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 5 + . ", +" . . | 6 7 3 3 3 8 9 0 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 0 9 8 3 3 3 3 a = . . ", +" . . b c 3 3 d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i h g f e d 3 3 j k + . ", +" . } l m 3 n o p 5 q r i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i r q 5 p o n 3 s t & . ", +" . % , 9 u v w x y z / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / z y x w v u A B $ . ", +" . $ C D E F G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G F H D C $ . ", +" . $ I J K L 3 3 3 3 M N / / / O P Q / / / 0 P P R P P P P R P P 0 / / / Q P O / / / N M 3 3 3 3 L K J I $ . ", +" . $ S T U 3 3 3 s V W X Y Z i ` .h ..i ...., B r +.r , @.I #.r $.- q %.+.B &.- r Y X W V s 3 3 3 U T S $ . ", +" . $ > *.3 3 3 =.-.;.>.+ + + . . . . . + . . . . . . . . . . . . . . . . . . . . & $ $ 5 ;.-.=.3 3 3 *.> $ . ", +" . $ > / 3 3 ,.* '.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . '.* ,.3 3 / > $ . ", +" . $ > / 3 ).!.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . ~.!.).3 / > $ . ", +" . $ > / 3 {.].+ . . . . . . . . . . . . . . . . ^./.(.^.^.^.^.. . . . . . . . . . . . . . . & _.{.3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . <.^.. . . . . . . . . . . . . . . . . . . . . . . } #./ 3 / > $ . ", +" . $ > / 3 / :.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 / [.. . . 3 3 3 3 3 3 3 3 8 }.G |.1.2.3.. . . . . . . . . . . . . . . . . . . . . + > / 3 / > $ . ", +" . $ > / 3 4.[.. . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5.6.^.. . . . . . . . . . . . . . . . . . . + 7./ 3 / > $ . ", +" . $ > / 3 O [.. . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8.. . . . . . . . . . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 9.:.. . . 3 3 3 3 0.0.0.a.3 3 3 3 3 3 3 3 3 b.. . . . . . . . . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / c.d.i + . . 3 3 3 3 . . . . e.r f.g.h.3 3 3 3 n . . . . . . . . . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / c.d.7.+ . . 3 3 3 3 . . . . . . . . ^.i.3 3 3 j.. . . . . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / c.d.7.+ . . 3 3 3 3 . . . . . . . . . k.3 3 3 0.. . . . . . . . . . . . . . . . . . . - / 3 / > $ . ", +" . $ > / c.l.i + . . 3 3 3 3 . . . . . . . . . h 3 3 3 R . . . . 3 3 m.- n.o.p.q.M q.r.s.t.. . - / 3 / > $ . ", +" . $ > / 3 u.i . . . 3 3 3 3 . . . . . . . . . v.3 3 3 w.. . . . 3 3 3 R 3 3 3 3 3 3 3 3 x.. . /./ 3 / > $ . ", +" . $ > / 3 y.[.. . . 3 3 3 3 . . . . . . . . z.] 3 3 3 A.. . . . 3 3 3 3 3 3 3 3 3 3 3 B.. . . /./ 3 / > $ . ", +" . $ > / 3 4.C.. . . 3 3 3 3 . . e.-.t.D.E.F.G.3 3 3 3 H.. . . . 3 3 3 3 3 3 }.|.I.5.3 4 . . . - 4.3 / > $ . ", +" . $ > / 3 / ..+ . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 J.. . . . . 3 3 3 3 K.L.. . . -.F M.. . . C.4.3 / > $ . ", +" . $ > / 3 / i . . . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 N.-.. . . . . 3 3 3 3 . . . . . . + . . . . ..y.3 / > $ . ", +" . $ > / 3 / r + . . 3 3 3 3 3 3 3 3 3 3 3 3 3 d.O.^.. . . . . . 3 3 3 3 . . . . . + . . . . . +.y.3 / > $ . ", +" . $ > / 3 / i . . . 3 3 3 3 3 3 L R P.Q.R.S.T./.. . . . . . . . 3 3 3 3 . . . . . . . . . . . C.y.3 / > $ . ", +" . $ > / 3 / t . . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . U.4.3 / > $ . ", +" . $ > / 3 / ... . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . V.4.3 / > $ . ", +" . $ > / 3 / W.. . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / B + . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . . / 3 / > $ . ", +" . $ > / 3 / X.+ . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . /./ 3 / > $ . ", +" . $ > / 3 / -.+ . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . %./ 3 / > $ . ", +" . $ > / 3 / :.. . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . -./ 3 / > $ . ", +" . $ > / 3 / :.. . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . :./ 3 / > $ . ", +" . $ > / 3 / [.. . . 3 3 3 3 . . . . . . . . . . . . . . . . . . 3 3 3 3 . . . . . . . . . . . i / 3 / > $ . ", +" . $ > / 3 / :.+ . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . W./ 3 / > $ . ", +" . $ > / 3 {.> + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } X {.3 / > $ . ", +" . $ > / 3 ).H 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + Y.Z.).3 `.> $ . ", +" . $ B 9.3 3 J.| } . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + '.| +3 3 z , % . ", +" . & t j.3 3 3 .+&.& + + . . . . . . . . . . . . . . . . . . . . . . . + + } + . . . . + ++-..+3 3 3 @+U.} . ", +" . + 5 #+3 3 3 3 s $+%+-.^.. /.%.-.:.:.:.:.:.:.+.-.7.t.C C [.$.q :.:.i W.#.> i l /.. ^.&+$+s 3 3 3 3 *+=+. . ", +" . . =+-+3 3 3 3 3 3 5./ / / / / / / / / / / / / 4.P P P P 4./ / / / / / / / / / / / / 5.3 3 3 3 3 ;+>+k . . ", +" . + >.,+3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 '+)+= . . ", +" . @ !+~+{+]+^+/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / q./+(+_+= + . ", +" . . + ++5 &.7.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > W.- ++) . . . ", +" . . + & % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # :++ . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" ", +" ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index ee7edc1..bcb0876 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -34,32 +34,436 @@ #include "modelCDMAppli.h" +#include +#include +#include +#include + +#include "CDMUtilities.h" +#include "creaWx.h" +#include "wx/dir.h" + modelCDMAppli::modelCDMAppli() { } +modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating appli\n"; + this->parent = parent; + this->type = wxDIR_DIRS; + this->name = name; + this->level = level; + this->path = path; + + + + this->path = CDMUtilities::fixPath(path); + std::string pathFixed(CDMUtilities::fixPath(path)); + + this->applications.clear(); + wxDir dir(crea::std2wx((pathFixed).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + if(stdfileName != "template_appli" && stdfileName != "template_wx_appli") + { + modelCDMApplication* application = new modelCDMApplication(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); + } + else + { + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + + cont = dir.GetNext(&fileName); + } + //files + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + //if is an unknown file, create file + else + { + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + + cont = dir.GetNext(&fileName); + } + + } + this->SortChildren(); + std::sort(this->applications.begin(), this->applications.end(), CompareNodeItem); +} + modelCDMAppli::~modelCDMAppli() { } -bool modelCDMAppli::CreateApplication( - const std::string& name, - std::string*& result, - const std::string& path +const std::vector& modelCDMAppli::GetApplications() const +{ + return this->applications; +} + +modelCDMApplication* modelCDMAppli::CreateApplication( + const std::string& namein, + const int& type, + std::string*& result ) { - //TODO: implement method - return true; + std::vector words; + CDMUtilities::splitter::split(words,namein," '/\\*\"%",CDMUtilities::splitter::no_empties); + std::string name; + for (int i = 0; i < (int)(words.size()); i++) + { + name += words[i]; + } + if (name == "") + { + result = new std::string("The given name is not valid: '/\\*\"% are forbidden."); + return NULL; + } + + if (type == 0) + { + //copy template application folder with new name +#ifdef _WIN32 + std::string copyCommand = "xcopy \"" + this->path + CDMUtilities::SLASH + "template_appli\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "\" /Y"; +#else + std::string copyCommand = "cp -r \"" + this->path + CDMUtilities::SLASH + "template_appli\" \"" + this->path + CDMUtilities::SLASH + name + "\""; +#endif + + if(system(copyCommand.c_str())) + { + result = new std::string("An error occurred while running '" + copyCommand + "'."); + return NULL; + } + //set name of library in CMakeLists inside copied folder + std::string line; + std::ifstream in((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return NULL; + } + std::ofstream out((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + while (getline(in, line)) + { + if(line == "SET ( EXE_NAME MyExe )") + line = "SET ( EXE_NAME " + name + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return NULL; + } + + //add application to model + modelCDMApplication* application = new modelCDMApplication(this, this->path + CDMUtilities::SLASH + name, name, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); + + this->SortChildren(); + + result = new std::string(this->path + CDMUtilities::SLASH + name); + return application; + } + else if(type == 1) + { + //copy template application folder with new name +#ifdef _WIN32 + std::string copyCommand = "xcopy \"" + this->path + CDMUtilities::SLASH + "template_wx_appli\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "\" /Y"; +#else + std::string copyCommand = "cp -r \"" + this->path + CDMUtilities::SLASH + "template_wx_appli\" \"" + this->path + CDMUtilities::SLASH + name + "\""; +#endif + + if(system(copyCommand.c_str())) + { + result = new std::string("An error occurred while running '" + copyCommand + "'."); + return NULL; + } + //set name of library in CMakeLists inside copied folder + std::string line; + std::ifstream in((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return NULL; + } + std::ofstream out((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + while (getline(in, line)) + { + if(line == "SET ( EXE_NAME MyExeWx )") + line = "SET ( EXE_NAME " + name + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return NULL; + } + + //add application to model + modelCDMApplication* application = new modelCDMApplication(this, this->path + CDMUtilities::SLASH + name, name, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); + + this->SortChildren(); + + result = new std::string(this->path + CDMUtilities::SLASH + name); + return application; + } + else + { + std::string res = "Invalid application type: "; + res += type; + res += std::string(".\n0:Console application.\n1:GUI Application (wxWidgets)."); + result = new std::string(res); + + return NULL; + } } -bool modelCDMAppli::OpenCMakeListsFile(std::string*& result) +const bool modelCDMAppli::Refresh(std::string*& result) { - //TODO: implement method + std::cout << "refreshing appli" << std::endl; + this->type = wxDIR_DIRS; + + std::vector checked(this->children.size(), false); + std::vector checkedApplications(this->applications.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + if(stdfileName != "template_appli" && stdfileName != "template_wx_appli") + { + std::string applicationName = stdfileName; + //check if application already exist + bool found = false; + for (int i = 0; !found && i < (int)(this->applications.size()); i++) + { + 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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); + } + } + else + { + //check if folder already exist + bool found = false; + for (int i = 0; !found && i < (int)(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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedApplications.size()); i++) + { + if(!checkedApplications[i]) + { + this->applications.erase(this->applications.begin()+i); + checkedApplications.erase(checkedApplications.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); + std::sort(this->applications.begin(), this->applications.end(), CompareNodeItem); return true; } -bool modelCDMAppli::Refresh(std::string*& result) +void modelCDMAppli::CheckStructure(std::map& properties) { - //TODO: implement method - return true; + //check cmake exist + if(this->CMakeLists != NULL) + { + //set properties parameters based on model + for (int i = 0; i < (int)(this->applications.size()); i++) + properties["appli add " + this->applications[i]->GetName()] = false; + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //add instructions + if (words.size() > 0 && words[words.size()-1] == "ADD_SUBDIRECTORY") + { + std::getline(ss,word, ')'); + //std::cout << word << std::endl; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + if (words.size() > 0) + { + { + properties["appli add " + words[0]] = true; + } + } + } + } + + } + + //check libraries' structure + 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/modelCDMAppli.h b/lib/creaDevManagerLib/modelCDMAppli.h index 569fdb1..579f12a 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.h +++ b/lib/creaDevManagerLib/modelCDMAppli.h @@ -37,25 +37,69 @@ #include #include +#include -#include"modelCDMIProjectTreeNode.h" +#include"modelCDMFolder.h" #include"modelCDMApplication.h" -class modelCDMAppli : public modelCDMIProjectTreeNode +/** + * Represents the appli folder of Crea project. The appli folder holds the applications of a project. + */ +class modelCDMAppli : public modelCDMFolder { public: + /** + * Default constructor. + */ modelCDMAppli(); + /** + * Constructor of the appli folder node. + * @param parent Parent node of the appli node. + * @param path Full path of the appli node. + * @param name Folder name of the appli node. By default "appli" + * @param level Folder Level in the project hierarchy. By default 1 + */ + modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "appli", const int& level = 1); + /** + * Destructor. + */ ~modelCDMAppli(); - bool CreateApplication( + /** + * Retrieves the applications inside the appli folder node. + * @return Reference array of the applications in the appli node. + */ + const std::vector& GetApplications() const; + + /** + * Creates a new application in the system and creates an application node. This node is stored in the applications attribute and returned. + * @param name Name of the new application. + * @param type 0=console application, 1=GUI Application (wxWidgets). + * @param result Result message of the operation. + * @return Reference to the created application or NULL. + */ + modelCDMApplication* CreateApplication( const std::string& name, - std::string*& result, - const std::string& path = "/" + const int& type, + std::string*& result ); - bool OpenCMakeListsFile(std::string*& result); - bool Refresh(std::string*& result); + /** + * Refreshes the file structure of the appli node. Deletes deleted folders and files and creates created files and folders since lasts refresh. + * @param result Result message of the operation. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + + /** + * Checks the CMakeLists structure and the applications in order to look for compilation errors before compiling. + * @param properties Properties found in the structure. + */ + void CheckStructure(std::map& properties); private: + /** + * application in the appli folder node. + */ std::vector applications; }; diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index c1e715e..7083c47 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -34,46 +34,483 @@ #include "modelCDMApplication.h" +#include +#include +#include + +#include "CDMUtilities.h" +#include "creaWx.h" +#include "wx/dir.h" + modelCDMApplication::modelCDMApplication() { + mainFile = NULL; +} + +modelCDMApplication::modelCDMApplication(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating application: " + path + "\n"; + this->parent = parent; + this->mainFile = NULL; + //folder name + this->name = name; + //path + this->path = CDMUtilities::fixPath(path); + //type + this->type = wxDIR_DIRS; + //level + this->level = level; + //open CMakeList + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get library name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "EXE_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + + this->executableName = word; + } + } + } + confFile.close(); + + //add library contents + + this->children.clear(); + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + //folders + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + + cont = dir.GetNext(&fileName); + } + //files + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + //if is an unknown file, create file + else + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + std::string extension = stdfileName.substr(stdfileName.size()-4); + if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) + { + std::ifstream fileStream; + std::string word; + fileStream.open((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + while (fileStream.is_open() && !fileStream.eof()) + { + //get sets + std::getline(fileStream,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") + { + this->mainFile = file; + } + } + fileStream.close(); + } + this->children.push_back(file); + } + + cont = dir.GetNext(&fileName); + } + } + this->SortChildren(); + std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem); } modelCDMApplication::~modelCDMApplication() { } -const std::string& modelCDMApplication::GetName() const +const std::string& modelCDMApplication::GetExecutableName() const { - return this->name; + return this->executableName; } -const std::string& modelCDMApplication::GetMainFile() const +modelCDMFile* modelCDMApplication::GetMainFile() const { return this->mainFile; } -void modelCDMApplication::SetMainFile(const std::string& fileName) +bool modelCDMApplication::SetExecutableName(const std::string& fileName, std::string*& result) { + std::vector words; + CDMUtilities::splitter::split(words, fileName, ", /\\\"", CDMUtilities::splitter::no_empties); + std::string fileNameReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + fileNameReal += "-" + words[i]; + } + + std::string line; + //opening original cmakelists + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + //opening temporal cmakelists + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + while (getline(in, line)) + { + if(line.find("SET ( EXE_NAME") != std::string::npos) + line = "SET ( EXE_NAME " + fileNameReal + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->executableName = fileNameReal; + return true; } -bool modelCDMApplication::CreateFolder( - const std::string& name, - std::string*& result, - const std::string& path -) +modelCDMFolder* modelCDMApplication::CreateFolder(const std::string& name, std::string*& result) { - //TODO: implement method - return true; + //TODO:: mkdir depending on OS + std::string command = "mkdir " + path + CDMUtilities::SLASH + name; + if(system(command.c_str())) + { + result = new std::string("Error executing: " + command + "."); + return NULL; + } + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + + return folder; } -bool modelCDMApplication::OpenCMakeListsFile(std::string*& result) +const bool modelCDMApplication::Refresh(std::string*& result) { - //TODO: implement method + this->mainFile = NULL; + std::cout << "refreshing application: " << this->executableName << std::endl; + //set attributes + this->type = wxDIR_DIRS; + + //open CMakeList + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get app name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "EXE_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + + this->executableName = word; + } + } + } + + confFile.close(); + + //check children + std::vector checked(this->children.size(), false); + std::vector checkedFolders(this->folders.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + 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 < (int)(this->folders.size()); i++) + { + if (this->folders[i]->GetName() == applicationName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->folders[i]) - this->children.begin(); + checked[pos] = true; + checkedFolders[i] = true; + if(!this->folders[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(this->children.size()); i++) + { + if (this->children[i]->GetName() == stdfileName) + { + found = true; + checked[i] = true; + + if(!this->children[i]->Refresh(result)) + return false; + + std::string extension = stdfileName.substr(stdfileName.size()-4); + if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) + { + std::ifstream fileStream; + std::string word; + fileStream.open((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + while (fileStream.is_open() && !fileStream.eof()) + { + //get sets + std::getline(fileStream,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") + { + this->mainFile = dynamic_cast(children[i]); + } + } + fileStream.close(); + } + } + } + + if(!found) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + + std::string extension = stdfileName.substr(stdfileName.size()-4); + if (mainFile == NULL && (extension == ".cxx" || extension == ".cpp")) + { + std::ifstream fileStream; + std::string word; + fileStream.open((this->path + CDMUtilities::SLASH + stdfileName).c_str()); + while (fileStream.is_open() && !fileStream.eof()) + { + //get sets + std::getline(fileStream,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP") + { + this->mainFile = file; + } + } + fileStream.close(); + } + + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedFolders.size()); i++) + { + if(!checkedFolders[i]) + { + this->folders.erase(this->folders.begin()+i); + checkedFolders.erase(checkedFolders.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); return true; } -bool modelCDMApplication::Refresh(std::string*& result) +void modelCDMApplication::CheckStructure(std::map& properties) { - //TODO: implement method - return true; + //check cmake exist + if(this->CMakeLists != NULL) + { + //set default properties + properties["application " + this->name + " lib ${crea_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${WXWIDGETS_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${KWWidgets_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${VTK_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${ITK_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${GDCM_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${BOOST_LIBRARIES}"] = false; + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //set instructions + if (words.size() > 0 && words[words.size()-1] == "SET") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + if (words.size() > 1) + { + if (words[0] == "${EXE_NAME}_LINK_LIBRARIES") + { + for (int i = 1; i < (int)(words.size()); i++) + { + properties["application " + this->name + " lib " + words[i]] = true; + } + } + } + } + else if (words.size() > 0 && words[words.size()-1] == "INCLUDE_DIRECTORIES") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + + for (int i = 0; i < (int)(words.size()); i++) + { + properties["application " + this->name + " dir " + words[i]] = true; + } + + + } + } + + } } diff --git a/lib/creaDevManagerLib/modelCDMApplication.h b/lib/creaDevManagerLib/modelCDMApplication.h index a878c35..e471ec9 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.h +++ b/lib/creaDevManagerLib/modelCDMApplication.h @@ -37,32 +37,87 @@ #include #include +#include -#include"modelCDMIProjectTreeNode.h" +#include "modelCDMFolder.h" +#include "modelCDMFile.h" -class modelCDMApplication : public modelCDMIProjectTreeNode +/** + * Class representing an application in a Crea project. An Application is an stand alone application that uses the project libraries to show their functionalities. + */ +class modelCDMApplication : public modelCDMFolder { public: + /** + * Default Constructor. + */ modelCDMApplication(); + /** + * Application Constructor + * @param parent Parent node of the application node. + * @param path Full path of the application node. + * @param name Name of the applcation folder node. + * @param level Level of the application node folder in the project. + */ + modelCDMApplication(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 2); + /** + * Destructor. + */ ~modelCDMApplication(); - const std::string& GetName() const; - const std::string& GetMainFile() const; + /** + * Returns the executable name of the application node + * @return + */ + const std::string& GetExecutableName() const; + /** + * Returns the main source file of the application node. That is, the file that contains the main method. + * @return File reference to main file. + */ + modelCDMFile* GetMainFile() const; + + /** + * Sets the executable name for the application. + * @param fileName Name of the application executable. + * @param result Result message. + * @return True if the operation was successful. + */ + bool SetExecutableName(const std::string& fileName, std::string*& result); + + /** + * Creates a folder in the application folder node. This takes effect in the system as well as in the project model. + * @param name Name of the new folder. + * @param result Result message. + * @return True if the operation was successful. + */ + modelCDMFolder* CreateFolder(const std::string& name, std::string*& result); - void SetMainFile(const std::string& fileName); + /** + * Refreshes the structure of the application. Removes folders and files deleted since the last refresh. Also, adds folders and files created since the las refresh. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); - bool CreateFolder( - const std::string& name, - std::string*& result, - const std::string& path = "/" - ); - bool OpenCMakeListsFile(std::string* & result); - bool Refresh(std::string*& result); + /** + * Checks the CMakeLists file and the application structure to identify registration errors before compiling the project. + * @param properties Properties found in the structure. + */ + void CheckStructure(std::map& properties); private: - std::string name; - std::string mainFile; - std::vector applications; + /** + * Name of the application executable file. + */ + std::string executableName; + /** + * Reference to the main file of the application. + */ + modelCDMFile* mainFile; + /** + * Reference array of the children folders of the application. + */ + std::vector folders; }; #endif /* MODELCDMAPPLICATION_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.cpp b/lib/creaDevManagerLib/modelCDMBlackBox.cpp index f285f78..73220cc 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.cpp +++ b/lib/creaDevManagerLib/modelCDMBlackBox.cpp @@ -34,27 +34,87 @@ #include "modelCDMBlackBox.h" +#include + +#include "CDMUtilities.h" + +#include +#include"wx/dir.h" + modelCDMBlackBox::modelCDMBlackBox() { + this->source = NULL; + this->header = NULL; } -modelCDMBlackBox::~modelCDMBlackBox() +modelCDMBlackBox::modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { + std::cout << "creating black box: " + name + " in " + path + "\n"; + this->parent = parent; + this->name = name; + this->path = path; + this->level = level; + this->type = wxDIR_DIRS; + this->source = NULL; + this->header = NULL; + + std::string pathHeader = path + CDMUtilities::SLASH + "bb" + this->name + ".h"; + + std::ifstream confFile; + confFile.open((pathHeader).c_str()); + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get BBTK's + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "BBTK_NAME") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->nameBlackBox = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_AUTHOR") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->authors = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_DESCRIPTION") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->description = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_CATEGORY") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->categories = word; + if (this->categories == "") + this->categories = "empty"; + } + } + confFile.close(); + } -const std::string& modelCDMBlackBox::GetName() const +modelCDMBlackBox::~modelCDMBlackBox() { - return this->name; + this->header = NULL; + this->source = NULL; } -const std::string& modelCDMBlackBox::GetAuthors() const +const std::string& modelCDMBlackBox::GetNameBlackBox() const { - return this->authors; + return this->nameBlackBox; } -const std::string& modelCDMBlackBox::GetAuthorsEmail() const +const std::string& modelCDMBlackBox::GetAuthors() const { - return this->authorsEmail; + return this->authors; } const std::string& modelCDMBlackBox::GetCategories() const @@ -69,25 +129,127 @@ const std::string& modelCDMBlackBox::GetDescription() const bool modelCDMBlackBox::SetAuthors(const std::string& authors, std::string*& result) { - //TODO: implement method - return true; -} + std::vector words; + CDMUtilities::splitter::split(words, authors, "/\\\"\n", CDMUtilities::splitter::no_empties); + std::string authorsReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + authorsReal += "," + words[i]; + } -bool modelCDMBlackBox::SetAuthorsEmail( - const std::string& email, - std::string*& result -) -{ - //TODO: implement method + //opening original header + std::string pathHeader = this->header->GetPath(); + std::ifstream in(pathHeader.c_str()); + if( !in.is_open()) + { + result = new std::string(pathHeader + " file failed to open."); + return false; + } + //opening temporal header + std::ofstream out((pathHeader + ".tmp").c_str()); + if( !out.is_open()) + { + result = new std::string(pathHeader + ".tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + std::string reading; + while (getline(in, reading, '(')) + { + CDMUtilities::splitter::split(words, reading, "\n ", CDMUtilities::splitter::no_empties); + if(words[words.size() - 1] == "BBTK_AUTHOR") + { + out << reading << "(\"" << authorsReal << "\")"; + getline(in, reading, ')'); + } + else + { + out << reading; + if (!in.eof()) + out << "("; + } + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else + std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->authors = authorsReal; return true; + } bool modelCDMBlackBox::SetCategories( - const std::string& version, + const std::string& categories, std::string*& result ) { - //TODO: implement method + std::vector words; + CDMUtilities::splitter::split(words, categories, "\"\\/", CDMUtilities::splitter::no_empties); + std::string catsReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + catsReal += "," + words[i]; + } + + //opening original header + std::string pathHeader = this->header->GetPath(); + std::ifstream in(pathHeader.c_str()); + if( !in.is_open()) + { + result = new std::string(pathHeader + " file failed to open."); + return false; + } + //opening temporal header + std::ofstream out((pathHeader + ".tmp").c_str()); + if( !out.is_open()) + { + result = new std::string(pathHeader + ".tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + std::string reading; + while (getline(in, reading, '(')) + { + CDMUtilities::splitter::split(words, reading, "\n ", CDMUtilities::splitter::no_empties); + if(words[words.size() - 1] == "BBTK_CATEGORY") + { + out << reading << "(\"" << catsReal << "\")"; + getline(in, reading, ')'); + } + else + { + out << reading; + if (!in.eof()) + out << "("; + } + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else + std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->categories = catsReal; return true; } @@ -96,24 +258,140 @@ bool modelCDMBlackBox::SetDescription( std::string*& result ) { - //TODO: implement method + std::vector words; + CDMUtilities::splitter::split(words, description, "\"\n\\/", CDMUtilities::splitter::no_empties); + std::string descReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + descReal += "-" + words[i]; + } + + //opening original header + std::string pathHeader = this->header->GetPath(); + std::ifstream in(pathHeader.c_str()); + if( !in.is_open()) + { + result = new std::string(pathHeader + " file failed to open."); + return false; + } + //opening temporal header + std::ofstream out((pathHeader + ".tmp").c_str()); + if( !out.is_open()) + { + result = new std::string(pathHeader + ".tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + std::string reading; + while (getline(in, reading, '(')) + { + CDMUtilities::splitter::split(words, reading, "\n ", CDMUtilities::splitter::no_empties); + if(words[words.size() - 1] == "BBTK_DESCRIPTION") + { + out << reading << "(\"" << descReal << "\")"; + getline(in, reading, ')'); + } + else + { + out << reading; + if (!in.eof()) + out << "("; + } + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else + std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->description = descReal; return true; } +void modelCDMBlackBox::SetHeaderFile(modelCDMFile* file) +{ + this->header = file; +} + +void modelCDMBlackBox::SetSourceFile(modelCDMFile* file) +{ + this->source = file; +} + bool modelCDMBlackBox::OpenCxx(std::string*& result) { - //TODO: implement method - return true; + return !CDMUtilities::openTextEditor(this->source->GetPath()); } bool modelCDMBlackBox::OpenHxx(std::string*& result) { - //TODO: implement method - return true; + return !CDMUtilities::openTextEditor(this->header->GetPath()); } -bool modelCDMBlackBox::Refresh(std::string*& result) +modelCDMFile* modelCDMBlackBox::GetHeaderFile() const { - //TODO: implement method + return this->header; +} + +modelCDMFile* modelCDMBlackBox::GetSourceFile() const +{ + return this->source; +} + +const bool modelCDMBlackBox::Refresh(std::string*& result) +{ + std::cout << "refreshing black box: " << this->nameBlackBox << std::endl; + std::string pathHeader = path + CDMUtilities::SLASH + "bb" + this->name + ".h"; + + std::ifstream confFile; + confFile.open((pathHeader).c_str()); + std::string word; + + if(!confFile.is_open()) + return false; + + while(confFile.is_open() && !confFile.eof()) + { + //get BBTK's + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "BBTK_NAME") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->nameBlackBox = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_AUTHOR") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->authors = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_DESCRIPTION") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->description = word; + } + else if(wordBits[wordBits.size()-1] == "BBTK_CATEGORY") + { + std::getline(confFile,word,'"'); + std::getline(confFile,word,'"'); + this->categories = word; + if (this->categories == "") + this->categories = "empty"; + } + } + confFile.close(); return true; } diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.h b/lib/creaDevManagerLib/modelCDMBlackBox.h index 6755448..4ef064a 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.h +++ b/lib/creaDevManagerLib/modelCDMBlackBox.h @@ -37,34 +37,149 @@ #include -class modelCDMBlackBox +#include"modelCDMFolder.h" + +/** + * Class representing a black box inside a Crea project. A black box is modular construct that uses the project libraries to execute its operations + */ +class modelCDMBlackBox : public modelCDMFolder { public: + /** + * Default Constructor. + */ modelCDMBlackBox(); + /** + * Black Box Constructor. + * @param parent parent node of the black box node. + * @param path Path of the source folder of the black box node. + * @param name Name of the black box node. + * @param level Hierarchy level of the black box node in the project. By default 3 + */ + modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 3); + /** + * Destructor. + */ ~modelCDMBlackBox(); - const std::string& GetName() const; + /** + * Returns the name of the black box node. + * @return Name of the black box node. + */ + const std::string& GetNameBlackBox() const; + /** + * Retrieves the black box authors' names. + * @return Names of the black box node authors. + */ const std::string& GetAuthors() const; - const std::string& GetAuthorsEmail() const; + /** + * Retrieves the categories of the black box. + * @return Categories associated with the black box. + */ const std::string& GetCategories() const; + /** + * Returns the description of the black box purpose. + * @return Description of the black box. + */ const std::string& GetDescription() const; + /** + * Returns a reference of the header file of the black box. + * @return Header file of the black box. + */ + modelCDMFile* GetHeaderFile() const; + /** + * Returns a reference of the source file of the black box. + * @return Source file of the black box. + */ + modelCDMFile* GetSourceFile() const; + + /** + * Sets the name of the black box with the one provided. + * @param name New name of the black box. + * @param result Result message. + * @return True if the operation was successful. + */ + bool SetNameBlackBox(const std::string& name, std::string*& result); + /** + * Sets the authors' names of the black box to the ones given. + * @param authors Authors' names. + * @param result Result message. + * @return True if the operation was successful. + */ bool SetAuthors(const std::string& authors, std::string*& result); - bool SetAuthorsEmail(const std::string& email, std::string*& result); - bool SetCategories(const std::string& version, std::string*& result); + /** + * Sets the Categories associated with the black box to the given ones. + * @param categories Categories associated with the black box. + * @param result Result message + * @return True if the operation was successful. + */ + bool SetCategories(const std::string& categories, std::string*& result); + /** + * Sets the Description of the black box to the given one. + * @param description Description of the black box. + * @param result Result message. + * @return True if the operation was successful. + */ bool SetDescription(const std::string& description, std::string*& result); + /** + * Sets the reference of the header file. + * @param file Reference to the Header file. + */ + void SetHeaderFile(modelCDMFile* file); + /** + * Sets the reference of the source file. + * @param file Reference to the source file. + */ + void SetSourceFile(modelCDMFile* file); + + /** + * Opens the source file with the system default code editor + * @param result Result message. + * @return True if the operation was successful. + */ bool OpenCxx(std::string*& result); + /** + * Opens the header file with the system default code editor + * @param result Result message. + * @return True if the operation was successful. + */ bool OpenHxx(std::string*& result); - bool Refresh(std::string*& result); + /** + * Refreshes the structure and properties of the black box. + * @param result Result message. + * @return True if the operation was successful. + */ + const bool Refresh(std::string*& result); private: - std::string name; + /** + * Name of the black box. It might be different from the header file name. + */ + std::string nameBlackBox; + /** + * Authors of the black box. + */ std::string authors; - std::string authorsEmail; + /** + * Categories associated to the categories. + */ std::string categories; + /** + * Description of the black box. + */ std::string description; + + /** + * Reference to the header file of the black box. + */ + modelCDMFile* header; + /** + * Reference to the source file of the black box. + */ + modelCDMFile* source; }; #endif /* MODELCDMBLACKBOX_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp new file mode 100644 index 0000000..2dc48b4 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp @@ -0,0 +1,94 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMCMakeListsFile.cpp + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMCMakeListsFile.h" + +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMCMakeListsFile::modelCDMCMakeListsFile() +{ +} + +modelCDMCMakeListsFile::modelCDMCMakeListsFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating cmakelist file: " + path + "\n"; + this->parent = parent; + this->children.clear(); + this->level = level; + this->type = wxDIR_FILES; + this->name = name; + this->path = path; + + std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); + in.seekg(0, std::ifstream::end); + this->length = in.tellg(); + in.close(); +} + +modelCDMCMakeListsFile::~modelCDMCMakeListsFile() +{ +} + +bool modelCDMCMakeListsFile::OpenFile(std::string*& result) +{ + + if (!CDMUtilities::openTextEditor(this->path)) + return true; + else + { + result = new std::string("Couldn't open CMakeLists file."); + return false; + } +} + +const bool modelCDMCMakeListsFile::Refresh(std::string*& result) +{ + //std::cout << "refreshing cmakelists" << std::endl; + std::ifstream in((this->path).c_str()); + if(!in.is_open()) + { + in.close(); + return false; + } + std::ifstream in2(path.c_str(), std::ifstream::in | std::ifstream::binary); + in2.seekg(0, std::ifstream::end); + this->length = in2.tellg(); + in2.close(); + return true; +} diff --git a/lib/creaDevManagerLib/modelCDMCMakeListsFile.h b/lib/creaDevManagerLib/modelCDMCMakeListsFile.h new file mode 100644 index 0000000..5d51e3d --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMCMakeListsFile.h @@ -0,0 +1,77 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMCMakeListsFile.h + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMCMAKELISTSFILE_H_ +#define MODELCDMCMAKELISTSFILE_H_ + +#include "modelCDMFile.h" + +/** + * Class representing the CMakeLists.txt file in a folder of a Crea project. + */ +class modelCDMCMakeListsFile : public modelCDMFile +{ +public: + /** + * Default Constructor. + */ + modelCDMCMakeListsFile(); + /** + * CMakeLists file Constructor. + * @param parent Parent node of the CMakeLists file node. + * @param path Full path to the CMakeLists file node. + * @param name File name of the CMakeLists file node. + * @param level Project hierarchy level of the CMakeLists file node. + */ + modelCDMCMakeListsFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "CMakeLists.txt", const int& level = 1); + /** + * Destructor + */ + ~modelCDMCMakeListsFile(); + + /** + * Opens the file in the system default code editor. + * @param result Result message. + * @return True if the operation was successful. + */ + bool OpenFile(std::string*& result); + /** + * Refreshes the state of the CMakeLists file. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); +}; + +#endif /* MODELCDMCMAKELISTSFILE_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMFile.cpp b/lib/creaDevManagerLib/modelCDMFile.cpp new file mode 100644 index 0000000..dcafc8e --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMFile.cpp @@ -0,0 +1,105 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMFile.cpp + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMFile.h" + +#include +#include +#include + +#include "CDMUtilities.h" + +modelCDMFile::modelCDMFile() +{ +} + +modelCDMFile::modelCDMFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating file: " + path + "\n"; + this->parent = parent; + this->children.clear(); + this->level = level; + this->name = name; + this->path = path; + this->type = wxDIR_FILES; + + std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); + in.seekg(0, std::ifstream::end); + this->length = in.tellg(); + in.close(); + +} + +modelCDMFile::~modelCDMFile() +{ +} + +bool modelCDMFile::OpenFile(std::string*& result, const std::string& command) +{ + if (!CDMUtilities::openFileWithCommand(path, command)) + return true; + else + { + result = new std::string("Couldn't open file with command " + command + "."); + return false; + } +} + +const bool modelCDMFile::Refresh(std::string*& result) +{ + //std::cout << "refreshing file " << this->name << std::endl; + std::ifstream in((this->path).c_str()); + if(!in.is_open()) + { + in.close(); + return false; + } + std::ifstream in2(path.c_str(), std::ifstream::in | std::ifstream::binary); + in2.seekg(0, std::ifstream::end); + this->length = in2.tellg(); + in2.close(); + return true; +} + +const bool modelCDMFile::OpenInFileExplorer(std::string*& result) const +{ + std::string pth = this->path.substr(0, path.size() - name.size() - 1); + if (!CDMUtilities::openFileExplorer(pth)) + return true; + else + { + result = new std::string("Couldn't open file."); + return false; + } +} diff --git a/lib/creaDevManagerLib/modelCDMFile.h b/lib/creaDevManagerLib/modelCDMFile.h new file mode 100644 index 0000000..e1908a3 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMFile.h @@ -0,0 +1,87 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMFile.h + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMFILE_H_ +#define MODELCDMFILE_H_ + +#include +#include + +#include "modelCDMIProjectTreeNode.h" + +/** + * Class representing a file node in the project hierarchy. + */ +class modelCDMFile : public modelCDMIProjectTreeNode +{ +public: + /** + * Default constructor + */ + modelCDMFile(); + /** + * Constructor of the File node class + * @param parent Parent node of the file node. + * @param path Full path to the file node + * @param name File name of the file node. + * @param level Hierarchy level of the file node. By default 3. + */ + modelCDMFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 3); + /** + * Destructor + */ + ~modelCDMFile(); + + /** + * Opens the file node with the provided command. + * @param result Result message of the operation. + * @param command Command to open the file. + * @return True if the operation was successful. + */ + bool OpenFile(std::string* & result, const std::string& command = ""); + /** + * Refreshes the file properties and checks that the file exists. + * @param result Result message of the operation. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + /** + * Opens the file node in the default file explorer. + * @param result Result message of the operation. + * @return True if the operation was successful. + */ + const bool OpenInFileExplorer(std::string*& result) const; +}; + +#endif /* MODELCDMFILE_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp new file mode 100644 index 0000000..bcef483 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -0,0 +1,296 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMFolder.cpp + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMFolder.h" + +#include +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMFolder::modelCDMFolder() +{ + this->CMakeLists = NULL; +} + +modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating folder: " + path + "\n"; + //set attributes + this->parent = parent; + this->children.clear(); + this->level = level; + this->CMakeLists = NULL; + this->length = 0; + this->name = name; + this->path = path; + this->type = wxDIR_DIRS; + + std::string pathFixed(CDMUtilities::fixPath(path)); + //check all folders + wxDir dir(crea::std2wx((pathFixed).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if is an unknown folder, create folder + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + this->folders.push_back(folder); + + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + //if is an unknown file, create file + cont = dir.GetNext(&fileName); + } + } + + this->SortChildren(); + std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem); +} + +modelCDMFolder::~modelCDMFolder() +{ + this->folders.clear(); + this->CMakeLists = NULL; + for (int i = 0; i < (int)(this->children.size()); i++) + { + if(this->children[i] != NULL) + { + delete this->children[i]; + this->children[i] = NULL; + } + } + 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, this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1)); + this->children.push_back(new modelCDMFile(this, 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 + std::string command = "mkdir \"" + path + CDMUtilities::SLASH + name + "\""; + if(system(command.c_str())) + { + result = new std::string("Error executing: " + command + "."); + return NULL; + } + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + + return folder; +} + +bool modelCDMFolder::OpenCMakeListsFile(std::string*& result) +{ + if (this->CMakeLists == NULL) + { + result = new std::string("There's no CMakeLists file to open."); + return false; + } + if (!CDMUtilities::openTextEditor(this->CMakeLists->GetPath())) + return true; + else + { + result = new std::string("Couldn't open CMakeLists file."); + return false; + } +} + +const bool modelCDMFolder::Refresh(std::string*& result) +{ + //std::cout << "refreshing folder " << this->name << std::endl; + //set attributes + this->type = wxDIR_DIRS; + + //check children + std::vector checked(this->children.size(), false); + std::vector checkedFolders(this->folders.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + //check if they already exist + bool found = false; + for (int i = 0; !found && i < (int)(this->folders.size()); i++) + { + if (this->folders[i]->GetName() == stdfileName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->folders[i]) - this->children.begin(); + checked[pos] = true; + checkedFolders[i] = true; + if(!this->folders[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0;!found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedFolders.size()); i++) + { + if(!checkedFolders[i]) + { + this->folders.erase(this->folders.begin()+i); + checkedFolders.erase(checkedFolders.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); + std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem); + return true; +} + +modelCDMCMakeListsFile* modelCDMFolder::GetCMakeLists() const +{ + return this->CMakeLists; +} + +std::vector modelCDMFolder::GetFolders() const +{ + return this->folders; +} + +bool +modelCDMFolder::HasCMakeLists() +{ + return this->CMakeLists != NULL; +} diff --git a/lib/creaDevManagerLib/modelCDMFolder.h b/lib/creaDevManagerLib/modelCDMFolder.h new file mode 100644 index 0000000..2a44830 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -0,0 +1,127 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMFolder.h + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMFOLDER_H_ +#define MODELCDMFOLDER_H_ + +#include +#include + +#include "modelCDMIProjectTreeNode.h" +#include "modelCDMCMakeListsFile.h" + +/** + * Class representing a folder in the project hierarchy. + */ +class modelCDMFolder : public modelCDMIProjectTreeNode +{ +public: + /** + * Default constructor. + */ + modelCDMFolder(); + /** + * Constructor of the folder node. + * @param parent Parent node. + * @param path Full path of the folder node. + * @param name Folder name of the folder node. + * @param level Hierarchy level of the folder node in the project. + */ + modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 3); + /** + * Destructor. + */ + ~modelCDMFolder(); + + /** + * Returns the reference to the folder node's CMakeLists file if it exists. + * @return Reference to the CMakeLists file or NULL. + */ + modelCDMCMakeListsFile* GetCMakeLists() const; + /** + * Returns an array with the containing folder children of the actual folder node. + * @return Array with references to children folder nodes. + */ + std::vector GetFolders() const; + + /** + * Creates a class (.h and .cpp files) in the folder node. It creates the files in the model as well as in the system. + * @param name Name of the class to create. + * @return True if the operation was successful. + */ + bool CreateClass(const std::string& name); + + /** + * Creates a folder in the folder node. It creates the folder in the model as well as in the system. + * @param name Name of the folder to create. + * @param result Result message of the operation. + * @return True if the operation was successful. + */ + modelCDMFolder* CreateFolder( + const std::string& name, + std::string*& result + ); + /** + * Opens the CMakeLists file in the default code editor. + * @param result Result message of the operation. + * @return True if the operation was successful. + */ + bool OpenCMakeListsFile(std::string* & result); + /** + * Refreshes the folder node structure. deletes deleted files and folders, and adds created files and folders. + * @param result Result message of the operation + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + + /** + * Returns wether the CMakeLists attribute is different from NULL or not. + * @return True if the MakeLists attribute is different from NULL. + */ + bool HasCMakeLists(); + +protected: + /** + * Reference to the folder node's CMakeLists. + */ + modelCDMCMakeListsFile* CMakeLists; +private: + /** + * Reference array to the children folders. + */ + std::vector folders; + +}; + +#endif /* MODELCDMFOLDER_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp new file mode 100644 index 0000000..8b07658 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.cpp @@ -0,0 +1,172 @@ +/* +# --------------------------------------------------------------------- +# +# 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" +#include + +#include "CDMUtilities.h" + +#include "wx/dir.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 == wxDIR_DIRS) + returnValue = true; + else + returnValue = false; + } + + return returnValue; +} + +const wxCDMTreeItemId& 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; +} + +modelCDMIProjectTreeNode* modelCDMIProjectTreeNode::GetParent() const +{ + return this->parent; +} + +std::vector modelCDMIProjectTreeNode::GetParents() const +{ + std::vector family; + modelCDMIProjectTreeNode* someFamily = this->parent; + while(someFamily != NULL) + { + family.push_back(someFamily); + someFamily = someFamily->GetParent(); + } + return family; + +} + +const std::vector& modelCDMIProjectTreeNode::GetChildren() const +{ + return this->children; +} + +void modelCDMIProjectTreeNode::SetId(const wxCDMTreeItemId& id) +{ + this->id = id; +} + +void modelCDMIProjectTreeNode::SortChildren() +{ + std::sort(this->children.begin(), this->children.end(), CompareNodeItem); +} + +void modelCDMIProjectTreeNode::SetChildren( + const std::vector& children) +{ + this->children.clear(); + this->children = children; +} + +const bool modelCDMIProjectTreeNode::Refresh(std::string*& result) +{ + //TODO: implement method + return false; +} + +const int& modelCDMIProjectTreeNode::GetLength() +{ + return this->length; +} + +const bool modelCDMIProjectTreeNode::OpenInFileExplorer(std::string*& result) const +{ + if (!CDMUtilities::openFileExplorer(this->GetPath())) + return true; + else + { + result = new std::string("Couldn't open file."); + return false; + } +} diff --git a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h index 4d06cb6..ddfae33 100644 --- a/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h +++ b/lib/creaDevManagerLib/modelCDMIProjectTreeNode.h @@ -23,7 +23,7 @@ # 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.h @@ -37,27 +37,132 @@ #include #include +#include +#include "wx/treectrl.h" +#include "wxCDMTreeItemId.h" +/** + * Class that represents an element of a Crea Project. + */ class modelCDMIProjectTreeNode { public: - virtual ~modelCDMIProjectTreeNode(){} + /** + * Destructor that doesn't do anything. + */ + virtual ~modelCDMIProjectTreeNode() {}; + + /** + * Compares the precedence of an modelCDMIProjectTreeNode object with another by the node's name and its type (first folder then file). + * @return Either if the node x goes before (true) or after (false) y. + */ + static bool CompareNodeItem(const modelCDMIProjectTreeNode* x, const modelCDMIProjectTreeNode* y); + /** + * Returns the id of the node in the tree of the project. + * @return Id of the node in the tree project. + */ + const wxCDMTreeItemId& GetId() const; + /** + * Returns the full path to the node, including the name of the node. + * @return Node's full path. + */ const std::string& GetPath() const; + /** + * Return the name of the node, either the file name or the folder name. + * @return Name of the node. + */ const std::string& GetName() const; + /** + * Returns the type of node. + * @return Either wxDIR_FILES for files or wxDIR_DIRS for folders. + */ const unsigned char& GetType() const; + /** + * Returns the level of the node in the project tree. + * @return Level of the node in the project tree. + */ const int& GetLevel() const; + /** + * Returns a reference to the parent node of the actual node. + * @return The reference of the parent node or NULL. + */ + modelCDMIProjectTreeNode* GetParent() const; + /** + * Returns an array with the hierarchy route between the node and the project root + * @return Hierarchy array ordered from higher to lower node level down to the project root. + */ + std::vector GetParents() const; + /** + * Returns the children nodes of the actual node. + * @return An array with the children nodes. + */ const std::vector& GetChildren() const; + /** + * Returns the file size of the node. + * @return File size. + */ + const int& GetLength(); + /** + * Sets the id of the node in the project tree. + * @param id Id of the node. + */ + void SetId(const wxCDMTreeItemId& id); + /** + * Sorts the children using the compareNodeItem function. + */ + void SortChildren(); + /** + * Sets the children array of the node. Warning: it discards the older children. + * @param children Array of children nodes. + */ void SetChildren(const std::vector& children); - const bool& Refresh(std::string*& result); - const bool& OpenInFileExplorer(std::string*& result) const; + /** + * Refreshes the structure of the node and its children. + * @param result Result of the procedure. + * @return True if the procedure was successful. + */ + virtual const bool Refresh(std::string*& result); + /** + * Opens the file explorer in the containing folder of the file or in the folder itself. + * @param result Result of the procedure. + * @return True if the procedure was successful. + */ + const bool OpenInFileExplorer(std::string*& result) const; -protected: + protected: + /** + * Id of the node in the project tree. + */ + wxCDMTreeItemId id; + /** + * path of the node in the computer. + */ std::string path; + /** + * Name of the folder or file. + */ std::string name; + /** + * Type of the node. Either wxDIR_FILES for files or wxDIR_DIRS for folders. + */ unsigned char type; + /** + * Level of the node in the file hierarchy. + */ int level; + /** + * Length of the file in the system. + */ + int length; + /** + * Reference to the parent node. + */ + modelCDMIProjectTreeNode* parent; + /** + * Array of references to the children nodes. + */ std::vector children; }; diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index d22a6fe..e3c2902 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -34,32 +34,367 @@ #include "modelCDMLib.h" +#include +#include +#include + +#include "CDMUtilities.h" +#include "creaWx.h" +#include "wx/dir.h" + modelCDMLib::modelCDMLib() { } +modelCDMLib::modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating lib\n"; + this->parent = parent; + this->type = wxDIR_DIRS; + this->name = name; + this->level = level; + this->path = path; + + + + this->path = CDMUtilities::fixPath(path); + //open makelists file + std::string pathFixed(CDMUtilities::fixPath(path)); + + this->libraries.clear(); + wxDir dir(crea::std2wx((pathFixed).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + //folders + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + if(stdfileName != "template_lib") + { + modelCDMLibrary* library = new modelCDMLibrary(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->libraries.push_back(library); + this->children.push_back(library); + } + else + { + modelCDMFolder* folder = new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + + cont = dir.GetNext(&fileName); + } + //files + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + //if is an unknown file, create file + else + { + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + + cont = dir.GetNext(&fileName); + } + } + this->SortChildren(); + std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem); +} + modelCDMLib::~modelCDMLib() { } -bool modelCDMLib::CreateLibrary( - const std::string& name, - std::string*& result, - const std::string& path +const std::vector& modelCDMLib::GetLibraries() const +{ + return this->libraries; +} + +modelCDMLibrary* modelCDMLib::CreateLibrary( + const std::string& namein, + std::string*& result ) { - //TODO: implement method - return true; + std::vector words; + CDMUtilities::splitter::split(words,namein," '/\\*\"%",CDMUtilities::splitter::no_empties); + std::string name; + for (int i = 0; i < (int)(words.size()); i++) + { + name += words[i]; + } + if (name == "") + { + result = new std::string("The given name is not valid: '/\\*\"% are forbidden."); + return NULL; + } + //copy template library folder with new name +#ifdef _WIN32 + std::string copyCommand = "xcopy \"" + this->path + CDMUtilities::SLASH + "template_lib\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "\" /Y"; +#else + std::string copyCommand = "cp -r \"" + this->path + CDMUtilities::SLASH + "template_lib\" \"" + this->path + CDMUtilities::SLASH + name + "\""; +#endif + if(system(copyCommand.c_str())) + { + result = new std::string("An error occurred while running '" + copyCommand + "'."); + return NULL; + } + //set name of library in CMakeLists inside copied folder + std::string line; + std::ifstream in((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return NULL; + } + std::ofstream out((this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + while (getline(in, line)) + { + if(line == "SET ( LIBRARY_NAME MyLib )") + line = "SET ( LIBRARY_NAME " + name + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return NULL; + } + + //add library to model + modelCDMLibrary* library = new modelCDMLibrary(this, this->path + CDMUtilities::SLASH + name, name, this->level + 1); + this->libraries.push_back(library); + this->children.push_back(library); + + this->SortChildren(); + + result = new std::string(this->path + CDMUtilities::SLASH + name); + return library; } -bool modelCDMLib::OpenCMakeListsFile(std::string*& result) +const bool modelCDMLib::Refresh(std::string*& result) { - //TODO: implement method + std::cout << "refreshing lib" << std::endl; + this->type = wxDIR_DIRS; + + + + std::vector checked(this->children.size(), false); + std::vector checkedLibraries(this->libraries.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + if(stdfileName != "template_lib") + { + std::string libraryName = stdfileName; + //check if library already exist + bool found = false; + for (int i = 0; !found && i < (int)(this->libraries.size()); i++) + { + 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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->libraries.push_back(library); + this->children.push_back(library); + } + } + else + { + //check if folder already exist + bool found = false; + for (int i = 0; !found && i < (int)(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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedLibraries.size()); i++) + { + if(!checkedLibraries[i]) + { + this->libraries.erase(this->libraries.begin()+i); + checkedLibraries.erase(checkedLibraries.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); + std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem); return true; } -bool modelCDMLib::Refresh(std::string*& result) +void modelCDMLib::CheckStructure(std::map& properties) { - //TODO: implement method - return true; + //check cmake exist + if(this->CMakeLists != NULL) + { + //set properties parameters based on model + for (int i = 0; i < (int)(this->libraries.size()); i++) + properties["lib add " + libraries[i]->GetName()] = false; + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //add instructions + if (words.size() > 0 && words[words.size()-1] == "ADD_SUBDIRECTORY") + { + std::getline(ss,word, ')'); + //std::cout << word << std::endl; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + if (words.size() > 0) + { + { + properties["lib add " + words[0]] = true; + } + } + } + } + + } + + //check libraries' structure + 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/modelCDMLib.h b/lib/creaDevManagerLib/modelCDMLib.h index 520822f..e372e5f 100644 --- a/lib/creaDevManagerLib/modelCDMLib.h +++ b/lib/creaDevManagerLib/modelCDMLib.h @@ -37,25 +37,68 @@ #include #include +#include -#include "modelCDMIProjectTreeNode.h" +#include "modelCDMFolder.h" #include "modelCDMLibrary.h" -class modelCDMLib : public modelCDMIProjectTreeNode +/** + * Class representing the lib folder of a Crea project. + */ +class modelCDMLib : public modelCDMFolder { public: + /** + * Default Constructor. + */ modelCDMLib(); + /** + * Lib folder node constructor. + * @param parent Parent node of the lib folder node. + * @param path Full path to the lib folder node. + * @param name Name of the lib folder node. By default "lib". + * @param level Project hierarchy level of the lib folder node. + */ + modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "lib", const int& level = 1); + /** + * Destructor. + */ ~modelCDMLib(); - bool CreateLibrary( + /** + * Returns the libraries registered in the lib folder. + * @return Array of library references. + */ + const std::vector& GetLibraries() const; + + /** + * Creates a new library node for the actual project and registers it. It modifies the project model as well as the system. + * @param name Name of the new library. + * @param result Result message. + * @return New library reference. + */ + modelCDMLibrary* CreateLibrary( const std::string& name, - std::string*& result, - const std::string& path = "/" + std::string*& result ); - bool OpenCMakeListsFile(std::string*& result); - bool Refresh(std::string*& result); + + /** + * Refreshes the structure of the lib folder. Deletes folders and files deleted since the las refresh and Adds folders and files created since the las refresh. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + + /** + * Checks the file structure and the CMakeLists file to find structure definition errors before compiling the project. + * @param properties Properties of the project. + */ + void CheckStructure(std::map& properties); private: + /** + * Libraries references. + */ std::vector libraries; }; diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index 7bf7373..7b99318 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -34,36 +34,402 @@ #include "modelCDMLibrary.h" +#include +#include +#include + +#include "CDMUtilities.h" +#include "creaWx.h" +#include "wx/dir.h" + modelCDMLibrary::modelCDMLibrary() { } +modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating library: " + path + "\n"; + this->parent = parent; + //folder name + this->name = name; + //path + this->path = CDMUtilities::fixPath(path); + //type + this->type = wxDIR_DIRS; + //level + this->level = level; + + //open CMakeList + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get library name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "LIBRARY_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + + this->nameLibrary = word; + } + } + } + + confFile.close(); + + //add library contents + + this->children.clear(); + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + //folders + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + + cont = dir.GetNext(&fileName); + } + //files + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + //if is an unknown file, create file + else + { + this->children.push_back(new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + + cont = dir.GetNext(&fileName); + } + } + this->SortChildren(); + std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem); +} + modelCDMLibrary::~modelCDMLibrary() { } -const std::string& modelCDMLibrary::GetName() const +const std::string& modelCDMLibrary::GetNameLibrary() const { - return this->name; + return this->nameLibrary; } -bool modelCDMLibrary::CreateFolder( - const std::string& name, - std::string*& result, - const std::string& path) +bool modelCDMLibrary::SetNameLibrary(const std::string& fileName, std::string*& result) { - //TODO: implement method + std::vector words; + CDMUtilities::splitter::split(words, fileName, ", /\\\"", CDMUtilities::splitter::no_empties); + std::string fileNameReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + fileNameReal += "-" + words[i]; + } + + std::string line; + //opening original cmakelists + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + //opening temporal cmakelists + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + while (getline(in, line)) + { + if(line.find("SET ( LIBRARY_NAME") != std::string::npos) + line = "SET ( LIBRARY_NAME " + fileNameReal + " )"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->nameLibrary = fileNameReal; return true; } -bool modelCDMLibrary::OpenCMakeListsFile(std::string*& result) +modelCDMFolder* modelCDMLibrary::CreateFolder(const std::string& name, std::string*& result) { - //TODO: implement method - return true; + //TODO:: mkdir depending on OS + std::string command = "mkdir \"" + path + CDMUtilities::SLASH + name + "\""; + if(system(command.c_str())) + { + result = new std::string("Error executing: " + command + "."); + return NULL; + } + modelCDMFolder* folder = new modelCDMFolder(this, path + CDMUtilities::SLASH + name, name, level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + + return folder; } -bool modelCDMLibrary::Refresh(std::string*& result) +const bool modelCDMLibrary::Refresh(std::string*& result) { - //TODO: implement method + std::cout << "refreshing library: " << this->nameLibrary << std::endl; + //set attributes + this->type = wxDIR_DIRS; + + //open CMakeList + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get library name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "LIBRARY_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + + this->nameLibrary = word; + } + } + } + + confFile.close(); + + //check children + std::vector checked(this->children.size(), false); + std::vector checkedFolders(this->folders.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + //check if they already exist + bool found = false; + for (int i = 0; !found && i < (int)(this->folders.size()); i++) + { + if (this->folders[i]->GetName() == stdfileName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->folders[i]) - this->children.begin(); + checked[pos] = true; + checkedFolders[i] = true; + if(!this->folders[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->folders.push_back(folder); + this->children.push_back(folder); + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, check if exist in children + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedFolders.size()); i++) + { + if(!checkedFolders[i]) + { + this->folders.erase(this->folders.begin()+i); + checkedFolders.erase(checkedFolders.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); + std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem); return true; } + +void modelCDMLibrary::CheckStructure(std::map& properties) +{ + //check cmake exist + if(this->CMakeLists != NULL) + { + //set default values + properties["library " + this->name + " lib ${crea_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${WXWIDGETS_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${KWWidgets_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${VTK_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${ITK_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${GDCM_LIBRARIES}"] = false; + properties["library " + this->name + " lib ${BOOST_LIBRARIES}"] = false; + + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //set instructions + if (words.size() > 0 && words[words.size()-1] == "SET") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + if (words.size() > 1) + { + if (words[0] == "${LIBRARY_NAME}_LINK_LIBRARIES") + { + for (int i = 1; i < (int)(words.size()); i++) + { + properties["library " + this->name + " lib " + words[i]] = true; + } + } + } + } + } + + } +} diff --git a/lib/creaDevManagerLib/modelCDMLibrary.h b/lib/creaDevManagerLib/modelCDMLibrary.h index 64ae1f8..ae37ec9 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.h +++ b/lib/creaDevManagerLib/modelCDMLibrary.h @@ -37,28 +37,76 @@ #include #include +#include -#include "modelCDMIProjectTreeNode.h" +#include "modelCDMFolder.h" -class modelCDMLibrary : public modelCDMIProjectTreeNode +/** + * Class that represents a library in a Crea project. + */ +class modelCDMLibrary : public modelCDMFolder { public: + /** + * Default Constructor + */ modelCDMLibrary(); + /** + * Constructor of the Library node. + * @param parent Parent node of the library node. + * @param path Full path to the library node. + * @param name Name of the library folder node. + * @param level Project hierarchy level of the library folder node. + */ + modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 2); + /** + * Destructor. + */ ~modelCDMLibrary(); - const std::string& GetName() const; + /** + * Retrieves the name of the Library node. The name of a library can be different than the name of the folder that contains it + * @return Name of the library node. + */ + const std::string& GetNameLibrary() const; + /** + * Renames the library with the given name. + * @param fileName New name of the library node. + * @param result Result message. + * @return True if the operation was successful. + */ + bool SetNameLibrary(const std::string& fileName, std::string*& result); + + /** + * Creates a new folder inside the library folder node. This method not only modifies the project model, but also the system. + * @param name Name of the new folder. + * @param result Result message. + * @return True if the operation was successful. + */ + modelCDMFolder* CreateFolder(const std::string& name, std::string*& result); + + /** + * Refreshes the structure of the library folder node. Deletes files and folders deleted since last refresh, adds files and folders created since last refresh. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); - bool CreateFolder( - const std::string& name, - std::string*& result, - const std::string& path = "/" - ); - bool OpenCMakeListsFile(std::string*& result); - bool Refresh(std::string*& result); + /** + * Checks the library structure and CMakeLists file to find project structure definition problems before compiling the project. + * @param properties Project properties. + */ + void CheckStructure(std::map& properties); private: - std::string name; - std::vector libraries; + /** + * Name of the library node. The name of a library can be different than the library folder name. + */ + std::string nameLibrary; + /** + * Folder reference array of folder node inside the library node. + */ + std::vector folders; }; #endif /* MODELCDMLIBRARY_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index e9df13e..8d69741 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -38,24 +38,29 @@ #include #include #include +#include #include #include #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; } @@ -71,8 +76,7 @@ bool modelCDMMain::CreateProject( 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 "); @@ -80,60 +84,79 @@ bool modelCDMMain::CreateProject( 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()); + 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())) + { + result = new std::string("An error occurred while running '" + command + "'."); + return false; } - else + + if (system (command1.c_str())) { - result = new std::string("An error occured while running '" + command + "'."); + 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; } -#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 + CDMUtilities::SLASH + name; + std::string nomPackageDirectory = nomDirectory + CDMUtilities::SLASH + "bbtk_" + name + "_PKG"; + std::string bbCreatePackage("bbCreatePackage "); + bbCreatePackage += "\"" + nomDirectory + "\" \"" + name + "\" \"" + author + "\" \"" + description + "\""; + 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\""; + if (system (add.c_str())) { - std::string nomDirectory = locationFixed + "/" + name; - std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG"; + result = new std::string("An error occurred while running '" + add + "'."); + return false; + } - std::string bbCreatePackage("bbCreatePackage "); - bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description; - std::cout << "executing " << bbCreatePackage << std::endl; - system (bbCreatePackage.c_str()); + this->project = new modelCDMProject(NULL, nomDirectory, name); - 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 +#else + // ------ LINUX / MacOS + std::string command("creaNewProject.sh "); + command += "\"" + locationFixed + "\"" +" \"" + name + "\""; + //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 + CDMUtilities::SLASH + name; + std::string nomPackageDirectory = nomDirectory + CDMUtilities::SLASH + "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 + CDMUtilities::SLASH + "CMakeLists.txt\""; + //std::cout << "executing " << add << std::endl; + system(add.c_str()); + + if(this->project != NULL) + { + if (!CloseProject(result)) + return false; + } + + this->project = new modelCDMProject(NULL, nomDirectory, name); + +#endif return true; } @@ -143,7 +166,7 @@ bool modelCDMMain::OpenProject( 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; @@ -153,29 +176,57 @@ bool modelCDMMain::OpenProject( std::string pathBuild = ""; //check if Makefile file exists - std::string pathMakefile = pathFixed + "/Makefile"; - FILE* pFile = fopen(pathMakefile.c_str(), "r"); - +#ifdef _WIN32 + std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "CMakeCache.txt"; + FILE* pFile; + errno_t errorOpen = fopen_s(&pFile, pathMakefile.c_str(), "r"); +#else + std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile"; + FILE* pFile; + 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; readFile.open(pathMakefile.c_str()); std::string word; + +#ifdef _WIN32 + while(!isBinary && !readFile.eof()) + { + getline(readFile, word, '\n'); + std::vector words; + CDMUtilities::splitter::split(words,word,"=",CDMUtilities::splitter::no_empties); + if(words.size() && words[0] == "CMAKE_HOME_DIRECTORY:INTERNAL") + { + pathBuild = pathFixed; + pathFixed = CDMUtilities::fixPath(words[1]); + for (int i = 0; i < (int)(pathFixed.size()); i++) + { + if (pathFixed[i]=='/') + pathFixed[i]='\\'; + } + isBinary = true; + } + } +#else while(!isBinary && readFile >> word) { - if(word == "CMAKE_SOURCE_DIR") + if(word == "CMAKE_SOURCE_DIR") { readFile >> word; readFile.ignore(); getline(readFile, word, '\n'); pathBuild = pathFixed; - pathFixed = word; + pathFixed = CDMUtilities::fixPath(word); isBinary = true; } - } + } +#endif readFile.close(); } @@ -183,11 +234,16 @@ bool modelCDMMain::OpenProject( bool isSource = false; std::string pathSource = ""; //check if CMakeLists file exists - std::string pathCMakeLists = pathFixed + "/CMakeLists.txt"; + 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; @@ -197,12 +253,14 @@ bool modelCDMMain::OpenProject( 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 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(); @@ -211,20 +269,32 @@ bool modelCDMMain::OpenProject( //if is source folder if(isSource) { - std::cout << "Project sources at: " << pathSource; + if(this->project != NULL) + { + if (!CloseProject(result)) + return false; + } + std::vector words; + CDMUtilities::splitter::split(words, pathSource, CDMUtilities::SLASH, CDMUtilities::splitter::no_empties); + + 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(NULL, pathSource, words[words.size()-1], pathBuild); + } + else + { + this->project = new modelCDMProject(NULL, pathSource, words[words.size()-1]); } - std::cout << std::endl; } else { - result = new std::string("No source folder found. Please make sure to select either the project's build or source folder."); + result = new std::string("No source folder found. Please make sure to select either the project's build or source folder. " + pathBuild + pathFixed); return false; } - //TODO: create Project given the source folder return true; } @@ -232,14 +302,37 @@ bool modelCDMMain::RefreshProject( std::string*& result ) { - //TODO: recreate the project using the project's path - return true; + //recreate the project using the project's path + if (this->project != NULL) + { + return this->project->Refresh(result); + } + else + { + result = new std::string("There is no open project."); + return false; + } +} + +std::map& modelCDMMain::GetModelElements() +{ + return this->modelElements; } bool modelCDMMain::CloseProject( std::string*& result ) { - //TODO: delete the project tree and leave it as NULL - return true; + //delete the project tree and leave it as NULL + if (this->project != NULL) + { + delete this->project; + this->project = NULL; + return true; + } + else + { + result = new std::string("There is no open project."); + return false; + } } diff --git a/lib/creaDevManagerLib/modelCDMMain.h b/lib/creaDevManagerLib/modelCDMMain.h index 6a10470..d028487 100644 --- a/lib/creaDevManagerLib/modelCDMMain.h +++ b/lib/creaDevManagerLib/modelCDMMain.h @@ -36,17 +36,50 @@ #define MODELCDMMAIN_H_ #include +#include +#include +#include + +#include "modelCDMIProjectTreeNode.h" #include "modelCDMProject.h" +/** + * Class representing the model of the project manager. + */ class modelCDMMain { public: + /** + * Default constructor. + */ modelCDMMain(); + /** + * Destructor. + */ ~modelCDMMain(); - const modelCDMProject* GetProject() const; + /** + * Retrieves the current active project. + * @return Reference to the current active project, if there's no active project NULL is returned. + */ + modelCDMProject* GetProject() const; + /** + * Retrieves the map of all the nodes inside the current active project. + * @return Map with ids and node reference of the project. + */ + std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& GetModelElements(); + + /** + * Creates a new project and sets it as the current active project. This method creates a new project model and also creates a project in the system. + * @param name Name of the new project. + * @param location Path where the project is to be created. + * @param result Result message. + * @param author Default Package Authors' names. + * @param description Description of the default package. + * @return True if the operation was successful. + */ bool CreateProject( const std::string& name, const std::string& location, @@ -54,19 +87,43 @@ public: const std::string& author = "unknown", const std::string& description = "no description" ); + /** + * Opens an existing project given the source or the binaries folder. + * @param path Path to the project source or binaries folder. + * @param result Result message. + * @return True if the operation was successful. + */ bool OpenProject( const std::string& path, std::string*& result ); + /** + * Refreshes the currently active project structure. + * @param result Result message. + * @return True if the operation was successful. + */ bool RefreshProject( std::string*& result ); + /** + * Closes the currently active project. This method deletes the project model but doesn't erase the project from the system. + * @param result Result message. + * @return True if the operation was successful. + */ bool CloseProject( std::string*& result ); + private: + /** + * Currently active project reference. + */ modelCDMProject* project; + /** + * Map of all the elements of the currently active project and their IDs. + */ + std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* > modelElements; }; diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 681c5a4..66c5e22 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -34,17 +34,154 @@ #include "modelCDMPackage.h" +#include +#include +#include + +#include "creaWx.h" +#include "wx/dir.h" +#include "CDMUtilities.h" + modelCDMPackage::modelCDMPackage() { + this->src = NULL; +} + +modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating package: " + path + "\n"; + this->parent = parent; + this->type = wxDIR_DIRS; + this->name = name; + //Get Package Name + + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get package name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "BBTK_PACKAGE_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->namePackage = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->authors = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->description = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MAJOR_VERSION") + { + this->version = wordBits[1]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MINOR_VERSION") + { + this->version += "." + wordBits[1]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_BUILD_VERSION") + { + this->version += "." + wordBits[1]; + } + } + } + + this->level = level; + this->path = path; + + //check all folders and files + wxDir dir(crea::std2wx((path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + + //folders + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + //if src, check for black boxes + if(stdfileName == "src") + { + this->src = new modelCDMPackageSrc(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->src); + } + else + { + this->children.push_back(new modelCDMFolder(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + + cont = dir.GetNext(&fileName); + } + + //files + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + this->children.push_back(new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + //if is an unknown file, create file + cont = dir.GetNext(&fileName); + } + } + this->SortChildren(); } modelCDMPackage::~modelCDMPackage() { } -const std::string& modelCDMPackage::GetName() const +const std::string& modelCDMPackage::GetNamePackage() const { - return this->name; + return this->namePackage; } const std::string& modelCDMPackage::GetAuthors() const @@ -67,9 +204,59 @@ const std::string& modelCDMPackage::GetDescription() const return this->description; } +modelCDMPackageSrc* modelCDMPackage::GetSrc() const +{ + return this->src; +} + bool modelCDMPackage::SetAuthors(const std::string& authors, std::string*& result) { - //TODO: implement method + std::vector words; + CDMUtilities::splitter::split(words, authors, ",\n", CDMUtilities::splitter::no_empties); + std::string authorsReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + authorsReal += "/" + words[i]; + } + + std::string line; + //opening original cmakelists + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + //opening temporal cmakelists + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + while (getline(in, line)) + { + if(line.find("SET(${BBTK_PACKAGE_NAME}_AUTHOR") != std::string::npos) + line = "SET(${BBTK_PACKAGE_NAME}_AUTHOR \"" + authorsReal + "\")"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->authors = authorsReal; return true; } @@ -81,36 +268,424 @@ bool modelCDMPackage::SetAuthorsEmail(const std::string& email, std::string*& re bool modelCDMPackage::SetVersion(const std::string& version, std::string*& result) { - //TODO: implement method - return true; + std::vector vers; + CDMUtilities::splitter::split(vers, version, " .", CDMUtilities::splitter::no_empties); + + + std::string line; + //opening original cmakelists + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + //opening temporal cmakelists + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + while (getline(in, line)) + { + if(line.find("SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION") != std::string::npos) + line = "SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION " + vers[0] + ")"; + else if(line.find("SET(${BBTK_PACKAGE_NAME}_VERSION") != std::string::npos) + line = "SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION " + vers[1] + ")"; + else if(line.find("SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION") != std::string::npos) + line = "SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION " + vers[2] + ")"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->version = vers[0] + "." + vers[1] + "." + vers[2]; + return true; } bool modelCDMPackage::SetDescription(const std::string& description, std::string*& result) { - //TODO: implement method + std::vector words; + CDMUtilities::splitter::split(words, description, " \n", CDMUtilities::splitter::no_empties); + std::string descriptionReal = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + descriptionReal += " " + words[i]; + } + + std::string line; + //opening original cmakelists + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + //opening temporal cmakelists + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + //copying contents from original to temporal and making changes + while (getline(in, line)) + { + if(line.find("SET(${BBTK_PACKAGE_NAME}_DESCRIPTION") != std::string::npos) + line = "SET(${BBTK_PACKAGE_NAME}_DESCRIPTION \"" + descriptionReal + "\")"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->description = descriptionReal; return true; } -bool modelCDMPackage::CreateBlackBox( +modelCDMBlackBox* modelCDMPackage::CreateBlackBox( + std::string*& result, const std::string& name, + const std::string& type, + const std::string& format, + const std::string& categories, const std::string& authors, const std::string& authorsEmail, - const std::string& categories, const std::string& description ) { - //TODO: implement method - return true; + return this->src->CreateBlackBox(result,name, this->namePackage, type,format,categories,authors,authorsEmail,description); } -bool modelCDMPackage::OpenCMakeListsFile(std::string*& result) +const bool modelCDMPackage::Refresh(std::string*& result) { - //TODO: implement method + std::cout << "refreshing package " << this->namePackage << std::endl; + this->type = wxDIR_DIRS; + + //Get Package Name + + std::string pathMakeLists = path + CDMUtilities::SLASH + "CMakeLists.txt"; + + std::ifstream confFile; + confFile.open((pathMakeLists).c_str()); + + std::string word; + while(confFile.is_open() && !confFile.eof()) + { + //get sets + std::getline(confFile,word,'('); + std::vector wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "SET") + { + //get package name + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "BBTK_PACKAGE_NAME") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->namePackage = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->authors = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION") + { + word = wordBits[1]; + for (int i = 2; i < (int)(wordBits.size()); i++) + { + word += " " + wordBits[i]; + } + wordBits.clear(); + CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties); + + this->description = wordBits[0]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MAJOR_VERSION") + { + this->version = wordBits[1]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MINOR_VERSION") + { + this->version += "." + wordBits[1]; + } + else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_BUILD_VERSION") + { + this->version += "." + wordBits[1]; + } + } + } + + + + std::vector checked(this->children.size(), false); + bool checkedSrc = false; + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + + std::string stdfileName = crea::wx2std(fileName); + + //detect black boxes in src + if(stdfileName == "src") + { + //check if box already exist + bool found = false; + if (this->src != NULL) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->src) - this->children.begin(); + checked[pos] = true; + checkedSrc = true; + if(!this->src->Refresh(result)) + return false; + } + else + { + this->src = new modelCDMPackageSrc(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level +1); + this->children.push_back(this->src); + } + } + else + { + + //check if folder already exist + bool found = false; + for (int i = 0; !found && i < (int)(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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + } + cont = dir.GetNext(&fileName); + + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + if(!checkedSrc) + { + this->src = NULL; + } + + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); return true; } -bool modelCDMPackage::Refresh(std::string*& result) +void modelCDMPackage::CheckStructure(std::map& properties) { - //TODO: implement method - return true; + //check cmake exist + if(this->CMakeLists != NULL) + { + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //set instructions + if (words.size() > 0 && words[words.size()-1] == "SET") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + if (words.size() > 1) + { + if (words[0] == "${BBTK_PACKAGE_NAME}_USE_VTK" && words[1] == "ON") + { + properties["package " + this->name + " set USE_VTK"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_ITK" && words[1] == "ON") + { + properties["package " + this->name + " set USE_ITK"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_GDCM" && words[1] == "ON") + { + properties["package " + this->name + " set USE_GDCM"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_GDCM_VTK" && words[1] == "ON") + { + properties["package " + this->name + " set USE_GDCM_VTK"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_GSMIS" && words[1] == "ON") + { + properties["package " + this->name + " set USE_GSMIS"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_WXWIDGETS" && words[1] == "ON") + { + properties["package " + this->name + " set USE_WXWIDGETS"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_USE_KWWIDGETS" && words[1] == "ON") + { + properties["package " + this->name + " set USE_KWWIDGETS"] = true; + } + else if (words[0] == "USE_BOOST" && words[1] == "ON") + { + properties["package " + this->name + " set USE_BOOST"] = true; + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_INCLUDE_DIRS") + { + 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; + } + } + else if (words[0] == "${BBTK_PACKAGE_NAME}_LIBS") + { + for (int i = 1; i < (int)(words.size()); i++) + { + properties["package " + this->name + " lib " + words[i]] = true; + } + } + } + } + } + + } } diff --git a/lib/creaDevManagerLib/modelCDMPackage.h b/lib/creaDevManagerLib/modelCDMPackage.h index b6202b5..05e2473 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.h +++ b/lib/creaDevManagerLib/modelCDMPackage.h @@ -37,45 +37,155 @@ #include #include +#include -#include"modelCDMIProjectTreeNode.h" -#include"modelCDMBlackBox.h" +#include"modelCDMFolder.h" +#include"modelCDMPackageSrc.h" -class modelCDMPackage : public modelCDMIProjectTreeNode +/** + * Class representing a package of a Crea project. + */ +class modelCDMPackage : public modelCDMFolder { public: + /** + * Default constructor. + */ modelCDMPackage(); + /** + * Package node constructor. + * @param parent Parent node of the package folder node. + * @param path Full path to the package. + * @param name Name of the package folder. + * @param level Project hierarchy level of the package node. + */ + modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1); + /** + * Destructor. + */ ~modelCDMPackage(); - const std::string& GetName() const; + /** + * Retrieves the name of the package. the name of the package can be different from the package folder name. + * @return Package name. + */ + const std::string& GetNamePackage() const; + /** + * Retrieves the authors of the package. + * @return Package authors. + */ const std::string& GetAuthors() const; + /** + * Retrieves the Author e-mails of the package. + * @return Author e-mails. + */ const std::string& GetAuthorsEmail() const; + /** + * Retrieves the version of the package. + * @return Package version. + */ const std::string& GetVersion() const; + /** + * Retrieves the description of the package. + * @return Package description + */ const std::string& GetDescription() const; + /** + * Retrieves the src folder node of the package node. + * @return Reference to the package src file node. + */ + modelCDMPackageSrc* GetSrc() const; + /** + * Sets the name of the package authors. This operation affects the project model as well as the system files. + * @param authors Name of the package authors. + * @param result Result message + * @return True if the operation was successful. + */ bool SetAuthors(const std::string& authors, std::string*& result); + /** + * Sets the email of the package authors. This operation affects the project model as well as the system files. + * @param email + * @param result Result message + * @return True if the operation was successful. + */ bool SetAuthorsEmail(const std::string& email, std::string*& result); + /** + * Sets the version of the package. This operation affects the project model as well as the system files. + * @param version + * @param result Result message + * @return True if the operation was successful. + */ bool SetVersion(const std::string& version, std::string*& result); + /** + * Sets the description of the package. This operation affects the project model as well as the system files. + * @param description + * @param result Result message + * @return True if the operation was successful. + */ bool SetDescription(const std::string& description, std::string*& result); - bool CreateBlackBox( + /** + * Creates a new black box and returns a reference to it if the creation is successful. This operation affects the project model as well as the system files. + * @param result Result message + * @param name New black box name. + * @param type Black box type. + * @param format Black box format. + * @param categories Categories associated to this black box. + * @param authors Black box authors' name. + * @param authorsEmail Black box authors' email. + * @param description Black box description. + * @return True if the operation was successful. + */ + modelCDMBlackBox* CreateBlackBox( + std::string*& result, const std::string& name, + const std::string& type = "std", + const std::string& format = "C++", + const std::string& categories = "empty", const std::string& authors = "unknown", const std::string& authorsEmail = "", - const std::string& categories = "empty", const std::string& description = "no description" ); - bool OpenCMakeListsFile(std::string*& result); - bool Refresh(std::string*& result); + /** + * Refreshes the structure of the package folder node. This method updates the properties of the package as well as it refreshes its children. + * @param result Result message + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + + /** + * Checks the package structure with the CMakeLists file to look for project structure definition problems before compiling the project. + * @param properties Project properties. + */ + void CheckStructure(std::map& properties); private: - std::string name; + /** + * Package name. + */ + std::string namePackage; + /** + * Package authors' name. + */ std::string authors; + /** + * Package authors' e-mails. + */ std::string authorsEmail; + /** + * Package version. + */ std::string version; + /** + * Package description. + */ std::string description; - std::vector applications; + /** + * Reference to the package source folder. + */ + modelCDMPackageSrc* src; }; diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp new file mode 100644 index 0000000..529bfe2 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -0,0 +1,421 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMFolder.cpp + * + * Created on: Nov 28, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMPackageSrc.h" + +#include +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMPackageSrc::modelCDMPackageSrc() +{ + this->CMakeLists = NULL; +} + +modelCDMPackageSrc::modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating package src: " + path + "\n"; + this->parent = parent; + //set attributes + this->children.clear(); + this->level = level; + this->CMakeLists = NULL; + this->length = 0; + this->name = name; + this->path = CDMUtilities::fixPath(path); + this->type = wxDIR_DIRS; + + //check all folders + wxDir dir(crea::std2wx(path)); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if is an unknown folder, create folder + this->children.push_back(new modelCDMFolder(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxT("CMakeLists.txt"), wxDIR_FILES); + if (cont) + { + std::string stdfileName = crea::wx2std(fileName); + this->CMakeLists = new modelCDMCMakeListsFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + + cont = dir.GetFirst(&fileName, wxT("*.h"), wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + modelCDMFile* file; + + if(stdfileName.substr(0,2) == "bb") + { + file = new modelCDMFile(this, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, path, stdfileName.substr(2,stdfileName.size()-4), level + 1); + blackBox->SetHeaderFile(file); + wxDir dir2(crea::std2wx(path)); + cont = dir2.GetFirst(&fileName, crea::std2wx(stdfileName.substr(0,stdfileName.size()-2) + ".cxx"), wxDIR_FILES); + if (cont) + { + file = new modelCDMFile(this, path + CDMUtilities::SLASH + crea::wx2std(fileName), crea::wx2std(fileName), this->level + 1); + this->children.push_back(file); + blackBox->SetSourceFile(file); + } + this->blackBoxes.push_back(blackBox); + } + cont = dir.GetNext(&fileName); + } + } + + this->SortChildren(); + std::sort(this->blackBoxes.begin(), this->blackBoxes.end(), CompareNodeItem); +} + +modelCDMPackageSrc::~modelCDMPackageSrc() +{ + for (int i = 0; i < (int)(this->blackBoxes.size()); i++) + { + if(this->blackBoxes[i] != NULL) + { + delete this->blackBoxes[i]; + this->blackBoxes[i] = NULL; + } + } + this->blackBoxes.clear(); +} + +const std::vector& modelCDMPackageSrc::GetBlackBoxes() const +{ + return this->blackBoxes; +} + +modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( + std::string*& result, + const std::string& name, + const std::string& package, + const std::string& type, + const std::string& format, + const std::string& categories, + const std::string& authors, + const std::string& authorsEmail, + const std::string& description) +{ + //parse name + std::vector words; + CDMUtilities::splitter::split(words, name, " \n\",/\\'", CDMUtilities::splitter::no_empties); + std::string bbName; + for (int i = 0; i < (int)(words.size()); i++) + { + bbName += words[i]; + } + + //parse categories + CDMUtilities::splitter::split(words, categories, " \n\",/\\'", CDMUtilities::splitter::no_empties); + std::string bbCategories; + if(words.size() > 0) + { + bbCategories = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + bbCategories += "," + words[i]; + } + } + if(bbCategories == "") + bbCategories = "empty"; + + //parse authors + CDMUtilities::splitter::split(words, authors, "\n\",/\\'", CDMUtilities::splitter::no_empties); + std::string bbAuthors; + if(words.size() > 0) + { + bbAuthors = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + bbAuthors += "," + words[i]; + } + } + if(bbAuthors == "") + bbAuthors = "Unknown"; + + //parse description + CDMUtilities::splitter::split(words, authorsEmail, " \n\"/\\'", CDMUtilities::splitter::no_empties); + std::string bbDescription; + if(words.size() > 0) + { + bbDescription = words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + bbDescription += "," + words[i]; + } + bbDescription += " - "; + } + CDMUtilities::splitter::split(words, description, "\n\"/\\'", CDMUtilities::splitter::no_empties); + if(words.size() > 0) + { + bbDescription += words[0]; + for (int i = 1; i < (int)(words.size()); i++) + { + bbDescription += words[i]; + } + } + + if(bbDescription == "") + bbDescription = "No Description."; + + + //create command + std::string command = "bbCreateBlackBox"; + command += " \"" + this->path + "\""; +#ifdef _WIN32 + command += " " + package; + command += " " + bbName; + command += " " + type; + command += " " + format; +#else + command += " \"" + package + "\""; + command += " \"" + bbName + "\""; + command += " \"" + type + "\""; + command += " \"" + format + "\""; +#endif + command += " \"" + bbAuthors + "\""; + command += " \"" + bbDescription + "\""; + command += " \"" + bbCategories + "\""; + + //excecute command + //wxMessageBox(crea::std2wx("Command: ->" + command + "<-"),_T("Creating Black Box"),wxOK | wxICON_INFORMATION); + if(system(command.c_str())) + { + result = new std::string("Error executing command '" + command + "'"); + return NULL; + } + + //if command succeed + + //create header + //create source + modelCDMFile* header = NULL; + modelCDMFile* source = NULL; + wxDir dir(crea::std2wx(path)); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, crea::std2wx("bb"+package+bbName+".h"), wxDIR_FILES); + if (cont) + { + std::string stdfileName = crea::wx2std(fileName); + header = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level+1); + } + cont = dir.GetFirst(&fileName, crea::std2wx("bb"+package+bbName+".cxx"), wxDIR_FILES); + if (cont) + { + std::string stdfileName = crea::wx2std(fileName); + source = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level+1); + } + } + //if source and header exist + if (header != NULL && source != NULL) + { + //create black box + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, this->path, package+bbName); + + //associate header and source + blackBox->SetHeaderFile(header); + blackBox->SetSourceFile(source); + + this->children.push_back(header); + this->children.push_back(source); + + this->blackBoxes.push_back(blackBox); + + //sort children + std::sort(this->blackBoxes.begin(), this->blackBoxes.end(), CompareNodeItem); + this->SortChildren(); + + return blackBox; + } + else + { + result = new std::string("The header and source files were not found. Black box not created."); + return NULL; + } +} + +const bool modelCDMPackageSrc::Refresh(std::string*& result) +{ + std::cout << "refreshing package src" << std::endl; + //set attributes + this->type = wxDIR_DIRS; + + //check children + std::vector checked(this->children.size(), false); + std::vector checkedBoxes(this->blackBoxes.size(), false); + + //check all boxes + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + std::string folderName = stdfileName; + //check if they already exist + bool found = false; + for (int i = 0; !found && i < (int)(this->children.size()); i++) + { + if (this->children[i]->GetName() == folderName) + { + found = true; + checked[i] = true; + if(!this->children[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMFolder* folder = new modelCDMFolder(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + //if is a Black Box header, check in black boxes + if(stdfileName.substr(stdfileName.size() - 2, 2) == ".h" && stdfileName.substr(0,2) == "bb") + { + bool found = false; + for (int i = 0; i < (int)(this->blackBoxes.size()); i++) + { + if(this->blackBoxes[i]->GetHeaderFile()->GetName() == stdfileName) + { + checkedBoxes[i] = true; + found = true; + if(!this->blackBoxes[i]->Refresh(result)) + return false; + break; + } + } + + if (!found) + { + modelCDMBlackBox* blackBox = new modelCDMBlackBox(this, path, stdfileName.substr(2,stdfileName.size()-4), level + 1); + this->blackBoxes.push_back(blackBox); + } + + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedBoxes.size()); i++) + { + if(!checkedBoxes[i]) + { + delete this->blackBoxes[i]; + this->blackBoxes.erase(this->blackBoxes.begin()+i); + checkedBoxes.erase(checkedBoxes.begin()+i); + i--; + } + } + + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + this->SortChildren(); + std::sort(this->blackBoxes.begin(), this->blackBoxes.end(), CompareNodeItem); + return true; +} diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.h b/lib/creaDevManagerLib/modelCDMPackageSrc.h new file mode 100644 index 0000000..8405044 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.h @@ -0,0 +1,113 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMPackageSrc.h + * + * Created on: Dic 19, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMPACKAGESRC_H_ +#define MODELCDMPACKAGESRC_H_ + +#include +#include + +#include "modelCDMFolder.h" +#include "modelCDMBlackBox.h" + +/** + * Class representing the source folder of a package from a Crea project. + */ +class modelCDMPackageSrc : public modelCDMFolder +{ +public: + /** + * Default constructor. + */ + modelCDMPackageSrc(); + /** + * Package source folder node constructor. + * @param parent Parent node of the package source folder. + * @param path Full path to the package source folder. + * @param name Name of the package source folder. + * @param level Project hierarchy level of the package source folder node. + */ + modelCDMPackageSrc(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "src", const int& level = 3); + /** + * Destructor. + */ + ~modelCDMPackageSrc(); + + /** + * Retrieves the black boxes inside the package source folder node. + * @return Array of black box references. + */ + const std::vector& GetBlackBoxes() const; + + /** + * Creates a new black box and returns a reference to it if the creation is successful. This operation affects the project model as well as the system files. + * @param result Result message + * @param name New black box name. + * @param package Black box package name. + * @param type Black box type. + * @param format Black box format. + * @param authors Black box authors' name. + * @param authorsEmail Black box authors' email. + * @param categories Categories associated to this black box. + * @param description Black box description. + * @return True if the operation was successful. + */ + modelCDMBlackBox* CreateBlackBox( + std::string*& result, + const std::string& name, + const std::string& package, + const std::string& type = "std", + const std::string& format = "C++", + const std::string& authors = "unknown", + const std::string& authorsEmail = "", + const std::string& categories = "empty", + const std::string& description = "no description" + ); + + /** + * Refreshes the structure of the package source folder node. This method updates the properties of the package source folder as well as it refreshes its children. + * @param result Result message + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); + +private: + /** + * Black box references of the package. + */ + std::vector blackBoxes; + +}; + +#endif /* MODELCDMPACKAGESRC_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index b7a0747..a021a10 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -34,91 +34,402 @@ #include "modelCDMProject.h" +#include +#include +#include +#include +#include +#include + +#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; + this->CMakeLists = NULL; } modelCDMProject::modelCDMProject( - const std::string& name, + modelCDMIProjectTreeNode* parent, const std::string& path, - const unsigned char& type, - const int& level + const std::string& name, + const std::string& buildPath ) { - //TODO: implement method + std::cout << "creating project: " + name + " in " + path + "\n"; + this->parent = parent; + this->path = CDMUtilities::fixPath(path); + //open makelists file + std::string pathFixed(CDMUtilities::fixPath(path)); + + std::string pathMakeLists = pathFixed + CDMUtilities::SLASH + "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 wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "PROJECT") + { + std::getline(confFile,word,')'); + std::vector nameBits; + CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); + + this->name = this->nameProject = ""; + for (int i = 0; i < (int)(nameBits.size()); i++) + { + if(i != 0) + this->name += " "; + this->name += nameBits[i]; + } + this->nameProject = this->name; + + } + + + if(wordBits[wordBits.size()-1] == "SET") + { + //get project version + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "PROJECT_MAJOR_VERSION") + { + version = wordBits[1]; + } + if(wordBits[0] == "PROJECT_MINOR_VERSION") + { + version += "." + wordBits[1]; + } + if(wordBits[0] == "PROJECT_BUILD_VERSION") + { + version += "." + wordBits[1]; + } + + //get project versionDate + if(wordBits[0] == "PROJECT_VERSION_DATE") + { + std::vector versionBits; + CDMUtilities::splitter::split(versionBits, wordBits[1], "\"", CDMUtilities::splitter::no_empties); + versionDate = versionBits[0]; + } + //get project buildPath + + if (buildPath != "") + { + this->buildPath = buildPath; + } + else + { + this->buildPath = this->path + "Bin"; + } + } + } + confFile.close(); + + this->type = wxDIR_DIRS; + this->level = 0; + + this->children.clear(); + this->appli = NULL; + this->lib = NULL; + this->packages.clear(); + + + //check all folders + wxDir dir(crea::std2wx((pathFixed).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if appli, create appli + if(stdfileName == "appli") + { + this->appli = new modelCDMAppli(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->appli); + } + //if lib, create lib + else if(stdfileName == "lib") + { + this->lib = new modelCDMLib(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->lib); + } + //if package , create package + else if(stdfileName.size() > 9 && stdfileName.substr(0,5) == "bbtk_" && stdfileName.substr(stdfileName.size()-4,4) == "_PKG") + { + modelCDMPackage* package = new modelCDMPackage(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->packages.push_back(package); + this->children.push_back(package); + } + //if is an unknown folder, create folder + else + { + this->children.push_back(new modelCDMFolder(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + //if is an unknown file, create file + cont = dir.GetNext(&fileName); + } + } + + this->SortChildren(); + std::sort(this->packages.begin(), this->packages.end(), CompareNodeItem); + +} + +modelCDMProject::~modelCDMProject() +{ } -const std::string& -modelCDMProject::GetName() const +const std::string& modelCDMProject::GetNameProject() const { - return this->name; + return this->nameProject; } -const std::string& -modelCDMProject::GetVersion() const +const std::string& modelCDMProject::GetVersion() const { return this->version; } -const std::string& -modelCDMProject::GetVersionDate() const +const std::string& modelCDMProject::GetVersionDate() const { return this->versionDate; } -const std::string& -modelCDMProject::GetBuildPath() const +const std::string& modelCDMProject::GetBuildPath() const { return this->buildPath; } +const std::vector& modelCDMProject::GetPackages() const +{ + return this->packages; +} + +modelCDMAppli* modelCDMProject::GetAppli() const +{ + return this->appli; +} + +modelCDMLib* modelCDMProject::GetLib() const +{ + return this->lib; +} + +std::string modelCDMProject::GetBuildInstruction() const +{ + std::string makeComm = "make -C \"" + this->buildPath + "\""; /*> \"" + this->buildPath + CDMUtilities::SLASH + "building.log\" 2>&1";*/ + return makeComm; +} + bool modelCDMProject::SetVersion(const std::string& version, std::string*& result) { - //TODO: implement method + + std::vector vers; + CDMUtilities::splitter::split(vers, version, " .", CDMUtilities::splitter::no_empties); + + time_t now = time(0); + + 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; + + //set name of library in CMakeLists inside copied folder + std::string line; + std::ifstream in((this->path + CDMUtilities::SLASH + "CMakeLists.txt").c_str()); + if( !in.is_open()) + { + result = new std::string("CMakeLists.txt file failed to open."); + return false; + } + std::ofstream out((this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp").c_str()); + if( !out.is_open()) + { + result = new std::string("CMakeLists.txt.tmp file failed to open."); + return false; + } + while (getline(in, line)) + { + if(line.find("SET(PROJECT_MAJOR_VERSION") != std::string::npos) + line = "SET(PROJECT_MAJOR_VERSION " + vers[0] + ")"; + else if(line.find("SET(PROJECT_MINOR_VERSION") != std::string::npos) + line = "SET(PROJECT_MINOR_VERSION " + vers[1] + ")"; + else if(line.find("SET(PROJECT_BUILD_VERSION") != std::string::npos) + line = "SET(PROJECT_BUILD_VERSION " + vers[2] + ")"; + else if(line.find("SET(PROJECT_VERSION_DATE") != std::string::npos) + line = "SET(PROJECT_VERSION_DATE \"" + date.str() + "\")"; + out << line << std::endl; + } + in.close(); + out.close(); + //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else + std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) + { + result = new std::string("An error occurred while running '" + renameCommand + "'."); + return false; + } + + this->version = vers[0] + "." + vers[1] + "." + vers[2]; + this->versionDate = date.str(); return true; } bool modelCDMProject::SetBuildPath(const std::string& path, std::string*& result) { - //TODO: implement method + if(path == "") + { + result = new std::string("The path cannot be empty"); + return false; + } + if(path == this->path) + { + result = new std::string("The path cannot be same as the project sources"); + return false; + } + this->buildPath = path; return true; } -bool modelCDMProject::CreatePackage( +modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( const std::string& name, std::string*& result, const std::string& authors, const std::string& authorsEmail, - const std::string& version, - const std::string& description + const std::string& description, + const std::string& version ) { - //TODO: implement method - return true; + //fixing input parameters + std::vector words; + + CDMUtilities::splitter::split(words,name," '/\"\\,.",CDMUtilities::splitter::no_empties); + std::string nameFixed = ""; + for (int i = 0; i < (int)(words.size()); i++) + { + nameFixed += words[i]; + } + + words.clear(); + CDMUtilities::splitter::split(words,authors," '/\"\\,.",CDMUtilities::splitter::no_empties); + std::string authorFixed; + for (int i = 0; i < (int)(words.size()); i++) + { + authorFixed += words[i]; + } + + words.clear(); + std::string descriptionFixed; + CDMUtilities::splitter::split(words,authorsEmail," '/\"\\,",CDMUtilities::splitter::no_empties); + 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 < (int)(words.size()); i++) + { + descriptionFixed += "_" + words[i]; + } + + //call project to create package : use bbCreatePackage [author] [description] + std::string creationCommand = "bbCreatePackage \"" + this->path + "\" \"" + nameFixed + "\" \"" + authorFixed + "\" \"" + descriptionFixed + "\""; + //TODO: bbCreatePackage script always returning 0. It should return 1 or greater if any error + bool resultCommand = 0 != system(creationCommand.c_str()); +#ifdef _WIN32 + resultCommand = false; +#endif + if(resultCommand) + { + result = new std::string("An error occurred while running '" + creationCommand + "'."); + return NULL; + } + + //add library to model + modelCDMPackage* package = new modelCDMPackage(this, this->path + CDMUtilities::SLASH + "bbtk_" + nameFixed + "_PKG", "bbtk_" + nameFixed + "_PKG", this->level + 1); + this->packages.push_back(package); + this->children.push_back(package); + + //TODO: set package version + + this->SortChildren(); + + result = new std::string(this->path + CDMUtilities::SLASH + name); + return package; } -bool modelCDMProject::CreateLibrary( +modelCDMIProjectTreeNode* modelCDMProject::CreateLibrary( const std::string& name, std::string*& result, const std::string& path ) { - //TODO: implement method - return true; + if(this->lib != NULL) + { + return this->lib->CreateLibrary(name, result); + } + result = new std::string("there is no lib folder in this project."); + return NULL; } -bool modelCDMProject::CreateApplication( +modelCDMIProjectTreeNode* modelCDMProject::CreateApplication( const std::string& name, + const int& type, std::string*& result, const std::string& path ) { - //TODO: implement method - return true; + if(this->appli != NULL) + { + return this->appli->CreateApplication(name, type, result); + } + result = new std::string("there is no appli folder in this project."); + return NULL; } -bool modelCDMProject::CreateBlackBox( +modelCDMIProjectTreeNode* modelCDMProject::CreateBlackBox( const std::string& name, const std::string& package, const std::string& authors, @@ -128,35 +439,544 @@ bool modelCDMProject::CreateBlackBox( ) { //TODO: implement method - return true; + return NULL; } bool modelCDMProject::OpenCMakeListsFile(std::string*& result) { - //TODO: implement method - return true; + if (!CDMUtilities::openTextEditor(this->CMakeLists->GetPath())) + return true; + else + { + result = new std::string("Couldn't open CMakeLists file."); + return false; + } } -bool modelCDMProject::Refresh(std::string*& result) +const bool modelCDMProject::Refresh(std::string*& result) { - //TODO: implement method + std::cout << "refreshing project" << std::endl; + //open makelists file + std::string pathMakeLists = this->path + CDMUtilities::SLASH + "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 wordBits; + CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties); + + if(wordBits[wordBits.size()-1] == "PROJECT") + { + std::getline(confFile,word,')'); + std::vector nameBits; + CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties); + + this->name = this->nameProject = ""; + for (int i = 0; i < (int)(nameBits.size()); i++) + { + if(i != 0) + this->name += " "; + this->name += nameBits[i]; + } + this->nameProject = this->name; + + } + + + if(wordBits[wordBits.size()-1] == "SET") + { + //get project version + std::getline(confFile,word,')'); + CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties); + if(wordBits[0] == "PROJECT_MAJOR_VERSION") + { + version = wordBits[1]; + } + if(wordBits[0] == "PROJECT_MINOR_VERSION") + { + version += "." + wordBits[1]; + } + if(wordBits[0] == "PROJECT_BUILD_VERSION") + { + version += "." + wordBits[1]; + } + + //get project versionDate + if(wordBits[0] == "PROJECT_VERSION_DATE") + { + std::vector versionBits; + CDMUtilities::splitter::split(versionBits, wordBits[1], "\"", CDMUtilities::splitter::no_empties); + versionDate = versionBits[0]; + } + } + } + confFile.close(); + + this->type = wxDIR_DIRS; + this->level = 0; + + std::vector checked(this->children.size(), false); + std::vector checkedPackages(this->packages.size(), false); + + //check all folders + wxDir dir(crea::std2wx((this->path).c_str())); + if (dir.IsOpened()) + { + wxString fileName; + bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if appli, create appli + if(stdfileName == "appli") + { + if (this->appli == NULL) + { + this->appli = new modelCDMAppli(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->appli); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->appli) - this->children.begin(); + checked[pos] = true; + if(!this->appli->Refresh(result)) + return false; + } + } + //if lib, create lib + else if(stdfileName == "lib") + { + if (this->lib == NULL) + { + this->lib = new modelCDMLib(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->lib); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->lib) - this->children.begin(); + checked[pos] = true; + if(!this->lib->Refresh(result)) + return false; + } + + } + //if package , create package + 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 < (int)(this->packages.size()); i++) + { + if (this->packages[i]->GetName() == stdfileName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->packages[i]) - this->children.begin(); + checked[pos] = true; + checkedPackages[i] = true; + if(!this->packages[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMPackage* package = new modelCDMPackage(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->packages.push_back(package); + this->children.push_back(package); + } + + } + //if is an unknown folder, create folder + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } + } + + cont = dir.GetNext(&fileName); + } + + cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_FILES); + while (cont) + { + std::string stdfileName = crea::wx2std(fileName); + + //if CMakeLists, create CMakeLists + if(stdfileName == "CMakeLists.txt") + { + if (this->CMakeLists == NULL) + { + this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(this->CMakeLists); + } + else + { + int pos = std::find(this->children.begin(), this->children.end(), this->CMakeLists) - this->children.begin(); + checked[pos] = true; + if(!this->CMakeLists->Refresh(result)) + return false; + } + } + //if is an unknown file, create file + else + { + bool found = false; + for (int i = 0; !found && i < (int)(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) + { + modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } + } + + cont = dir.GetNext(&fileName); + } + } + + for (int i = 0; i < (int)(checkedPackages.size()); i++) + { + if(!checkedPackages[i]) + { + this->packages.erase(this->packages.begin()+i); + checkedPackages.erase(checkedPackages.begin()+i); + i--; + } + } + for (int i = 0; i < (int)(checked.size()); i++) + { + if(!checked[i]) + { + delete this->children[i]; + this->children.erase(this->children.begin()+i); + checked.erase(checked.begin()+i); + i--; + } + } + + this->SortChildren(); + std::sort(this->packages.begin(), this->packages.end(), CompareNodeItem); return true; } bool modelCDMProject::ConfigureBuild(std::string*& result) { - //TODO: implement method + //TODO: adjust for windows and mac +#ifdef _WIN32 + // ------ Windows + if(0 == system("cmake-gui")) + return true; + else + { + result = new std::string("There was an error opening cmake-gui. Please make sure it's installed and that cmake's bin folder is in the system path."); + return false; + } +#elif __APPLE__ + // ------ Apple +#else + // ------ Linux + //open binary folder + wxDir dir(crea::std2wx((this->buildPath).c_str())); + + //if folder doesn't exist then create it + if (!dir.IsOpened()) + { + //create command line to create folder + std::string createComm = "mkdir \"" + this->buildPath + "\""; + //execute creation command + if (system(createComm.c_str())) + { + //if there was an error then report it + result = new std::string("There was an error creating the build path: \"" + this->buildPath + "\""); + return false; + } + } + //create command line to execute ccmake + //TODO:: adjust for different Linux distributions + std::string confComm = "gnome-terminal --tab --working-directory=\"" + this->buildPath + "\" -e \"ccmake '" + this->path + "'\""; + //execute command + if(CDMUtilities::openTerminal(confComm)) + { + //if there was an error then report it + result = new std::string("There was an error opening the configuration tool in the desired place."); + return false; + } +#endif return true; } -bool modelCDMProject::Build(std::string*& result) +bool modelCDMProject::Build(std::string*& result, const std::string& line) { - //TODO: implement method + //TODO: adjust for windows and mac +#ifdef _WIN32 + // ------ Windows + //\\..\\IDE\\VCExpress.exe \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" +// std::string command = "\"" + std::string(getenv("VS90COMNTOOLS")) + "..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &"; + std::string command = "\"\"%VS90COMNTOOLS%..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &\""; + command = "start cmd.exe /k " + command + " &"; + if(0 == system(command.c_str())) + return true; + else + { + result = new std::string("An error has happened running: \"" + command + "\". Please make sure to have visual c++ express installed and to have the VS90COMNTOOLS environment variable set."); + return false; + } +#elif __APPLE__ + // ------ Apple +#else + // ------ Linux + //open binary folder + wxDir dir(crea::std2wx((this->buildPath).c_str())); + + //if binary folder can't be opened then return false + if (!dir.IsOpened()) + { + result = new std::string("The build path could not be opened. Make sure to configure the project before compiling it"); + return false; + } + //create make command + std::string makeComm = "gnome-terminal -e \"bash -c \\\""; + for (int i = 0; i < line.size(); i++) + { + if(line[i] == '"') + { + makeComm+="\\\\\\\""; + } + else if(line[i] == '\\') + { + makeComm+="\\\\\\\\"; + } + else + { + makeComm.push_back(line[i]); + } + } + makeComm += "; echo -e '\\a'; bash"; + makeComm += "\\\"\""; + + std::cout << "executing '" << makeComm << "'" << std::endl; + //execute make command + if(system(makeComm.c_str())) + { + //if there was an error then report it + result = new std::string("There was an error compiling the project, please check the \"building.log\" file located in the build folder to read more about the problem."); + return false; + } +#endif return true; } -bool modelCDMProject::Connect(std::string*& result) +bool modelCDMProject::Connect(std::string*& result, const std::string& folder) { - //TODO: implement method + //TODO: adjust for mac +#ifdef _WIN32 + // ------ Windows + //open binary folder + wxDir dir(crea::std2wx(folder)); + + //if binary folder can't be opened then return false + if (!dir.IsOpened()) + { + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); + return false; + } + //create plug command + std::string plugComm = "bbPlugPackage \"" + folder + "\""; + std::cout << "executing '" << plugComm << "'" << std::endl; + //execute plug command + if(system(std::string("start cmd.exe /k \"" + plugComm + "\"").c_str())) + { + //if there was an error then report it + result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem."); + return false; + } +#elif __APPLE__ + // ------ Apple +#else + // ------ Linux + //open binary folder + wxDir dir(crea::std2wx(folder)); + + //if binary folder can't be opened then return false + if (!dir.IsOpened()) + { + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); + return false; + } + //create plug command + std::string plugComm = "bbPlugPackage \"" + this->buildPath + "\" > \"" + this->buildPath + CDMUtilities::SLASH + "plugging.log\" 2>&1"; + std::cout << "executing '" << plugComm << "'" << std::endl; + //execute plug command + if(system(plugComm.c_str())) + { + //if there was an error then report it + result = new std::string("There was an error plugging the packages of the project, please check the plugging.log in the build folder file to read more about the problem."); + return false; + } +#endif return true; } + +void modelCDMProject::CheckStructure(std::map& properties) +{ + //check cmake exist + if(this->CMakeLists != NULL) + { + //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 < (int)(this->packages.size()); i++) + properties["project add " + packages[i]->GetName()] = false; + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < (int)(words.size()); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //set instructions + if (words.size() > 0 && words[words.size()-1] == "SET") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + if (words.size() > 1) + { + if (words[0] == "USE_CREA" && words[1] == "ON") + { + properties["project set USE_CREA"] = true; + } + else if (words[0] == "USE_GDCM" && words[1] == "ON") + { + properties["project set USE_GDCM"] = true; + } + else if (words[0] == "USE_GDCM_VTK" && words[1] == "ON") + { + properties["project set USE_GDCM_VTK"] = true; + } + else if (words[0] == "USE_GDCM2" && words[1] == "ON") + { + properties["project set USE_GDCM2"] = true; + } + else if (words[0] == "USE_WXWIDGETS" && words[1] == "ON") + { + properties["project set USE_WXWIDGETS"] = true; + } + else if (words[0] == "USE_KWWIDGETS" && words[1] == "ON") + { + properties["project set USE_KWWIDGETS"] = true; + } + else if (words[0] == "USE_VTK" && words[1] == "ON") + { + properties["project set USE_VTK"] = true; + } + else if (words[0] == "USE_ITK" && words[1] == "ON") + { + properties["project set USE_ITK"] = true; + } + else if (words[0] == "USE_BOOST" && words[1] == "ON") + { + properties["project set USE_BOOST"] = true; + } + } + } + //add instructions + else if (words.size() > 0 && words[words.size()-1] == "ADD_SUBDIRECTORY") + { + std::getline(ss,word, ')'); + //std::cout << word << std::endl; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + if (words.size() > 0) + { + if(words[0] == "appli") + { + properties["project add "+words[0]] = this->appli != NULL; + } + else if(words[0] == "lib") + { + properties["project add "+words[0]] = this->lib != NULL; + } + else + { + properties["project add "+words[0]] = true; + } + } + } + } + + } + + //check appli's structure + this->appli->CheckStructure(properties); + //check lib's structure + this->lib->CheckStructure(properties); + //check packages' structure + 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/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index 604cea5..5df1550 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -37,46 +37,168 @@ #include #include +#include -#include "modelCDMIProjectTreeNode.h" +#include "modelCDMFolder.h" #include "modelCDMLib.h" #include "modelCDMAppli.h" #include "modelCDMPackage.h" +#include "modelCDMCMakeListsFile.h" -class modelCDMProject : public modelCDMIProjectTreeNode +/** + * Project model class. + * This class represents a project stored in a hard drive. It can perform some of the most relevant operations for a crea project. + */ +class modelCDMProject : public modelCDMFolder { public: + /** + * Default constructor. + */ modelCDMProject(); - modelCDMProject(const std::string& name, const std::string& path, const unsigned char& type, const int& level); - ~modelCDMProject(){} - const std::string& GetName() const; + /** + * Constructor receiving the source path and the build path. + * @param parent Parent node of the Project node. + * @param path The source path. + * @param name Name of the project folder. + * @param buildPath The build path. By default it's an empty string. + */ + modelCDMProject(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const std::string& buildPath = ""); + + /** + * Destructor. + */ + ~modelCDMProject(); + + + //Getters + /** + * Retrieves the name of the project. + * @return The name of the project. + */ + const std::string& GetNameProject() const; + + /** + * Retrieves the version of the project. + * @return The version of the project in the format X.Y.Z where X is the major version of the project, Y is the minor version of the project, and Z is the build version. + */ const std::string& GetVersion() const; + + /** + * Retrieves the last version modification date of the project + * @return The date of the last version modification in the format DD/MM/YYYY + */ const std::string& GetVersionDate() const; + + /** + * Retrieves the build path of the project. + * @return The build path of the project. By default .../ProjectNameBin. + */ const std::string& GetBuildPath() const; + /** + * Retrieves the package vector containing the packages present in the project. + * @return The package vector containing references to the packages of the project. + */ + const std::vector& GetPackages() const; + + /** + * Retrieves the appli containing the applications present in the project. + * @return The appli object present in the project. + */ + modelCDMAppli* GetAppli() const; + + /** + * Retrieves the lib containing the libraries present in the project. + * @return The lib object present in the project. + */ + modelCDMLib* GetLib() const; + + /** + * Retrieves the default make instruction to compile the project. + * @return The make instruction to compile. + */ + std::string GetBuildInstruction() const; + + + //Setters + /** + * Sets the version of the project. It also modifies the build date of the project. + * @param version New version of the project. + * @param result returns the result of the operation. + * @return If the version configuration was successful it returns true. If not, it returns false and the error description returns in the parameter result. + */ bool SetVersion(const std::string& version, std::string*& result); + + /** + * Sets the build path of the project. + * @param path Path for builing the project. + * @param result Result of the operation. + * @return If the build path configuration was successful it returns true. If not, it returns false and the error description returns in the parameter result. + */ bool SetBuildPath(const std::string& path, std::string*& result); - bool CreatePackage( + + //Creations + /** + * Creates a package and sets it as a children of the project. This method creates the package in the hard drive and also in the model. + * @param name Name of the package. + * @param result Result of the operation. + * @param authors Authors of the operation. If any space is found, it will be replaced by '_'. + * @param authorsEmail Authors' E-mails. This is appended to the package description. + * @param description Package description. + * @param version Package version in the format X.Y.Z where X is the major version, Y the minor version, and Z the build version. + * @return The result of the creation. If everything goes well it returns true, else it returns false. + */ + modelCDMIProjectTreeNode* CreatePackage( const std::string& name, std::string*& result, const std::string& authors = "info-dev", const std::string& authorsEmail = "info-dev@creatis.insa-lyon.fr", - const std::string& version = "1.0.0", - const std::string& description = "no description" + const std::string& description = "no description", + const std::string& version = "1.0.0" ); - bool CreateLibrary( + + /** + * Creates a library and sets it as a children of the lib folder in the project. This method creates the library in the hard drive and also in the model. + * @param name Library name. + * @param result Result of the operation. + * @param path Path of the library if not in the lib folder. This parameter is not used (for now). + * @return The result of the creation. If everything goes well it returns true, else it returns false. + */ + modelCDMIProjectTreeNode* CreateLibrary( const std::string& name, std::string*& result, const std::string& path = "/lib" ); - bool CreateApplication( + + /** + * Creates an application and sets it as a children of the appli folder in the project. This method creates the library in the hard drive and also in the model. + * @param name Application name. + * @param type Application type. 0=console application, 1=GUI application (wxWidgets). + * @param result Result of the operation. + * @param path Path of the application if not in the application folder. This parameter is not used (for now). + * @return The result of the creation. If everything goes well it returns true, else it returns false. + */ + modelCDMIProjectTreeNode* CreateApplication( const std::string& name, + const int& type, std::string*& result, const std::string& path = "/appli" ); - bool CreateBlackBox( + + /** + * Creates a black box and sets it as a children of the specified package folder in the project. This method creates the black box in the hard drive and also in the model. + * @param name Black box name. + * @param package The name of the package where the black box is created. The name should not contain neither the "bbtk_" , nor the "_PKG" parts of the folder name. If empty converts into "/bbtk_*projectName*_PKG" + * @param authors The authors of the black box. This string should not contain commas or spaces, they will be replaced by '_'. + * @param authorsEmail The authors e-mails. This string should not contain spaces, they will be replaced by '/'. This field is appended to the black box description. + * @param categories The categories of concerning for the created black box. + * @param description Description of the black box. It should not contain spaces, they will be replaced by '_'. + * @return The result of the creation. If everything goes well it returns true, else it returns false. + */ + modelCDMIProjectTreeNode* CreateBlackBox( const std::string& name, const std::string& package = "", //if empty converts into "/bbtk_*projectName*_PKG" const std::string& authors = "unknown", @@ -84,21 +206,83 @@ public: const std::string& categories = "empty", const std::string& description = "no description" ); + + + //Operations + /** + * Opens the CMakeLists.txt file in the system's default text editor. + * @param result Result of the operation. + * @return Success of the operation. If the file doesn't exist or can't be opened it returns false. + */ bool OpenCMakeListsFile(std::string*& result); - bool Refresh(std::string*& result); + + /** + * Refresh the model with the file hierarchy in the hard drive. + * @param result Result of the operation. + * @return if there's an error refreshing the project it returns false. + */ + virtual const bool Refresh(std::string*& result); + + /** + * Launches in console the ccmake tool in the build path to configure the building of the project. + * @param result The result message of the operation. + * @return if the ccmake tool doesn't launches it returns false. + */ bool ConfigureBuild(std::string*& result); - bool Build(std::string*& result); - bool Connect(std::string*& result); + + /** + * Launches in console the make -clean and make commands to build the project. + * @param result Result message for building the project. + * @param line Line to execute the compilation. + * @return if any of the commands cannot be executed it return false. + */ + bool Build(std::string*& result, const std::string& line); + + /** + * Launches in console the bbPlugPackage command to connect the project to the .bbtk folder in the hard drive. + * @param result Result message for connecting the project. + * @param folder Folder to make connection with. It must contain the bbtkPackage file + * @return if the command cannot be executed it return false. + */ + bool Connect(std::string*& result, const std::string& folder); + + /** + * Checks the CMakeLists files to see what's going to be compiled and what's not. + * @param properties Map containing the project compilation properties. + */ + void CheckStructure(std::map& properties); + private: - std::string name; + /** + * Project Name + */ + std::string nameProject; + /** + * Project Version + */ std::string version; + /** + * Last Project Version Modification Date + */ std::string versionDate; + /** + * Build Path for compiling the project + */ std::string buildPath; + /** + * lib folder + */ modelCDMLib* lib; + /** + * appli folder + */ modelCDMAppli* appli; + /** + * package folders + */ std::vector packages; }; diff --git a/lib/creaDevManagerLib/modelCDMProjectsTree.cpp b/lib/creaDevManagerLib/modelCDMProjectsTree.cpp index 4e17226..7e00d95 100755 --- a/lib/creaDevManagerLib/modelCDMProjectsTree.cpp +++ b/lib/creaDevManagerLib/modelCDMProjectsTree.cpp @@ -86,7 +86,7 @@ bool modelCDMProjectsTree::CompareNodeItem(modelCDMProjectsTreeNode x, modelCDMP if(xType != yType) { - if(xType == DT_DIR) + if(xType == wxDIR_DIRS) returnValue = true; else returnValue = false; @@ -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] + "/"; } @@ -121,7 +121,7 @@ void modelCDMProjectsTree::SetRoot(std::string path) if(!projectFound) { - this->projectRoot = modelCDMProjectsTreeNode(path,name,DT_DIR,0); + this->projectRoot = modelCDMProjectsTreeNode(path,name,wxDIR_DIRS ,0); }else{ std::cout << "already existing "; } diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp new file mode 100644 index 0000000..94f0d00 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp @@ -0,0 +1,369 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMAppliDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMAppliDescriptionPanel.h" + + + +#include "wxCDMMainFrame.h" + +#include "wxCDMAppliHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/ApIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMAppliDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMAppliDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_LINK_SELECT_APPLICATION, wxCDMAppliDescriptionPanel::OnLnkApplicationSelect) +EVT_BUTTON(ID_BUTTON_CREATE_APPLICATION, wxCDMAppliDescriptionPanel::OnBtnCreateApplication) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMAppliDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMAppliDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMAppliDescriptionPanel::wxCDMAppliDescriptionPanel( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMAppliDescriptionPanel::Create(parent, appli, id, caption, pos, size, style); +} + +wxCDMAppliDescriptionPanel::~wxCDMAppliDescriptionPanel() +{ +} + +bool wxCDMAppliDescriptionPanel::Create( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->appli = appli; + CreateControls(); + return TRUE; +} + +void wxCDMAppliDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->appli->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(ApIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Application Management")),0, wxALIGN_LEFT, 0); + + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Applications + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Applications")); + propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available applications to see its details or the modify them.")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + + std::vector applications = this->appli->GetApplications(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pApplicationlk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + 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, 1, wxEXPAND | wxALL, 5); + } + + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxEXPAND | wxALL, 5); + sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions")); + actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new application or make any change to the appli's CMakeLists.txt file by selecting the desired action.")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* createApplicationbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_APPLICATION, _T("A. Create Application")); + createApplicationbt->SetToolTip(wxT("Create a new application for this project.")); + actionsGridSizer->Add(createApplicationbt, 1, wxALL | wxEXPAND, 5); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the CMakeLists.txt file.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Applications Folder")); + openFolderbt->SetToolTip(wxT("Open the appli folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 0, wxALL | wxEXPAND, 5); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMAppliHelpDialog* helpDialog = new wxCDMAppliHelpDialog(this->GetParent(), this->appli, wxID_ANY); + helpDialog->Show(true); + } +} + +void wxCDMAppliDescriptionPanel::OnBtnCreateApplication(wxCommandEvent& event) +{ + //get name + wxTextEntryDialog* appDlg = new wxTextEntryDialog( + this, + wxT("Enter the new application name (NO white spaces)"), + wxT("New Application - creaDevManager"), + wxT(""), + wxOK | wxCANCEL + ); + + if (appDlg->ShowModal() == wxID_OK) + { + std::string applicationName = crea::wx2std(appDlg->GetValue()); + //check name + if(applicationName.size() > 0) + { + wxArrayString types; + types.Add(wxT("Console Application")); + types.Add(wxT("GUI Application (wxWidgets)")); + int applicationType = wxGetSingleChoiceIndex( + wxT("Select the application type"), + wxT("New Application - creaDevManager"), + types + ); + + if (applicationType != -1) + { + std::string* result; + //create library + modelCDMIProjectTreeNode* application = this->appli->CreateApplication(applicationName, applicationType ,result); + //check library created + if(application == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("New Application - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + wxMessageBox(crea::std2wx("Application successfully created."),_T("New Application - Success!"),wxOK | wxICON_INFORMATION); + + //refreshing tree and description + //send event instead of calling parent to avoid crashing + + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(application); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); + } + } + else + { + wxMessageBox(crea::std2wx("Invalid application name, please try again with a valid name."),_T("New Application - Error!"),wxOK | wxICON_INFORMATION); + } + } +} + +void wxCDMAppliDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->appli->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void wxCDMAppliDescriptionPanel::OnLnkApplicationSelect(wxHyperlinkEvent& event) +{ + modelCDMApplication* applicationFound = NULL; + std::vector applications = this->appli->GetApplications(); + for (int i = 0; i < (int)(applications.size()); i++) + { + if(applications[i]->GetName() == crea::wx2std(event.GetURL())) + { + applicationFound = applications[i]; + break; + } + } + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + newEvent1->SetClientData(applicationFound); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(applicationFound); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMAppliDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->appli->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMAppliDescriptionPanel::OnMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMApplication* theApp = NULL; + std::vector applications = this->appli->GetApplications(); + for (int i = 0; i < (int)(applications.size()); i++) + { + if(applications[i]->GetName() == AppName) + { + theApp = applications[i]; + break; + } + } + newEvent->SetClientData(theApp); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMAppliDescriptionPanel::OnMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMApplication* theApp = NULL; + std::vector applications = this->appli->GetApplications(); + for (int i = 0; i < (int)(applications.size()); i++) + { + if(applications[i]->GetName() == AppName) + { + theApp = applications[i]; + break; + } + } + newEvent->SetClientData(theApp); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMAppliDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMAppliDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h new file mode 100644 index 0000000..88c2cf9 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.h @@ -0,0 +1,151 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMAppliDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMAPPLIDESCRIPTIONPANEL_H_ +#define WXCDMAPPLIDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMAppli.h" + +/** + * Application manager description panel. Shows the available applications in the project and the actions corresponding to application management. + */ +class wxCDMAppliDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Application manager description panel Constructor. + * @param parent Parent window reference. + * @param appli Application manager class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMAppliDescriptionPanel( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + ~wxCDMAppliDescriptionPanel(); + + /** + * Application manager description panel Creator. + * @param parent Parent window reference. + * @param appli Application manager class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if the creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Application manager described. + */ + modelCDMAppli* appli; + + //handlers +protected: + /** + * Handles when the create application button is pressed. + */ + void OnBtnCreateApplication(wxCommandEvent& event); + /** + * Handles when the open package cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when an application link is pressed. + * @param event Has the link reference to know which application was selected. + */ + void OnLnkApplicationSelect(wxHyperlinkEvent& event); + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the open folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + + /** + * Handles when a application link is hovered. + * @param event Has the link reference to know which application was selected. + */ + void OnMouseEnter(wxMouseEvent& event); + /** + * Handles when a application link button finishes hover. + * @param event Has the link reference to know which application was selected. + */ + void OnMouseExit(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMAPPLIDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMAppliHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMAppliHelpDialog.cpp new file mode 100644 index 0000000..ec93c10 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMAppliHelpDialog.cpp @@ -0,0 +1,173 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMAppliHelpDialog.cpp + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMAppliHelpDialog.h" + +#include "creaDevManagerIds.h" + + +BEGIN_EVENT_TABLE(wxCDMAppliHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMAppliHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMAppliHelpDialog::OnEditCMake) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMAppliHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMAppliHelpDialog::wxCDMAppliHelpDialog( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMAppliHelpDialog::Create(parent, id, caption, position, size, style); + this->appli = appli; +} + +wxCDMAppliHelpDialog::~wxCDMAppliHelpDialog() +{ +} + +bool wxCDMAppliHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMAppliHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Managing your applications"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Applications are stand alone programs that use the projects' core functionality (libraries' functions). These " + "applications are useful when showing the projects' \"out of the box\" functionalities.\n" + "\n" + "In the application manager you can view a list of the available applications in the current project, as well as create " + "new applications. Remember that any application you make must be included in the appli's folder CMakeLists file. You can do that " + "by clicking on the \"Edit Appli's CMakeLists File\" button bellow or in the Application Manager the \"Edit CMakeLists file\" " + "button and include the desired applications at the end of the file.\n" + "For a better understanding of how to use the applications please check the \"myFierceAppli\" application (which is shipped by " + "default in every new project) and take a look at how it's included in the project."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakeAppliBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit Appli's CMakeLists File")); + editCMakeAppliBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakeAppliBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliHelpDialog::OnCMakeListsExit,NULL,this); + v_sizer1->Add(editCMakeAppliBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + +} + +void wxCDMAppliHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMAppliHelpDialog::OnEditCMake(wxCommandEvent& event) +{ + std::string* result; + if(!this->appli->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + + +void wxCDMAppliHelpDialog::OnCMakeListsEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMAppliHelpDialog::OnCMakeListsExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->appli->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->appli->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + +void wxCDMAppliHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMAppliHelpDialog.h b/lib/creaDevManagerLib/wxCDMAppliHelpDialog.h new file mode 100644 index 0000000..40d8d11 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMAppliHelpDialog.h @@ -0,0 +1,138 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMAppliHelpDialog.h + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMAPPLIHELPDIALOG_H_ +#define WXCDMAPPLIHELPDIALOG_H_ + +#include +#include + +#include "modelCDMAppli.h" + +/** + * Appli Panel Help Dialog + */ +class wxCDMAppliHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Appli Panel Help Dialog Constructor. + * @param parent Parent window. + * @param appli Appli class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Applications". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 600. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMAppliHelpDialog( + wxWindow* parent, + modelCDMAppli* appli, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Applications"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,600), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMAppliHelpDialog(); + /** + * Appli Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Applications". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 600. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Applications"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,600), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +//attributes +private: + /** + * Appli class reference. + */ + modelCDMAppli* appli; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnEditCMake(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnCMakeListsEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnCMakeListsExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMAPPLIHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp new file mode 100644 index 0000000..cddc1af --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp @@ -0,0 +1,409 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMApplicationDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMApplicationDescriptionPanel.h" + +#include "CDMUtilities.h" +#include "wxCDMMainFrame.h" + +#include "wxCDMApplicationHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/AIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMApplicationDescriptionPanel, wxPanel) +EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMApplicationDescriptionPanel::OnBtnSetExeName) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMApplicationDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMApplicationDescriptionPanel::OnBtnCreateClass) +EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnOpenFolder) +EVT_BUTTON(ID_BUTTON_OPEN_CXX, wxCDMApplicationDescriptionPanel::OnBtnOpenMain) +END_EVENT_TABLE() + +wxCDMApplicationDescriptionPanel::wxCDMApplicationDescriptionPanel( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMApplicationDescriptionPanel::Create(parent, application, id, caption, pos, size, style); +} + +wxCDMApplicationDescriptionPanel::~wxCDMApplicationDescriptionPanel() +{ +} + +bool wxCDMApplicationDescriptionPanel::Create( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->application = application; + CreateControls(); + return TRUE; +} + +void wxCDMApplicationDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->application->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(AIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Application")),0, wxALIGN_LEFT, 0); + //Application Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->application->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + /* //Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Executable Name")); + wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL); + this->executableNametc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->application->GetExecutableName())); + wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_NAME, wxT("Set")); + pMainFilebt->SetToolTip(wxT("Set the name of the executable file for the application.")); + pMainFilesz->Add(this->executableNametc, 0, wxALIGN_CENTER_VERTICAL, 0); + pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10); + + propertiesGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pMainFilesz, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer->Add(propertiesGridSizer, 0, wxEXPAND); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 0, wxEXPAND); + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + */ + //Actions + //actions StaticBoxSizer + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions")); + actionsBox->GetStaticBox()->SetToolTip(wxT("Create classes or edit them for this application, as well as editing the application's CMakeLists.txt file by selecting the desired action.")); + //actions Panel + wxPanel* actionsPanel = new wxPanel(this); + //actions Sizer + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(3, 2, 9, 15); + + 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.")); + wxButton* openMainbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("A. Open Main File")); + openMainbt->SetToolTip(wxT("Open the main file in the application folder with the default code editor.")); + openMainbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseEnter,NULL,this); + openMainbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseExit,NULL,this); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("C. Edit CMakeLists File")); + 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("B. Open Application Folder")); + openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer.")); + + + actionsGridSizer->Add(openMainbt, 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 + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxALL | wxEXPAND, 5); + sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMApplicationHelpDialog* helpDialog = new wxCDMApplicationHelpDialog(this->GetParent(), this->application, wxID_ANY); + helpDialog->Show(true); + } +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + +} + +void wxCDMApplicationDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event) +{ + //get name + wxString versionWx = wxGetTextFromUser( + wxT("Enter the new executable name"), + wxT("Change Application Executable Name - creaDevManager"), + crea::std2wx(this->application->GetExecutableName()) + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties); + if(parts.size() > 0) + { + std::string* result; + if(!this->application->SetExecutableName(crea::wx2std(versionWx), result)) + wxMessageBox(crea::std2wx(*result),_T("Change Application Executable Name - Error!"),wxOK | wxICON_ERROR); + } + else + { + wxMessageBox(crea::std2wx("No name specified"),_T("Set Application Executable Name - Error!"),wxOK | wxICON_ERROR); + } + this->executableNametc->SetLabel(crea::std2wx(this->application->GetExecutableName())); +} + +void wxCDMApplicationDescriptionPanel::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->application->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->SetClientData(this->application); + 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 wxCDMApplicationDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event) +{ + //get name + wxString folderName = wxGetTextFromUser( + wxT("Enter the name of the new folder:"), + wxT("Create Folder - creaDevManager") + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties); + if(parts.size() > 0) + { + std::string* result; + modelCDMFolder* folderC = this->application->CreateFolder(crea::wx2std(folderName), result); + if(folderC == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + return; + } + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(folderC); + wxPostEvent(this->GetParent(), *newEvent); + wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION); + } + else + { + wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->application->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + + event.Skip(); +} + +void wxCDMApplicationDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->application->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMApplicationDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMApplicationDescriptionPanel::OnBtnOpenMain(wxCommandEvent& event) +{ + if (this->application->GetMainFile() != NULL) + { + if (CDMUtilities::openTextEditor(this->application->GetMainFile()->GetPath())) + { + wxMessageBox(crea::std2wx("The main file couldn't be opened."),_T("Open Main File - Error!"),wxOK | wxICON_ERROR); + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + newEvent->SetClientData(this->application->GetMainFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + + event.Skip(); + } + else + { + wxMessageBox(crea::std2wx("There is no main file or it couldn't be detected."),_T("Open Main File - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMApplicationDescriptionPanel::OnMainMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->application->GetMainFile() != NULL) + { + newEvent->SetClientData(this->application->GetMainFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMApplicationDescriptionPanel::OnMainMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->application->GetMainFile() != NULL) + { + newEvent->SetClientData(this->application->GetMainFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h new file mode 100644 index 0000000..741eb44 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h @@ -0,0 +1,162 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMApplicationDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMAPPLICATIONDESCRIPTIONPANEL_H_ +#define WXCDMAPPLICATIONDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMApplication.h" + +/** + * Application description panel. Shows the properties and actions available for the described application. + */ +class wxCDMApplicationDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Application description panel Constructor. + * @param parent Parent window reference. + * @param application Application class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMApplicationDescriptionPanel( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMApplicationDescriptionPanel(); + + /** + * Application description panel Creator. + * @param parent Parent window reference. + * @param application Application class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + bool Create( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Application described. + */ + modelCDMApplication* application; + /** + * described application's executable name control. + */ + wxStaticText* executableNametc; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + + /** + * Handles when the set executable name button is pressed. + */ + void OnBtnSetExeName(wxCommandEvent& event); + /** + * Handles when the create class button is pressed. + */ + void OnBtnCreateClass(wxCommandEvent& event); + /** + * Handles when the create folder button is pressed. + */ + void OnBtnCreateFolder(wxCommandEvent& event); + /** + * Handles when the open package cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + /** + * Handles when the open Main file button is pressed. + */ + void OnBtnOpenMain(wxCommandEvent& event); + /** + * Handles when the open Main file button is hovered. + */ + void OnMainMouseEnter(wxMouseEvent& event); + /** + * Handles when the open Main file button finishes hover. + */ + void OnMainMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMAPPLICATIONDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.cpp new file mode 100644 index 0000000..d4aa18d --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.cpp @@ -0,0 +1,259 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMApplicationHelpDialog.cpp + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMApplicationHelpDialog.h" + +#include "creaDevManagerIds.h" + +#include "modelCDMAppli.h" + +BEGIN_EVENT_TABLE(wxCDMApplicationHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMApplicationHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMApplicationHelpDialog::OnCMakeLists) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationHelpDialog::OnCMakeLists) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMApplicationHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMApplicationHelpDialog::wxCDMApplicationHelpDialog( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMApplicationHelpDialog::Create(parent, id, caption, position, size, style); + this->application = application; +} + +wxCDMApplicationHelpDialog::~wxCDMApplicationHelpDialog() +{ +} + +bool wxCDMApplicationHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMApplicationHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with Applications"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Applications are stand alone programs that use the projects' core functionality (libraries' functions). These " + "applications are useful when showing the projects' \"out of the box\" functionalities.\n" + "Applications are stored in the project's appli folder and each application has its own dedicated folder. Inside " + "these folders each application has its main file.\n" + "\n" + "To start developing an application, go ahead and open the application main file with the button \"Open Main File\" " + "and implement the application's functionality.\n" + "If you need to create separate classes in the application folder, or inside an specific folders you can do it by " + "creating a new class with the \"Create Class\" button or by creating a folder with the \"Create Folder\" button.\n" + "Then, in order to include your applications in the project correctly you must include them in the appli's folder " + "\"CMakeLists.txt\" file. Also, if you create additional folders in your library you should include them in the application's " + "\"CMakeLists.txt\" file.\n" + "\n" + "You can easily edit the CMakeLists files previously mentioned by clicking on the following buttons."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakeApplicationBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Application's directory CMakeLists file")); + editCMakeApplicationBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakeApplicationBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsExit,NULL,this); + wxButton* editCMakeAppliBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Appli's directory CMakeLists file")); + editCMakeAppliBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakeAppliBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsExit,NULL,this); + + v_sizer1->Add(editCMakeApplicationBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + v_sizer1->Add(editCMakeAppliBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMApplicationHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMApplicationHelpDialog::OnCMakeLists(wxCommandEvent& event) +{ + std::string* result; + + if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE) + { + + if(!this->application->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->application; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + if(!((modelCDMAppli*)node)->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMAppli*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMAppli*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else + { + wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + } +} + +void wxCDMApplicationHelpDialog::OnCMakeListsEnter(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->application; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(((modelCDMAppli*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMAppli*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMApplicationHelpDialog::OnCMakeListsExit(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->application->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->application->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->application; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMAppli*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMAppli*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMApplicationHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.h b/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.h new file mode 100644 index 0000000..f9b4131 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMApplicationHelpDialog.h @@ -0,0 +1,139 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMApplicationHelpDialog.h + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMAPPLICATIONHELPDIALOG_H_ +#define WXCDMAPPLICATIONHELPDIALOG_H_ + +#include +#include + +#include "modelCDMApplication.h" + +#include + +/** + * Application Panel Help Dialog + */ +class wxCDMApplicationHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Application Panel Help Dialog Constructor. + * @param parent Parent window. + * @param application Application class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Applications". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 670. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMApplicationHelpDialog( + wxWindow* parent, + modelCDMApplication* application, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Applications"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,670), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMApplicationHelpDialog(); + /** + * Application Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Applications". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 670. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Applications"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,670), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +private: + /** + * Application class reference. + */ + modelCDMApplication* application; + + //handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnCMakeLists(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnCMakeListsEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnCMakeListsExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMAPPLICATIONHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp new file mode 100644 index 0000000..c511aff --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp @@ -0,0 +1,405 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBlackBoxDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMBlackBoxDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "wxCDMBlackBoxHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/BBIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMBlackBoxDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMBlackBoxDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMBlackBoxDescriptionPanel::OnBtnSetAuthor) +EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMBlackBoxDescriptionPanel::OnBtnSetDescription) +EVT_BUTTON(ID_BUTTON_SET_CATEGORY, wxCDMBlackBoxDescriptionPanel::OnBtnSetCategories) +EVT_BUTTON(ID_BUTTON_OPEN_CXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx) +EVT_BUTTON(ID_BUTTON_OPEN_HXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMBlackBoxDescriptionPanel::wxCDMBlackBoxDescriptionPanel( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMBlackBoxDescriptionPanel::Create(parent, blackBox, id, caption, pos, size, style); +} + +wxCDMBlackBoxDescriptionPanel::~wxCDMBlackBoxDescriptionPanel() +{ +} + +bool wxCDMBlackBoxDescriptionPanel::Create( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->blackBox = blackBox; + CreateControls(); + return TRUE; +} + +void wxCDMBlackBoxDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->blackBox->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(BBIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Black Box")),0, wxALIGN_LEFT, 0); + //Black Box Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->blackBox->GetNameBlackBox())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //BlackBox Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pAuthor = new wxStaticText(propertiesPanel, -1, wxT("Author")); + wxStaticText *pDescription = new wxStaticText(propertiesPanel, -1, wxT("Description")); + wxStaticText *pCategories = new wxStaticText(propertiesPanel, -1, wxT("Categories")); + + // author + wxBoxSizer* pAuthorsz = new wxBoxSizer(wxHORIZONTAL); + 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, 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, 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, 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->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pDescriptionsz, 1, wxEXPAND); + propertiesGridSizer->Add(pCategories, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pCategoriessz, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND | wxALL, 5); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxEXPAND, 5); + + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* openHxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_HXX, _T("A. Open .h")); + openHxxbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnHxxMouseEnter,NULL,this); + openHxxbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnHxxMouseExit,NULL,this); + openHxxbt->SetToolTip(wxT("Open the .h file in the default text editor.")); + actionsGridSizer->Add(openHxxbt, 1, wxALL | wxEXPAND, 5); + wxButton* openCxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("B. Open .cxx")); + openCxxbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnCxxMouseEnter,NULL,this); + openCxxbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnCxxMouseExit,NULL,this); + openCxxbt->SetToolTip(wxT("Open the .cxx file in the default text editor.")); + actionsGridSizer->Add(openCxxbt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Source Folder")); + openFolderbt->SetToolTip(wxT("Open the source folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMBlackBoxHelpDialog* helpDialog = new wxCDMBlackBoxHelpDialog(this->GetParent(), this->blackBox, wxID_ANY); + helpDialog->Show(true); + } +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event) +{ + //get author from user + wxTextEntryDialog* authDlg = new wxTextEntryDialog( + this, + wxT("Enter the new authors name. Separate each author with a '/'."), + wxT("Change Black Box Author - creaDevManager"), + crea::std2wx(this->blackBox->GetAuthors()), + wxOK | wxCANCEL + ); + + if (authDlg->ShowModal() == wxID_OK) + { + std::string authorsStr = crea::wx2std(authDlg->GetValue()); + //check name + if(authorsStr.size() > 0) + { + std::string* result; + if(!this->blackBox->SetAuthors(authorsStr, result)) + wxMessageBox(crea::std2wx(*result),_T("Change Black Box Author - Error!"),wxOK | wxICON_ERROR); + + } + + this->authortc->SetLabel(crea::std2wx(this->blackBox->GetAuthors())); + this->authortc->GetParent()->GetSizer()->RecalcSizes(); + } + +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnSetDescription(wxCommandEvent& event) +{ + //get author from user + wxTextEntryDialog* descDlg = new wxTextEntryDialog( + this, + wxT("Edit the black box description."), + wxT("Change Black Box Description - creaDevManager"), + crea::std2wx(this->blackBox->GetDescription()), + wxTE_MULTILINE | wxOK | wxCANCEL + ); + + if (descDlg->ShowModal() == wxID_OK) + { + std::string descriptionStr = crea::wx2std(descDlg->GetValue()); + //check name + if(descriptionStr.size() > 0) + { + std::string* result; + if(!this->blackBox->SetDescription(descriptionStr, result)) + wxMessageBox(crea::std2wx(*result),_T("Change Black Box Description - Error!"),wxOK | wxICON_ERROR); + } + this->descriptiontc->SetLabel(crea::std2wx(this->blackBox->GetDescription())); + this->descriptiontc->GetParent()->GetSizer()->RecalcSizes(); + } +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnSetCategories(wxCommandEvent& event) +{ + //get author from user + wxTextEntryDialog* catsDlg = new wxTextEntryDialog( + this, + wxT("Edit the black box categories separated by '/'."), + wxT("Change Black Box Categories - creaDevManager"), + crea::std2wx(this->blackBox->GetCategories()), + wxTE_MULTILINE | wxOK | wxCANCEL + ); + + if (catsDlg->ShowModal() == wxID_OK) + { + std::string categoriesStr = crea::wx2std(catsDlg->GetValue()); + //check name + if(categoriesStr.size() > 0) + { + std::string* result; + if(!this->blackBox->SetCategories(categoriesStr, result)) + wxMessageBox(crea::std2wx(*result),_T("Change Black Box Categories - Error!"),wxOK | wxICON_ERROR); + } + this->categoriestc->SetLabel(crea::std2wx(this->blackBox->GetCategories())); + this->categoriestc->GetParent()->GetSizer()->RecalcSizes(); + } +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx(wxCommandEvent& event) +{ + std::string* result; + if(!this->blackBox->OpenCxx(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Source File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->blackBox->GetSourceFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetSourceFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + + event.Skip(); +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx(wxCommandEvent& event) +{ + std::string* result; + if(!this->blackBox->OpenHxx(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Header File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->blackBox->GetHeaderFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetHeaderFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + + event.Skip(); +} + +void wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->blackBox->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMBlackBoxDescriptionPanel::OnCxxMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->blackBox->GetSourceFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetSourceFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMBlackBoxDescriptionPanel::OnCxxMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->blackBox->GetSourceFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetSourceFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMBlackBoxDescriptionPanel::OnHxxMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->blackBox->GetHeaderFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetHeaderFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMBlackBoxDescriptionPanel::OnHxxMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->blackBox->GetHeaderFile() != NULL) + { + newEvent->SetClientData(this->blackBox->GetHeaderFile()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h new file mode 100644 index 0000000..94d3071 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h @@ -0,0 +1,172 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBlackBoxDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMBLACKBOXDESCRIPTIONPANEL_H_ +#define WXCDMBLACKBOXDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMBlackBox.h" + +/** + * Black box description panel. Shows the properties and available actions for the described black box. + */ +class wxCDMBlackBoxDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Black box description panel Constructor. + * @param parent Parent window reference. + * @param blackBox Black box class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMBlackBoxDescriptionPanel( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMBlackBoxDescriptionPanel(); + + /** + * Black box description panel Creator. + * @param parent Parent window reference. + * @param blackBox Black box class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if the creatios was successful. + */ + bool Create( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Black box described. + */ + modelCDMBlackBox* blackBox; + /** + * Black box author control. + */ + wxStaticText* authortc; + /** + * Black box description control + */ + wxStaticText* descriptiontc; + /** + * Black box categories control. + */ + wxStaticText* categoriestc; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the set author button is pressed. + */ + void OnBtnSetAuthor(wxCommandEvent& event); + /** + * Handles when the set description button is pressed. + */ + void OnBtnSetDescription(wxCommandEvent& event); + /** + * Handles when the set categories button is pressed. + */ + void OnBtnSetCategories(wxCommandEvent& event); + /** + * Handles when the open Cxx button is pressed. + */ + void OnBtnOpenCxx(wxCommandEvent& event); + /** + * Handles when the open Hxx button is pressed. + */ + void OnBtnOpenHxx(wxCommandEvent& event); + /** + * Handles when the open Folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + + /** + * Handles when the open Cxx button is hovered. + */ + void OnCxxMouseEnter(wxMouseEvent& event); + /** + * Handles when the open Cxx button finishes hover. + */ + void OnCxxMouseExit(wxMouseEvent& event); + /** + * Handles when the open Hxx button is hovered. + */ + void OnHxxMouseEnter(wxMouseEvent& event); + /** + * Handles when the open Hxx button finishes hover. + */ + void OnHxxMouseExit(wxMouseEvent& event); + + +}; + +#endif /* WXCDMBLACKBOXDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.cpp new file mode 100644 index 0000000..d8f0c9e --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.cpp @@ -0,0 +1,289 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMBlackBoxHelpDialog.cpp + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMBlackBoxHelpDialog.h" + +#include "creaDevManagerIds.h" + +#include "modelCDMProject.h" +#include "modelCDMPackage.h" + +BEGIN_EVENT_TABLE(wxCDMBlackBoxHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMBlackBoxHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMBlackBoxHelpDialog::OnCMakeLists) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMBlackBoxHelpDialog::OnCMakeLists) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMBlackBoxHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMBlackBoxHelpDialog::wxCDMBlackBoxHelpDialog( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMBlackBoxHelpDialog::Create(parent, id, caption, position, size, style); + this->blackBox = blackBox; +} + +wxCDMBlackBoxHelpDialog::~wxCDMBlackBoxHelpDialog() +{ +} + +bool wxCDMBlackBoxHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMBlackBoxHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with BlackBoxes"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Black boxes are made to work in a modular fashion. They have programmer defined inputs and outputs. Their " + "purpose is to use the functions available in the libraries and expose them to be used as boxes in the crea " + "environment.\n" + "Black boxes are stored in the src folder of a package and they are composed of two files, the header(.h) " + "and the implementation(.cxx) files.\n" + "To start developing black boxes, go ahead and open the header file with the button \"Open .h\" and define " + "the inputs and outputs of the black box. Then, you will be able to use them in the implementation file, which " + "you can open using the \"Open .cxx\" button.\n" + "If you don't understand how this inputs and outputs are used, try looking at the sample black boxes available " + "in the sample package, which is shipped with every new project.\n" + "Also, don't forget to include the libraries your boxes use in the header and implementation files. They should " + "also be pointed and included in the package's directory CMakeLists.txt file and the project's directory " + "CMakeLists.txt file. Again, please take a look at the sample package and its boxes to see how to include libraries " + "in order to use them in the boxes.\n" + "\n" + "You can easily edit the CMakeLists files previously mentioned by clicking on the following buttons."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakePkgBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file")); + editCMakePkgBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakePkgBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this); + wxButton* editCMakePrjBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file")); + editCMakePrjBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakePrjBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this); + + v_sizer1->Add(editCMakePkgBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + v_sizer1->Add(editCMakePrjBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMBlackBoxHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMBlackBoxHelpDialog::OnCMakeLists(wxCommandEvent& event) +{ + std::string* result; + + if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + if(!((modelCDMPackage*)node)->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMPackage*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else + { + wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + if(!((modelCDMProject*)node)->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else + { + wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + } +} + +void wxCDMBlackBoxHelpDialog::OnCMakeListsEnter(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(((modelCDMPackage*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMBlackBoxHelpDialog::OnCMakeListsExit(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMPackage*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->blackBox; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMBlackBoxHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.h b/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.h new file mode 100644 index 0000000..66995d5 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.h @@ -0,0 +1,139 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMBlackBoxHelpDialog.h + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMBLACKBOXHELPDIALOG_H_ +#define WXCDMBLACKBOXHELPDIALOG_H_ + +#include +#include + +#include "modelCDMBlackBox.h" + +#include + +/** + * Black Box Panel Help Dialog + */ +class wxCDMBlackBoxHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Black Box Panel Help Dialog Constructor. + * @param parent Parent window. + * @param blackBox Black Box class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Black Boxes". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 700. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMBlackBoxHelpDialog( + wxWindow* parent, + modelCDMBlackBox* blackBox, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Black Boxes"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,700), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMBlackBoxHelpDialog(); + /** + * Black Box Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Black Boxes". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 700. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Black Boxes"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,700), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +private: + /** + * Black Box class reference. + */ + modelCDMBlackBox* blackBox; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnCMakeLists(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnCMakeListsEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnCMakeListsExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMBLACKBOXHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp new file mode 100644 index 0000000..9b61ae2 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp @@ -0,0 +1,172 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCMakeListsDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMCMakeListsDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/CMIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMCMakeListsDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMCMakeListsDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMCMakeListsDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMCMakeListsDescriptionPanel::wxCDMCMakeListsDescriptionPanel( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMCMakeListsDescriptionPanel::Create(parent, makefile, id, caption, pos, size, style); +} + +wxCDMCMakeListsDescriptionPanel::~wxCDMCMakeListsDescriptionPanel() +{ +} + +bool wxCDMCMakeListsDescriptionPanel::Create( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->cMakeLists = makefile; + CreateControls(); + return TRUE; +} + +void wxCDMCMakeListsDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->cMakeLists->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CMIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("CMake Configuration File")),0, wxALIGN_LEFT, 0); + //File Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx("CMakeLists.txt")),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(1, 2, 9, 15); + + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Open File")); + editCMakebt->SetToolTip(wxT("Open the CMakeLists file in the default text editor.")); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Containing Folder")); + openFolderbt->SetToolTip(wxT("Open the folder where the CMakeLists file is located in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) +{ + std::string* result; + if(!this->cMakeLists->OpenFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMCMakeListsDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->cMakeLists->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} diff --git a/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h new file mode 100644 index 0000000..ac6f73f --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.h @@ -0,0 +1,125 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMCMakeListsDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ +#define WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMCMakeListsFile.h" + +/** + * CMakeLists File description panel. Shows the file properties and the available actions for it. + */ +class wxCDMCMakeListsDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * CMakeLists File description panel Constructor. + * @param parent Parent window reference. + * @param makefile CMakeLists class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMCMakeListsDescriptionPanel( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMCMakeListsDescriptionPanel(); + + /** + * CMakeLists File description panel Constructor. + * @param parent Parent window reference. + * @param makefile CMakeLists class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if the creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMCMakeListsFile* makefile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * CMakeLists file described. + */ + modelCDMCMakeListsFile* cMakeLists; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the open file in text editor button is pressed. + */ + void OnBtnOpenInEditor(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); +}; + +#endif /* WXCDMCMAKELISTSDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp new file mode 100644 index 0000000..2c54eae --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp @@ -0,0 +1,216 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBlackBoxDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMFileDescriptionPanel.h" + +#include + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/FlIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMFileDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMFileDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFileDescriptionPanel::OnBtnOpenFolder) +EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMFileDescriptionPanel::OnBtnOpenWithCommand) +END_EVENT_TABLE() + +wxCDMFileDescriptionPanel::wxCDMFileDescriptionPanel( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMFileDescriptionPanel::Create(parent, file, id, caption, pos, size, style); +} + +wxCDMFileDescriptionPanel::~wxCDMFileDescriptionPanel() +{ +} + +bool wxCDMFileDescriptionPanel::Create( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->file = file; + CreateControls(); + return TRUE; +} + +void wxCDMFileDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->file->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FlIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("File")),0, wxALIGN_LEFT, 0); + //File Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->file->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //File Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pLocation = new wxStaticText(propertiesPanel, -1, wxT("Location")); + wxStaticText *pLength = new wxStaticText(propertiesPanel, -1, wxT("File Size")); + + wxStaticText* pLocationtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->file->GetPath())); + pLocationtc->SetMaxSize(wxSize(350,-1)); + int lgth = this->file->GetLength(); + std::stringstream ss; + ss << lgth / 1024; + std::string lgths = ss.str() + " KB"; + wxStaticText* pLengthtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(lgths)); + + propertiesGridSizer->Add(pLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pLocationtc, 1, wxEXPAND); + propertiesGridSizer->Add(pLength, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pLengthtc, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxALL|wxEXPAND, 5); + + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(1, 2, 9, 15); + + wxButton* openCommandbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_COMMAND, _T("Open with Command")); + openCommandbt->SetToolTip(wxT("Open this file executing a command in a terminal/command line.")); + actionsGridSizer->Add(openCommandbt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Containing Folder")); + openFolderbt->SetToolTip(wxT("Open the folder where this file is located in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->file->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMFileDescriptionPanel::OnBtnOpenWithCommand(wxCommandEvent& event) +{ + //get command + wxString commandEx = wxGetTextFromUser( + _T("Enter the command to execute file"), + _T("Execute File - creaDevManager"), + _T("") + ); + //check name + if(commandEx.Len() > 0) + { + std::string* result; + if(!this->file->OpenFile(result, crea::wx2std(commandEx))) + wxMessageBox(crea::std2wx(*result),_T("Execute File - Error!"),wxOK | wxICON_ERROR); + } +} diff --git a/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h new file mode 100644 index 0000000..09cc104 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h @@ -0,0 +1,127 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFileDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMFILEDESCRIPTIONPANEL_H_ +#define WXCDMFILEDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMFile.h" + +/** + * File description panel. Shows the File properties and the available options for it. + */ +class wxCDMFileDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * File description panel Constructor. + * @param parent Parent window reference. + * @param file File class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMFileDescriptionPanel( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMFileDescriptionPanel(); + + /** + * File description panel Constructor. + * @param parent Parent window reference. + * @param file File class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMFile* file, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + + +private: + /** + * File described. + */ + modelCDMFile* file; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the Open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + /** + * Handles when the Open with command button is pressed. + */ + void OnBtnOpenWithCommand(wxCommandEvent& event); + +}; + +#endif /* WXCDMBLACKBOXDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp new file mode 100644 index 0000000..69a5146 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp @@ -0,0 +1,291 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFolderDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMFolderDescriptionPanel.h" + +#include "wxCDMMainFrame.h" +#include "CDMUtilities.h" + +#include "creaDevManagerIds.h" +#include "images/FdIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel) +EVT_HYPERLINK(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() + +wxCDMFolderDescriptionPanel::wxCDMFolderDescriptionPanel( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMFolderDescriptionPanel::Create(parent, folder, id, caption, pos, size, style); +} + +wxCDMFolderDescriptionPanel::~wxCDMFolderDescriptionPanel() +{ +} + +bool wxCDMFolderDescriptionPanel::Create( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->folder = folder; + CreateControls(); + return TRUE; +} + +void wxCDMFolderDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->folder->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FdIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Folder")),0, wxALIGN_LEFT, 0); + //Folder Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->folder->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer")); + openFolderbt->SetToolTip(wxT("Open this folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + if(this->folder->HasCMakeLists()) + { + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Open the CMakeLists.txt file in this folder with the default text editor.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMFolderDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMFolderDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + } + + wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("Create Class")); + createClassbt->SetToolTip(wxT("Create a new class (.h and .cpp) inside this folder.")); + actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5); + + wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder")); + createFolderbt->SetToolTip(wxT("Create a new folder inside this folder.")); + actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event) +{ + std::string* result; + if(!this->folder->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->folder->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->folder->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->folder->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +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->SetClientData(folder); + 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 + wxString folderName = wxGetTextFromUser( + wxT("Enter the name of the new folder:"), + wxT("Create Folder - creaDevManager") + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties); + if(parts.size() > 0) + { + std::string* result; + modelCDMFolder* folderC = this->folder->CreateFolder(crea::wx2std(folderName), result); + if(folderC == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + return; + } + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(folderC); + wxPostEvent(this->GetParent(), *newEvent); + wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION); + } + else + { + wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMFolderDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->folder->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->folder->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMFolderDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->folder->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->folder->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h new file mode 100644 index 0000000..fafe66e --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h @@ -0,0 +1,143 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMFolderDescriptionPanel.h + * + * Created on: Dic 3, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMFOLDERDESCRIPTIONPANEL_H_ +#define WXCDMFOLDERDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMFolder.h" + +/** + * Folder description panel. Shows the properties of the referenced folder and the available actions. + */ +class wxCDMFolderDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Folder description panel Constructor. + * @param parent Parent window reference. + * @param folder Folder class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMFolderDescriptionPanel( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMFolderDescriptionPanel(); + + /** + * Folder description panel Creator. + * @param parent Parent window reference. + * @param folder Folder class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation is successful. + */ + bool Create( + wxWindow* parent, + modelCDMFolder* folder, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Folder described. + */ + modelCDMFolder* folder; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the open package cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when the create class button is pressed. + */ + void OnBtnCreateClass(wxCommandEvent& event); + /** + * Handles when the create folder button is pressed. + */ + void OnBtnCreateFolder(wxCommandEvent& event); + /** + * Handles when the open in explorer button is pressed. + */ + void OnBtnOpenInExplorer(wxCommandEvent& event); + + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp new file mode 100644 index 0000000..abc0a8e --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -0,0 +1,345 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMLibDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMLibDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "wxCDMLibHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/LbIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMLibDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMLibDescriptionPanel::OnBtnReturn) +EVT_HYPERLINK(ID_LINK_SELECT_LIBRARY, wxCDMLibDescriptionPanel::OnLnkLibrarySelect) +EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMLibDescriptionPanel::OnBtnCreateLibrary) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMLibDescriptionPanel::wxCDMLibDescriptionPanel( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMLibDescriptionPanel::Create(parent, lib, id, caption, pos, size, style); +} + +wxCDMLibDescriptionPanel::~wxCDMLibDescriptionPanel() +{ +} + +bool wxCDMLibDescriptionPanel::Create( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->lib = lib; + CreateControls(); + return TRUE; +} + +void wxCDMLibDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->lib->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LbIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Library Management")),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Libraries + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Libraries")); + propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available libraries to see its details or modify them.")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + + std::vector libraries = this->lib->GetLibraries(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pLibrarylk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + 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, wxEXPAND | wxALL, 5); + } + + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5); + sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions")); + actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new library or make any change to the lib's CMakeLists.txt file by selecting the desired action.")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("A. Create Library")); + createLibrarybt->SetToolTip(wxT("Create a new library for this project.")); + actionsGridSizer->Add(createLibrarybt, 1, wxALL | wxEXPAND, 5); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the Lib's CMakeLists.txt file.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Libraries Folder")); + openFolderbt->SetToolTip(wxT("Open the lib folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 0, wxALL, 5); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMLibHelpDialog* helpDialog = new wxCDMLibHelpDialog(this->GetParent(), this->lib, wxID_ANY); + helpDialog->Show(true); + } +} + +void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) +{ + //get name + wxString libraryName = wxGetTextFromUser( + _T("Enter the new library name"), + _T("New Library - creaDevManager"), + _T("") + ); + //check name + if(libraryName.Len() > 0) + { + std::string* result; + //create library + modelCDMIProjectTreeNode* library = this->lib->CreateLibrary(crea::wx2std(libraryName),result); + //check library created + if(library == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("New Library - Error!"),wxOK | wxICON_ERROR); + return; + } + wxMessageBox(crea::std2wx("Library successfully created."),_T("New Library - Success!"),wxOK | wxICON_INFORMATION); + + //refreshing tree and description + //send event instead of calling parent to avoid crashing + + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(library); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->lib->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) +{ + modelCDMLibrary* theLibrary = NULL; + std::vector libraries = this->lib->GetLibraries(); + for (int i = 0; i < (int)(libraries.size()); i++) + { + if(libraries[i]->GetName() == crea::wx2std(event.GetURL())) + { + theLibrary = libraries[i]; + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(theLibrary); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + newEvent1->SetClientData(theLibrary); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->lib->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMLibrary* theLibrary = NULL; + std::vector libraries = this->lib->GetLibraries(); + for (int i = 0; i < (int)(libraries.size()); i++) + { + if(libraries[i]->GetName() == LibName) + { + theLibrary = libraries[i]; + break; + } + } + newEvent->SetClientData(theLibrary); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMLibDescriptionPanel::OnMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMLibrary* theLibrary = NULL; + std::vector libraries = this->lib->GetLibraries(); + for (int i = 0; i < (int)(libraries.size()); i++) + { + if(libraries[i]->GetName() == LibName) + { + theLibrary = libraries[i]; + break; + } + } + newEvent->SetClientData(theLibrary); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMLibDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMLibDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h new file mode 100644 index 0000000..2483c9a --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h @@ -0,0 +1,154 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMLibDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMLIBDESCRIPTIONPANEL_H_ +#define WXCDMLIBDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMLib.h" + +/** + * Library manager description panel. Shows the available libraries in the project and the actions corresponding to library management. + */ +class wxCDMLibDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Library manager description panel Constructor. + * @param parent Parent window reference. + * @param lib Lib class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMLibDescriptionPanel( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMLibDescriptionPanel(); + + /** + * Library manager description panel Creator. + * @param parent Parent window reference. + * @param lib Lib class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Library manager described. + */ + modelCDMLib* lib; + + //handlers +protected: + /** + * Handles when the create library button is pressed. + */ + void OnBtnCreateLibrary(wxCommandEvent& event); + /** + * Handles when the open package cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when a library link is pressed. + * @param event Has the link reference to know which library was selected. + */ + void OnLnkLibrarySelect(wxHyperlinkEvent& event); + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + + /** + * Handles when a library link is hovered. + * @param event Has the link reference to know which library was selected. + */ + void OnMouseEnter(wxMouseEvent& event); + /** + * Handles when a library link button finishes hover. + * @param event Has the link reference to know which library was selected. + */ + void OnMouseExit(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMLibHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMLibHelpDialog.cpp new file mode 100644 index 0000000..351406a --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibHelpDialog.cpp @@ -0,0 +1,172 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMLibHelpDialog.cpp + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMLibHelpDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMLibHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMLibHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibHelpDialog::OnEditCMake) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMLibHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMLibHelpDialog::wxCDMLibHelpDialog( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMLibHelpDialog::Create(parent, id, caption, position, size, style); + this->lib = lib; +} + +wxCDMLibHelpDialog::~wxCDMLibHelpDialog() +{ +} + +bool wxCDMLibHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMLibHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Managing your libraries"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Libraries contain the core classes of your project, these libraries should be used by black boxes and applications " + "from this project to perform the main functions of the project. Functions implementing important tasks such as image " + "processing algorithms or point cloud processing algorithms should be developed in the libraries of the project, while " + "the black boxes and applications serve as interfaces between the user or other platforms and the libraries functions.\n" + "\n" + "In the library manager you can view a list of the available libraries in the current project, as well as create " + "new libraries. Remember that any library you make must be included in the lib's folder CMakeLists file. You can do that " + "by clicking on the \"Edit Lib's CMakeLists File\" button bellow or in the Library Manager the \"Edit CMakeLists file\" " + "button and include the desired libraries at the end of the file."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakeLibBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit Lib's CMakeLists File")); + editCMakeLibBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibHelpDialog::OnEditCMakeMouseEnter,NULL,this); + editCMakeLibBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibHelpDialog::OnEditCMakeMouseExit,NULL,this); + v_sizer1->Add(editCMakeLibBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + +} + +void wxCDMLibHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMLibHelpDialog::OnEditCMake(wxCommandEvent& event) +{ + std::string* result; + if(!this->lib->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + + +void wxCDMLibHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMLibHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->lib->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->lib->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + +void wxCDMLibHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMLibHelpDialog.h b/lib/creaDevManagerLib/wxCDMLibHelpDialog.h new file mode 100644 index 0000000..9d7049a --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibHelpDialog.h @@ -0,0 +1,138 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMLibHelpDialog.h + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMLIBHELPDIALOG_H_ +#define WXCDMLIBHELPDIALOG_H_ + +#include +#include + +#include "modelCDMLib.h" + +/** + * Lib Panel Help Dialog + */ +class wxCDMLibHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Lib Panel Help Dialog Constructor. + * @param parent Parent window. + * @param lib Library class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Libraries". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 600. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMLibHelpDialog( + wxWindow* parent, + modelCDMLib* lib, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Libraries"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,600), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMLibHelpDialog(); + /** + * Lib Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Libraries". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 600. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Libraries"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,600), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + + //attributes +private: + /** + * Lib class reference. + */ + modelCDMLib* lib; + + //handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnEditCMake(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnEditCMakeMouseEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnEditCMakeMouseExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMLIBHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp new file mode 100644 index 0000000..a892ad8 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp @@ -0,0 +1,347 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMLibraryDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMLibraryDescriptionPanel.h" + +#include "CDMUtilities.h" +#include "wxCDMMainFrame.h" + +#include "wxCDMLibraryHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/LIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMLibraryDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMLibraryDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMLibraryDescriptionPanel::OnBtnSetExeName) +EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMLibraryDescriptionPanel::OnBtnCreateClass) +EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnCreateFolder) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMLibraryDescriptionPanel::wxCDMLibraryDescriptionPanel( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMLibraryDescriptionPanel::Create(parent, library, id, caption, pos, size, style); +} + +wxCDMLibraryDescriptionPanel::~wxCDMLibraryDescriptionPanel() +{ +} + +bool wxCDMLibraryDescriptionPanel::Create( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->library = library; + CreateControls(); + return TRUE; +} + +void wxCDMLibraryDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->library->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Library")),0, wxALIGN_LEFT, 0); + //Library Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->library->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + /*//Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Library Name")); + wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL); + this->libraryNametc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->library->GetNameLibrary())); + wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_NAME, wxT("Set")); + pMainFilebt->SetToolTip(wxT("Set the name of the library for the project.")); + pMainFilesz->Add(this->libraryNametc, 0, wxALIGN_CENTER_VERTICAL, 0); + pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10); + + propertiesGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pMainFilesz, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer->Add(propertiesGridSizer, 0, wxEXPAND); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 0, wxEXPAND); + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + */ + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("A. Create Class")); + createClassbt->SetToolTip(wxT("Create a new class for this library.")); + actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("B. Open Library Folder")); + openFolderbt->SetToolTip(wxT("Open the library folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("C. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt of this library in the default text editor.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder (Optional)")); + createFolderbt->SetToolTip(wxT("Create a new folder for this library.")); + actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxALL | wxEXPAND, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMLibraryHelpDialog* helpDialog = new wxCDMLibraryHelpDialog(this->GetParent(), this->library, wxID_ANY); + helpDialog->Show(true); + } +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMLibraryDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event) +{ + //get name + wxString versionWx = wxGetTextFromUser( + wxT("Enter the new executable name"), + wxT("Change Library Name - creaDevManager"), + crea::std2wx(this->library->GetNameLibrary()) + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties); + if(parts.size() > 0) + { + std::string* result; + if(!this->library->SetNameLibrary(crea::wx2std(versionWx), result)) + wxMessageBox(crea::std2wx(*result),_T("Change Library Name - Error!"),wxOK | wxICON_ERROR); + } + else + { + wxMessageBox(crea::std2wx("No name specified"),_T("Set Library Name - Error!"),wxOK | wxICON_ERROR); + } + this->libraryNametc->SetLabel(crea::std2wx(this->library->GetNameLibrary())); +} + +void wxCDMLibraryDescriptionPanel::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->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->SetClientData(this->library); + 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) +{ + //get name + wxString folderName = wxGetTextFromUser( + wxT("Enter the name of the new folder:"), + wxT("Create Folder - creaDevManager") + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties); + if(parts.size() > 0) + { + std::string* result; + modelCDMFolder* folderC = this->library->CreateFolder(crea::wx2std(folderName), result); + if(folderC == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + return; + } + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(folderC); + wxPostEvent(this->GetParent(), *newEvent); + wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION); + } + else + { + wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->library->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + + event.Skip(); +} + +void wxCDMLibraryDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->library->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMLibraryDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h new file mode 100644 index 0000000..724e485 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h @@ -0,0 +1,158 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMLibraryDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMLIBRARYDESCRIPTIONPANEL_H_ +#define WXCDMLIBRARYDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMLibrary.h" + +/** + * Library description panel. Shows the available actions on the described library. + */ +class wxCDMLibraryDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + + /** + * Library description panel Constructor. + * @param parent Parent window reference. + * @param library Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMLibraryDescriptionPanel( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMLibraryDescriptionPanel(); + + /** + * Library description panel Creator. + * @param parent Parent window reference. + * @param library Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Library described. + */ + modelCDMLibrary* library; + /** + * Control with the described library name. + */ + wxStaticText* libraryNametc; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when the set executable name button is pressed. + * @param event Unused. + */ + void OnBtnSetExeName(wxCommandEvent& event); + /** + * Handles when the create class button is pressed. + * @param event Unused. + */ + void OnBtnCreateClass(wxCommandEvent& event); + /** + * Handles when the create folder buttonis pressed. + * @param event Unused. + */ + void OnBtnCreateFolder(wxCommandEvent& event); + /** + * Handles when Edit Cmakelists button is pressed. + * @param event Unused. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + * @param event Unused. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + /** + * Handles when the edit cmakelists button is hovered. + * @param event Unused. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the edit cmakelists button exits hover. + * @param event Unused. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMLIBRARYDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.cpp new file mode 100644 index 0000000..13a7038 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.cpp @@ -0,0 +1,259 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMLibraryHelpDialog.cpp + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMLibraryHelpDialog.h" + +#include "creaDevManagerIds.h" + +#include "modelCDMLib.h" + +BEGIN_EVENT_TABLE(wxCDMLibraryHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMLibraryHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMLibraryHelpDialog::OnCMakeLists) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibraryHelpDialog::OnCMakeLists) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMLibraryHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMLibraryHelpDialog::wxCDMLibraryHelpDialog( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMLibraryHelpDialog::Create(parent, id, caption, position, size, style); + this->library = library; +} + +wxCDMLibraryHelpDialog::~wxCDMLibraryHelpDialog() +{ +} + +bool wxCDMLibraryHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMLibraryHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with Libraries"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Libraries are made to expose the projects' main functionalities to the applications and black boxes of the project. " + "The functions and classes available in the libraries are the core of any project, thus they should implement important " + "tasks such as image processing algorithms or point cloud processing algorithms." + "Libraries are stored in the project's lib folder and each library has its own dedicated folder. Inside these folders " + "each library has its classes.\n" + "\n" + "To start developing a library, go ahead and create a new class with the button \"Create Class\" and implement the main " + "functionalities of your project inside the created files.\n" + "If you need to separate classes in folders you can do it by creating a folder with the \"Create Folder\" button.\n" + "Then, in order to include your libraries in the project correctly you must include them in the lib's folder " + "\"CMakeLists.txt\" file. Also, if you create additional folders in your library you should include them in the library's " + "\"CMakeLists.txt\" file.\n" + "\n" + "You can easily edit the CMakeLists files previously mentioned by clicking on the following buttons."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakeLibraryBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Library's directory CMakeLists file")); + editCMakeLibraryBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakeLibraryBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsExit,NULL,this); + wxButton* editCMakeLibBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Lib's directory CMakeLists file")); + editCMakeLibBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakeLibBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsExit,NULL,this); + + v_sizer1->Add(editCMakeLibraryBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + v_sizer1->Add(editCMakeLibBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMLibraryHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMLibraryHelpDialog::OnCMakeLists(wxCommandEvent& event) +{ + std::string* result; + + if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE) + { + + if(!this->library->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->library; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + if(!((modelCDMLib*)node)->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMLib*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMLib*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else + { + wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + } +} + +void wxCDMLibraryHelpDialog::OnCMakeListsEnter(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->library; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(((modelCDMLib*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMLib*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMLibraryHelpDialog::OnCMakeListsExit(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->library->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->library->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->library; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMLib*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMLib*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMLibraryHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.h b/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.h new file mode 100644 index 0000000..f475b50 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMLibraryHelpDialog.h @@ -0,0 +1,140 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMLibraryHelpDialog.h + * + * Created on: 11/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMLIBRARYHELPDIALOG_H_ +#define WXCDMLIRBARYHELPDIALOG_H_ + +#include +#include + +#include "modelCDMLibrary.h" + +#include + +/** + * Library Panel Help Dialog + */ +class wxCDMLibraryHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Library Panel Help Dialog Constructor. + * @param parent Parent window. + * @param library Library class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Libraries". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 650. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMLibraryHelpDialog( + wxWindow* parent, + modelCDMLibrary* library, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Libraries"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,650), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMLibraryHelpDialog(); + /** + * Library Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Libraries". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 410, 650. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Libraries"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(410,650), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +private: + /** + * Library class reference. + */ + modelCDMLibrary* library; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnCMakeLists(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnCMakeListsEnter(wxMouseEvent& event); + + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnCMakeListsExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMLIRBARYHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp index e50abba..d7f10ae 100644 --- a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -34,9 +34,19 @@ */ #include "wxCDMMainDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "wxCDMMainHelpDialog.h" + #include "creaDevManagerIds.h" -#include "images/Cicon64.xpm" +#include "images/CIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMMainDescriptionPanel, wxPanel) +EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainDescriptionPanel::OnBtnNewProject) +EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainDescriptionPanel::OnBtnOpenProject) +END_EVENT_TABLE() wxCDMMainDescriptionPanel::wxCDMMainDescriptionPanel( wxWindow* parent, @@ -72,37 +82,57 @@ void wxCDMMainDescriptionPanel::CreateControls() { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - //Welcome - sizer->Add(new wxStaticText(this, -1, _("Welcome")),0, wxALIGN_CENTER, 0); - - //Image - sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(Cicon)),0, wxALIGN_CENTER, 0); - - //Crea Development Manager - sizer->Add(new wxStaticText(this, -1, _("Crea Development Manager")),0, wxALIGN_CENTER, 0); + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Welcome")),0, wxALIGN_LEFT, 0); + //Application Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx("Crea Development Manager")),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER | wxUP, 10); //Actions - wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions")); - wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL); - sizer -> Add(actionsBoxInnerSizer, 2, wxEXPAND | wxALL, 20); - - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_NEWPROJECT, _T("New Project")), 0, wxRIGHT | wxLEFT, 20); - actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPENPROJECT, _T("Open Project")), 0, wxRIGHT | wxLEFT, 20); + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions")); + actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new crea project or open an existing one selection any of the available actions.")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + + wxButton* newProjectbt = new wxButton(actionsPanel, ID_BUTTON_NEWPROJECT, _T("New Project")); + newProjectbt->SetToolTip(wxT("Create a new crea project.")); + actionsPanelSizer->Add(newProjectbt, 0, wxRIGHT | wxLEFT, 20); + wxButton* openProjectbt = new wxButton(actionsPanel, ID_BUTTON_OPENPROJECT, _T("Open Project (source/binaries)")); + openProjectbt->SetToolTip(wxT("Open an existing crea project from its binaries or its sources.")); + actionsPanelSizer->Add(openProjectbt, 0, wxRIGHT | wxLEFT, 20); + + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 0, wxALIGN_CENTER | wxALL, 10); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 20); //Asign sizer sizer->SetSizeHints(this); SetSizer(sizer); + + if(((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxDialog* helpDialog = new wxCDMMainHelpDialog(this->GetParent(), this, wxID_ANY); + helpDialog->Show(true); + } + } void wxCDMMainDescriptionPanel::OnBtnNewProject(wxCommandEvent& event) { - event.ResumePropagation(1); event.Skip(); } void wxCDMMainDescriptionPanel::OnBtnOpenProject(wxCommandEvent& event) { - event.ResumePropagation(1); event.Skip(); } diff --git a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h index e2efa88..fb0defa 100644 --- a/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMMainDescriptionPanel.h @@ -38,10 +38,23 @@ #include #include - +/** + * Main View description panel. Shows the welcome message and allows to open or create Crea projects. + */ class wxCDMMainDescriptionPanel : public wxPanel { + DECLARE_EVENT_TABLE() + public: + /** + * Main description panel Constructor. + * @param parent Parent window reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ wxCDMMainDescriptionPanel( wxWindow* parent, wxWindowID id = -1, @@ -51,8 +64,20 @@ public: long style = wxDEFAULT_FRAME_STYLE ); + /** + * Destructor. + */ ~wxCDMMainDescriptionPanel(); + /** + * Main description panel Constructor. + * @param parent Parent window reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ bool Create( wxWindow* parent, wxWindowID id = -1, @@ -62,11 +87,20 @@ public: long style = wxDEFAULT_FRAME_STYLE ); + /** + * Creates all the controls in the panel (property and action controls). + */ void CreateControls(); //handlers protected: + /** + * Handles when the create new project button is pressed. + */ void OnBtnNewProject(wxCommandEvent& event); + /** + * Handles when the open project button is pressed. + */ void OnBtnOpenProject(wxCommandEvent& event); }; diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index d60b317..441d99e 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -29,42 +29,64 @@ #include "wxCDMMainFrame.h" #include +#include #include +#include "creaSystem.h" +#include "wx/treectrl.h" +#include "wx/treebase.h" +#include "wx/tooltip.h" +#include "wx/wxhtml.h" +#include "wx/statline.h" #include "CDMUtilities.h" #include "creaDevManagerIds.h" #include "wxCDMMainDescriptionPanel.h" +#include "wxCDMProjectDescriptionPanel.h" +#include "wxCDMAppliDescriptionPanel.h" +#include "wxCDMApplicationDescriptionPanel.h" +#include "wxCDMLibDescriptionPanel.h" +#include "wxCDMLibraryDescriptionPanel.h" +#include "wxCDMPackageDescriptionPanel.h" +#include "wxCDMBlackBoxDescriptionPanel.h" +#include "wxCDMCMakeListsDescriptionPanel.h" +#include "wxCDMFolderDescriptionPanel.h" +#include "wxCDMFileDescriptionPanel.h" +#include "wxCDMPackageManagerPanel.h" + #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.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_TOGGLE_HELP, wxCDMMainFrame::OnMenuToggleHelp) 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_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged) + +EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnChangeView) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCDMMainFrame::OnElementSelected) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, wxCDMMainFrame::OnElementDeselected) + + +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainFrame::OnDisableHelp) END_EVENT_TABLE() wxCDMMainFrame::wxCDMMainFrame( @@ -76,6 +98,13 @@ wxCDMMainFrame::wxCDMMainFrame( 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); } @@ -95,11 +124,38 @@ bool wxCDMMainFrame::Create( { wxFrame::Create(parent, id, caption, pos, size, style); this->model = new modelCDMMain(); + this->help = true; CreateMenus(); CreateControls(); return TRUE; } +modelCDMMain* wxCDMMainFrame::GetModel() const +{ + return this->model; +} + +wxPanel* wxCDMMainFrame::GetPropertiesPanel() const +{ + return this->panel_Properties; +} + +bool wxCDMMainFrame::isHelp() const +{ + return this->help; +} + +void wxCDMMainFrame::RefreshProject() +{ + std::string* result; + std::cout << "refreshing project" << std::endl; + this->model->RefreshProject(result); + std::cout << "rebuilding project tree" << std::endl; + this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); + this->tree_Projects->Unselect(); + this->actualTreeItem.Unset(); +} + void wxCDMMainFrame::CreateMenus() { wxMenuBar* menuBar = new wxMenuBar; @@ -108,10 +164,8 @@ void wxCDMMainFrame::CreateMenus() menu_File = new wxMenu(); menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project...")); menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project...")); - menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent")); menu_File->AppendSeparator(); menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project")); - menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects")); menu_File->AppendSeparator(); menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy...")); menu_File->AppendSeparator(); @@ -122,20 +176,11 @@ void wxCDMMainFrame::CreateMenus() //EditMenu menu_Edit = new wxMenu(); menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project")); - menu_Edit->AppendSeparator(); - menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t")); - menu_Edit->Append(ID_MENU_COPY, wxT("&Copy")); - menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste")); - menu_Edit->AppendSeparator(); - menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete")); - menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All")); - menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection")); menuBar->Append(menu_Edit, wxT("&Edit")); //ToolsMenu menu_Tools = new wxMenu(); - menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log")); menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor")); menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools")); menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor")); @@ -145,6 +190,8 @@ void wxCDMMainFrame::CreateMenus() //HelpMenu menu_Help = new wxMenu(); + menu_Help->AppendCheckItem(ID_MENU_TOGGLE_HELP, wxT("He&lp Dialogs")); + menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); menu_Help->Append(ID_MENU_HELP, wxT("&Help")); menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug")); menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager")); @@ -171,115 +218,226 @@ void wxCDMMainFrame::CreateControls() this, ID_TREE_PROJECTS, wxDefaultPosition, - wxSize(300,400), - wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS + wxSize(200,400), + wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS ); - tree_Projects->SetMinSize(wxSize(200,200)); + this->actualTreeItem.Unset(); panel_Properties = new wxCDMMainDescriptionPanel( this, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, - wxSize(300, 400), + wxSize(400, 600), 0 ); - - - panel_ProjectActions = new wxCDMProjectActionsPanel( - this, - ID_WINDOW_PROJ_ACTIONS, - wxT("Project Actions Panel"), - wxDefaultPosition, - wxSize(600,200), - 0 - ); - panel_ProjectActions->SetMinSize(wxSize(500, 100)); - - auiManager.AddPane(tree_Projects, wxLEFT, wxT("Projects Tree")); - auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions")); - auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); - + 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)); auiManager.Update(); - auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true); - auiManager.GetPane(panel_Properties).CloseButton(false); + //auiManager.LoadPerspective(pers,true); + wxToolTip::Enable(true); + wxToolTip::SetDelay(0); } //Event Handlers //File menu void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) { + std::string* result; + wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this); long userResponse; userResponse = dialog->ShowModal(); if(userResponse == wxID_FORWARD) { - std::string* result; + //create project + if(this->model->GetProject() != NULL) + { + if(!this->model->CloseProject(result)) + { + std::cout << "error closing project: " << *result << std::endl; + wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + if(this->panel_Properties != NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Hide(); + } + if(this->panel_ProjectActions != NULL) + { + auiManager.DetachPane(this->panel_ProjectActions); + this->panel_ProjectActions->Hide(); + } + + } + + if(!this->model->CreateProject( crea::wx2std(dialog->GetProjectName()), crea::wx2std(dialog->GetProjectLocation()), result, crea::wx2std(dialog->GetPackageAuthor()), crea::wx2std(dialog->GetPackageDescription()) - )) + )) { + std::cout << "error opening project: " << *result << std::endl; wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; } - 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()); + + //show project actions panel + if(this->panel_ProjectActions != NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_ProjectActions->Destroy(); + this->panel_ProjectActions = NULL; + } + + panel_ProjectActions = new wxCDMProjectActionsPanel( + this, + this->model->GetProject(), + ID_WINDOW_PROJ_ACTIONS, + wxT("Project Actions Panel"), + wxDefaultPosition, + wxSize(800,200), + 0 + ); + + 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(); - } - event.Skip(); + //populate tree control + tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject()); + tree_Projects->Unselect(); + this->actualTreeItem.Unset(); + tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true); + //wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR); + } } void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) { + std::string* result; + 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 + if(this->model->GetProject() != NULL) + { + std::cout << "Project not null, closing it" << std::endl; + if(!this->model->CloseProject(result)) + { + std::cout << "error closing project: " << *result << std::endl; + wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + if(this->panel_Properties != NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Hide(); + } + if(this->panel_ProjectActions != NULL) + { + auiManager.DetachPane(this->panel_ProjectActions); + this->panel_ProjectActions->Hide(); + } + } - std::string* result; if (!this->model->OpenProject(path, result)) { + std::cout << "error opening project: " << *result << std::endl; wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR); event.Skip(); + return; }; - //TODO: populate model - //TODO: populate tree control + std::cout << "building ui" << std::endl; + + //populate tree control + tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); + tree_Projects->Unselect(); + this->actualTreeItem.Unset(); + tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true); + + + //change project's actions panel + if(this->panel_ProjectActions!= NULL) + { + auiManager.DetachPane(this->panel_ProjectActions); + this->panel_ProjectActions->Destroy(); + this->panel_ProjectActions = NULL; + } + panel_ProjectActions = new wxCDMProjectActionsPanel( + this, + this->model->GetProject(), + ID_WINDOW_PROJ_ACTIONS, + wxT("Project Actions Panel"), + wxDefaultPosition, + 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)); - //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects()); auiManager.Update(); - } - event.Skip(); -} -void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event) -{ - std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl; - event.Skip(); + } } + void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event) { - std::cerr << "Event OnMenuCloseProject not implemented" << std::endl; - event.Skip(); -} -void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event) -{ - std::cerr << "Event OnMenuCloseAllProjects not implemented" << std::endl; - event.Skip(); + std::cout << "closing project" << std::endl; + std::string* result; + if(!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()); + this->actualTreeItem.Unset(); + if(this->panel_Properties != NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Hide(); + } + if(this->panel_ProjectActions != NULL) + { + auiManager.DetachPane(this->panel_ProjectActions); + this->panel_ProjectActions->Hide(); + } + + this->panel_Properties = new wxCDMMainDescriptionPanel( + this, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + + auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); + + auiManager.Update(); } + void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event) { std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl; @@ -288,92 +446,519 @@ void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event) void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event) { std::cout << "Closing CreaDevManager..." << std::endl; + std::string* result; + if(this->model->GetProject() != NULL && !this->model->CloseProject(result)) + { + std::cout << "error closing project: " << *result << std::endl; + } + + if(this->panel_Properties != NULL) + { + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Destroy(); + this->panel_Properties = NULL; + } + + if(this->tree_Projects != NULL) + { + auiManager.DetachPane(this->tree_Projects); + this->tree_Projects->Destroy(); + this->tree_Projects = NULL; + } + + if(this->panel_ProjectActions != NULL) + { + auiManager.DetachPane(this->panel_ProjectActions); + this->panel_ProjectActions->Destroy(); + this->panel_ProjectActions = NULL; + } + Close(); - event.Skip(); } //Edit Menu void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event) { - std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl; + std::string* result; + if(!model->RefreshProject(result)) + { + wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR); + } + if(this->model->GetProject() != NULL) + { + this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); + this->auiManager.Update(); + + this->tree_Projects->Unselect(); + this->actualTreeItem.Unset(); + this->tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true); + } event.Skip(); } -void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event) + +void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event) { - std::cerr << "Event OnMenuMenuCut not implemented" << std::endl; + std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl; event.Skip(); + if(CDMUtilities::openBBEditor()) + { + wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR); + } } -void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event) { - std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl; - event.Skip(); + if(CDMUtilities::openCreaToolsTools()) + { + wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR); + } } -void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event) { - std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl; - event.Skip(); + if(CDMUtilities::openTextEditor()) + { + wxMessageBox( wxT("Can't open the Text Editor. Please check the default text editor command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR); + } } -void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event) { - std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl; - event.Skip(); + if(CDMUtilities::openTerminal()) + { + wxMessageBox( wxT("Can't open Terminal. Please check the default terminal command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR); + } } -void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event) + +//Help Menu +void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event) { - std::cerr << "Event OnMenuSelectAll not implemented" << std::endl; - event.Skip(); + wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en/CreatoolsDocumentation"), 0); } -void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event) { - std::cerr << "Event OnMenuSelectNone not implemented" << std::endl; - event.Skip(); + wxLaunchDefaultBrowser(_T("http://vip.creatis.insa-lyon.fr:9002/projects/crea"), 0); } - -//Tools Menu -void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event) { - std::cerr << "Event OnMenuEventLog not implemented" << std::endl; - event.Skip(); + wxBoxSizer *topsizer; + wxHtmlWindow *html; + wxDialog dlg(this, wxID_ANY, wxString(_("About"))); + + topsizer = new wxBoxSizer(wxVERTICAL); + + html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER); + html -> SetBorders(0); + + std::string content = "" + "" + "" + "" + " " + " " + " " + " " + " " + " " + "
" + "
" + " CREA Development Manager" + " " + "
" + "
" + "

Creatis 2012 - Lyon, France

" + " " + " " + " " + " " + " " + "
" + "

Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr

" + "
" + " " + "

This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software.

" + "
" + "
" + "
" + "" + "" + ; + + html -> SetPage(crea::std2wx(content)); + html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(), + html -> GetInternalRepresentation() -> GetHeight()); + + topsizer -> Add(html, 1, wxALL, 10); + +#if wxUSE_STATLINE + topsizer -> Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10); +#endif // wxUSE_STATLINE + + wxButton *bu1 = new wxButton(&dlg, wxID_OK, _("OK")); + bu1 -> SetDefault(); + + topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15); + + dlg.SetSizer(topsizer); + topsizer -> Fit(&dlg); + + dlg.ShowModal(); } -void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event) -{ - std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl; - event.Skip(); -} -void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event) +void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event) { - std::cerr << "Event OnMenuMiniTools not implemented" << std::endl; - event.Skip(); + wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en"), 0); } -void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event) + +void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) { - std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl; - event.Skip(); + + //get selected element + wxTreeItemId elementId = event.GetItem(); + //std::cout << "Tree Selection id: " << elementId.m_pItem << this->actualTreeItem.m_pItem << std::endl; + //elementId.IsOk() && this->tree_Projects->IsSelected(elementId) + if(elementId.IsOk() && this->actualTreeItem != elementId) + { + + //std::cout << "Valid tree selection id: " << elementId.m_pItem << std::endl; + //get element from model + modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId]; + + if (element == NULL) + return; + std::cout << "Tree Selection: " << element->GetName() << std::endl; + + //std::stringstream ss; + //ss << this->actualTreeItem.m_pItem << ":" << event.GetOldItem().m_pItem << " --> " << elementId.m_pItem; + //wxMessageBox( wxT("Tree Selection id: " + ss.str() + " by " + element->GetName()), wxT("Refresh Project - Error"), wxICON_ERROR); + this->actualTreeItem = elementId; + + //get element type + //project + modelCDMProject* elementProject = dynamic_cast(element); + wxPanel* description; + if(elementProject != NULL) + { + //create element description + description = new wxCDMProjectDescriptionPanel( + this, + elementProject, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + + } + else + { + //appli + modelCDMAppli* elementAppli = dynamic_cast(element); + if(elementAppli != NULL) + { + //create element description + description = new wxCDMAppliDescriptionPanel( + this, + elementAppli, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + + } + else + { + //application + modelCDMApplication* elementApplication = dynamic_cast(element); + if(elementApplication != NULL) + { + //create element description + description = new wxCDMApplicationDescriptionPanel( + this, + elementApplication, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //lib + modelCDMLib* elementLib = dynamic_cast(element); + if(elementLib != NULL) + { + //create element description + description = new wxCDMLibDescriptionPanel( + this, + elementLib, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //library + modelCDMLibrary* elementLibrary = dynamic_cast(element); + if(elementLibrary != NULL) + { + //create element description + description = new wxCDMLibraryDescriptionPanel( + this, + elementLibrary, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //package + modelCDMPackage* elementPackage = dynamic_cast(element); + if(elementPackage != NULL) + { + //create element description + description = new wxCDMPackageDescriptionPanel( + this, + elementPackage, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //black box + modelCDMBlackBox* elementBlackBox = dynamic_cast(element); + if(elementBlackBox != NULL) + { + //create element description + description = new wxCDMBlackBoxDescriptionPanel( + this, + elementBlackBox, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //CMakeLists + modelCDMCMakeListsFile* elementCMakeLists = dynamic_cast(element); + if(elementCMakeLists != NULL) + { + //create element description + description = new wxCDMCMakeListsDescriptionPanel( + this, + elementCMakeLists, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //folder + modelCDMFolder* elementFolder = dynamic_cast(element); + if(elementFolder != NULL) + { + //create element description + description = new wxCDMFolderDescriptionPanel( + this, + elementFolder, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + //file + modelCDMFile* elementFile = dynamic_cast(element); + if(elementFile != NULL) + { + //create element description + description = new wxCDMFileDescriptionPanel( + this, + elementFile, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else + { + + //main if not any + //create element description + description = new wxCDMMainDescriptionPanel( + this, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + } + } + } + } + } + } + } + } + } + + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Hide(); + auiManager.DetachPane(this->panel_Properties); + //this->panel_Properties->Destroy(); + //this->panel_Properties = NULL; + } + //set new view + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); + this->panel_Properties = description; + + auiManager.Update(); + } + else + { + event.Skip(); + } + + return; + } -void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event) + +void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) { - std::cerr << "Event OnMenuCommandLine not implemented" << std::endl; - event.Skip(); + modelCDMIProjectTreeNode* myItem = NULL; + wxPanel* description = NULL; + switch(event.GetId()) + { + case 0: + myItem = ((modelCDMIProjectTreeNode*)event.GetClientData()); + //select out old one to generate selection event + this->tree_Projects->Unselect(); + this->tree_Projects->SelectItem(myItem->GetId().GetWxId()); + this->tree_Projects->Expand(myItem->GetId().GetWxId()); + break; + case 1: + + if(event.GetString() == wxT("manage_packages")) + { + //this->tree_Projects->Expand(this->model->GetProject()->GetId()); + //this->tree_Projects->Unselect(); + this->actualTreeItem.Unset(); + description = new wxCDMPackageManagerPanel( + this, + this->model->GetProject(), + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + } + else if(event.GetString() == wxT("manage_libraries")) + { + this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId().GetWxId()); + this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId().GetWxId()); + break; + } + else if(event.GetString() == wxT("manage_applications")) + { + this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId().GetWxId()); + this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId().GetWxId()); + break; + } + else if(event.GetString() == wxT("blackbox")) + { + modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData(); + this->actualTreeItem.Unset(); + description = new wxCDMBlackBoxDescriptionPanel( + this, + bb, + ID_WINDOW_PROPERTIES, + wxT("Description Panel"), + wxDefaultPosition, + wxSize(600, 400), + 0 + ); + + } + + //delete old view + if(this->panel_Properties!= NULL) + { + this->panel_Properties->Hide(); + auiManager.DetachPane(this->panel_Properties); + this->panel_Properties->Destroy(); + this->panel_Properties = NULL; + } + //set new view + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); + this->panel_Properties = description; + auiManager.Update(); + break; + default: + event.Skip(); + } + } -//Help Menu -void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event) +void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event) { - std::cerr << "Event OnMenuHelp not implemented" << std::endl; - event.Skip(); + //std::cout << "element " << event.GetInt() << std::endl; + modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData(); + this->tree_Projects->EnsureVisible(item->GetId().GetWxId()); + this->tree_Projects->SetItemBold(item->GetId().GetWxId(), true); + this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,255)); + this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(230,230,255)); + this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE); + auiManager.Update(); } -void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event) + +void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event) { - std::cerr << "Event OnMenuReportBug not implemented" << std::endl; - event.Skip(); + modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData(); + this->tree_Projects->SetItemBold(item->GetId().GetWxId(), false); + this->tree_Projects->SetItemTextColour(item->GetId().GetWxId(), wxColour(0,0,0)); + this->tree_Projects->SetItemBackgroundColour(item->GetId().GetWxId(), wxColour(255,255,255)); + this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE); + auiManager.Update(); } -void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event) + +void wxCDMMainFrame::OnMenuToggleHelp(wxCommandEvent& event) { - std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl; - event.Skip(); + this->help = !this->help; + this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); } -void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event) + +void wxCDMMainFrame::OnDisableHelp(wxCommandEvent& event) { - std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl; - event.Skip(); + if (event.GetInt()) + this->help = false; + else + this->help = true; + + this->menu_Help->Check(ID_MENU_TOGGLE_HELP, this->help); } diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index e2505eb..9df0879 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -31,87 +31,273 @@ #include #include +#include #include "wxCDMProjectsTreeCtrl.h" #include "modelCDMMain.h" +/** + * Main Frame Class. + * This class is the main class of the application. It starts the other classes and windows as well as it holds a reference to the application model. + */ class wxCDMMainFrame:public wxFrame { DECLARE_EVENT_TABLE() public: + /** + * Constructor receiving common parameter for frame construction. + * @param parent The parent window of the wxCDMMainFrame object. + * @param id The id of the Frame, by default wxID_ANY. + * @param caption Frame caption. Usually shown on the top of the window. It's by default "CREATIS CreaDevManager". + * @param pos Position of the application, by default wxDefaultPosition. + * @param size Size of the application, by default wxDefaultSize. + * @param style Style of the application, by default wxDEFAULT_FRAME_STYLE. + */ wxCDMMainFrame( wxWindow* parent, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, const wxString& caption = wxT("CREATIS CreaDevManager"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE ); + /** + * Destructor. + */ ~wxCDMMainFrame(); + /** + * Create Method. + * Actually creates the frame and creates the controls inside the application. + * @param parent The parent window of the wxCDMMainFrame object. + * @param id The id of the Frame, by default wxID_ANY. + * @param caption Frame caption. Usually shown on the top of the window. It's by default "CREATIS CreaDevManager". + * @param pos Position of the application, by default wxDefaultPosition. + * @param size Size of the application, by default wxDefaultSize. + * @param style Style of the application, by default wxDEFAULT_FRAME_STYLE. + * @return True if the creation process went well. + */ bool Create( wxWindow* parent, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, const wxString& caption = wxT("CREATIS CreaDevManager"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE ); + /** + * Retreives the application model. + * @return Model of the application. + */ + modelCDMMain* GetModel() const; + + /** + * Returns the properties panel. where the selection description is shown. + * @return the description panel of the project component chosen by the user. + */ + wxPanel* GetPropertiesPanel() const; + + /** + * Checks if the help is enabled. + * @return true if the help is enabled. + */ + bool isHelp() const; + + /** + * Refresh the project structure by comparing the existing model with the corresponding files in the hard drive. + */ + void RefreshProject(); + protected: + + /** + * Creates the menu bar and binds the corresponding event handler to each menu. + */ void CreateMenus(); + + /** + * Create the user interface containing a wxCDMMainDescriptionPanel and a wxCDMProjectsTreeCtrl. + */ void CreateControls(); private: //Menus + /** + * File menu + */ wxMenu* menu_File; + /** + * Edit menu + */ wxMenu* menu_Edit; + /** + * Tools menu + */ wxMenu* menu_Tools; + /** + * Help menu + */ wxMenu* menu_Help; //Controls + /** + * Floating panel manager + */ wxAuiManager auiManager; + /** + * Tree control for an open project + */ wxCDMProjectsTreeCtrl* tree_Projects; + /** + * Tree item for the selected item in the tree. + */ + wxTreeItemId actualTreeItem; + /** + * Description panel for a selected project item + */ wxPanel* panel_Properties; + /** + * Main actions for an open project + */ wxPanel* panel_ProjectActions; //Model + /** + * Application model. It holds the open project model. + */ modelCDMMain* model; + /** + * Help enabled + */ + bool help; + //events protected: //File + /** + * New project handler. Launches a new project dialog and creates a project model if the project is correctly created. + * @param event The event object that triggers the handler. + */ void OnMenuNewProject(wxCommandEvent& event); + /** + * Open project handler. Launches a directory dialog and creates a project model if the project is correctly opened. + * @param event The event object that triggers the handler. + */ void OnMenuOpenProject(wxCommandEvent& event); - void OnMenuOpenRecent(wxCommandEvent& event); + /** + * Close project handler. Remove the project from the model and restarts the user interface. + * @param event The event object that triggers the handler. + */ void OnMenuCloseProject(wxCommandEvent& event); - void OnMenuCloseAllProjects(wxCommandEvent& event); + /** + * Unimplemented optional method handler. It should export the project structure in XML format. + * @param event The event object that triggers the handler. + */ void OnMenuExportHierarchy(wxCommandEvent& event); + /** + * Exit handler. It closes any open project and quits the application. + * @param event The event object that triggers the handler. + */ void OnMenuExit(wxCommandEvent& event); //Edit + /** + * Refresh project handler. Refreshes the project structure. + * @param event The event object that triggers the handler. + */ void OnMenuRefreshProject(wxCommandEvent& event); - void OnMenuMenuCut(wxCommandEvent& event); - void OnMenuMenuCopy(wxCommandEvent& event); - void OnMenuMenuPaste(wxCommandEvent& event); - void OnMenuMenuDelete(wxCommandEvent& event); - void OnMenuSelectAll(wxCommandEvent& event); - void OnMenuSelectNone(wxCommandEvent& event); //Tools - void OnMenuEventLog(wxCommandEvent& event); + /** + * Launches the BBTK Graphical Editor, also known as BBEditor. + * @param event The event object that triggers the handler. + */ void OnMenuBBTKGraphicalEditor(wxCommandEvent& event); + /** + * Launches the Minitools application alse known as creaTools + * @param event The event object that triggers the handler. + */ void OnMenuMiniTools(wxCommandEvent& event); + /** + * Launches the system default code editor. + * Linux: gedit + * Mac: + * Windows: + * @param event The event object that triggers the handler. + */ void OnMenuCodeEditor(wxCommandEvent& event); + /** + * Launches the system command line interpreter (CLI). + * Linux: gnome-terminal + * Mac: + * Windows: + * @param event The event object that triggers the handler. + */ void OnMenuCommandLine(wxCommandEvent& event); //Help + /** + * Enables/Disables the help option. + * @param event The event object that triggers the handler. + */ + void OnMenuToggleHelp(wxCommandEvent& event); + /** + * Open the default web browser and redirects to the CreaTools Documentation page. + * @param event The event object that triggers the handler. + */ void OnMenuHelp(wxCommandEvent& event); + /** + * Open the default web browser and redirects to the Crea Bug Tracking page. + * @param event The event object that triggers the handler. + */ void OnMenuReportBug(wxCommandEvent& event); + /** + * Shows the about dialog of creaDevManager + * @param event The event object that triggers the handler. + */ void OnMenuAboutCreaDevManager(wxCommandEvent& event); + /** + * Open the default web browser and redirects to the Creatis page. + * @param event The event object that triggers the handler. + */ void OnMenuAboutCreatis(wxCommandEvent& event); + + //Tree + /** + * Handles the propertiesPanel change when there is a change in the selection on the Project Tree. + * @param event The event object that triggers the handler. + */ + void OnTreeSelectionChanged(wxTreeEvent& event); + + //PropertiesPanel + /** + *Handles the propertiesPanel change when the event wxEVT_DISPLAY_CHANGED is triggered. + * @param event The event object that triggers the handler. + */ + void OnChangeView(wxCommandEvent& event); + + //Element higlighted + /** + * Handles the change of the style of an element in the tree when buttons are hovered. + * @param event The event object that triggers the handler. + */ + void OnElementSelected(wxCommandEvent& event); + /** + * Handles the change of the style of an element in the tree when buttons finish hover. + * @param event The event object that triggers the handler. + */ + void OnElementDeselected(wxCommandEvent& event); + + //Enable/Disable help + /** + * Handles the change of the state of the help option when it's triggered by another class. + * @param event The event object that triggers the handler. + */ + void OnDisableHelp(wxCommandEvent& event); }; #endif diff --git a/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp new file mode 100644 index 0000000..1749dc1 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp @@ -0,0 +1,150 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMMainHelpDialog.cpp + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMMainHelpDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMMainHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMMainHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainHelpDialog::OnNewProject) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainHelpDialog::OnOpenProject) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMMainHelpDialog::wxCDMMainHelpDialog( + wxWindow* parent, + wxCDMMainDescriptionPanel* mainDescription, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMMainHelpDialog::Create(parent, id, caption, position, size, style); + this->mainDescription = mainDescription; +} + +wxCDMMainHelpDialog::~wxCDMMainHelpDialog() +{ +} + +bool wxCDMMainHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMMainHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Welcome to the Crea Development Manager"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "This application was made to help you in the creation process of Crea projects. This help dialogs will explain what " + "each part of the program does and will give you tips to get your project up and running in no time. You can disable " + "them by checking the \"Disable Help\" option, or you can also enable or disable them at any time checking the \"Help " + "Dialogs\" option in the Help menu.\n To begin working on your projects you can either create a new project or open an " + "already existing project.\n"), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + +// wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15); +// +// wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_NEWPROJECT, wxT("New Project")); +// wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project")); +// +// formItems->Add(createPackageBtn, 1, wxALIGN_CENTER); +// formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER); +// +// formItems->AddGrowableCol(0,1); +// formItems->AddGrowableCol(1,1); +// +// v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMMainHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMMainHelpDialog::OnNewProject(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMMainHelpDialog::OnOpenProject(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMMainHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMMainHelpDialog.h b/lib/creaDevManagerLib/wxCDMMainHelpDialog.h new file mode 100644 index 0000000..a011c24 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMMainHelpDialog.h @@ -0,0 +1,132 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMMainHelpDialog.h + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMMAINHELPDIALOG_H_ +#define WXCDMMAINHELPDIALOG_H_ + +#include +#include + +#include "wxCDMMainDescriptionPanel.h" + +/** + * Main Panel Help Dialog + */ +class wxCDMMainHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Main Panel Help Dialog Constructor. + * @param parent Parent window. + * @param packageManager Main panel reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Welcome". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 370. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMMainHelpDialog( + wxWindow* parent, + wxCDMMainDescriptionPanel* packageManager, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Welcome"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,370), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMMainHelpDialog(); + /** + * Main Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Welcome". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 370. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Welcome"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,370), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +//attributes +private: + /** + * Main panel reference. + */ + wxCDMMainDescriptionPanel* mainDescription; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when new project button is pressed. + * @param event Unused. + */ + void OnNewProject(wxCommandEvent& event); + /** + * Handler when open project button is pressed. + * @param event Unused. + */ + void OnOpenProject(wxCommandEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMMAINHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.cpp b/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.cpp new file mode 100644 index 0000000..7e0c69f --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.cpp @@ -0,0 +1,247 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMNewBlackBoxDialog.cpp + * + * Created on: 26/12/2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMNewBlackBoxDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMNewBlackBoxDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_NEXT, wxCDMNewBlackBoxDialog::OnCreateBlackBox) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMNewBlackBoxDialog::OnCancel) +END_EVENT_TABLE() + +wxCDMNewBlackBoxDialog::wxCDMNewBlackBoxDialog( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMNewBlackBoxDialog::Create(parent, id, caption, position, size, style); +} + +wxCDMNewBlackBoxDialog::~wxCDMNewBlackBoxDialog() +{ +} + +bool wxCDMNewBlackBoxDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxName() const +{ + return this->blackBoxName->GetValue(); +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxAuthor() const +{ + return this->blackBoxAuthor->GetValue(); +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxAuthorEmail() const +{ + return this->blackBoxAuthorEmail->GetValue(); +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxDescription() const +{ + return this->blackBoxDescription->GetValue(); +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxCategories() const +{ + return this->blackBoxCategories->GetValue(); +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxType() const +{ + wxString res; + switch(this->blackBoxType->GetCurrentSelection()) + { + case 0: + res = wxT("std"); + break; + case 1: + res = wxT("widget"); + break; + case 2: +#ifdef _WIN32 + res = wxT("VTK_ImageAlgorithm"); +#else + res = wxT("VTK-ImageAlgorithm"); +#endif + break; + case 3: +#ifdef _WIN32 + res = wxT("VTK_PolyDataAlgorithm"); +#else + res = wxT("VTK-PolyAlgorithm"); +#endif + break; + default: + res = wxT("std"); + } + return res; +} + +const wxString wxCDMNewBlackBoxDialog::GetBlackBoxFormat() const +{ + wxString res; + switch(this->blackBoxFormat->GetCurrentSelection()) + { + case 0: + res = wxT("C++"); + break; + case 1: + res = wxT("XML"); + break; + default: + res = wxT("C++"); + } + return res; +} + +void wxCDMNewBlackBoxDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Create a new black box"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText(this, wxID_ANY, wxT("Please fill the following details."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + v_sizer1->Add(instruction, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxFlexGridSizer* formItems = new wxFlexGridSizer(4,2,9,15); + + wxStaticText *stxtPrjName = new wxStaticText(this, -1, wxT("Black Box Name")); + wxStaticText *stxtPrjAuth = new wxStaticText(this, -1, wxT("Black Box Authors (separated by ',')")); + wxStaticText *stxtPrjAuthEmail = new wxStaticText(this, -1, wxT("Black Box Authors' Email")); + wxStaticText *stxtPrjDsc = new wxStaticText(this, -1, wxT("Black Box Description")); + wxStaticText *stxtPrjCat = new wxStaticText(this, -1, wxT("Black Box Categories (separated by ',')")); + wxStaticText *stxtPrjTyp = new wxStaticText(this, -1, wxT("Black Box Type")); + wxStaticText *stxtPrjFmt = new wxStaticText(this, -1, wxT("Black Box Format")); + + this->blackBoxName = new wxTextCtrl(this, -1); + this->blackBoxAuthor = new wxTextCtrl(this, -1); + this->blackBoxAuthorEmail = new wxTextCtrl(this, -1); + this->blackBoxDescription = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); + this->blackBoxCategories = new wxTextCtrl(this, -1); + wxString BBTypes[] = + { + wxT("Basic - AtomicBlackBox"), + wxT("Widget - WxBlackBox"), + wxT("VTK ImageAlgorithm - Basic and vtkImageAlgorithm (standard vtk I/O)"), + wxT("VTK PolyDataAlgorithm - Basic and vtkPolyDataAlgorithm (standard vtk I/O)") + }; + this->blackBoxType = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, BBTypes); + + wxString BBFormats[] = + { + wxT("C++"), + wxT("XML") + }; + this->blackBoxFormat = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, BBFormats); + + formItems->Add(stxtPrjName, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxName, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjAuth, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxAuthor, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjAuthEmail, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxAuthorEmail, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjDsc, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxDescription, 1, wxEXPAND); + formItems->Add(stxtPrjCat,0 , wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxCategories, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjTyp, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxType, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjFmt, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->blackBoxFormat, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL); + + formItems->AddGrowableCol(1,1); + formItems->AddGrowableRow(3,1); + + v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); + + wxBoxSizer* h_sizer2 = new wxBoxSizer(wxHORIZONTAL); + h_sizer2->Add(new wxButton(this, ID_BUTTON_NEXT, wxT("Create Black Box")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); + h_sizer2->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Cancel")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); + + v_sizer1->Add(h_sizer2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); +} + +void wxCDMNewBlackBoxDialog::OnCreateBlackBox(wxCommandEvent& event) +{ + bool ready = true; + + if(ready && this->blackBoxName->GetValue() == wxT("")) + { + wxMessageBox(wxT("The black box name cannot be empty"),_T("Error"),wxOK | wxICON_ERROR); + ready = false; + } + if(ready && this->blackBoxAuthor->GetValue() == wxT("")) + { + wxMessageBox(wxT("The black box author has to be specified"),_T("Error"),wxOK | wxICON_ERROR); + ready = false; + } + + if(ready) + { + this->EndModal(wxID_FORWARD); + } + event.Skip(); +} + +void wxCDMNewBlackBoxDialog::OnCancel(wxCommandEvent& event) +{ + this->EndModal(wxID_CANCEL); + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.h b/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.h new file mode 100644 index 0000000..1c48f94 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMNewBlackBoxDialog.h @@ -0,0 +1,176 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMNewBlackBoxDialog.h + * + * Created on: 26/12/2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMNEWBLACKBOXDIALOG_H_ +#define WXCDMNEWBLACKBOXDIALOG_H_ + +#include +#include +#include + +/** + * Dialog to create a new Black Box in a Crea Project. + */ +class wxCDMNewBlackBoxDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * New Black Box Dialog Constructor. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Black Box". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 500, 500. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMNewBlackBoxDialog( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("New Black Box"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(500,500), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMNewBlackBoxDialog(); + /** + * New Black Box Dialog Constructor. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Black Box". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 500, 500. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return True if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("New Black Box"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(500,500), + long style = wxDEFAULT_DIALOG_STYLE + ); + + /** + * Returns the black box name chosen by the user. + * @return Black box name. + */ + const wxString GetBlackBoxName() const; + /** + * Returns the black box's author name chosen by the user. + * @return Black box's author name. + */ + const wxString GetBlackBoxAuthor() const; + /** + * Returns the black box's author email chosen by the user. + * @return Black box's author email. + */ + const wxString GetBlackBoxAuthorEmail() const; + /** + * Returns the black box description chosen by the user. + * @return Black box description. + */ + const wxString GetBlackBoxDescription() const ; + /** + * Returns the black box categories chosen by the user. + * @return Black box categories. + */ + const wxString GetBlackBoxCategories() const ; + /** + * Returns the black box type chosen by the user. + * @return Black box type. + */ + const wxString GetBlackBoxType() const; + /** + * Returns the black box format chosen by the user. + * @return Black box format. + */ + const wxString GetBlackBoxFormat() const; + +protected: + /** + * Creates the visual controls of the Dialog. + */ + void CreateControls(); + +private: + /** + * Black box name. + */ + wxTextCtrl* blackBoxName; + /** + * Black box's author name. + */ + wxTextCtrl* blackBoxAuthor; + /** + * Black box's author email. + */ + wxTextCtrl* blackBoxAuthorEmail; + /** + * Black box description. + */ + wxTextCtrl* blackBoxDescription; + /** + * Black box categories. + */ + wxTextCtrl* blackBoxCategories; + /** + * Black box type. + */ + wxChoice* blackBoxType; + /** + * Black box format. + */ + wxChoice* blackBoxFormat; + + //handlers +protected: + /* + * Handles when the create black box button is pressed. + * @param event Unused event. + */ + void OnCreateBlackBox(wxCommandEvent& event); + /* + * Handles when the cancel button is pressed. + * @param event Unused event. + */ + void OnCancel(wxCommandEvent& event); +}; + +#endif /* WXCDMNEWBLACKBOXDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMNewPackageDialog.cpp b/lib/creaDevManagerLib/wxCDMNewPackageDialog.cpp new file mode 100644 index 0000000..f648d65 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMNewPackageDialog.cpp @@ -0,0 +1,167 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMNewPackageDialog.cpp + * + * Created on: 05/12/2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMNewPackageDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMNewPackageDialog, wxDialog) + EVT_BUTTON(ID_BUTTON_NEXT, wxCDMNewPackageDialog::OnCreatePackage) + EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMNewPackageDialog::OnCancel) +END_EVENT_TABLE() + +wxCDMNewPackageDialog::wxCDMNewPackageDialog( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMNewPackageDialog::Create(parent, id, caption, position, size, style); +} + +wxCDMNewPackageDialog::~wxCDMNewPackageDialog() +{ +} + +bool wxCDMNewPackageDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +const wxString wxCDMNewPackageDialog::GetPackageName() +{ + return this->packageName->GetValue(); +} +const wxString wxCDMNewPackageDialog::GetPackageAuthor() +{ + return this->packageAuthor->GetValue(); +} +const wxString wxCDMNewPackageDialog::GetPackageAuthorEmail() +{ + return this->packageAuthorEmail->GetValue(); +} +const wxString wxCDMNewPackageDialog::GetPackageDescription() +{ + return this->packageDescription->GetValue(); +} + +void wxCDMNewPackageDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Create a new package"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText(this, wxID_ANY, wxT("Please fill the following details."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + v_sizer1->Add(instruction, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxFlexGridSizer* formItems = new wxFlexGridSizer(4,2,9,15); + + wxStaticText *stxtPrjName = new wxStaticText(this, -1, wxT("Package Name")); + wxStaticText *stxtPrjAuth = new wxStaticText(this, -1, wxT("Package's Author (1 word)")); + wxStaticText *stxtPrjAuthEmail = new wxStaticText(this, -1, wxT("Package's Author Email")); + wxStaticText *stxtPrjPkg = new wxStaticText(this, -1, wxT("Package's Description (HTML)")); + + this->packageName = new wxTextCtrl(this, -1); + this->packageAuthor = new wxTextCtrl(this, -1); + this->packageAuthorEmail = new wxTextCtrl(this, -1); + this->packageDescription = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); + + formItems->Add(stxtPrjName, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->packageName, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjAuth, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->packageAuthor, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjAuthEmail, 0, wxALIGN_CENTER_VERTICAL); + formItems->Add(this->packageAuthorEmail, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + formItems->Add(stxtPrjPkg); + formItems->Add(this->packageDescription, 1, wxEXPAND); + + formItems->AddGrowableCol(1,1); + formItems->AddGrowableRow(3,1); + + v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); + + wxBoxSizer* h_sizer2 = new wxBoxSizer(wxHORIZONTAL); + h_sizer2->Add(new wxButton(this, ID_BUTTON_NEXT, wxT("Create Package")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); + h_sizer2->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Cancel")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); + + v_sizer1->Add(h_sizer2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); +} + +void wxCDMNewPackageDialog::OnCreatePackage(wxCommandEvent& event) +{ + bool ready = true; + + if(ready && this->packageName->GetValue() == wxT("")) + { + wxMessageBox(wxT("The package name cannot be empty"),_T("Error"),wxOK | wxICON_ERROR); + ready = false; + } + if(ready && this->packageAuthor->GetValue() == wxT("")) + { + wxMessageBox(wxT("The package's author cannot be empty"),_T("Error"),wxOK | wxICON_ERROR); + ready = false; + } + + if(ready) + { + this->EndModal(wxID_FORWARD); + } + + event.Skip(); +} + +void wxCDMNewPackageDialog::OnCancel(wxCommandEvent& event) +{ + this->EndModal(wxID_CANCEL); + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMNewPackageDialog.h b/lib/creaDevManagerLib/wxCDMNewPackageDialog.h new file mode 100644 index 0000000..eda8a91 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMNewPackageDialog.h @@ -0,0 +1,147 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMNewPackageDialog.h + * + * Created on: 05/12/2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMNEWPACKAGEDIALOG_H_ +#define WXCDMNEWPACKAGEDIALOG_H_ + +#include +#include + +/** + * Dialog to create a new Package in a Crea Project. + */ +class wxCDMNewPackageDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * New Package Dialog Constructor. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Package". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 500, 400. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMNewPackageDialog( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("New Package"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(500,400), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMNewPackageDialog(); + /** + * New Package Dialog Creator. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Package". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 500, 400. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("New Package"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(500,400), + long style = wxDEFAULT_DIALOG_STYLE + ); + + /** + * Returns the package name chosen by the user. + * @return Package name. + */ + const wxString GetPackageName(); + /** + * Returns the package author name chosen by the user. + * @return Package author name. + */ + const wxString GetPackageAuthor(); + /** + * Returns the package author's email chosen by the user. + * @return Package author's email. + */ + const wxString GetPackageAuthorEmail(); + /** + * Returns the package description chosen by the user. + * @return Package description. + */ + const wxString GetPackageDescription(); + +protected: + /** + * Creates the visual controls of the Dialog. + */ + void CreateControls(); + +private: + /** + * Package name. + */ + wxTextCtrl* packageName; + /** + * Package author name. + */ + wxTextCtrl* packageAuthor; + /** + * Package author's email. + */ + wxTextCtrl* packageAuthorEmail; + /** + * Package description. + */ + wxTextCtrl* packageDescription; + + //handlers +protected: + /** + * Handles when the create package button is pressed. + * @param event Unused event. + */ + void OnCreatePackage(wxCommandEvent& event); + /** + * Handles when the cancel button is pressed. + * @param event Unused event. + */ + void OnCancel(wxCommandEvent& event); +}; + +#endif /* WXCDMNEWPACKAGEDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMNewProjectDialog.cpp b/lib/creaDevManagerLib/wxCDMNewProjectDialog.cpp index e0ad6d4..c3066a7 100644 --- a/lib/creaDevManagerLib/wxCDMNewProjectDialog.cpp +++ b/lib/creaDevManagerLib/wxCDMNewProjectDialog.cpp @@ -142,7 +142,7 @@ void wxCDMNewProjectDialog::CreateControls() v_sizer1->Add(h_sizer2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); SetSizer(v_sizer1); - v_sizer1->SetSizeHints(this); + //v_sizer1->RecalcSizes(); } void wxCDMNewProjectDialog::OnCreateProject(wxCommandEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMNewProjectDialog.h b/lib/creaDevManagerLib/wxCDMNewProjectDialog.h index ce99eab..be99c95 100644 --- a/lib/creaDevManagerLib/wxCDMNewProjectDialog.h +++ b/lib/creaDevManagerLib/wxCDMNewProjectDialog.h @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -39,46 +39,114 @@ #include #include +/** + * Dialog to create a new Crea Project. + */ class wxCDMNewProjectDialog : public wxDialog { DECLARE_EVENT_TABLE() public: + /** + * New Project Dialog Constructor. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Project". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 700, 400. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ wxCDMNewProjectDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = wxT("New Project"), const wxPoint& position = wxDefaultPosition, - const wxSize& size = wxSize(400,300), + const wxSize& size = wxSize(700,400), long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ); + /** + * Destructor. + */ ~wxCDMNewProjectDialog(); + /** + * New Project Dialog Creator. + * @param parent Parent window reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "New Project". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 700, 400. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return True if the creation was successful. + */ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = wxT("New Project"), const wxPoint& position = wxDefaultPosition, - const wxSize& size = wxSize(400,300), + const wxSize& size = wxSize(700,400), long style = wxDEFAULT_DIALOG_STYLE ); + /** + * Returns the project location chosen by the user. + * @return Project creation path. + */ const wxString GetProjectLocation(); + /** + * Returns the project name chosen by the user. + * @return Project name. + */ const wxString GetProjectName(); + /** + * Returns the default package authors chosen by the user. + * @return Default Package authors. + */ const wxString GetPackageAuthor(); + /** + * Returns the default package description chosen by the user. + * @return Default Package description. + */ const wxString GetPackageDescription(); protected: + /** + * Creates the visual controls of the Dialog. + */ void CreateControls(); private: + /** + * Project creation path. + */ wxStaticText* projectLocation; + /** + * Project Name. + */ wxTextCtrl* projectName; + /** + * Default Package Author. + */ wxTextCtrl* packageAuthor; + /** + * Default Package Description. + */ wxTextCtrl* packageDescription; -//handlers + //handlers protected: + /** + * Handles when the create project button is pressed. If no path or no author was specified, the dialog shows an error. + * @param event Unused event. + */ void OnCreateProject(wxCommandEvent& event); + /** + * Handles when the cancel button is pressed. + * @param event Unused event. + */ void OnCancel(wxCommandEvent& event); + /** + * Handles when the choose location is pressed. a Directory dialog is shown and the new project location is chosen. + * @param event Unused event. + */ void OnChooseLocation(wxCommandEvent& event); }; diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp new file mode 100644 index 0000000..bed6dc5 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp @@ -0,0 +1,502 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/PkIcon64.xpm" + +#include "wxCDMNewBlackBoxDialog.h" +#include +#include "CDMUtilities.h" + +#include +#include "modelCDMCMakeListsFile.h" +#include "wxCDMPackageHelpDialog.h" + + +BEGIN_EVENT_TABLE(wxCDMPackageDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMPackageDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMPackageDescriptionPanel::OnBtnSetAuthor) +EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMPackageDescriptionPanel::OnBtnSetVersion) +EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMPackageDescriptionPanel::OnBtnSetDescription) +EVT_HYPERLINK(ID_LINK_SELECT_BLACKBOX, wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect) +EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMPackageDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMPackageDescriptionPanel::wxCDMPackageDescriptionPanel( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMPackageDescriptionPanel::Create(parent, package, id, caption, pos, size, style); +} + +wxCDMPackageDescriptionPanel::~wxCDMPackageDescriptionPanel() +{ +} + +bool wxCDMPackageDescriptionPanel::Create( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->package = package; + CreateControls(); + return TRUE; +} + +void wxCDMPackageDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->package->GetParents(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); + if (i < (int)(parents.size())-1) + { + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + } + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PkIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Package")),0, wxALIGN_LEFT, 0); + //Package Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->package->GetNamePackage())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Package Properties + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + + wxStaticText *pAuthor = new wxStaticText(propertiesPanel, -1, wxT("Author")); + wxStaticText *pVersion = new wxStaticText(propertiesPanel, -1, wxT("Version")); + wxStaticText *pDescription = new wxStaticText(propertiesPanel, -1, wxT("Description")); + + // author + wxBoxSizer* pAuthorsz = new wxBoxSizer(wxHORIZONTAL); + this->authortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->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); + pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10); + + // version + wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL); + this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetVersion())); + wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set")); + pVersionbt->SetToolTip(wxT("Update the version of the package.")); + pVersionsz->Add(this->versiontc, 1, wxALIGN_CENTER_VERTICAL); + pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10); + + // description + wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL); + this->descriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->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); + pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10); + + propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pAuthorsz, 1, wxEXPAND); + propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND); + propertiesGridSizer->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pDescriptionsz, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND); + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 0, wxEXPAND | wxALL, 5); + + sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + //Black Boxes + wxStaticBoxSizer* BBBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Black Boxes")); + BBBox->GetStaticBox()->SetToolTip(wxT("Select any of the available black boxes to see its details or modify them.")); + wxPanel* BBPanel = new wxPanel(this); + wxBoxSizer* BBPanelSizer = new wxBoxSizer(wxVERTICAL); + + + std::vector blackBoxes = this->package->GetSrc()->GetBlackBoxes(); + for (int i = 0; i < (int)(blackBoxes.size()); i++) + { + + if(blackBoxes[i] != NULL) + { + + wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pBBlk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + 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, wxEXPAND | wxALL, 5); + } + } + + BBPanel->SetSizer(BBPanelSizer); + BBPanelSizer->Fit(BBPanel); + BBBox->Add(BBPanel, 1, wxEXPAND | wxALL, 5); + sizer -> Add(BBBox, 0, wxEXPAND | wxALL, 10); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + + wxButton* createBBbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_BLACKBOX, _T("A. Create Black Box")); + createBBbt->SetToolTip(wxT("Create a new black box for the active project inside this package.")); + actionsGridSizer->Add(createBBbt, 1, wxALL | wxEXPAND, 5); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the package's CMakeLists.txt file.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Package Folder")); + openFolderbt->SetToolTip(wxT("Open the package folder in the file explorer.")); + actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMPackageHelpDialog* helpDialog = new wxCDMPackageHelpDialog(this->GetParent(), this->package, wxID_ANY); + helpDialog->Show(true); + } +} + +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 < (int)(parents.size()); i++) + { + if (parents[i]->GetPath() == parentURL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(parents[i]); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } +} + +void wxCDMPackageDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event) +{ + //get author from user + wxTextEntryDialog* authDlg = new wxTextEntryDialog( + this, + wxT("Enter the new authors name. Separate each author with a '/'."), + wxT("Change Package Author - creaDevManager"), + crea::std2wx(this->package->GetAuthors()), + wxTE_MULTILINE | wxOK | wxCANCEL + ); + + if (authDlg->ShowModal() == wxID_OK) + { + std::string authorsStr = crea::wx2std(authDlg->GetValue()); + //check name + if(authorsStr.size() > 0) + { + std::string* result; + if(!this->package->SetAuthors(authorsStr, result)) + wxMessageBox(crea::std2wx(*result),_T("Change Package Author - Error!"),wxOK | wxICON_ERROR); + } + this->authortc->SetLabel(crea::std2wx(this->package->GetAuthors())); + this->authortc->GetParent()->GetSizer()->RecalcSizes(); + } + +} + +void wxCDMPackageDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event) +{ + //get version + wxString versionWx = wxGetTextFromUser( + wxT("Enter the new version name"), + wxT("Change Package Version - creaDevManager"), + crea::std2wx(this->package->GetVersion()) + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties); + if(parts.size() == 3) + { + std::string* result; + if(!this->package->SetVersion(crea::wx2std(versionWx), result)) + wxMessageBox(crea::std2wx(*result),_T("Change Package Version - Error!"),wxOK | wxICON_ERROR); + } + else + { + wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR); + } + this->versiontc->SetLabel(crea::std2wx(this->package->GetVersion())); +} + +void wxCDMPackageDescriptionPanel::OnBtnSetDescription(wxCommandEvent& event) +{ + //get description from user + wxTextEntryDialog* descDlg = new wxTextEntryDialog( + this, + wxT("Edit the package description."), + wxT("Change Package Description - creaDevManager"), + crea::std2wx(this->package->GetDescription()), + wxTE_MULTILINE | wxOK | wxCANCEL + ); + + if (descDlg->ShowModal() == wxID_OK) + { + std::string descriptionStr = crea::wx2std(descDlg->GetValue()); + //check desc + if(descriptionStr.size() > 0) + { + std::string* result; + if(!this->package->SetDescription(descriptionStr, result)) + wxMessageBox(crea::std2wx(*result),_T("Change Package Description - Error!"),wxOK | wxICON_ERROR); + } + this->descriptiontc->SetLabel(crea::std2wx(this->package->GetDescription())); + this->descriptiontc->GetParent()->GetSizer()->RecalcSizes(); + } +} + +void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event) +{ + modelCDMBlackBox* bb; + std::vector bbs = this->package->GetSrc()->GetBlackBoxes(); + for (int i = 0; i < (int)(bbs.size()); i++) + { + if(bbs[i]->GetName() == crea::wx2std(event.GetURL())) + { + bb = bbs[i]; + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(bb); + newEvent->SetId(1); + newEvent->SetString(wxT("blackbox")); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + newEvent1->SetClientData(bb->GetHeaderFile()); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + +} + +void wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event) +{ + + wxCDMNewBlackBoxDialog* dialog = new wxCDMNewBlackBoxDialog(this); + long userResponse; + userResponse = dialog->ShowModal(); + + if(userResponse == wxID_FORWARD) + { + std::string* result; + //create black box + modelCDMIProjectTreeNode* blackBox = this->package->CreateBlackBox( + result, + crea::wx2std(dialog->GetBlackBoxName()), + crea::wx2std(dialog->GetBlackBoxType()), + crea::wx2std(dialog->GetBlackBoxFormat()), + crea::wx2std(dialog->GetBlackBoxCategories()), + crea::wx2std(dialog->GetBlackBoxAuthor()), + crea::wx2std(dialog->GetBlackBoxAuthorEmail()), + crea::wx2std(dialog->GetBlackBoxDescription()) + ); + //check black box created + if(blackBox == NULL) + { + wxMessageBox(crea::std2wx(*result),_T("New Black Box - Error!"),wxOK | wxICON_ERROR); + return; + } + wxMessageBox(crea::std2wx("Black box successfully created."),_T("New Black Box - Success!"),wxOK | wxICON_INFORMATION); + + //refreshing tree and description + //send event instead of calling parent to avoid crashing + + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetClientData(blackBox); + newEvent->SetString(wxT("blackbox")); + newEvent->SetClientData(blackBox); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->package->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + + event.Skip(); +} + +void wxCDMPackageDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->package->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMPackageDescriptionPanel::OnMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + + modelCDMFile* bbHeader = NULL; + std::vector boxes = this->package->GetSrc()->GetBlackBoxes(); + for (int i = 0; i < (int)(boxes.size()); i++) + { + if(boxes[i]->GetName() == BBName) + { + bbHeader = boxes[i]->GetHeaderFile(); + break; + } + } + newEvent->SetClientData(bbHeader); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMPackageDescriptionPanel::OnMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMFile* bbHeader = NULL; + std::vector boxes = this->package->GetSrc()->GetBlackBoxes(); + for (int i = 0; i < (int)(boxes.size()); i++) + { + if(boxes[i]->GetName() == BBName) + { + bbHeader = boxes[i]->GetHeaderFile(); + break; + } + } + newEvent->SetClientData(bbHeader); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMPackageDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMPackageDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h new file mode 100644 index 0000000..8e88f9a --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h @@ -0,0 +1,176 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEDESCRIPTIONPANEL_H_ +#define WXCDMPACKAGEDESCRIPTIONPANEL_H_ + +#include +#include +#include + +#include "modelCDMPackage.h" + +/** + * Package description panel. Shows the package's properties and the available actions for a package. + */ +class wxCDMPackageDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + /** + * Package description panel Constructor. + * @param parent Parent window reference. + * @param package Package class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMPackageDescriptionPanel( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor + */ + ~wxCDMPackageDescriptionPanel(); + + /** + * Package description panel Creator. + * @param parent Parent window reference. + * @param package Package class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + +private: + /** + * Package described. + */ + modelCDMPackage* package; + /** + * Control with the package author. + */ + wxStaticText* authortc; + /** + * Control with the package version. + */ + wxStaticText* versiontc; + /** + * Control with the package description. + */ + wxStaticText* descriptiontc; + + //handlers +protected: + /** + * Handles when a return link is pressed. + */ + void OnBtnReturn(wxHyperlinkEvent& event); + + /** + * Handles when the Set author button is pressed. + */ + void OnBtnSetAuthor(wxCommandEvent& event); + /** + * Handles when the Set version button is pressed. + */ + void OnBtnSetVersion(wxCommandEvent& event); + /** + * Handles when the Change description button is pressed. + */ + void OnBtnSetDescription(wxCommandEvent& event); + + /** + * Handles when a black box link is pressed. + */ + void OnLnkBlackBoxSelect(wxHyperlinkEvent& event); + + /** + * Handles when the create black box button is pressed. + */ + void OnBtnCreateBlackBox(wxCommandEvent& event); + /** + * Handles when the edit cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when the open folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + /** + * Handles when a black box link is hovered. + */ + void OnMouseEnter(wxMouseEvent& event); + /** + * Handles when a black box link exits hover. + */ + void OnMouseExit(wxMouseEvent& event); + /** + * Handles when the edit cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the edit cmakelists file button exits hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + +}; + +#endif /* WXCDMPACKAGEDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMPackageHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMPackageHelpDialog.cpp new file mode 100644 index 0000000..07d653a --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageHelpDialog.cpp @@ -0,0 +1,255 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMPackageHelpDialog.cpp + * + * Created on: 9/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageHelpDialog.h" + +#include "creaDevManagerIds.h" + +#include "modelCDMProject.h" + +BEGIN_EVENT_TABLE(wxCDMPackageHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMPackageHelpDialog::OnCMakeLists) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageHelpDialog::OnCMakeLists) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageHelpDialog::OnFinish) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMPackageHelpDialog::wxCDMPackageHelpDialog( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMPackageHelpDialog::Create(parent, id, caption, position, size, style); + this->package = package; +} + +wxCDMPackageHelpDialog::~wxCDMPackageHelpDialog() +{ +} + +bool wxCDMPackageHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMPackageHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Working with Packages"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Packages contain black boxes, which allow to work modularly with other boxes. This boxes can use the functions " + "present in your libraries and expose them to work in a BBTK-fashion.\n" + "\n" + "To create a black box click on the \"Create Black Box\" button.\n" + "If you want to check the files in the file explorer click the \"Open Package Folder\" " + "button.\n" + "\n" + "Don't forget to include the libraries your black boxes use in the Package directory CMakeLists.txt file\n" + "Also, make sure you include this package in the Project directory CMakeLists.txt file\n" + "You can open these files with the following buttons."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + wxButton* editCMakePkgBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file")); + editCMakePkgBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakePkgBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsExit,NULL,this); + wxButton* editCMakePrjBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file")); + editCMakePrjBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsEnter,NULL,this); + editCMakePrjBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsExit,NULL,this); + + v_sizer1->Add(editCMakePkgBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + v_sizer1->Add(editCMakePrjBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMPackageHelpDialog::OnCMakeLists(wxCommandEvent& event) +{ + std::string* result; + + if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE) + { + + if(!this->package->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->package; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + if(!((modelCDMProject*)node)->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else + { + wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + } +} + +void wxCDMPackageHelpDialog::OnCMakeListsEnter(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->package; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMPackageHelpDialog::OnCMakeListsExit(wxMouseEvent& event) +{ + if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->package->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->package->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT) + { + modelCDMIProjectTreeNode* node = this->package; + while (node != NULL && dynamic_cast(node) == NULL) + { + node = node->GetParent(); + } + if (node != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(((modelCDMProject*)node)->GetCMakeLists() != NULL) + { + newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + } + } + event.Skip(); +} + +void wxCDMPackageHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMPackageHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMPackageHelpDialog.h b/lib/creaDevManagerLib/wxCDMPackageHelpDialog.h new file mode 100644 index 0000000..870f7a7 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageHelpDialog.h @@ -0,0 +1,139 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMPackageHelpDialog.h + * + * Created on: 9/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEHELPDIALOG_H_ +#define WXCDMPACKAGEHELPDIALOG_H_ + +#include +#include + +#include "modelCDMPackage.h" + +#include + +/** + * Package Panel Help Dialog + */ +class wxCDMPackageHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Package Panel Help Dialog Constructor. + * @param parent Parent window. + * @param package Package class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Packages". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 570. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMPackageHelpDialog( + wxWindow* parent, + modelCDMPackage* package, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,570), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMPackageHelpDialog(); + /** + * Package Panel Help Dialog Constructor. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Working with Packages". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 570. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Working With Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,570), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +private: + /** + * Package class reference. + */ + modelCDMPackage* package; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnCMakeLists(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnCMakeListsEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnCMakeListsExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPACKAGEHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp new file mode 100644 index 0000000..6af683d --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.cpp @@ -0,0 +1,188 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMPackageManagerHelpDialog.cpp + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageManagerHelpDialog.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMPackageManagerHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageManagerHelpDialog::OnFinish) +EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerHelpDialog::OnCreatePackage) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerHelpDialog::OnEditCMake) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageManagerHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMPackageManagerHelpDialog::wxCDMPackageManagerHelpDialog( + wxWindow* parent, + wxCDMPackageManagerPanel* packageManager, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMPackageManagerHelpDialog::Create(parent, id, caption, position, size, style); + this->packageManager = packageManager; +} + +wxCDMPackageManagerHelpDialog::~wxCDMPackageManagerHelpDialog() +{ +} + +bool wxCDMPackageManagerHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMPackageManagerHelpDialog::CreateControls() +{ + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Managing your packages"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "Packages contain black boxes, which allow to work modularly with other boxes. This boxes can use the functions " + "present in your libraries and expose them to work in a BBTK-fashion.\n" + "\n" + "In the package manager you can view a list of the available packages in the current project, as well as create " + "new packages. Remember that any package you make must be included in the CMakeLists file. You can do that by " + "clicking on the \"Edit CMakeLists File\" button in the package manager section and include the desired packages " + "at the end of the file. You should also include in this file those libraries your black boxes located in this " + "package use."), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + +// wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15); +// +// wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_CREATE_PACKAGE, wxT("Create a Package")); +// wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit the CMakeLists File")); +// editCMakeBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter,NULL,this); +// editCMakeBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit,NULL,this); +// +// formItems->Add(createPackageBtn, 1, wxALIGN_CENTER); +// formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER); +// +// formItems->AddGrowableCol(0,1); +// formItems->AddGrowableCol(1,1); +// +// v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMPackageManagerHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMPackageManagerHelpDialog::OnCreatePackage(wxCommandEvent& event) +{ + if(this->packageManager != NULL) + { + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_CLICKED); + wxPostEvent(this->packageManager, *newEvent); + } + event.Skip(); + + this->EndDialog(wxID_OK); +} + +void wxCDMPackageManagerHelpDialog::OnEditCMake(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_TOOL_ENTER); + if(this->packageManager != NULL) + wxPostEvent(this->packageManager, *newEvent); + event.Skip(); + + this->EndDialog(wxID_OK); +} + + +void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(packageManager->GetProject()->GetCMakeLists() != NULL) + { + newEvent->SetClientData(packageManager->GetProject()->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMPackageManagerHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(packageManager->GetProject()->GetCMakeLists() != NULL) + { + newEvent->SetClientData(packageManager->GetProject()->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + +void wxCDMPackageManagerHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h new file mode 100644 index 0000000..50c8ed1 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerHelpDialog.h @@ -0,0 +1,143 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMPackageManagerHelpDialog.h + * + * Created on: 7/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEMANAGERHELPDIALOG_H_ +#define WXCDMPACKAGEMANAGERHELPDIALOG_H_ + +#include +#include + +#include "wxCDMPackageManagerPanel.h" + +/** + * Package Manager Panel Help Dialog + */ +class wxCDMPackageManagerHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Package Manager Panel Help Dialog Constructor. + * @param parent Parent window. + * @param packageManager Package Manager panel reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Packages". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 450. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMPackageManagerHelpDialog( + wxWindow* parent, + wxCDMPackageManagerPanel* packageManager, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMPackageManagerHelpDialog(); + /** + * Package Manager Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Managing Packages". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 450. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Managing Packages"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,450), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +//attributes +private: + /** + * Package Manager panel reference. + */ + wxCDMPackageManagerPanel* packageManager; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when the create package button is pressed. + * @param event Unused. + */ + void OnCreatePackage(wxCommandEvent& event); + /** + * Handler when a cmakelists button is pressed. + * @param event cmakelists event. + */ + void OnEditCMake(wxCommandEvent& event); + + /** + * Handler when a cmakelists button is hovered. + * @param event cmakelists event. + */ + void OnEditCMakeMouseEnter(wxMouseEvent& event); + /** + * Handler when a cmakelists button hover finishes. + * @param event cmakelists event. + */ + void OnEditCMakeMouseExit(wxMouseEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPACKAGEMANAGERHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp new file mode 100644 index 0000000..543ac59 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -0,0 +1,333 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageManagerPanel.cpp + * + * Created on: Dec 10, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMPackageManagerPanel.h" + +#include "wxCDMMainFrame.h" +#include "wxCDMNewPackageDialog.h" + +#include "wxCDMPackageManagerHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/PkIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMPackageManagerPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMPackageManagerPanel::OnBtnReturn) +EVT_HYPERLINK(ID_LINK_SELECT_PACKAGE, wxCDMPackageManagerPanel::OnLnkPackageSelect) +EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerPanel::OnBtnCreatePackage) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_CLICKED, wxCDMPackageManagerPanel::OnBtnCreatePackage) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) +EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_ENTER, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) +END_EVENT_TABLE() + +wxCDMPackageManagerPanel::wxCDMPackageManagerPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMPackageManagerPanel::Create(parent, project, id, caption, pos, size, style); +} + +wxCDMPackageManagerPanel::~wxCDMPackageManagerPanel() +{ +} + +bool wxCDMPackageManagerPanel::Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->project = project; + CreateControls(); + return TRUE; +} + +void wxCDMPackageManagerPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Link to return + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(this->project->GetName()), crea::std2wx(this->project->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(wxT("Return to the active project description.")); + sizer->Add(returnLnk, 0, wxALIGN_CENTER | wxALL, 5); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PkIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Package Management")),0, wxALIGN_LEFT, 0); + + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + //Packages + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Packages")); + propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available packages to see its details or modify them. Remember that black boxes are created inside packages, any of these packages is available.")); + wxPanel* propertiesPanel = new wxPanel(this); + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + + std::vector packages = this->project->GetPackages(); + 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()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pPackagelk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription(); + pPackagelk->SetToolTip(crea::std2wx(tt)); + 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, 1, wxALL | wxEXPAND, 5); + + sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10); + + //Actions + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions")); + wxPanel* actionsPanel = new wxPanel(this); + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(1, 2, 9, 15); + + wxButton* createPkgbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_PACKAGE, _T("A. Create Package")); + createPkgbt->SetToolTip(wxT("Create a new package for this project.")); + actionsGridSizer->Add(createPkgbt, 1, wxALL | wxEXPAND, 5); + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file of this project.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxEXPAND); + sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + //Assign sizer + SetSizer(sizer); + sizer->SetSizeHints(this); + + if (((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMPackageManagerHelpDialog* helpDialog = new wxCDMPackageManagerHelpDialog(this->GetParent(), this, wxID_ANY); + helpDialog->Show(true); + } +} + +modelCDMProject* wxCDMPackageManagerPanel::GetProject() const +{ + return this->project; +} + +void wxCDMPackageManagerPanel::OnBtnReturn(wxHyperlinkEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(project); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); +} + +void wxCDMPackageManagerPanel::OnLnkPackageSelect(wxHyperlinkEvent& event) +{ + modelCDMPackage* thePackage = NULL; + std::vector packages = this->project->GetPackages(); + for (int i = 0; i < (int)(packages.size()); i++) + { + if(packages[i]->GetName() == crea::wx2std(event.GetURL())) + { + thePackage = packages[i]; + break; + } + } + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(thePackage); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + newEvent1->SetClientData(thePackage); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + +} + +void wxCDMPackageManagerPanel::OnBtnCreatePackage(wxCommandEvent& event) +{ + std::string* result; + + wxCDMNewPackageDialog* dialog = new wxCDMNewPackageDialog(this); + long userResponse; + userResponse = dialog->ShowModal(); + + if(userResponse == wxID_FORWARD) + { + modelCDMIProjectTreeNode* package = this->project->CreatePackage( + crea::wx2std(dialog->GetPackageName()), + result, + crea::wx2std(dialog->GetPackageAuthor()), + crea::wx2std(dialog->GetPackageAuthorEmail()), + crea::wx2std(dialog->GetPackageDescription()) + ); + if(package == NULL) + { + std::cout << "error creating package: " << *result << std::endl; + wxMessageBox(crea::std2wx(*result),_T("New Package - Error!"),wxOK | wxICON_ERROR); + event.Skip(); + return; + } + wxMessageBox(crea::std2wx("Package successfully created."),_T("New Package - Success!"),wxOK | wxICON_INFORMATION); + + //refreshing tree and description + //send event instead of calling parent to avoid crashing + + ((wxCDMMainFrame*)this->GetParent())->RefreshProject(); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetClientData(package); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); + } + + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->project->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void wxCDMPackageManagerPanel::OnMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMPackage* thePackage = NULL; + std::vector packages = this->project->GetPackages(); + for (int i = 0; i < (int)(packages.size()); i++) + { + if(packages[i]->GetName() == PkgName) + { + thePackage = packages[i]; + break; + } + } + newEvent->SetClientData(thePackage); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL()); + modelCDMPackage* thePackage = NULL; + std::vector packages = this->project->GetPackages(); + project->GetPackages(); + for (int i = 0; i < (int)(packages.size()); i++) + { + if(packages[i]->GetName() == PkgName) + { + thePackage = packages[i]; + break; + } + } + newEvent->SetClientData(thePackage); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMPackageManagerPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + + diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h new file mode 100644 index 0000000..66a1d1c --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h @@ -0,0 +1,156 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMPackageManagerPanel.h + * + * Created on: Dec 10, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPACKAGEMANAGERPANEL_H_ +#define WXCDMPACKAGEMANAGERPANEL_H_ + +#include +#include +#include +#include + +#include "modelCDMProject.h" + +/** + * Package manager description panel. Shows the available packages in the project and the actions corresponding to package management. + */ +class wxCDMPackageManagerPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + + /** + * Package manager description panel Constructor. + * @param parent Parent window reference. + * @param project Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMPackageManagerPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMPackageManagerPanel(); + + /** + * Package manager description panel Creator. + * @param parent Parent window reference. + * @param project Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + bool Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + + /** + * Retrieves the described project class reference. + * @return Project reference. + */ + modelCDMProject* GetProject() const; + +private: + /** + * Project described. + */ + modelCDMProject* project; + + //handlers +protected: + /** + * Handles when a return link is pressed. + * @param event Has the link reference to know where to return + */ + void OnBtnReturn(wxHyperlinkEvent& event); + /** + * Handles when a packages link is pressed. + * @param event Has the link reference to know which package was selected. + */ + void OnLnkPackageSelect(wxHyperlinkEvent& event); + /** + * Handles when the create package button is pressed. + */ + void OnBtnCreatePackage(wxCommandEvent& event); + /** + * Handles when the open package cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + + /** + * Handles when a package link is hovered. + * @param event Has the link reference to know which package was selected. + */ + void OnMouseEnter(wxMouseEvent& event); + /** + * Handles when a package link button finishes hover. + * @param event Has the link reference to know which package was selected. + */ + void OnMouseExit(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); +}; + +#endif /* WXCDMPACKAGEMANAGERPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp index fec0050..9871519 100755 --- a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp @@ -21,7 +21,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -33,10 +33,23 @@ #include "wxCDMProjectActionsPanel.h" +#include + +#include "creaDevManagerIds.h" +#include +#include "wxCDMProjectStructureReportDialog.h" + +BEGIN_EVENT_TABLE(wxCDMProjectActionsPanel, wxPanel) +EVT_BUTTON(ID_BUTTON_CHECK_PROJECT, wxCDMProjectActionsPanel::OnBtnCheckProjectStructure) +EVT_BUTTON(ID_BUTTON_BUILD_PROJECT, wxCDMProjectActionsPanel::OnBtnBuildProject) +EVT_BUTTON(ID_BUTTON_CONFIGURE_BUILD, wxCDMProjectActionsPanel::OnBtnConfigureBuild) +EVT_BUTTON(ID_BUTTON_CONNECT_PROJECT, wxCDMProjectActionsPanel::OnBtnConnectProject) +END_EVENT_TABLE() wxCDMProjectActionsPanel::wxCDMProjectActionsPanel( wxWindow* parent, + modelCDMProject* project, wxWindowID id, const wxString& caption, const wxPoint& pos, @@ -45,6 +58,7 @@ wxCDMProjectActionsPanel::wxCDMProjectActionsPanel( ) { wxCDMProjectActionsPanel::Create(parent,id,caption,pos,size,style); + this->project = project; } wxCDMProjectActionsPanel::~wxCDMProjectActionsPanel() @@ -71,8 +85,103 @@ bool wxCDMProjectActionsPanel::Create( void wxCDMProjectActionsPanel::CreateControls() { - this->GetSizer()->Add(new wxButton(this, -1, _T("Action 1")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, -1, _T("Action 2")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, -1, _T("Action 3")), 0, wxALL, 5); - this->GetSizer()->Add(new wxButton(this, -1, _T("Action 4")), 0, wxALL, 5); + wxButton* checkStructbt = new wxButton(this, ID_BUTTON_CHECK_PROJECT, _T("1. Check Project Structure")); + checkStructbt->SetToolTip(wxT("This step checks the project structure and tells what is going to be compiled.")); + wxButton* configurebt = new wxButton(this, ID_BUTTON_CONFIGURE_BUILD, _T("2. Configure Project (CMake)")); + configurebt->SetToolTip(wxT("This is the second step in order to execute the project. Make sure you have selected the desired Build location.")); + wxButton* compilebt = new wxButton(this, ID_BUTTON_BUILD_PROJECT, _T("3. Compile Project")); + compilebt->SetToolTip(wxT("This step should be done after configuring the project. This will create the executables.")); + wxButton* plugbt = new wxButton(this, ID_BUTTON_CONNECT_PROJECT, _T("4. Plug Packages (BBTK)")); + plugbt->SetToolTip(wxT("This step should be done after compiling the project. This will allow to use the boxes in this project to be available in the bbEditor.")); + this->GetSizer()->Add(checkStructbt, 0, wxALL, 5); + this->GetSizer()->Add(configurebt, 0, wxALL, 5); + this->GetSizer()->Add(compilebt, 0, wxALL, 5); + this->GetSizer()->Add(plugbt, 0, wxALL, 5); +} + +//check project structure +void wxCDMProjectActionsPanel::OnBtnCheckProjectStructure(wxCommandEvent& event) +{ + std::map prjStruct; + this->project->CheckStructure(prjStruct); + std::cout << prjStruct.size() << std::endl; + wxCDMProjectStructureReportDialog* structure = new wxCDMProjectStructureReportDialog(this->GetParent(), prjStruct, wxID_ANY); + structure->Show(true); +} + +//configure project +void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event) +{ + std::string* result; + if(!this->project->ConfigureBuild(result)) + { + wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Configuration - Error!")); + return; + } + wxMessageBox(crea::std2wx("The configuration was executed successfully."), wxT("Project Configuration")); +} + +//compile project +void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event) +{ +#ifdef _WIN32 + std::string* result; + if(!this->project->Build(result, "")) + { + wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!")); + return; + } +#else + //get author from user + wxTextEntryDialog* buildDlg = new wxTextEntryDialog( + this, + wxT("Enter the compilation instruction:"), + wxT("Project Compilation- creaDevManager"), + crea::std2wx(this->project->GetBuildInstruction()), + wxTE_MULTILINE | wxOK | wxCANCEL + ); + + if (buildDlg->ShowModal() == wxID_OK) + { + std::string buildDlgStr = crea::wx2std(buildDlg->GetValue()); + //check name + if (buildDlgStr != "") + { + std::string* result; + //wxProgressDialog* loadBar = new wxProgressDialog(wxT("Compiling"), wxT("Please wait while the compilation is executing..."), 100, this); + //loadBar->Pulse(); + if(!this->project->Build(result, buildDlgStr)) + { + //loadBar->Destroy(); + wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!")); + return; + } + //loadBar->Destroy(); + //wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation")); + } + } +#endif +} +//plug packages +void wxCDMProjectActionsPanel::OnBtnConnectProject(wxCommandEvent& event) +{ + std::string* result; + wxString file = wxDirSelector( + wxT("Please select the folder containing the bbtkPackage file you want to use. Usually it is where you built your project."), + crea::std2wx(this->project->GetBuildPath()) + ); + + if(crea::wx2std(file) == "" || !this->project->Connect(result, crea::wx2std(file))) + { + if (crea::wx2std(file) == "") + result = new std::string("Folder not specified."); + wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug BBTK Packages - Error!"), wxICON_ERROR); + return; + } +#ifdef _WIN32 + wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the console to see the compilation result."), wxT("Plug Package")); +#else + wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to see the compilation result."), wxT("Plug Package")); +#endif + } diff --git a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.h b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.h index 74133d1..93850e2 100755 --- a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.h @@ -39,18 +39,48 @@ #include #include +#include "modelCDMProject.h" + +/** + * Panel with common actions for an open Crea project. + */ class wxCDMProjectActionsPanel : public wxPanel { + DECLARE_EVENT_TABLE() public: + /** + * Project actions panel constructor. + * @param parent Parent window reference. + * @param project Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ wxCDMProjectActionsPanel( wxWindow* parent, + modelCDMProject* project, wxWindowID id = -1, const wxString& caption = _("Description Frame"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE ); + /** + * Destructor. + */ ~wxCDMProjectActionsPanel(); + /** + * Project actions panel constructor. + * @param parent Parent window reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if the creation was successful. + */ bool Create( wxWindow* parent, wxWindowID id = -1, @@ -61,7 +91,33 @@ public: ); protected: + /** + * Creates the Panel controls (buttons) + */ void CreateControls(); + + /** + * Handles when the Check Project Structure button is pressed. + */ + void OnBtnCheckProjectStructure(wxCommandEvent& event); + /** + * Handles when the Configure Compilation button is pressed. + */ + void OnBtnConfigureBuild(wxCommandEvent& event); + /** + * Handles when the Compile Project button is pressed. + */ + void OnBtnBuildProject(wxCommandEvent& event); + /** + * Handles when the Plug packages button is pressed. + */ + void OnBtnConnectProject(wxCommandEvent& event); + +private: + /** + * Project class reference + */ + modelCDMProject* project; }; #endif /* WXCDMPROJECTACTIONSPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp new file mode 100644 index 0000000..76aa9bb --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -0,0 +1,429 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMProjectDescriptionPanel.cpp + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMProjectDescriptionPanel.h" + +#include "wxCDMMainFrame.h" +#include "wxCDMNewPackageDialog.h" + +#include "wxCDMProjectHelpDialog.h" + +#include "creaDevManagerIds.h" +#include "images/PrIcon64.xpm" +#include "CDMUtilities.h" + +BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel) +EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManagePackages) +EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageLibraries) +EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageApplications) +EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists) +EVT_BUTTON(ID_BUTTON_SET_BUILD_PATH, wxCDMProjectDescriptionPanel::OnBtnSetBuildPath) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMProjectDescriptionPanel::OnBtnOpenFolder) +EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMProjectDescriptionPanel::OnBtnSetVersion) +END_EVENT_TABLE() + +wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMProjectDescriptionPanel::Create(parent, project, id, caption, pos, size, style); +} + +wxCDMProjectDescriptionPanel::~wxCDMProjectDescriptionPanel() +{ +} + +bool wxCDMProjectDescriptionPanel::Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->project = project; + CreateControls(); + return TRUE; +} + +void wxCDMProjectDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Header + wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL); + { + //Image + headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PrIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("Project")),0, wxALIGN_LEFT, 0); + //Project Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->project->GetName())),0, wxALIGN_LEFT, 0); + headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + } + sizer->Add(headerSizer, 0, wxALIGN_CENTER); + + + + + //----------------------------------Project Properties----------------------------------- + //properties StaticBoxSizer + wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, _T("&Properties")); + //properties Panel + wxPanel* propertiesPanel = new wxPanel(this); + //properties Sizer + wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); + //propertiesGrid Sizer + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15); + //properties elements + //labels + wxStaticText* pVersion = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Version")); + wxStaticText* pVersionDate = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Version Date")); + wxStaticText* pSourceLocation = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Source Location")); + wxStaticText* pBuildLocation = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Build Location")); + //values + // version + wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL); + this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->project->GetVersion())); + wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set")); + pVersionbt->SetToolTip(wxT("Update the version of the project.")); + pVersionsz->Add(this->versiontc, 1, wxALIGN_CENTER, 1); + pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); + // versionDate + this->versionDatetc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetVersionDate())); + // sourceLocation + wxBoxSizer* pSourceLocationsz = new wxBoxSizer(wxHORIZONTAL); + wxStaticText* pSourceLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetPath())); + //pSourceLocationtc->SetMaxSize(wxSize(350,-1)); + wxButton* pSourceLocationbt = new wxButton(propertiesPanel, ID_BUTTON_OPEN_FOLDER, wxT("Open")); + pSourceLocationbt->SetToolTip(wxT("Open the source folder in the file explorer.")); + pSourceLocationsz->Add(pSourceLocationtc, 1, wxALIGN_CENTER, 1); + pSourceLocationsz->Add(pSourceLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); + // buildLocation + wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL); + this->buildPathtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetBuildPath())); + //this->buildPathtc->SetMaxSize(wxSize(350,-1)); + wxButton* pBuildLocationbt = new wxButton(propertiesPanel, ID_BUTTON_SET_BUILD_PATH, wxT("Choose")); + pBuildLocationbt->SetToolTip(wxT("Select a new location for compiling the project.")); + pBuildLocationsz->Add(this->buildPathtc, 1, wxALIGN_CENTER, 1); + pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); + + propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND); + propertiesGridSizer->Add(pVersionDate, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(this->versionDatetc, 1, wxEXPAND); + propertiesGridSizer->Add(pSourceLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pSourceLocationsz, 1, wxEXPAND); + propertiesGridSizer->Add(pBuildLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + propertiesGridSizer->Add(pBuildLocationsz, 1, wxEXPAND); + + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanelSizer-> Add(propertiesGridSizer, 1, wxALL | wxEXPAND, 5); + + //SetPanel sizer and box + propertiesPanel->SetSizer(propertiesPanelSizer); + propertiesPanelSizer->Fit(propertiesPanel); + propertiesBox->Add(propertiesPanel, 1, wxEXPAND); + sizer->Add(propertiesBox, 0, wxEXPAND | wxLEFT | wxRIGHT, 10); + + //----------------------------------Project Actions-------------------------------------- + //actions StaticBoxSizer + wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL,this, _T("&Actions")); + actionsBox->GetStaticBox()->SetToolTip(wxT("Go to any of the content managers of the project or edit the project's CMakeLists.txt file by selecting any of the available actions.")); + //actions Panel + wxPanel* actionsPanel = new wxPanel(this); + //actions Sizer + wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL); + + //actionsGrid Sizer + wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15); + //buttons + // lib manager + // show only if there is a lib folder + if(this->project->GetLib() != NULL) + { + wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("A. Library Manager")); + libMgrbt->SetToolTip(wxT("Find the current available libraries into this project. You can also create new Libraries in this section as well as edit the lib folder's CMakeLists.txt file.")); + libMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseEnter,NULL,this); + libMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseExit,NULL,this); + actionsGridSizer->Add(libMgrbt, 1, wxALL | wxEXPAND, 5); + } + // package manager + wxButton* packageMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("B. Package Manager")); + packageMgrbt->SetToolTip(wxT("Find the current available packages into this project. You can also create new Packages in this section.")); + actionsGridSizer->Add(packageMgrbt, 1, wxALL | wxEXPAND, 5); + + // appli manager + // show only if there is a appli folder + if(this->project->GetAppli() != NULL) + { + wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("C. Application Manager")); + appliMgrbt->SetToolTip(wxT("Find the current available applications into this project. You can also create new Applications in this section as well as edit the appli folder's CMakeLists.txt file.")); + appliMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseEnter,NULL,this); + appliMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseExit,NULL,this); + actionsGridSizer->Add(appliMgrbt, 1, wxALL | wxEXPAND, 5); + } + // edit CMakeLists file + wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("D. Edit CMakeLists File")); + editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file of this project.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseExit,NULL,this); + actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); + + actionsGridSizer->AddGrowableCol(0,1); + actionsGridSizer->AddGrowableCol(1,1); + + actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0); + //SetPanel sizer and box + actionsPanel->SetSizer(actionsPanelSizer); + actionsPanelSizer->Fit(actionsPanel); + actionsBox->Add(actionsPanel, 1, wxALL | wxEXPAND, 5); + sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10); + + + //Assign sizer + this->SetSizer(sizer); + sizer->SetSizeHints(this); + + if(((wxCDMMainFrame*)this->GetParent())->isHelp()) + { + wxCDMProjectHelpDialog* helpDialog = new wxCDMProjectHelpDialog(this->GetParent(), this->project, wxID_ANY); + helpDialog->Show(true); + } +} + +modelCDMProject* wxCDMProjectDescriptionPanel::GetProject() const +{ + return this->project; +} + +void wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_packages")); + newEvent->SetClientData(this->project); + wxPostEvent(this->GetParent(), *newEvent); + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_libraries")); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetLib() != NULL) + { + newEvent1->SetClientData(this->project->GetLib()); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); + newEvent->SetId(1); + newEvent->SetString(wxT("manage_applications")); + wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetAppli() != NULL) + { + newEvent1->SetClientData(this->project->GetAppli()); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) +{ + std::string* result; + if(!this->project->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } +} + +void +wxCDMProjectDescriptionPanel::OnBtnSetBuildPath(wxCommandEvent& event) +{ + wxDirDialog* dialog = new wxDirDialog(this, wxT("Choose the new build location for the project")); + if(dialog->ShowModal()) + { + std::string* result; + if(!this->project->SetBuildPath(crea::wx2std(dialog->GetPath()), result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); + } + this->buildPathtc->SetLabel(crea::std2wx(this->project->GetBuildPath())); +} + +void +wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->project->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} + +void wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event) +{ + //get version + wxString libraryName = wxGetTextFromUser( + wxT("Enter the new version name"), + wxT("Change Project Version - creaDevManager"), + crea::std2wx(this->project->GetVersion()) + ); + //check name + std::vector parts; + CDMUtilities::splitter::split(parts, crea::wx2std(libraryName), " .", CDMUtilities::splitter::no_empties); + if(parts.size() == 3) + { + std::string* result; + if(!this->project->SetVersion(crea::wx2std(libraryName), result)) + wxMessageBox(crea::std2wx(*result),_T("Open File - Error!"),wxOK | wxICON_ERROR); + } + else + { + wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR); + } + this->versiontc->SetLabel(crea::std2wx(this->project->GetVersion())); + this->versionDatetc->SetLabel(crea::std2wx(this->project->GetVersionDate())); + +} + +void wxCDMProjectDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + newEvent->SetClientData(this->project->GetCMakeLists()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnAppliMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + std::cout << "entra appli " << this->project->GetAppli()->GetCMakeLists(); + if(this->project->GetAppli() != NULL) + { + newEvent->SetClientData(this->project->GetAppli()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnAppliMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetAppli() != NULL) + { + newEvent->SetClientData(this->project->GetAppli()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnLibMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED); + + if(this->project->GetLib() != NULL) + { + newEvent->SetClientData(this->project->GetLib()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnLibMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); + + if(this->project->GetLib() != NULL) + { + newEvent->SetClientData(this->project->GetLib()); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h new file mode 100644 index 0000000..86726c5 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -0,0 +1,183 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMProjectDescriptionPanel.h + * + * Created on: Nov 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPROJECTDESCRIPTIONPANEL_H_ +#define WXCDMPROJECTDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMProject.h" + +/** + * Project Description Panel. Shows the project properties and the principal actions for the project. + */ +class wxCDMProjectDescriptionPanel : public wxPanel +{ + DECLARE_EVENT_TABLE() +public: + + /** + * Project Description panel Constructor. + * @param parent Parent window reference. + * @param project Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + */ + wxCDMProjectDescriptionPanel( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMProjectDescriptionPanel(); + + /** + * Project Description panel Creator. + * @param parent Parent window reference. + * @param project Project class reference. + * @param id Panel ID. By default -1. + * @param caption Panel label. By default "Description Frame". + * @param pos Panel position. By default wxDefaultPosition. + * @param size Panel size. By default wxDefaultSize. + * @param style Panel style. By default wxDEFAULT_FRAME_STYLE. + * @return True if creation was successful. + */ + bool Create( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Creates all the controls in the panel (property and action controls). + */ + void CreateControls(); + + /** + * Retrieves the described project class reference. + * @return Project reference. + */ + modelCDMProject* GetProject() const; + +private: + /** + * Project described + */ + modelCDMProject* project; + /** + * Text control showing the project version. + */ + wxStaticText* versiontc; + /** + * Text control showing the project version date. + */ + wxStaticText* versionDatetc; + /** + * Text control showing the project build path. + */ + wxStaticText* buildPathtc; + + //handlers +protected: + /** + * Handles when the manage packages button is pressed. + */ + void OnBtnManagePackages(wxCommandEvent& event); + /** + * Handles when the manage libraries button is pressed. + */ + void OnBtnManageLibraries(wxCommandEvent& event); + /** + * Handles when the manage applications button is pressed. + */ + void OnBtnManageApplications(wxCommandEvent& event); + /** + * Handles when the open cmakelists file button is pressed. + */ + void OnBtnEditCMakeLists(wxCommandEvent& event); + /** + * Handles when the choose build path button is pressed. + */ + void OnBtnSetBuildPath(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); + /** + * Handles when the set version button is pressed. + */ + void OnBtnSetVersion(wxCommandEvent& event); + + /** + * Handles when the open cmakelists file button is hovered. + */ + void OnCMakeMouseEnter(wxMouseEvent& event); + /** + * Handles when the open cmakelists file button finishes hover. + */ + void OnCMakeMouseExit(wxMouseEvent& event); + /** + * Handles when the manage applications button is hovered. + */ + void OnAppliMouseEnter(wxMouseEvent& event); + /** + * Handles when the manage applications file button finishes hover. + */ + void OnAppliMouseExit(wxMouseEvent& event); + /** + * Handles when the manage libraries button is hovered. + */ + void OnLibMouseEnter(wxMouseEvent& event); + /** + * Handles when the manage libraries button finishes hover. + */ + void OnLibMouseExit(wxMouseEvent& event); +}; + +#endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp new file mode 100644 index 0000000..baf51a9 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.cpp @@ -0,0 +1,129 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMProjectReadyDialog.cpp + * + * Created on: 3/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMProjectHelpDialog.h" + +#include "wxCDMProjectDescriptionPanel.h" + +#include "creaDevManagerIds.h" + +BEGIN_EVENT_TABLE(wxCDMProjectHelpDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectHelpDialog::OnFinish) +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMProjectHelpDialog::OnDisableHelp) +END_EVENT_TABLE() + +wxCDMProjectHelpDialog::wxCDMProjectHelpDialog( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style); + this->project = project; +} + +wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog() +{ +} + +bool wxCDMProjectHelpDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMProjectHelpDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + + wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Your project is ready!"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); + v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText* instruction = new wxStaticText( + this, + wxID_ANY, + crea::std2wx( + "A project has four main elements:\n" + "- Packages: Host the black boxes you make.\n" + "- Libraries: Contain the core functions of your programs, they are called by the black boxes and applications you make.\n" + "- Applications: Stand alone programs that use the functions available on your libraries.\n" + "- Configuration file: Contains the information of what should or shouldn't be compiled from this project.\n" + "\n" + "To the right of the description panel you will find a tree with the project structure and it's actual content.\n" + "Bellow the description panel you will find a panel with the project's main actions when you're ready to compile " + "the project. you can hover on this buttons to see more information about what they do.\n" + "When you create a project it comes with a default package. If you need to work on it or if you want to create more " + "packages you can do it by clicking the \"Package Manager\" button bellow. You can also work with Libraries and " + "Applications. Just click in the \"Library Manager\" button or \"Application manager\" button to start working " + "with them.\n"), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_LEFT + ); + v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); + + v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); + + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); + + SetSizer(v_sizer1); + //v_sizer1->RecalcSizes(); +} + +void wxCDMProjectHelpDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +void wxCDMProjectHelpDialog::OnDisableHelp(wxCommandEvent& event) +{ + wxPostEvent(this->GetParent(), event); +} diff --git a/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h new file mode 100644 index 0000000..2e03c56 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectHelpDialog.h @@ -0,0 +1,121 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMProjectHelpDialog.h + * + * Created on: 3/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPROJECTHELPDIALOG_H_ +#define WXCDMPROJECTHELPDIALOG_H_ + +#include +#include + +#include "wxCDMProjectDescriptionPanel.h" + +/** + * Project Panel Help Dialog + */ +class wxCDMProjectHelpDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Project Panel Help Dialog Constructor. + * @param parent Parent window. + * @param project Project class reference. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Project Ready". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 700. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMProjectHelpDialog( + wxWindow* parent, + modelCDMProject* project, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Ready"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,700), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMProjectHelpDialog(); + /** + * Project Panel Help Dialog Creator. + * @param parent Parent window. + * @param id Dialog ID. By default wxID_ANY. + * @param caption Dialog label. By default "Project Ready". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 350, 700. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Ready"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(350,700), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the help controls (text and buttons). + */ + void CreateControls(); + +//attributes +private: + /** + * Project class reference. + */ + modelCDMProject* project; + +//handlers +protected: + /** + * Handler to close help dialog. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + + /** + * Handler when the disable help checkbox is changed. + * @param event Check box event. + */ + void OnDisableHelp(wxCommandEvent& event); +}; + +#endif /* WXCDMPROJECTHELPDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.cpp b/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.cpp new file mode 100644 index 0000000..8c5ff80 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.cpp @@ -0,0 +1,558 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + + +/* + * wxCDMProjectStructureReportDialog.cpp + * + * Created on: 17/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMProjectStructureReportDialog.h" + +#include "creaDevManagerIds.h" + +#include +#include +#include "CDMUtilities.h" + +BEGIN_EVENT_TABLE(wxCDMProjectStructureReportDialog, wxDialog) +EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectStructureReportDialog::OnFinish) +END_EVENT_TABLE() + +wxCDMProjectStructureReportDialog::wxCDMProjectStructureReportDialog( + wxWindow* parent, + const std::map& properties, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long style +) +{ + this->properties = properties; + wxCDMProjectStructureReportDialog::Create(parent, id, caption, position, size, style); +} + +wxCDMProjectStructureReportDialog::~wxCDMProjectStructureReportDialog() +{ +} + +bool wxCDMProjectStructureReportDialog::Create( + wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& position, + const wxSize& size, + long int style +) +{ + wxDialog::Create(parent, id, caption, position, size, style); + + this->CreateControls(); + + return TRUE; +} + +void wxCDMProjectStructureReportDialog::CreateControls() +{ + + wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); + + wxHtmlWindow* htmlWindow = new wxHtmlWindow(this, wxID_ANY); + htmlWindow->SetPage(this->GetContent()); + v_sizer1->Add(htmlWindow, 1, wxEXPAND); + v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")),0,wxEXPAND); + + SetSizer(v_sizer1); +} + +void wxCDMProjectStructureReportDialog::OnFinish(wxCommandEvent& event) +{ + this->EndDialog(wxID_CANCEL); +} + +wxString wxCDMProjectStructureReportDialog::GetContent() +{ + std::map::iterator it, it2; + std::map pkgs; + std::map libs; + std::map applis; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + std::cout << it->first << " " << it->second << std::endl; + if(it->first.substr(0,7) == "package") + { + std::vector words; + CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); + pkgs[words[1]] = true; + } + else if(it->first.substr(0,7) == "library") + { + std::vector words; + CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); + libs[words[1]] = true; + } + else if(it->first.substr(0,11) == "application") + { + std::vector words; + CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); + applis[words[1]] = true; + } + } + std::string report = ""; + report += + "" + "" + " Project Structure Check Report" + "" + "" + "

Project Structure Check Report

" + "
" + "

Project CMakeLists.txt

" + "

" + " Includes the following built-in libraries:" + "

    "; + if(this->properties["project set USE_CREA"]) + report += + "
  • Crea
  • "; + if(this->properties["project set USE_GDCM"]) + report += + "
  • GDCM
  • "; + if(this->properties["project set USE_GDCM_VTK"]) + report += + "
  • GDCM_VTK
  • "; + if(this->properties["project set USE_GDCM2"]) + report += + "
  • GDCM2
  • "; + if(this->properties["project set USE_WXWIDGETS"]) + report += + "
  • wxWidgets
  • "; + if(this->properties["project set USE_KWWIDGETS"]) + report += + "
  • kwWidgets
  • "; + if(this->properties["project set USE_VTK"]) + report += + "
  • VTK
  • "; + if(this->properties["project set USE_ITK"]) + report += + "
  • ITK
  • "; + if(this->properties["project set USE_BOOST"]) + report += + "
  • Boost
  • "; + report+= + "
" + "

" + "

" + " Doesn't include the following built-in libraries:" + "

    "; + if(!this->properties["project set USE_CREA"]) + report += + "
  • Crea
  • "; + if(!this->properties["project set USE_GDCM"]) + report += + "
  • GDCM
  • "; + if(!this->properties["project set USE_GDCM_VTK"]) + report += + "
  • GDCM_VTK
  • "; + if(!this->properties["project set USE_GDCM2"]) + report += + "
  • GDCM2
  • "; + if(!this->properties["project set USE_WXWIDGETS"]) + report += + "
  • wxWidgets
  • "; + if(!this->properties["project set USE_KWWIDGETS"]) + report += + "
  • kwWidgets
  • "; + if(!this->properties["project set USE_VTK"]) + report += + "
  • VTK
  • "; + if(!this->properties["project set USE_ITK"]) + report += + "
  • ITK
  • "; + if(!this->properties["project set USE_BOOST"]) + report += + "
  • Boost
  • "; + report+= + "
" + "

" + "

" + " Includes:" + "

    "; + if(this->properties["project add lib"]) + report += + "
  • Lib
  • "; + if(this->properties["project add appli"]) + report += + "
  • Appli
  • "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == true && it->first.substr(0,11) == "project add") + { + std::string namePkg = it->first.substr(12); + if (namePkg.substr(0,4) == "bbtk") + report += + "
  • Package " + namePkg + "
  • "; + } + } + report+= + "
" + "

" + "

Doesn't include:" + "

    "; + if(!this->properties["project add lib"]) + report += + "
  • " + " Lib: use" + "
    ADD_SUBDIRECTORY(lib)
    " + " in the project CMakeLists file." + "
  • "; + if(!this->properties["project add appli"]) + report += + "
  • " + " Appli: use" + "
    ADD_SUBDIRECTORY(appli)
    " + " in the project CMakeLists file." + "
  • "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == false && it->first.substr(0,11) == "project add") + { + std::string namePkg = it->first.substr(12); + report += + "
  • " + " Package \"" + namePkg + "\": use" + "
    ADD_SUBDIRECTORY(" + namePkg + ")
    " + " in the project CMakeLists file." + "
  • "; + } + } + report+= + "
" + "

" + "
"; + + for (it = pkgs.begin(); it != pkgs.end(); it++) + { + report += + "
first + "Chk\">" + "

Package " + it->first + " CMakeLists.txt

" + "

" + " Includes the following built-in libraries:" + "

    "; + if(this->properties["package " + it->first + " set USE_VTK"]) + report += + "
  • VTK
  • "; + if(this->properties["package " + it->first + " set USE_ITK"]) + report += + "
  • ITK
  • "; + if(this->properties["package " + it->first + " set USE_GDCM"]) + report += + "
  • GDCM
  • "; + if(this->properties["package " + it->first + " set USE_GDC_VTK"]) + report += + "
  • GDCM_VTK
  • "; + if(this->properties["package " + it->first + " set USE_GSMIS"]) + report += + "
  • GSMIS
  • "; + if(this->properties["package " + it->first + " set USE_WXWIDGETS"]) + report += + "
  • wxWidgets
  • "; + if(this->properties["package " + it->first + " set USE_KWWIDGETS"]) + report += + "
  • kwWidgets
  • "; + report += + "
" + "

" + "

" + " Doesn't include the following built-in libraries:" + "

    "; + if(!this->properties["package " + it->first + " set USE_VTK"]) + report += + "
  • VTK
  • "; + if(!this->properties["package " + it->first + " set USE_ITK"]) + report += + "
  • ITK
  • "; + if(!this->properties["package " + it->first + " set USE_GDCM"]) + report += + "
  • GDCM
  • "; + if(!this->properties["package " + it->first + " set USE_GDC_VTK"]) + report += + "
  • GDCM_VTK
  • "; + if(!this->properties["package " + it->first + " set USE_GSMIS"]) + report += + "
  • GSMIS
  • "; + if(!this->properties["package " + it->first + " set USE_WXWIDGETS"]) + report += + "
  • wxWidgets
  • "; + if(!this->properties["package " + it->first + " set USE_KWWIDGETS"]) + report += + "
  • kwWidgets
  • "; + report += + "
" + "

" + "

" + " Includes the following additional directories:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string pkgname = "package " + it->first + " dir"; + if(it2->first.substr(0,pkgname.size()) == pkgname) + { + std::string directoryName = it2->first.substr(pkgname.size()+1); + report += + "
  • " + directoryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Includes the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string pkgname = "package " + it->first + " lib"; + if(it2->first.substr(0,pkgname.size()) == pkgname) + { + std::string libraryName = it2->first.substr(pkgname.size()+1); + report += + "
  • " + libraryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Note:
" + " Please include the following lines in the package CMakeLists file in order to add a library:
" + " - In section SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS use:" + "

" + " ../lib/[libraryFolderName]" + "
" + " - In section SET(${BBTK_PACKAGE_NAME}_LIBS use:" + "
" + " [libraryName]" + "
" + "

" + "
"; + } + report += + "
" + "

Lib CMakeLists.txt

" + "

" + " Includes libraries:" + "

    "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == true && it->first.substr(0, 7) == "lib add") + { + std::string nameLib = it->first.substr(8); + report += + "
  • " + nameLib + "
  • "; + } + } + report += + "
" + "

" + "

Doesn't include libraries:" + "

    "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == false && it->first.substr(0, 7) == "lib add") + { + std::string nameLib = it->first.substr(8); + report += + "
  • " + nameLib + "
  • "; + } + } + report += + "
" + "

" + "

" + " Note:
" + " Please include the following lines in the lib CMakeLists file in order to add a library:" + "

ADD_SUBDIRECTORY([libraryName])
" + "

" + "
"; + for (it = libs.begin(); it != libs.end(); it++) + { + report += + "
first + "Chk\">" + "

Library " + it->first + " CMakeLists.txt

" + "

" + " Includes the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string libname = "library " + it->first + " lib"; + if(it2->second == true && it2->first.substr(0,libname.size()) == libname) + { + std::string libraryName = it2->first.substr(libname.size()+1); + report += + "
  • " + libraryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Doesn't include the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string libname = "library " + it->first + " lib"; + if(it2->second == false && it2->first.substr(0,libname.size()) == libname) + { + std::string libraryName = it2->first.substr(libname.size()+1); + report += + "
  • " + libraryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Note:
" + " Please include the following line in the library CMakeLists file in order to add a library:" + "

[libraryName]
" + " on SET ( ${LIBRARY_NAME}_LINK_LIBRARIES section if needed." + "

" + "
"; + } + report += + "
" + "

Appli CMakeLists.txt

" + "

" + " Includes applications:" + "

    "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == true && it->first.substr(0, 9) == "appli add") + { + std::string nameAppli = it->first.substr(10); + report += + "
  • " + nameAppli + "
  • "; + } + } + report += + "
" + "

" + "

Doesn't include applications:" + "

    "; + for (it = this->properties.begin(); it != this->properties.end(); it++) + { + if(it->second == false && it->first.substr(0, 9) == "appli add") + { + std::string nameAppli = it->first.substr(10); + report += + "
  • " + nameAppli + "
  • "; + } + } + report += + "
" + "

" + "

" + " Note:
" + " Please include the following lines in the appli CMakeLists file in order to add an application:" + "

ADD_SUBDIRECTORY([applicationName])
" + "

" + "
"; + for (it = applis.begin(); it != applis.end(); it++) + { + report += + "
first + "Chk\">" + "

Application " + it->first + " CMakeLists.txt

" + "

" + " Includes the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string appliname = "application " + it->first + " dir"; + if(it2->second && it2->first.substr(0,appliname.size()) == appliname) + { + std::string directoryName = it2->first.substr(appliname.size()+1); + report += + "
  • " + directoryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Includes the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string appliname = "application " + it->first + " lib"; + if(it2->second && it2->first.substr(0,appliname.size()) == appliname) + { + std::string libraryName = it2->first.substr(appliname.size()+1); + report += + "
  • " + libraryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Doesn't include the following libraries:" + "

    "; + for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) + { + std::string appliname = "application " + it->first + " lib"; + if(it2->second == false && it2->first.substr(0,appliname.size()) == appliname) + { + std::string libraryName = it2->first.substr(appliname.size()+1); + report += + "
  • " + libraryName + "
  • "; + } + } + report += + "
" + "

" + "

" + " Note:
" + " Please include the following lines in the application CMakeLists file in order to add a library:
" + " - In section INCLUDE_DIRECTORIES( use:" + "

" + " ../lib/[libraryFolderName]" + "
" + " - In section SET(${EXE_NAME}_LINK_LIBRARIES use:" + "
" + " [libraryName]" + "
" + "

" + "
"; + } + report += + "" + "" + ; + return crea::std2wx(report); +} diff --git a/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.h b/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.h new file mode 100644 index 0000000..72fb814 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMProjectStructureReportDialog.h @@ -0,0 +1,120 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMProjectStructureReportDialog.h + * + * Created on: 3/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMPROJECTSTRUCTUREREPORTDIALOG_H_ +#define WXCDMPROJECTSTRUCTUREREPORTDIALOG_H_ + +#include +#include + +#include + +/** + * Project Structure Report Dialog. Allows the user to inspect what is compiling and what's not. + */ +class wxCDMProjectStructureReportDialog : public wxDialog +{ + DECLARE_EVENT_TABLE() +public: + /** + * Project Structure Report Dialog Constructor. + * @param parent Parent window. + * @param properties Project precompilation check map. + * @param id Window ID. By default wxID_ANY. + * @param caption Window label. By default "Project Structure Report". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 700, 500. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + */ + wxCDMProjectStructureReportDialog( + wxWindow* parent, + const std::map& properties, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Structure Report"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(700,500), + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER + ); + /** + * Destructor. + */ + ~wxCDMProjectStructureReportDialog(); + /** + * Project Structure Report Dialog Creator. + * @param parent Parent window. + * @param id Window ID. By default wxID_ANY. + * @param caption Window label. By default "Project Structure Report". + * @param position Dialog position. By default wxDefaultPosition. + * @param size Dialog size. By default 700, 500. + * @param style Dialog style. By default wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER. + * @return if the creation was successful. + */ + bool Create( + wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& caption = wxT("Project Structure Report"), + const wxPoint& position = wxDefaultPosition, + const wxSize& size = wxSize(700,500), + long style = wxDEFAULT_DIALOG_STYLE + ); + +protected: + /** + * Creates the Dialog controls (text and button). + */ + void CreateControls(); + +//attributes +private: + /** + * Project check results. + */ + std::map properties; + +//handlers +protected: + /** + * Handles when the close button is pressed. + * @param event Unused. + */ + void OnFinish(wxCommandEvent& event); + /** + * Creates the project structure check results processed for showing them. In HTML + * @return Report in HTML format. + */ + wxString GetContent(); +}; + +#endif /* WXCDMPROJECTSTRUCTUREREPORTDIALOG_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index 5ba578e..2d21718 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -34,8 +34,24 @@ */ #include "wxCDMProjectsTreeCtrl.h" -#include "creaDevManagerIds.h" + #include +#include + +#include + +#include "creaDevManagerIds.h" +#include "images/AIcon20.xpm" +#include "images/ApIcon20.xpm" +#include "images/BBIcon20.xpm" +#include "images/CIcon20.xpm" +#include "images/CMIcon20.xpm" +#include "images/FdIcon20.xpm" +#include "images/FlIcon20.xpm" +#include "images/LbIcon20.xpm" +#include "images/LIcon20.xpm" +#include "images/PrIcon20.xpm" +#include "images/PkIcon20.xpm" wxCDMProjectsTreeCtrl::wxCDMProjectsTreeCtrl( wxWindow *parent, @@ -65,37 +81,158 @@ bool wxCDMProjectsTreeCtrl::Create( ) { wxTreeCtrl::Create (parent, id, pos, size, style, validator, name); - wxTreeItemId rootIndex = this-> AddRoot(_("Open Projects")); + + 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_BBIcon = images->Add(wxIcon(BBIcon20)); + this->ID_Cicon = images->Add(wxIcon(CIcon20)); + this->ID_CMIcon = images->Add(wxIcon(CMIcon20)); + this->ID_FdIcon = images->Add(wxIcon(FdIcon20)); + this->ID_FlIcon = images->Add(wxIcon(FlIcon20)); + this->ID_LbIcon = images->Add(wxIcon(LbIcon20)); + this->ID_LIcon = images->Add(wxIcon(LIcon20)); + this->ID_PrIcon = images->Add(wxIcon(PrIcon20)); + this->ID_PkIcon = images->Add(wxIcon(PkIcon20)); + this->AssignImageList(images); + + wxTreeItemId rootIndex = this->AddRoot(wxT("No Open Project"), this->ID_Cicon, this->ID_Cicon); + this->Update(); return TRUE; } -void wxCDMProjectsTreeCtrl::BuildTree(const modelCDMProjectsTree& projectsTree) +void wxCDMProjectsTreeCtrl::BuildTree(std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& modelElements, modelCDMProject* projectTree) { + this->Unselect(); + std::cout << "building tree" << std::endl; 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); + modelElements.clear(); + if(projectTree != NULL) + { + projectTree->SetId(this->AddRoot(crea::std2wx(projectTree->GetName()), this->ID_PrIcon)); + + modelElements[projectTree->GetId()] = projectTree; - this->Expand(rootIndex); + std::cout << "Building TreeCtrl for " << projectTree->GetName() << std::endl; + this->BuildTree(projectTree->GetChildren(), modelElements, projectTree->GetId()); - this->Update(); + this->Expand(projectTree->GetId().GetWxId()); + + this->Update(); + } + else + { + wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"), this->ID_Cicon); + } } -void wxCDMProjectsTreeCtrl::BuildTree(const std::vector& projectsTree, wxTreeItemId parent) +void wxCDMProjectsTreeCtrl::BuildTree(const std::vector& treeNodes, std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& modelElements, const wxCDMTreeItemId& 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 innerChildren = projectsTree[i].GetChildren(); - if(innerChildren.size() > 0) + for (int i = 0; i < (int)(treeNodes.size()); i++) + { + //cout << projectsTree[i].GetName() << endl; + if(treeNodes[i] != NULL) + { + int idIcon = GetIconId(treeNodes[i]); + wxString nodeName((treeNodes[i]->GetName()).c_str(), wxConvUTF8); + treeNodes[i]->SetId(wxCDMTreeItemId(this->AppendItem(parent.GetWxId(), nodeName, idIcon))); + + modelElements[treeNodes[i]->GetId()] = treeNodes[i]; + + std::vector innerChildren = treeNodes[i]->GetChildren(); + if(innerChildren.size() > 0) + { + this->BuildTree(innerChildren, modelElements, treeNodes[i]->GetId()); + } + } + + } +} + +int wxCDMProjectsTreeCtrl::GetIconId(modelCDMIProjectTreeNode* node) +{ + modelCDMIProjectTreeNode* element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_PrIcon; + } + else { - this->BuildTree(innerChildren, parentNodeIndex); + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_ApIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_AIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_LbIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_LIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_PkIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_BBIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_CMIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_FdIcon; + } + else + { + element = dynamic_cast(node); + if(element != NULL) + { + return this->ID_FlIcon; + } + else + { + return this->ID_Cicon; + } + } + } + } + } + } + } + } + } } - } } diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h index cb5fbda..08b52b6 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -23,7 +23,7 @@ # 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. # ------------------------------------------------------------------------ -*/ + */ /* @@ -38,13 +38,28 @@ #include #include -#include "modelCDMProjectsTree.h" +#include "modelCDMProject.h" +#include "modelCDMIProjectTreeNode.h" #include +#include +/** + * Project Tree Control. Shows a project's content in a hierarchy tree control. + */ class wxCDMProjectsTreeCtrl: public wxTreeCtrl { public: + /** + * Project Tree Control Constructor. + * @param parent Parent window reference. + * @param id Control ID, by default wxID_ANY. + * @param pos Control position. By default wxDefaultPosition. + * @param size Control size. By default wxDefaultSize. + * @param style Control style. By default wxTR_DEFAULT_STYLE. + * @param validator Validator. By default wxDefaultValidator. + * @param name Control Name. By default "Projects tree". + */ wxCDMProjectsTreeCtrl( wxWindow *parent, wxWindowID id=wxID_ANY, @@ -54,20 +69,96 @@ public: const wxValidator &validator=wxDefaultValidator, const wxString &name=_("Projects tree") ); + /** + * Destructor. + */ ~wxCDMProjectsTreeCtrl(); + /** + * Project Tree Control Creator. + * @param parent Parent window reference. + * @param id Control ID, by default wxID_ANY. + * @param pos Control position. By default wxDefaultPosition. + * @param size Control size. By default wxDefaultSize. + * @param style Control style. By default wxTR_DEFAULT_STYLE. + * @param validator Validator. By default wxDefaultValidator. + * @param name Control Name. By default "Projects tree". + * @return True if the creation was successful. + */ bool Create( - wxWindow *parent, - wxWindowID id=wxID_ANY, - const wxPoint &pos=wxDefaultPosition, - const wxSize &size=wxDefaultSize, - long style=wxTR_DEFAULT_STYLE, - const wxValidator &validator=wxDefaultValidator, - const wxString &name=_("Projects tree") + wxWindow *parent, + wxWindowID id=wxID_ANY, + const wxPoint &pos=wxDefaultPosition, + const wxSize &size=wxDefaultSize, + long style=wxTR_DEFAULT_STYLE, + const wxValidator &validator=wxDefaultValidator, + const wxString &name=_("Projects tree") ); - void BuildTree(const modelCDMProjectsTree& tree); + /** + * Builds the tree hierarchy with the given model elements. + */ + void BuildTree(std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& modelElements, modelCDMProject* tree = NULL); + private: - void BuildTree(const std::vector& tree, wxTreeItemId parent); + + /** + * A Icon ID. + */ + int ID_AIcon; + /** + * Ap Icon ID. + */ + int ID_ApIcon; + /** + * BB Icon ID. + */ + int ID_BBIcon; + /** + * C Icon ID. + */ + int ID_Cicon; + /** + * CM Icon ID. + */ + int ID_CMIcon; + /** + * Fd Icon ID. + */ + int ID_FdIcon; + /** + * Fl Icon ID. + */ + int ID_FlIcon; + /** + * Lb Icon ID. + */ + int ID_LbIcon; + /** + * L Icon ID. + */ + int ID_LIcon; + /** + * Pr Icon ID. + */ + int ID_PrIcon; + /** + * Pk Icon ID. + */ + int ID_PkIcon; + + /** + * Builds the tree with the hierarchy given and fills the modelElements map. + * @param tree Root node of the tree. + * @param modelElements Id->node map. + * @param parent ID of the root node ID. + */ + void BuildTree(const std::vector& tree, std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& modelElements, const wxCDMTreeItemId& parent); + /** + * Retrieves the icon ID of the given node by its type. + * @param node Node to search its icon. + * @return Icon ID + */ + int GetIconId(modelCDMIProjectTreeNode* node); }; #endif /* WXCDMPROJECTSTREECTRL_H_ */ diff --git a/lib/creaDevManagerLib/ControlCreaDevManagerProject.h b/lib/creaDevManagerLib/wxCDMTreeItemId.cpp similarity index 52% rename from lib/creaDevManagerLib/ControlCreaDevManagerProject.h rename to lib/creaDevManagerLib/wxCDMTreeItemId.cpp index ca4f8d0..0818c01 100644 --- a/lib/creaDevManagerLib/ControlCreaDevManagerProject.h +++ b/lib/creaDevManagerLib/wxCDMTreeItemId.cpp @@ -1,49 +1,79 @@ /* # --------------------------------------------------------------------- # -# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Sant�) +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sante) # 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 +# 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. +# 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 + * wxCDMTreeItemId.cpp * - * Created on: 5/11/2012 + * Created on: 29/1/2013 * Author: Daniel Felipe Gonzalez Obando */ -#ifndef CONTROLCREADEVMANAGERPROJECT_H_ -#define CONTROLCREADEVMANAGERPROJECT_H_ +#include "wxCDMTreeItemId.h" -#include +wxCDMTreeItemId::wxCDMTreeItemId(){ + this->_id = this->_idWx.m_pItem; +} -class ControlCreaDevManagerProject +wxCDMTreeItemId::wxCDMTreeItemId(const wxTreeItemId& id) { -public: - ControlCreaDevManagerProject(); - ~ControlCreaDevManagerProject(); - static bool CreateProject(const std::string& name, const std::string& location, const std::string& author, const std::string& description); -}; + this->_idWx = id; + this->_id = id.m_pItem; +} -#endif /* CONTROLCREADEVMANAGERPROJECT_H_ */ +wxCDMTreeItemId::~wxCDMTreeItemId(){} + +const wxTreeItemId& wxCDMTreeItemId::GetWxId() const +{ + return this->_idWx; +} + +const wxTreeItemIdValue& wxCDMTreeItemId::GetId() const +{ + return this->_id; +} + +bool wxCDMTreeItemId::operator == (const wxCDMTreeItemId& id) const +{ + return this->_id == id._id; +} + +bool wxCDMTreeItemId::operator != (const wxCDMTreeItemId& id) const +{ + return !(*this == id); +} + +bool wxCDMTreeItemId::operator < (const wxCDMTreeItemId& id) const +{ + return this->_id < id._id; +} + +std::ostream& operator << (std::ostream& stream, const wxCDMTreeItemId& id) +{ + stream << id._id; + return stream; +} diff --git a/lib/creaDevManagerLib/wxCDMTreeItemId.h b/lib/creaDevManagerLib/wxCDMTreeItemId.h new file mode 100644 index 0000000..0f71400 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMTreeItemId.h @@ -0,0 +1,128 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sante) +# 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. +# ------------------------------------------------------------------------ +*/ + + +/* + * wxCDMTreeItemId.h + * + * Created on: 29/1/2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef _WXCDMTREEITEMID_H_ +#define _WXCSMTREEITEMID_H_ + + +#include +#include +#include +#include + +/** + * Class Name: wxCDMTreeItemId + * Class Id manager for the project tree control. + */ +class wxCDMTreeItemId +{ + +//--------------------------------------------- +//Methods and attributes exposed to other classes +//--------------------------------------------- +public : + /** + * Default Constructor + */ + wxCDMTreeItemId(); + /** + * Constructor + * @param id Original TreeItem Id. + */ + wxCDMTreeItemId(const wxTreeItemId& id); + /** + * Destructor + */ + ~wxCDMTreeItemId(); + + /** + * Retrieves the id from the wxTreeItemId object + * @return id name + */ + const wxTreeItemId& GetWxId() const; + /** + * Retrieves the private id of the tree item. + * @return id value + */ + const wxTreeItemIdValue& GetId() const; + + /** + * Operator == + * @param id comparing tree item id + * @return true if the id value is the same. + */ + bool operator == (const wxCDMTreeItemId& id) const; + /** + * Operator != + * @param id comparing tree item id + * @return true if the id value is not the same. + */ + bool operator != (const wxCDMTreeItemId& id) const; + /** + * Operator < + * @param id comparing tree item id + * @return true if the id value is less than the one in the given id. + */ + bool operator < (const wxCDMTreeItemId& id) const; + /** + * operator << allows to manage output stream printing of the object. + * @param stream Target stream. + * @param id Tree item id to print. + * @return Stream modified. + */ + friend std::ostream& operator << (std::ostream& stream, const wxCDMTreeItemId& id); + +//--------------------------------------------- +//Methods and attributes exposed only to classes +//that are derived from this class +//--------------------------------------------- +protected: + /** + * Real tree item + */ + wxTreeItemId _idWx; + /** + * Tree item value + */ + wxTreeItemIdValue _id; +//--------------------------------------------- +//Methods and attributes only visible by this class +//--------------------------------------------- +private: + +}; + +//-end of _WXCDMTREEITEMID_H_------------------------------------------------------ +#endif 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) */