wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent)
: wxFrame(parent, -1, _T("bbtkGEditor"),wxDefaultPosition, wxSize(1200,800))
{
+
+ printf ("EED %p wxGUIEditorGraphicBBS()\n" , this );
+
_frameAUIMgr = new wxAuiManager(this);
//=========================================================================
wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS()
{
- _frameAUIMgr->UnInit();
+ printf ("EED %p ~wxGUIEditorGraphicBBS()\n" , this );
+
+//EED02JUIN2010 delete _tabsMgr;
+
+ _frameAUIMgr->UnInit();
+
+
}
//=========================================================================
//=========================================================================
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"));
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);
}
#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\" ";
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="";
if (nameDialog->ShowModal() == wxID_OK)
{
wxString fileName = nameDialog->GetValue();
- cbName=fileName;
+//EED cbName=fileName;
+ cbName=(const char*) (fileName.mb_str());
}
if(!cbName.empty())
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="";
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";
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);
+ }
}
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);
//=========================================================================
+ void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event)
+ {
+ _tabsMgr->copySelectedBBoxesToComplexDiagram();
+ }
+
+ //=========================================================================
+
void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
{
Close(true);