+ std::string script1 = _tabsMgr->getActualDiagramBBS(true);
+ cout<<endl<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<<endl<<endl;
+ cout<<script1<<endl;
+
+ std::string script2 = _tabsMgr->getActualDiagramBBS(false);
+ executeScript(script2);
+ }
+
+
+ //=========================================================================
+ // HANDLERS
+ //=========================================================================
+ void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event)
+ {
+ wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxOPEN);
+ if (openFileDialog->ShowModal() == wxID_OK)
+ {
+ wxString fileName = openFileDialog->GetPath( );
+
+
+ _tabsMgr->addNewTab();
+
+ bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());
+
+ // We tell the interpreter to throw exceptions on error
+ I->SetThrow(true);
+ // Interpret the file supposed to define a box called 'Processing'
+ I->InterpretFile( (const char*) (fileName.mb_str()) );
+ }
+ refreshGUIControls();
+ }
+
+ 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();
+ }
+
+ }
+
+ //=========================================================================
+
+ void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
+ {
+ 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());
+ }
+
+ 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()) );
+
+ std::string content="";
+
+ // writing file header
+ content += "# ----------------------------------\n";
+ content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+ content += _tabsMgr->getActualComplexBoxBBS(cbName);
+ file << content;
+ file.close();
+ }
+ }