refreshGUIControls();
}
+
+
+ void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename)
+ {
+ ofstream file;
+
+//EED file.open(fileName.c_str());
+ file.open( filename.c_str() );
+ std::string content="";
+ // writing file header
+ content += "# ----------------------------------\n";
+ content += "# - BBTKGEditor v 1.1 BBS BlackBox Script\n";
+ content += "# - ";
+ content += filename;
+ content += "\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+ content += _tabsMgr->getActualDiagramBBS();
+ file << content;
+ file.close();
+ }
+
+
void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event)
{
wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxSAVE|wxOVERWRITE_PROMPT);
if (saveFileDialog->ShowModal() == wxID_OK)
{
wxString fileName = saveFileDialog->GetPath( );
-
- ofstream file;
-
-//EED file.open(fileName.c_str());
- file.open( (const char*) (fileName.mb_str()) );
-
- std::string content="";
-
- // writing file header
- content += "# ----------------------------------\n";
- content += "# - BBTKGEditor v 1.1 BBS BlackBox Script\n";
- content += "# ----------------------------------\n";
- content += "\n";
- content += _tabsMgr->getActualDiagramBBS();
- file << content;
- file.close();
+ SaveActualBBS( (const char*) (fileName.mb_str()) );
}
}
+
//=========================================================================
- void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
+ void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename)
{
wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of complex box"));
std::string cbName="";
if (nameDialog->ShowModal() == wxID_OK)
{
- wxString fileName = nameDialog->GetValue();
- cbName=(const char*) (fileName.mb_str());
+ wxString complexboxname = nameDialog->GetValue();
+ cbName=(const char*) (complexboxname.mb_str());
}
if(!cbName.empty())
{
- wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, wxString( cbName.c_str(), wxConvUTF8),wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
- if (saveFileDialog->ShowModal() == wxID_OK)
- {
- wxString fileName = saveFileDialog->GetPath();
ofstream file;
- file.open( (const char*) (fileName.mb_str()) );
+ file.open( filename.c_str() );
std::string content="";
// writing file header
content += "# ----------------------------------\n";
content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n";
+ content += "# - ";
+ content += filename;
+ content += "\n";
content += "# ----------------------------------\n";
content += "\n";
content += _tabsMgr->getActualComplexBoxBBS(cbName);
file << content;
file.close();
- }
}
+
}
//=========================================================================
- void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
+ void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
{
- wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
- if (saveFileDialog->ShowModal() == wxID_OK)
- {
- wxString fileName = saveFileDialog->GetPath();
+ wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, _T("ComplexBoxName") ,wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
+ if (saveFileDialog->ShowModal() == wxID_OK)
+ {
+ wxString fileName = saveFileDialog->GetPath();
+ SaveActualComplexBox( (const char*) (fileName.mb_str()) );
+ }
+ }
+
+ //=========================================================================
+ void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename)
+ {
+ ofstream file;
+ file.open( filename.c_str() );
- ofstream file;
- file.open( (const char*) (fileName.mb_str()) );
+ std::string content="";
- std::string content="";
+ // writing file header
+ content += "# ----------------------------------\n";
+ content += "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file\n";
+ content += "# - ";
- // writing file header
- content += "# ----------------------------------\n";
- content += "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file\n";
- content += "# - ";
+ content += filename;
- content += (const char*) (fileName.mb_str());
+ content += "\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+ content += "APP_START\n";
+ _tabsMgr->saveActualDiagram(content);
+ content += "APP_END\n";
+ file << content;
+ file.close();
+ }
- content += "\n";
- content += "# ----------------------------------\n";
- content += "\n";
- content += "APP_START\n";
- _tabsMgr->saveActualDiagram(content);
- content += "APP_END\n";
- file << content;
- file.close();
- }
+ //=========================================================================
+ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
+ {
+ wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
+ if (saveFileDialog->ShowModal() == wxID_OK)
+ {
+ wxString fileName = saveFileDialog->GetPath();
+ std::string filename = (const char*) (fileName.mb_str());
+ std::string filenamebbs = filename+"s";
+
+ SaveActualDiagram( filename );
+ if (_tabsMgr->isActualDiagramComplexBox()==false)
+ {
+ SaveActualBBS(filenamebbs);
+ } else {
+ SaveActualComplexBox(filenamebbs);
+ } //if isActualDiagramComplexBox
+ } // if saveFileDialog
}
//=========================================================================
_tabsMgr->copySelectedBBoxesToComplexDiagram();
}
-
+
void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event)
{
printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ......\n");
}
-
-
-
+
+
+
//=========================================================================
void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
{
Close(true);
}
-
+
//=========================================================================
-/*=========================================================================
+/*=========================================================================
Program: bbtk
Module: $RCSfile$
Language: C++
* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
*
-* This software is governed by the CeCILL-B license under French law and
-* abiding by the rules of distribution of free software. You can use,
-* modify and/ or redistribute the software under the terms of the CeCILL-B
-* license as circulated by CEA, CNRS and INRIA at the following URL
-* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+* This software is governed by the CeCILL-B license under French law and
+* abiding by the rules of distribution of free software. You can use,
+* modify and/ or redistribute the software under the terms of the CeCILL-B
+* license as circulated by CEA, CNRS and INRIA at the following URL
+* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
* or in the file LICENSE.txt.
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
-* liability.
+* liability.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
-* ------------------------------------------------------------------------ */
+* ------------------------------------------------------------------------ */
/**
- * \file
- * \brief Class bbtk::BlackBox : abstract black-box interface.
+ * \file
+ * \brief Class bbtk::BlackBox : abstract black-box interface.
*/
/****
* Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
* RaC - 2010
****/
-
+
#ifndef __WxGUIEditorGraphicBBS_h__
#define __WxGUIEditorGraphicBBS_h__
namespace bbtk
{
- //RaC: It is important if it exists a double relation
+ //RaC: It is important if it exists a double relation
//e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
class wxTabPanelsManager;
class wxVtkSceneManager;
class wxGUIEditorGraphicBBS : public wxFrame
{
- public:
+ public:
wxGUIEditorGraphicBBS(wxFrame *parent);
~wxGUIEditorGraphicBBS();
- void initToolbar();
+ void initToolbar();
void initMenu();
void initTabPanelsManager();
void initPackageBrowser();
// Method that can be used to refresh the help and package browser
// RaC TOFIX!!!
void RegenerateAll();
- void DoRegeneratePackageDoc(const std::string& pack);
+ void DoRegeneratePackageDoc(const std::string& pack);
void DoRegenerateBoxesLists();
// Refresh the state of buttons and menus when changing for example the mode to edit complex box
void refreshGUIControls();
+ void SaveActualBBS(std::string filename);
+ void SaveActualComplexBox(std::string filename);
+ void SaveActualDiagram(std::string filename);
+
+
+
// File menu and toolbar events
void OnCreateNewTab(wxCommandEvent& event);
void OnOpenDiagram(wxCommandEvent& event);
private:
-
+
//AuiManager for the wxWindow
wxAuiManager *_frameAUIMgr;
WxGUIHtmlBrowser *_helpHtmlBrowser;
//Name of the box and its package that is shown in the browser
- std::string _actualPkgBrowserBoxName;
- std::string _actualPkgBrowserPkgName;
+ std::string _actualPkgBrowserBoxName;
+ std::string _actualPkgBrowserPkgName;
protected:
-
+
};