X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;fp=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=7addacf59c6dcee36929bfb443724a19933733fe;hb=e5a27bdba2e0cbc6a918a4fe9cbb0cc57ed85dc1;hp=4a9ec05c1bb0582fdb4703ab5792fc660bc213ae;hpb=ec7fc3bf3cc44da7cb9f9b840391c2f44c52a875;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 4a9ec05..7addacf 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -428,7 +428,7 @@ namespace bbtk wxString fileName = openFileDialog->GetPath( ); - _tabsMgr->addNewTab(); + _tabsMgr->addNewTab( openFileDialog->GetFilename() ); bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory()); @@ -451,7 +451,7 @@ namespace bbtk std::string content=""; // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.1 BBS BlackBox Script\n"; + content += "# - BBTKGEditor v 1.2 BBS BlackBox Script\n"; content += "# - "; content += filename; content += "\n"; @@ -475,50 +475,54 @@ namespace bbtk } - //========================================================================= + void wxGUIEditorGraphicBBS::AskComplexBoxConfiguration() + { + std::string cbName = _tabsMgr->GetCbName(); + std::string paName = _tabsMgr->GetCbPackageName(); - void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) - { wxTextEntryDialog *cbNameDialog = new wxTextEntryDialog(this,wxT("Complex Box name")); - cbNameDialog->SetValue(_T("BBBBoxName")); - std::string cbName=""; + wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,wxT("Package name")); + + cbNameDialog->SetValue( wxString(cbName.c_str(),wxConvUTF8) ); + paNameDialog->SetValue( wxString(paName.c_str(),wxConvUTF8) ); + if (cbNameDialog->ShowModal() == wxID_OK) { wxString complexboxname = cbNameDialog->GetValue(); cbName=(const char*) (complexboxname.mb_str()); } - wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,wxT("Package name")); - paNameDialog->SetValue(_T("PPPPackageName")); - std::string paName=""; + if (paNameDialog->ShowModal() == wxID_OK) { wxString packagename = paNameDialog->GetValue(); paName=(const char*) (packagename.mb_str()); } - if( (!cbName.empty()) || (!paName.empty()) ) - { + _tabsMgr->SetCbName(cbName); + _tabsMgr->SetCbPackageName(paName); + } - ofstream file; - 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,paName); - file << content; - file.close(); - } + //========================================================================= + void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) + { + ofstream file; + file.open( filename.c_str() ); + + std::string content=""; + // writing file header + content += "# ----------------------------------\n"; + content += "# - BBTKGEditor v 1.2 BBS BlackBox Script (Complex Box)\n"; + content += "# - "; + content += filename; + content += "\n"; + content += "# ----------------------------------\n"; + content += "\n"; + content += _tabsMgr->getActualComplexBoxBBS(); + file << content; + file.close(); } //========================================================================= @@ -543,7 +547,7 @@ namespace bbtk // writing file header content += "# ----------------------------------\n"; - content += "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file\n"; + content += "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file\n"; content += "# - "; content += filename; @@ -565,17 +569,21 @@ namespace bbtk 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; - filenamebbs[filename.length()-1]='s'; + _tabsMgr->SetNameTabPanel( saveFileDialog->GetFilename() ); + + wxString pathfileName = saveFileDialog->GetPath(); + std::string pathfilename = (const char*) (pathfileName.mb_str()); + std::string pathfilenamebbs = pathfilename; + pathfilenamebbs[pathfilenamebbs.length()-1]='s'; - SaveActualDiagram( filename ); if (_tabsMgr->isActualDiagramComplexBox()==false) { - SaveActualBBS(filenamebbs); + SaveActualDiagram( pathfilename ); + SaveActualBBS(pathfilenamebbs); } else { - SaveActualComplexBox(filenamebbs); + AskComplexBoxConfiguration(); + SaveActualDiagram( pathfilename ); + SaveActualComplexBox(pathfilenamebbs); } //if isActualDiagramComplexBox } // if saveFileDialog } @@ -643,9 +651,10 @@ namespace bbtk { wxString fileName = openFileDialog->GetPath(); ifstream inputStream; -//EED inputStream.open(fileName.c_str()); - inputStream.open( (const char*) (fileName.mb_str()) ); - _tabsMgr->addNewTab(); + std::string fName=(const char*) (fileName.mb_str()); + inputStream.open( fName.c_str() ); + _tabsMgr->addNewTab( openFileDialog->GetFilename() ); + _tabsMgr->loadDiagram(inputStream); inputStream.close();