X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=cb3231b87cd2bae070306cc4821441059f8ef675;hb=66d85963bdb3dea88f7d8e8931855d092629b37c;hp=f75b97e9c1bf0f2982d3beae4493db49b8634658;hpb=b07121ce96dd600b41cb6b9588d117ec72969317;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index f75b97e..cb3231b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -44,6 +44,9 @@ namespace bbtk wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) : wxFrame(parent, -1, _T("bbtkGEditor"),wxDefaultPosition, wxSize(1200,800)) { + + printf ("EED %p wxGUIEditorGraphicBBS()\n" , this ); + _frameAUIMgr = new wxAuiManager(this); @@ -80,7 +83,13 @@ namespace bbtk //========================================================================= wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() { - _frameAUIMgr->UnInit(); + printf ("EED %p ~wxGUIEditorGraphicBBS()\n" , this ); + +//EED02JUIN2010 delete _tabsMgr; + + _frameAUIMgr->UnInit(); + + } //========================================================================= @@ -141,7 +150,7 @@ namespace bbtk //========================================================================= void wxGUIEditorGraphicBBS::initMenu() { - // create a menu bar + // Create File menu and its items wxMenu *fileMenu = new wxMenu(); fileMenu->Append(ID_NEW, _T("New diagram"), _T("New")); fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save diagram"), _T("Save diagram")); @@ -155,16 +164,23 @@ namespace bbtk Connect(ID_SAVE_AS_COMPLEXBOX,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox)); Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit)); - // the "About" item should be in the help menu + // Create Help menu and its items + wxMenu *editMenu = new wxMenu; + editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes")); + + Connect(ID_COPY_TO_COMPLEXDIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram)); + + // Create Help menu and its items wxMenu *helpMenu = new wxMenu; helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About")); - // now append the freshly created menu to the menu bar... + // Append the created menu to the menu bar wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(editMenu, _T("&Edit")); menuBar->Append(helpMenu, _T("&Help")); - // attach this menu bar to the frame + // Attach this menu bar to the frame SetMenuBar(menuBar); } @@ -345,7 +361,10 @@ namespace bbtk #endif //command += ConfigurationFile::GetInstance().Get_bin_path(); - command +="C:/temp/bbtkBIN/RelWithDebInfo//"; +//EED command +="C:/temp/bbtkBIN/RelWithDebInfo//"; +//EED command +="C:/Program Files/CreaTools/bbtk-0.9.5/bin"; + command +="."; + #ifdef MACOSX command += separator + "bbi.app/Contents/MacOS/bbi\" "; @@ -391,13 +410,15 @@ namespace bbtk void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) { - wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual BBS"),wxEmptyString,"NewBBS","*.bbs",wxSAVE|wxOVERWRITE_PROMPT); + 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; - file.open(fileName.c_str()); + +//EED file.open(fileName.c_str()); + file.open( (const char*) (fileName.mb_str()) ); std::string content=""; @@ -422,18 +443,20 @@ namespace bbtk if (nameDialog->ShowModal() == wxID_OK) { wxString fileName = nameDialog->GetValue(); - cbName=fileName; +//EED cbName=fileName; + cbName=(const char*) (fileName.mb_str()); } if(!cbName.empty()) { - wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save Complex Box BBS"),wxEmptyString,cbName,"*.bbs",wxSAVE|wxOVERWRITE_PROMPT); + 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; - file.open(fileName.c_str()); +//EED file.open(fileName.c_str()); + file.open( (const char*) (fileName.mb_str()) ); std::string content=""; @@ -454,21 +477,25 @@ namespace bbtk void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) { - wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual diagram"),wxEmptyString,"NewDiagram","*.bbd",wxSAVE|wxOVERWRITE_PROMPT); + 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; - file.open(fileName.c_str()); +//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 BBD BlackBox Diagram file\n"; + content += "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file\n"; content += "# - "; - content += fileName; + +//EED content += fileName; + content += (const char*) (fileName.mb_str()); + content += "\n"; content += "# ----------------------------------\n"; content += "\n"; @@ -504,6 +531,16 @@ namespace bbtk 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); + } } @@ -530,13 +567,17 @@ namespace bbtk void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { - wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,"","*.bbd",wxOPEN|wxFILE_MUST_EXIST); + wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbg"),wxOPEN|wxFILE_MUST_EXIST); if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath(); ifstream inputStream; - inputStream.open(fileName.c_str()); + +//EED inputStream.open(fileName.c_str()); + inputStream.open( (const char*) (fileName.mb_str()) ); + + _tabsMgr->addNewTab(); _tabsMgr->loadDiagram(inputStream); @@ -573,7 +614,7 @@ namespace bbtk wxString fileName = nameDialog->GetValue(); if(!fileName.IsEmpty()) { - std::string portName=fileName; + std::string portName=(const char*) (fileName.mb_str()); _tabsMgr->addActualDiagramComplexInputPort(portName); } } @@ -589,7 +630,7 @@ namespace bbtk wxString fileName = nameDialog->GetValue(); if(!fileName.IsEmpty()) { - std::string portName=fileName; + std::string portName=(const char*) (fileName.mb_str()); _tabsMgr->addActualDiagramComplexOutputPort(portName); } } @@ -597,6 +638,13 @@ namespace bbtk //========================================================================= + void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event) + { + _tabsMgr->copySelectedBBoxesToComplexDiagram(); + } + + //========================================================================= + void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) { Close(true);