]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
Implemented deleting of boxes from the scene....
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GBlackBoxController.cxx
index bafa37f019402b0de5a36bc0c19179e6334afe1a..b8d884e12b7e8b3664e32ba3780f03594ff667d9 100644 (file)
@@ -81,7 +81,7 @@ namespace bbtk
                                }
                        }
                        
-                       _model->notifyObservers(_id);
+                       _model->notifyObservers(getId());
                        
                }
                return true;
@@ -98,7 +98,7 @@ namespace bbtk
                {
                        _isLeftClickDown=true;
                        _view->setState(SELECTED);
-                       _model->notifyObservers(_id,ADD_TO_SELECTED);
+                       _model->notifyObservers(getId(),ADD_TO_SELECTED);
                }
                return true;
 
@@ -123,7 +123,7 @@ namespace bbtk
                        {
                                // It is supposed that I'm always inside even if the box is in drag
                                _view->setState(SELECTED);
-                               _model->notifyObservers(_id);
+                               _model->notifyObservers(getId());
                        }
                }
                return true;
@@ -140,8 +140,37 @@ namespace bbtk
        
        //=========================================================================
        
-       bool GBlackBoxController::OnRightButtonDown()
+       bool GBlackBoxController::OnRightButtonUp()
        {
+               GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+               if(bbmodel->isExecutable())
+               {
+                       bbmodel->setExecutable(false);
+               }
+               
+               return true;
+       }
+
+       //=========================================================================
+
+       bool GBlackBoxController::OnMiddleButtonDown()
+       {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               int state  = _view->getState();
+
+               //Evaluate new state
+               if(_view->isPointInside(X,Y))
+               {
+                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+                       _view->setState(HIGHLIGHTED);
+                       bbmodel->setExecutable(true);
+                       bbmodel->notifyObservers(getId());
+               }
+                       
                return true;
        }