X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsVtkGUIEditorGraphic%2FGBlackBoxController.cxx;h=bafa37f019402b0de5a36bc0c19179e6334afe1a;hb=50851761f4216d932217db8e8fe56dd5aac6b0fb;hp=4554e541c77c02809c61f285c1b748d57b230f97;hpb=eaf825847b9ac4bd762deafa59a7df1c2ceba433;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx index 4554e54..bafa37f 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx @@ -65,16 +65,12 @@ namespace bbtk int state = _view->getState(); //Evaluate new state - if( state == DRAG) - { - moveObject(X,Y); - } - + if(state == NOTHING_HAPPENS) { if(_view->isPointInside(X,Y)) { - _view->setState(HIGHLIGHTED); + _view->setState(HIGHLIGHTED); } } if( state==HIGHLIGHTED) @@ -95,80 +91,50 @@ namespace bbtk bool GBlackBoxController::OnLeftButtonDown() { - - if ( _vtkInteractorStyleBaseView!=NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); - - int state = _view->getState(); - - //Evaluate new state - if( state==HIGHLIGHTED) - { - _view->isStartDragging(true); - _view->setState(DRAG); - } - - if( state == SELECTED) - { - if(_view->isPointInside(X,Y)) - { - _view->isStartDragging(true); - _view->setState(DRAG); - } - } + int state = _view->getState(); - _model->notifyObservers(_id); + //Evaluate new state + if(state == HIGHLIGHTED) + { + _isLeftClickDown=true; + _view->setState(SELECTED); + _model->notifyObservers(_id,ADD_TO_SELECTED); } return true; + } //========================================================================= bool GBlackBoxController::OnLeftButtonUp() { - if ( _vtkInteractorStyleBaseView!=NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); + int X,Y; + wxVTKRenderWindowInteractor *wxVTKiren; + wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + wxVTKiren->GetEventPosition(X,Y); - int state = _view->getState(); + int state = _view->getState(); - //Evaluate new state - if(state==CLICKED) - { - _view->setState(SELECTED); - } - - if( state == DRAG) + //Evaluate new state + 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(_id); } - - _model->notifyObservers(_id); - } return true; + } //========================================================================= bool GBlackBoxController::OnLeftDClick() { - if ( _vtkInteractorStyleBaseView!=NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); - - _model->notifyObservers(_id); - } + return true; } @@ -176,23 +142,6 @@ namespace bbtk bool GBlackBoxController::OnRightButtonDown() { - if( _vtkInteractorStyleBaseView!= NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X, Y); - - int state = _view->getState(); - - //Evaluate new state - if( state == SELECTED) - { - _view->setState(NOTHING_HAPPENS); - } - - _model->notifyObservers(_id); - } return true; }