From: Daniel Gonzalez Date: Thu, 27 Jun 2013 10:16:52 +0000 (+0200) Subject: Feature #1711 CreaDevManager application implementation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bae167768b5d3ccae6ec9b04c844d80e0368a52d;p=crea.git Feature #1711 CreaDevManager application implementation Feature: Now detecting BBG files in folders. They can be edited with bbEditor or with code editor. --- diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index e683862..ae37bb5 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -129,6 +129,7 @@ namespace CDMUtilities comm += " \"" + file + "\" " + parameters; comm += " &"; #endif + std::cout << "executing: " << comm << std::endl; return system(comm.c_str()); } diff --git a/lib/creaDevManagerLib/images/BBGIcon20.xpm b/lib/creaDevManagerLib/images/BBGIcon20.xpm new file mode 100644 index 0000000..dd3f130 --- /dev/null +++ b/lib/creaDevManagerLib/images/BBGIcon20.xpm @@ -0,0 +1,148 @@ +/* XPM */ +const static char * BBGIcon20[] = { +"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 #182029", +"8 c #1C232C", +"9 c #1D232C", +"0 c #1D242D", +"a c #181F28", +"b c #86898D", +"c c #7E8387", +"d c #192029", +"e c #1C242D", +"f c #82858A", +"g c #7D8086", +"h c #242B33", +"i c #2C323B", +"j c #292F38", +"k c #242B34", +"l c #2C333B", +"m c #282F38", +"n c #2B323A", +"o c #212831", +"p c #7E8287", +"q c #CDCED0", +"r c #F4F4F5", +"s c #3A4048", +"t c #9EA2A5", +"u c #7F8388", +"v c #D2D3D5", +"w c #83878B", +"x c #B5B7BB", +"y c #595D64", +"z c #61666C", +"A c #7C8085", +"B c #7D8186", +"C c #C4C6C9", +"D c #BDBFC2", +"E c #F8F8F9", +"F c #333942", +"G c #9A9DA1", +"H c #B2B5B8", +"I c #DFE0E1", +"J c #2D343C", +"K c #D8D9DA", +"L c #141B25", +"M c #767B80", +"N c #9DA0A3", +"O c #81858A", +"P c #C9CBCD", +"Q c #64696E", +"R c #A3A5A9", +"S c #878A8F", +"T c #9A9EA1", +"U c #565B62", +"V c #797D82", +"W c #909397", +"X c #A2A5A8", +"Y c #909499", +"Z c #84888C", +"` c #6C7177", +" . c #979B9F", +".. c #8A8D92", +"+. c #293039", +"@. c #5B6066", +"#. c #8C9095", +"$. c #282F37", +"%. c #1F262F", +"&. c #7B8084", +"*. c #61666D", +"=. c #7F8389", +"-. c #7D8286", +";. c #8D9196", +">. c #A4A6AA", +",. c #141C25", +"'. c #19202A", +"). c #141B24", +"!. c #8D9195", +"~. c #6B7075", +"{. c #FFFFFF", +"]. c #B3B5B9", +"^. c #7A7F84", +"/. c #808389", +"(. c #7F8488", +"_. c #80858A", +":. c #818489", +"<. c #818589", +"[. c #797E83", +"}. c #B0B3B6", +"|. c #65696F", +"1. c #1A212A", +"2. c #8C9094", +"3. c #64686E", +"4. c #161D27", +" ", +" ", +" . + @ # # # # # # # # # # $ % & ", +" * = - ; > > > > > > > > ; - , % ", +" * ' ) ! ) ~ { ) ) ] ~ { ! ) ' ^ ", +" > / ( _ : < [ } | 1 2 3 4 5 / > ", +" # 6 7 8 8 8 9 0 0 0 8 8 8 a b # ", +" # c d 0 0 0 e 8 8 8 0 0 0 d f # ", +" # g h i j 8 k l m 0 0 j n o p # ", +" - g q # r s t u v m w x y z A # ", +" # B C D E F G H I J K L M N O # ", +" # u P Q R S T U V W X Y 3 r Z # ", +" # u ` ...+.@.G #.$.%.&.G *.B Y ", +" # =.d 0 0 0 0 0 0 0 0 0 0 d -.# ", +" # p d 0 0 0 0 0 0 0 0 0 0 d u # ", +" ;.>.,.d d d d d d d d d '.).>.!. ", +" ~.{.].^.p /./.(._.u :.<.[.}.{.|. ", +" 1.% #.Y # # # # # # # # Y 2.3.4. ", +" ", +" "}; diff --git a/lib/creaDevManagerLib/images/BBGIcon64.xpm b/lib/creaDevManagerLib/images/BBGIcon64.xpm index 7ab1106..1aa9c09 100644 --- a/lib/creaDevManagerLib/images/BBGIcon64.xpm +++ b/lib/creaDevManagerLib/images/BBGIcon64.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * BBGIcon_xpm[] = { +const static char * BBGIcon64[] = { "64 64 212 2", " c None", ". c #1D242D", diff --git a/lib/creaDevManagerLib/modelCDMBBGFile.cpp b/lib/creaDevManagerLib/modelCDMBBGFile.cpp new file mode 100644 index 0000000..aaf1a88 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMBBGFile.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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMBBGFile.cpp + * + * Created on: Jun 27, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "modelCDMBBGFile.h" + +#include + +#include +#include + +#include "CDMUtilities.h" + +modelCDMBBGFile::modelCDMBBGFile() +{ +} + +modelCDMBBGFile::modelCDMBBGFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) +{ + std::cout << "creating bbg 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(); +} + +modelCDMBBGFile::~modelCDMBBGFile() +{ +} + +bool modelCDMBBGFile::OpenFile(std::string*& result) +{ + + if (!CDMUtilities::openTextEditor(this->path)) + return true; + else + { + result = new std::string("Couldn't open bbg file in text editor."); + return false; + } +} + +bool modelCDMBBGFile::EditFile( + std::string*& result, + const std::string& parameters) +{ + if (!CDMUtilities::openFileWithCommand(this->path, "bbEditor", parameters)) + return true; + else + { + result = new std::string("Couldn't open bbg file with bbEditor."); + return false; + } +} + +const bool modelCDMBBGFile::Refresh(std::string*& result) +{ + //std::cout << "refreshing bbg 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/modelCDMBBGFile.h b/lib/creaDevManagerLib/modelCDMBBGFile.h new file mode 100644 index 0000000..45dd093 --- /dev/null +++ b/lib/creaDevManagerLib/modelCDMBBGFile.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. +# ------------------------------------------------------------------------ + */ + +/* + * modelCDMBBGFile.h + * + * Created on: Jun 27, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef MODELCDMBBGFILE_H_ +#define MODELCDMBBGFILE_H_ + +#include "modelCDMFile.h" + +/** + * Class representing a bbg file in a folder of a Crea project. + */ +class modelCDMBBGFile : public modelCDMFile +{ +public: + /** + * Default Constructor. + */ + modelCDMBBGFile(); + /** + * BBG file Constructor. + * @param parent Parent node of the BBG file node. + * @param path Full path to the BBG file node. + * @param name File name of the BBG file node. + * @param level Project hierarchy level of the BBG file node. + */ + modelCDMBBGFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "CMakeLists.txt", const int& level = 1); + /** + * Destructor + */ + ~modelCDMBBGFile(); + + /** + * 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 bbEditor. + * @param parameters Execution parameters. + * @param result Result message. + * @return True if the operation was successful. + */ + bool EditFile(std::string*& result, const std::string& parameters = ""); + + /** + * Refreshes the state of the BBG file. + * @param result Result message. + * @return True if the operation was successful. + */ + virtual const bool Refresh(std::string*& result); +}; + +#endif /* MODELCDMBBGFILE_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMFolder.cpp b/lib/creaDevManagerLib/modelCDMFolder.cpp index cdd1006..6195892 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.cpp +++ b/lib/creaDevManagerLib/modelCDMFolder.cpp @@ -109,11 +109,18 @@ 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); } + //if is a bbs file, create bbs 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 a bbg file, create bbg file + else if(fileType == ".bbg") + { + modelCDMBBGFile* file = new modelCDMBBGFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } //if is an unknown file, create file else { @@ -288,10 +295,17 @@ const bool modelCDMFolder::Refresh(std::string*& result) { this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } + //if is a bbs file, create modelCDMBBSFile else if(fileType == ".bbs") { this->children.push_back(new modelCDMBBSFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } + //if is a bbg file, create modelCDMBBGFile + else if(fileType == ".bbg") + { + this->children.push_back(new modelCDMBBGFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); + } + //if is an unknown file, create modelCDMFile 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 d11c676..d1b4be5 100644 --- a/lib/creaDevManagerLib/modelCDMFolder.h +++ b/lib/creaDevManagerLib/modelCDMFolder.h @@ -42,6 +42,7 @@ #include "modelCDMCMakeListsFile.h" #include "modelCDMCodeFile.h" #include "modelCDMBBSFile.h" +#include "modelCDMBBGFile.h" /** * Class representing a folder in the project hierarchy. diff --git a/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.cpp new file mode 100644 index 0000000..b69bff4 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBBGFileDescriptionPanel.cpp + * + * Created on: Jun 27, 2013 + * Author: Daniel Felipe Gonzalez Obando + */ + +#include "wxCDMBBGFileDescriptionPanel.h" + +#include "wxCDMMainFrame.h" + +#include "creaDevManagerIds.h" +#include "images/BBGIcon64.xpm" + +BEGIN_EVENT_TABLE(wxCDMBBGFileDescriptionPanel, wxPanel) +EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMBBGFileDescriptionPanel::OnBtnReturn) +EVT_BUTTON(ID_BUTTON_OPEN_FILE, wxCDMBBGFileDescriptionPanel::OnBtnOpenInEditor) +EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMBBGFileDescriptionPanel::OnBtnOpenInBBEditor) +EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMBBGFileDescriptionPanel::OnBtnOpenFolder) +END_EVENT_TABLE() + +wxCDMBBGFileDescriptionPanel::wxCDMBBGFileDescriptionPanel( + wxWindow* parent, + modelCDMBBGFile* bbgfile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxCDMBBGFileDescriptionPanel::Create(parent, bbgfile, id, caption, pos, size, style); +} + +wxCDMBBGFileDescriptionPanel::~wxCDMBBGFileDescriptionPanel() +{ +} + +bool wxCDMBBGFileDescriptionPanel::Create( + wxWindow* parent, + modelCDMBBGFile* bbgfile, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style +) +{ + wxPanel::Create(parent, id, pos, size, style); + this->bbgFile = bbgfile; + CreateControls(); + // this part makes the scrollbars show up + this->FitInside(); // ask the sizer about the needed size + this->SetScrollRate(5, 5); + return TRUE; +} + +void wxCDMBBGFileDescriptionPanel::CreateControls() +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + //Links to return + wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL); + std::vector parents = this->bbgFile->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->bbgFile->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(BBGIcon64)),0, wxALIGN_CENTER, 0); + wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + //Title + textSizer->Add(new wxStaticText(this, -1, _("BBG Script File")),0, wxALIGN_LEFT, 0); + //File Name + textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->bbgFile->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("Open in BBEditor")); + executeScriptbt->SetToolTip(wxT("Edit the BBG file using bbEditor.")); + actionsGridSizer->Add(executeScriptbt, 1, wxALL | wxEXPAND, 5); + wxButton* editScriptbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FILE, _T("Edit File")); + editScriptbt->SetToolTip(wxT("Edit the BBG 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 BBG 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 wxCDMBBGFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event) +{ + std::vector parents = this->bbgFile->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 wxCDMBBGFileDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event) +{ + std::string* result; + if(!this->bbgFile->OpenFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open BBG File - Error!"),wxOK | wxICON_ERROR); +} + +void +wxCDMBBGFileDescriptionPanel::OnBtnOpenInBBEditor(wxCommandEvent& event) +{ + std::string* result; + std::string params = ""; + if(!this->bbgFile->EditFile(result, params)) + { + wxMessageBox(crea::std2wx(*result),_T("Edit BBG File - Error!"),wxOK | wxICON_ERROR); + } +} + +void wxCDMBBGFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) +{ + std::string* result; + if(!this->bbgFile->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); +} diff --git a/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.h new file mode 100644 index 0000000..bba2291 --- /dev/null +++ b/lib/creaDevManagerLib/wxCDMBBGFileDescriptionPanel.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. +# ------------------------------------------------------------------------ + */ + +/* + * wxCDMBBGFileDescriptionPanel.h + * + * Created on: Jun 27, 2012 + * Author: Daniel Felipe Gonzalez Obando + */ + +#ifndef WXCDMBBGFILEDESCRIPTIONPANEL_H_ +#define WXCDMBBGFILEDESCRIPTIONPANEL_H_ + +#include +#include + +#include "modelCDMBBGFile.h" + +/** + * BBG File description panel. Shows the file properties and the available actions for it. + */ +class wxCDMBBGFileDescriptionPanel : public wxScrolledWindow +{ + DECLARE_EVENT_TABLE() +public: + /** + * BBG File description panel Constructor. + * @param parent Parent window reference. + * @param bbgfile BBGFile 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. + */ + wxCDMBBGFileDescriptionPanel( + wxWindow* parent, + modelCDMBBGFile* bbgfile, + wxWindowID id = -1, + const wxString& caption = _("Description Frame"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE + ); + + /** + * Destructor. + */ + ~wxCDMBBGFileDescriptionPanel(); + + /** + * BBG File description panel Constructor. + * @param parent Parent window reference. + * @param bbgfile BBGFile 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, + modelCDMBBGFile* bbgfile, + 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: + /** + * BBG file described. + */ + modelCDMBBGFile* bbgFile; + + //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 OnBtnOpenInBBEditor(wxCommandEvent& event); + /** + * Handles when the open containing folder button is pressed. + */ + void OnBtnOpenFolder(wxCommandEvent& event); +}; + +#endif /* WXCDMBBGFILEDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index e8d28c5..41052d4 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -52,6 +52,7 @@ #include "wxCDMPackageDescriptionPanel.h" #include "wxCDMBlackBoxDescriptionPanel.h" #include "wxCDMBBSFileDescriptionPanel.h" +#include "wxCDMBBGFileDescriptionPanel.h" #include "wxCDMCodeFileDescriptionPanel.h" #include "wxCDMCMakeListsDescriptionPanel.h" #include "wxCDMFolderDescriptionPanel.h" @@ -1040,14 +1041,14 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } else { - //folder - modelCDMFolder* elementFolder = dynamic_cast(element); - if(elementFolder != NULL) + //BBSFile + modelCDMBBGFile* elementBBGFile = dynamic_cast(element); + if(elementBBGFile != NULL) { //create element description - description = new wxCDMFolderDescriptionPanel( + description = new wxCDMBBGFileDescriptionPanel( this, - elementFolder, + elementBBGFile, ID_WINDOW_PROPERTIES, wxT("Description Panel"), wxDefaultPosition, @@ -1057,14 +1058,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, @@ -1074,17 +1075,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 6007d94..d0bbafb 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -45,6 +45,7 @@ #include "images/ApIcon20.xpm" #include "images/BBIcon20.xpm" #include "images/BBSIcon20.xpm" +#include "images/BBGIcon20.xpm" #include "images/CIcon20.xpm" #include "images/CFIcon20.xpm" #include "images/CMIcon20.xpm" @@ -90,6 +91,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_BBGIcon = images->Add(wxIcon(BBGIcon20)); this->ID_BBSIcon = images->Add(wxIcon(BBSIcon20)); this->ID_Cicon = images->Add(wxIcon(CIcon20)); this->ID_CMIcon = images->Add(wxIcon(CMIcon20)); @@ -228,21 +230,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_BBGIcon; } 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 a29745b..5c19935 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.h @@ -113,6 +113,10 @@ private: * BB Icon ID. */ int ID_BBIcon; + /** + * BBG Icon ID. + */ + int ID_BBGIcon; /** * BBS Icon ID. */