From: Daniel Gonzalez Date: Thu, 27 Jun 2013 09:50:46 +0000 (+0200) Subject: Feature #1711 CreaDevManager application implementation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4790438d1d66a44ff16b2a8689882460bb85312c;p=crea.git Feature #1711 CreaDevManager application implementation Feature: Now detecting BBS files in folders. They can be executed with bbs or edited in code editor. --- diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index 37f4deb..e683862 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -117,16 +117,16 @@ namespace CDMUtilities return system(command.c_str()); } - int openFileWithCommand(const std::string& file, const std::string& command) + int openFileWithCommand(const std::string& file, const std::string& command, const std::string& parameters) { #ifdef _WIN32 std::string comm = "start " + command; if(file != "") - comm += " \"" + file + "\""; + comm += " \"" + file + "\" " + parameters; #else std::string comm = command; if(file != "") - comm += " \"" + file + "\""; + comm += " \"" + file + "\" " + parameters; comm += " &"; #endif return system(comm.c_str()); diff --git a/lib/creaDevManagerLib/CDMUtilities.h b/lib/creaDevManagerLib/CDMUtilities.h index 935ce94..50e2cd4 100644 --- a/lib/creaDevManagerLib/CDMUtilities.h +++ b/lib/creaDevManagerLib/CDMUtilities.h @@ -173,9 +173,10 @@ namespace CDMUtilities * Opens a file with a given command. * @param file Full path of the file to open. * @param command Command to execute the file with. + * @param parameters Parameters to open file. * @return True if there was an error on the execution of the operation. */ - int openFileWithCommand(const std::string& file, const std::string& command); + int openFileWithCommand(const std::string& file, const std::string& command, const std::string& parameters = ""); /** * Opens the BBTK Graphical Editor * @return True if there was an error on the execution of the operation. diff --git a/lib/creaDevManagerLib/images/BBSIcon20.xpm b/lib/creaDevManagerLib/images/BBSIcon20.xpm index b3a4b06..aae2b8d 100644 --- a/lib/creaDevManagerLib/images/BBSIcon20.xpm +++ b/lib/creaDevManagerLib/images/BBSIcon20.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * BBSIcon20_xpm[] = { +const static char * BBSIcon20[] = { "20 20 131 2", " c None", ". c #171E27", diff --git a/lib/creaDevManagerLib/images/BBSIcon64.xpm b/lib/creaDevManagerLib/images/BBSIcon64.xpm index df59a10..9640414 100644 --- a/lib/creaDevManagerLib/images/BBSIcon64.xpm +++ b/lib/creaDevManagerLib/images/BBSIcon64.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * BBSIcon_xpm[] = { +const static char * BBSIcon64[] = { "64 64 217 2", " c None", ". c #1D242D", diff --git a/lib/creaDevManagerLib/modelCDMBBSFile.cpp b/lib/creaDevManagerLib/modelCDMBBSFile.cpp new file mode 100644 index 0000000..19d39a9 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMBBSFile.cpp @@ -0,0 +1,107 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMBBSFile.cpp + * + * Created on: Jun 27, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMBBSFile.h" + +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMBBSFile::modelCDMBBSFile() +{ +} + +modelCDMBBSFile::modelCDMBBSFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating bbs 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(); +} + +modelCDMBBSFile::~modelCDMBBSFile() +{ +} + +bool modelCDMBBSFile::OpenFile(std::string*& result) +{ + + if (!CDMUtilities::openTextEditor(this->path)) + return true; + else + { + result = new std::string("Couldn't open bbs file in text editor."); + return false; + } +} + +bool modelCDMBBSFile::ExecuteFile( + std::string*& result, + const std::string& parameters) +{ + if (!CDMUtilities::openFileWithCommand(this->path, "bbi", parameters)) + return true; + else + { + result = new std::string("Couldn't open bbs file with bbi."); + return false; + } +} + +const bool modelCDMBBSFile::Refresh(std::string*& result) +{ + //std::cout << "refreshing bbs file" << 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/modelCDMBBSFile.h b/lib/creaDevManagerLib/modelCDMBBSFile.h new file mode 100644 index 0000000..68e1497 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMBBSFile.h @@ -0,0 +1,86 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMBBSFile.h + * + * Created on: Jun 27, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMBBSFILE_H_ +#define MODELCDMBBSFILE_H_ + +#include "modelCDMFile.h" + +/** + * Class representing a bbs file in a folder of a Crea project. + */ +class modelCDMBBSFile : public modelCDMFile +{ +public: + /** + * Default Constructor. + */ + modelCDMBBSFile(); + /** + * BBS file Constructor. + * @param parent Parent node of the BBS file node. + * @param path Full path to the BBS file node. + * @param name File name of the BBS file node. + * @param level Project hierarchy level of the BBS file node. + */ + modelCDMBBSFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "CMakeLists.txt", const int& level = 1); + /** + * Destructor + */ + ~modelCDMBBSFile(); + + /** + * 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); + + /** + * Opens the file using bbi. + * @param parameters Execution parameters. + * @param result Result message. + * @return True if the operation was successful. + */ + bool ExecuteFile(std::string*& result, const std::string& parameters = ""); + + /** + * Refreshes the state of the BBS file. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); +}; + +#endif /* MODELCDMBBSFILE_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index 01379ac..cdd1006 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -109,6 +109,11 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri modelCDMCodeFile* file = new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); this->children.push_back(file); } + else if(fileType == ".bbs") + { + modelCDMBBSFile* file = new modelCDMBBSFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } //if is an unknown file, create file else { @@ -283,6 +288,10 @@ const bool modelCDMFolder::Refresh(std::string*& result) { this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } + else if(fileType == ".bbs") + { + this->children.push_back(new modelCDMBBSFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } else { modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); diff --git a/lib/creaDevManagerLib/modelCDMFolder.h b/lib/creaDevManagerLib/modelCDMFolder.h index e9cae7c..d11c676 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.h +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -41,6 +41,7 @@ #include "modelCDMIProjectTreeNode.h" #include "modelCDMCMakeListsFile.h" #include "modelCDMCodeFile.h" +#include "modelCDMBBSFile.h" /** * Class representing a folder in the project hierarchy. diff --git a/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.cpp new file mode 100644 index 0000000..75cb0ad --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.cpp @@ -0,0 +1,190 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBBSFileDescriptionPanel.cpp + * + * Created on: Jun 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMBBSFileDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/BBSIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMBBSFileDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMBBSFileDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_OPEN_FILE, wxCDMBBSFileDescriptionPanel::OnBtnOpenInEditor) +EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMBBSFileDescriptionPanel::OnBtnOpenInBBI) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMBBSFileDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMBBSFileDescriptionPanel::wxCDMBBSFileDescriptionPanel( + wxWindow* parent, + modelCDMBBSFile* bbsfile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMBBSFileDescriptionPanel::Create(parent, bbsfile, id, caption, pos, size, style); +} + +wxCDMBBSFileDescriptionPanel::~wxCDMBBSFileDescriptionPanel() +{ +} + +bool wxCDMBBSFileDescriptionPanel::Create( + wxWindow* parent, + modelCDMBBSFile* bbsfile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->bbsFile = bbsfile; + CreateControls(); + // this part makes the scrollbars show up + this->FitInside(); // ask the sizer about the needed size + this->SetScrollRate(5, 5); + return TRUE; +} + +void wxCDMBBSFileDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->bbsFile->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); + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); + } + + linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->bbsFile->GetName())), 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(BBSIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("BBS Script File")),0, wxALIGN_LEFT, 0); + //File Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->bbsFile->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* executeScriptbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_COMMAND, _T("Execute Script")); + executeScriptbt->SetToolTip(wxT("Execute the BBS file using bbi.")); + actionsGridSizer->Add(executeScriptbt, 1, wxALL | wxEXPAND, 5); + wxButton* editScriptbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FILE, _T("Edit File")); + editScriptbt->SetToolTip(wxT("Edit the BBS file in the default text editor.")); + actionsGridSizer->Add(editScriptbt, 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 BBS 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 wxCDMBBSFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) +{ + std::vector parents = this->bbsFile->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 wxCDMBBSFileDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) +{ + std::string* result; + if(!this->bbsFile->OpenFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open BBS File - Error!"),wxOK | wxICON_ERROR); +} + +void +wxCDMBBSFileDescriptionPanel::OnBtnOpenInBBI(wxCommandEvent& event) +{ + std::string* result; + std::string params = "-g"; + if(!this->bbsFile->ExecuteFile(result, params)) + { + wxMessageBox(crea::std2wx(*result),_T("Execute BBS File - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMBBSFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->bbsFile->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} diff --git a/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.h new file mode 100644 index 0000000..9319407 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBBSFileDescriptionPanel.h @@ -0,0 +1,128 @@ +/* +# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBBSFileDescriptionPanel.h + * + * Created on: Jun 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMBBSFILEDESCRIPTIONPANEL_H_ +#define WXCDMBBSFILEDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMBBSFile.h" + +/** + * BBS File description panel. Shows the file properties and the available actions for it. + */ +class wxCDMBBSFileDescriptionPanel : public wxScrolledWindow +{ + DECLARE_EVENT_TABLE() +public: + /** + * BBS File description panel Constructor. + * @param parent Parent window reference. + * @param bbsfile BBSFile 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. + */ + wxCDMBBSFileDescriptionPanel( + wxWindow* parent, + modelCDMBBSFile* bbsfile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMBBSFileDescriptionPanel(); + + /** + * BBS File description panel Constructor. + * @param parent Parent window reference. + * @param bbsfile BBSFile 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, + modelCDMBBSFile* bbsfile, + 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: + /** + * BBS file described. + */ + modelCDMBBSFile* bbsFile; + + //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 file in bbi button is pressed. + */ + void OnBtnOpenInBBI(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); +}; + +#endif /* WXCDMBBSFILEDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 6ef4155..e8d28c5 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -51,6 +51,7 @@ #include "wxCDMLibraryDescriptionPanel.h" #include "wxCDMPackageDescriptionPanel.h" #include "wxCDMBlackBoxDescriptionPanel.h" +#include "wxCDMBBSFileDescriptionPanel.h" #include "wxCDMCodeFileDescriptionPanel.h" #include "wxCDMCMakeListsDescriptionPanel.h" #include "wxCDMFolderDescriptionPanel.h" @@ -1022,14 +1023,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //folder - modelCDMFolder* elementFolder = dynamic_cast(element); - if(elementFolder != NULL) + //BBSFile + modelCDMBBSFile* elementBBSFile = dynamic_cast(element); + if(elementBBSFile != NULL) { //create element description - description = new wxCDMFolderDescriptionPanel( + description = new wxCDMBBSFileDescriptionPanel( this, - elementFolder, + elementBBSFile, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -1039,14 +1040,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //file - modelCDMFile* elementFile = dynamic_cast(element); - if(elementFile != NULL) + //folder + modelCDMFolder* elementFolder = dynamic_cast(element); + if(elementFolder != NULL) { //create element description - description = new wxCDMFileDescriptionPanel( + description = new wxCDMFolderDescriptionPanel( this, - elementFile, + elementFolder, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -1056,17 +1057,35 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - - //main if not any - //create element description - description = new wxCDMMainDescriptionPanel( - this, - ID_WINDOW_PROPERTIES, - wxT("Description Panel"), - wxDefaultPosition, - wxSize(600, 400), - 0 - ); + //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 + ); + } } } } diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index 653397d..6007d94 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -44,6 +44,7 @@ #include "images/AIcon20.xpm" #include "images/ApIcon20.xpm" #include "images/BBIcon20.xpm" +#include "images/BBSIcon20.xpm" #include "images/CIcon20.xpm" #include "images/CFIcon20.xpm" #include "images/CMIcon20.xpm" @@ -89,6 +90,7 @@ bool wxCDMProjectsTreeCtrl::Create( this->ID_AIcon = images->Add(wxIcon(AIcon20)); this->ID_ApIcon = images->Add(wxIcon(ApIcon20)); this->ID_BBIcon = images->Add(wxIcon(BBIcon20)); + this->ID_BBSIcon = images->Add(wxIcon(BBSIcon20)); this->ID_Cicon = images->Add(wxIcon(CIcon20)); this->ID_CMIcon = images->Add(wxIcon(CMIcon20)); this->ID_FdIcon = images->Add(wxIcon(FdIcon20)); @@ -219,21 +221,29 @@ int wxCDMProjectsTreeCtrl::GetIconId(modelCDMIProjectTreeNode* node) } else { - element = dynamic_cast(node); + element = dynamic_cast(node); if(element != NULL) { - return this->ID_FdIcon; + return this->ID_BBSIcon; } else { - element = dynamic_cast(node); + element = dynamic_cast(node); if(element != NULL) { - return this->ID_FlIcon; + return this->ID_FdIcon; } else { - return this->ID_Cicon; + 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 8d63e58..a29745b 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -113,6 +113,10 @@ private: * BB Icon ID. */ int ID_BBIcon; + /** + * BBS Icon ID. + */ + int ID_BBSIcon; /** * C Icon ID. */