From f08102d8cf97a93b5fbff395a9fd667eaa26b269 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 2 Oct 2017 17:10:00 +0200 Subject: [PATCH] #3132 bbGEditor Feature New Normal - branch changeWx28to30 compilation with wxWidgets3 --- appli/bbEditor/bbEditor.cxx | 3 +- .../GBlackBoxController.cxx | 47 +++---------------- .../bbsVtkGUIEditorGraphic/GBoxController.cxx | 4 +- .../GConnectorController.cxx | 12 ++--- .../GObjectController.cxx | 2 +- .../bbtkwxGUIEditorGraphicBBS.cxx | 15 +++++- .../bbtkwxGUIEditorGraphicBBS.h | 23 --------- .../wxVtkSceneManager.cxx | 47 ++----------------- 8 files changed, 33 insertions(+), 120 deletions(-) diff --git a/appli/bbEditor/bbEditor.cxx b/appli/bbEditor/bbEditor.cxx index 497d60f..a12bae4 100644 --- a/appli/bbEditor/bbEditor.cxx +++ b/appli/bbEditor/bbEditor.cxx @@ -130,7 +130,6 @@ bool wxBBEditorApp::OnCmdLineParsed(wxCmdLineParser& parser) // main frame bool wxBBEditorApp::OnInit( ) { - vtkOutputWindowbbGEditor *vtkoutputwindowbbgeditor= vtkOutputWindowbbGEditor::New(); vtkOutputWindow::SetInstance( vtkoutputwindowbbgeditor ); vtkoutputwindowbbgeditor->Delete(); @@ -148,6 +147,7 @@ bool wxBBEditorApp::OnInit( ) #endif bbtk::wxGUIEditorGraphicBBS *iegbbs; + iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL); SetTopWindow(iegbbs); iegbbs->Show(true); @@ -171,7 +171,6 @@ bool wxBBEditorApp::OnInit( ) } } - return true; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx index e593fc2..095e704 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx @@ -86,7 +86,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; + crea::wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); @@ -132,7 +132,7 @@ namespace bbtk bool ok=true; int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; + crea::wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); @@ -172,68 +172,36 @@ namespace bbtk } //========================================================================= - bool GBlackBoxController::OnLeftButtonUp() { _isLeftClickDown = false; int state = _view->getState(); - - //Evaluate new state - -//EED Borrame -// int X,Y; -// wxVTKRenderWindowInteractor *wxVTKiren; -// wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); -// wxVTKiren->GetEventPosition(X,Y); -// if(_isLeftClickDown) -// { -// _isLeftClickDown=false; -// if(_view->isPointInside(X,Y)) -// { - // It is supposed that I'm always inside even if the box is in drag -// _view->setState(SELECTED); -// _model->notifyObservers(getId()); -// } -// } - - - - int shiftkey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey(); - int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); + int shiftkey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey(); + int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); ctrlkey = ctrlkey + shiftkey; - - //EED 12/07/2012 // if ( (state==SELECTED) && (ctrlkey==0) && (_objHasBeenMoved==false)) // { // _view->setState(NOTHING_HAPPENS); // _model->notifyObservers(getId(),REMOVE_FROM_SELECTED); // } - - - return true; - } //========================================================================= - bool GBlackBoxController::OnRightButtonUp() { return true; } //========================================================================= - bool GBlackBoxController::OnMiddleButtonDown() { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); - // int state = _view->getState(); - //Evaluate new state if(_view->isPointInside(X,Y)) { @@ -242,14 +210,11 @@ namespace bbtk if(bbmodel->isExecutable()) { bbmodel->setExecutable(false); - } - else - { + } else { bbmodel->setExecutable(true); } bbmodel->notifyObservers(getId()); } - return true; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx index 80e59f0..ad8024d 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx @@ -86,7 +86,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; + crea::wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); @@ -139,7 +139,7 @@ namespace bbtk bool GBoxController::OnLeftButtonUp() { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx index 8a97cb4..1b2fcd4 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx @@ -93,7 +93,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; + crea::wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); @@ -114,7 +114,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); @@ -132,7 +132,7 @@ namespace bbtk if( _vtkInteractorStyleBaseView!= NULL ) { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); @@ -156,7 +156,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); @@ -173,7 +173,7 @@ namespace bbtk if( _vtkInteractorStyleBaseView!= NULL ) { int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); @@ -197,7 +197,7 @@ namespace bbtk if ( _vtkInteractorStyleBaseView!=NULL ) { int X, Y, Z=GPOSITION_Z; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); _controller->GetManualViewBaseContour()->InitMove( X, Y,Z); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index e4d6b8b..19994d9 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -89,7 +89,7 @@ namespace bbtk bool GObjectController::OnMouseMove( ) { int X , Y ; - wxVTKRenderWindowInteractor *_wxVTKiren ; + crea::wxVTKRenderWindowInteractor *_wxVTKiren ; _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ; _wxVTKiren->GetEventPosition( X , Y ) ; int state = _view->getState( ) ; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index b5355ea..4b9c0e5 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -122,7 +122,8 @@ wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() } //========================================================================= -void wxGUIEditorGraphicBBS::initToolbar() { +void wxGUIEditorGraphicBBS::initToolbar() +{ wxBitmap bmp_new(new_xpm); wxBitmap bmp_open(open_xpm); wxBitmap bmp_save(save_xpm); @@ -143,8 +144,10 @@ void wxGUIEditorGraphicBBS::initToolbar() { //Adds a tool btn to the toolbar toolbar->AddTool(ID_NEW, _T("New"), bmp_new, wxNullBitmap, wxITEM_NORMAL, _T("New tab"), _T("Create a new panel tab")); + toolbar->AddTool(ID_OPEN, _T("Open diagram"), bmp_open, wxNullBitmap, wxITEM_NORMAL, _T("Open a diagram"), _T("Open a diagram")); + toolbar->AddTool(ID_SAVE_DIAGRAM, _T("Save Diagram"), bmp_save, wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH @@ -165,7 +168,14 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->AddSeparator(); toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm, wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box")); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 toolbar->SetToggle(ID_BTNCOMPLEXBOX, true); +#else + printf ("EED Warnning. wxGUIEditorGraphicBBS::initToolbar >>> toolbar->SetToggle \n "); + // .. +#endif // RaC 2012 2nd HackFest - Now Complex inputs are any external input // toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"), @@ -191,6 +201,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->EnableTool(ID_EDITPROPERTIES, false); toolbar->AddTool(ID_SHOWTREE, _T("Show tree"),bmp_showTree, wxNullBitmap, wxITEM_NORMAL, _T("Show tree"), _T("Show tree")); + toolbar->EnableTool(ID_UNDO, false); toolbar->EnableTool(ID_REDO, false); @@ -198,6 +209,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->Realize(); SetToolBar(toolbar); + // connect command event handlers @@ -239,6 +251,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties)); Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree)); + } //========================================================================= void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index ef9dc2f..78a3f31 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -31,29 +31,6 @@ Version: $Revision$ =========================================================================*/ -/* --------------------------------------------------------------------- - -* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) -* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux -* -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -* or in the file LICENSE.txt. -* -* As a counterpart to the access to the source code and rights to copy, -* modify and redistribute granted by the license, users are provided only -* with a limited warranty and the software's author, the holder of the -* economic rights, and the successive licensors have only limited -* liability. -* -* The fact that you are presently reading this means that you have had -* knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ - - /** * \file diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 731585d..d3a984f 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -138,7 +138,7 @@ void wxVtkSceneManager::configureBaseView() _baseView->SetInteractorStyleBaseView(interactorstylebaseview); // Important to activate the 2D interaction system - wxVTKRenderWindowInteractor *iren = _baseView->GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *iren = _baseView->GetWxVTKRenderWindowInteractor(); interactorstylebaseview->SetInteractor(iren); iren->SetInteractorStyle(interactorstylebaseview); interactorstylebaseview->SetwxVtkBaseView(_baseView); @@ -816,7 +816,7 @@ bool wxVtkSceneManager::OnMouseMove() int X, Y; bool okStatusMessage = false; bool okPortMessage = false; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); @@ -1055,7 +1055,7 @@ bool wxVtkSceneManager::OnMiddleButtonUp() { GObjectController *wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse() { GObjectController *result = NULL; int X, Y; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); @@ -1093,47 +1093,6 @@ bool wxVtkSceneManager::OnLeftDClick() { UnSelectBlackBoxes(); _parent->editBlackBox((GBlackBoxModel*) cont->getModel()); } - - /*EED Borrame - - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); - - std::map::iterator it; - - bool clickOnObject = false; - - for(it = _controllers.begin(); it != _controllers.end() && clickOnObject==false; ++it) - { - GObjectController *cont = it->second; - int type = cont->getGObjectType(); - - if(cont->getView()->isPointInside(X,Y)) - { - if(type==GBLACKBOX) - { - for (int i=0; i< (int)_selectedObjects.size(); i++) - { - int id = _selectedObjects[i]; - GObjectController* control = _controllers[id]; - control->getView()->setState(NOTHING_HAPPENS); - } - _selectedObjects.clear(); - - GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel(); - _parent->editBlackBox(bbmodel); - } - clickOnObject = true; - } - } - - if(clickOnObject==false) - { - //_parent->editDiagramParameters(this); - } - */ return true; } -- 2.47.1