+ //=========================================================================
+ // HANDLERS
+ //=========================================================================
+
+ 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.0 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();
+//EED cbName=fileName;
+ cbName=(const char*) (fileName.mb_str());
+ }
+
+ if(!cbName.empty())
+ {
+ wxFileDialog * saveFileDialog = new wxFileDialog( this , _T("Save Complex Box BBS") ,_T(""), wxString( cbName.c_str(), wxConvUTF8),_T(""), 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 (Complex Box)\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+ content += _tabsMgr->getActualComplexBoxBBS(cbName);
+ 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();
+
+ 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.0 BBG BlackBox Diagram file\n";
+ content += "# - ";
+
+//EED 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();
+ }
+
+ }
+
+ //=========================================================================
+
+ void wxGUIEditorGraphicBBS::refreshGUIControls()
+ {
+ wxToolBar* toolbar = GetToolBar();
+ if(_tabsMgr->isActualDiagramComplexBox())
+ {
+ toolbar->ToggleTool(ID_BTNCOMPLEXBOX,true);
+ toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true);
+ toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true);
+
+ GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,true);
+ GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,false);
+ }
+ else
+ {
+ toolbar->ToggleTool(ID_BTNCOMPLEXBOX,false);
+ toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+ toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
+
+ GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,false);
+ GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,true);
+ }
+
+ if(_tabsMgr->getNumActualSelectedObjects()>0)
+ {
+ GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+ }
+ else
+ {
+ ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
+ GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+ }
+
+ }
+