# ---------------------------------------------------------------------
#
# 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
# 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.
# ------------------------------------------------------------------------
-*/
+ */
/*
#ifndef CREADEVMANAGER_H_
#define CREADEVMANAGER_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();
- virtual bool OnInit();
- virtual int OnExit();
+ /**
+ * Executed when the application is closing, this method destroys the frames created and shuts the program down.
+ */
+ virtual int OnExit();
};
DECLARE_APP(wxCreaDevManagerApp)
namespace CDMUtilities
{
- //path slash
+ /**
+ * Path slash
+ */
#ifdef _WIN32
// ------ Windows
static std::string SLASH = "\\";
static std::string SLASH = "/";
#endif
- //text editor program
+ /**
+ * Text editor program
+ */
#ifdef _WIN32
// ------ Windows
//TODO: implementation for windows
static std::string TEXT_EDITOR = "gedit";
#endif
- //file explorer program
+ /**
+ * File explorer program
+ */
#ifdef _WIN32
// ------ Windows
//TODO: implementation for windows
static std::string FILE_EXPLORER = "nautilus";
#endif
- //terminal program
+ /**
+ * Terminal program
+ */
#ifdef _WIN32
// ------ Windows
//TODO: implementation for windows
#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 <typename Container>
static Container& split
(
);
};
+ /**
+ * 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);
};
#include"modelCDMFolder.h"
#include"modelCDMApplication.h"
+/**
+ * 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();
+ /**
+ * Retrieves the applications inside the appli folder node.
+ * @return Reference array of the applications in the appli node.
+ */
const std::vector<modelCDMApplication*>& 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 result Result message of the operation.
+ * @return Reference to the created application or NULL.
+ */
modelCDMApplication* CreateApplication(
const std::string& name,
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<std::string, bool>& properties);
private:
+ /**
+ * application in the appli folder node.
+ */
std::vector<modelCDMApplication*> applications;
};
#include "modelCDMFolder.h"
#include "modelCDMFile.h"
+/**
+ * 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();
+ /**
+ * 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);
+ /**
+ * 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);
+ /**
+ * 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<std::string, bool>& properties);
private:
+ /**
+ * 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<modelCDMFolder*> folders;
};
#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();
- modelCDMBlackBox(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1);
+ /**
+ * 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();
+ /**
+ * 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;
+ /**
+ * 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 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);
+ /**
+ * 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:
+ /**
+ * 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;
+ /**
+ * 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;
};
#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);
};
#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;
};
#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<modelCDMFolder*> 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<modelCDMFolder*> folders;
};
# 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
#include <creaWx.h>
#include "wx/treectrl.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 wxTreeItemId& 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<modelCDMIProjectTreeNode*> GetParents() const;
+ /**
+ * Returns the children nodes of the actual node.
+ * @return An array with the children nodes.
+ */
const std::vector<modelCDMIProjectTreeNode*>& 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 wxTreeItemId& 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<modelCDMIProjectTreeNode*>& children);
+ /**
+ * 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.
+ */
wxTreeItemId 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<modelCDMIProjectTreeNode*> children;
};
#include "modelCDMFolder.h"
#include "modelCDMLibrary.h"
+/**
+ * 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();
+ /**
+ * Returns the libraries registered in the lib folder.
+ * @return Array of library references.
+ */
const std::vector<modelCDMLibrary*>& 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
);
+ /**
+ * 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<std::string, bool>& properties);
private:
+ /**
+ * Libraries references.
+ */
std::vector<modelCDMLibrary*> libraries;
};
#include "modelCDMFolder.h"
+/**
+ * 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();
+ /**
+ * 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);
+ /**
+ * 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<std::string, bool>& properties);
private:
+ /**
+ * 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<modelCDMFolder*> folders;
};
#include "modelCDMIProjectTreeNode.h"
#include "modelCDMProject.h"
+/**
+ * Class representing the model of the project manager.
+ */
class modelCDMMain
{
public:
+ /**
+ * Default constructor.
+ */
modelCDMMain();
+ /**
+ * Destructor.
+ */
~modelCDMMain();
+ /**
+ * 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< wxTreeItemId, 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,
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< wxTreeItemId, modelCDMIProjectTreeNode* > modelElements;
};
#include"modelCDMFolder.h"
#include"modelCDMPackageSrc.h"
+/**
+ * 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();
+ /**
+ * 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);
+ /**
+ * 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& authorsEmail = "",
const std::string& description = "no description"
);
+ /**
+ * 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<std::string, bool>& properties);
private:
+ /**
+ * 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;
+ /**
+ * Reference to the package source folder.
+ */
modelCDMPackageSrc* src;
};
#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<modelCDMBlackBox*>& 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& 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<modelCDMBlackBox*> blackBoxes;
};
/**
* 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 = "");
/**
* 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);
private:
+ /**
+ * 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<modelCDMPackage*> packages;
};
EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
-EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
+EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnChangeView)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
}
-void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
+void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
{
switch(event.GetId() != 0)
{
#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 = wxID_ANY,
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 = wxID_ANY,
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;
+ /**
+ * 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
+ /**
+ * 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);
+ /**
+ * 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);
+ /**
+ * 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);
//Tools
+ /**
+ * 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
- void OnCreationComplete(wxCommandEvent& event);
+ /**
+ *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);
};