]> Creatis software - bbtkGEditor.git/commitdiff
BUG 1504
authordavila <>
Thu, 12 Jul 2012 13:53:51 +0000 (13:53 +0000)
committerdavila <>
Thu, 12 Jul 2012 13:53:51 +0000 (13:53 +0000)
  Erase wrong connections
  Simple selection of a box not possible

lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index 8c73675eeab4d6779ba589759cdc27d9bc297667..99c7d07bef0bc8fb3a6a7387d35b5aaf8e3cff19 100644 (file)
@@ -120,13 +120,18 @@ namespace bbtk
                
 //             if(state == HIGHLIGHTED)
 //EED3oct2010          if ( (state == HIGHLIGHTED) && (ctrlkey==1  ) )
                
 //             if(state == HIGHLIGHTED)
 //EED3oct2010          if ( (state == HIGHLIGHTED) && (ctrlkey==1  ) )
+                       
+               if(state == SELECTED)
                {
                {
+                       _view->setState(NOTHING_HAPPENS);
+                       _model->notifyObservers(getId(),REMOVE_FROM_SELECTED);
+               } else {
                    ok=false;
                        _view->setState(SELECTED);
                        _model->notifyObservers(getId(),ADD_TO_SELECTED);
                }
                
                    ok=false;
                        _view->setState(SELECTED);
                        _model->notifyObservers(getId(),ADD_TO_SELECTED);
                }
                
-      
+               
                int shiftkey            = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey();
                int ctrlkey             = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
                ctrlkey = ctrlkey + shiftkey;
                int shiftkey            = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey();
                int ctrlkey             = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
                ctrlkey = ctrlkey + shiftkey;
@@ -173,11 +178,12 @@ namespace bbtk
                ctrlkey = ctrlkey + shiftkey;
                
                
                ctrlkey = ctrlkey + shiftkey;
                
                
-               if ( (state==SELECTED) && (ctrlkey==0) && (_objHasBeenMoved==false))
-               {
-                       _view->setState(NOTHING_HAPPENS);
-                       _model->notifyObservers(getId(),REMOVE_FROM_SELECTED);
-               }
+//EED 12/07/2012               
+//             if ( (state==SELECTED) && (ctrlkey==0) && (_objHasBeenMoved==false))
+//             {
+//                     _view->setState(NOTHING_HAPPENS);
+//                     _model->notifyObservers(getId(),REMOVE_FROM_SELECTED);
+//             }
 
 
 
 
 
 
index b0175e6e07d425a6d299c2d934d941f330375807..da3336334faf938db197fb1e7bb2460779431642 100644 (file)
@@ -95,7 +95,6 @@ namespace bbtk
        bool GBoxController::OnLeftButtonDown()
        {
            bool ok=true;
        bool GBoxController::OnLeftButtonDown()
        {
            bool ok=true;
-printf("EED GBoxController::OnLeftButtonDown \n");
                int state  = _view->getState();
 
                //Evaluate new state
                int state  = _view->getState();
 
                //Evaluate new state
@@ -104,7 +103,8 @@ printf("EED GBoxController::OnLeftButtonDown \n");
                    ok=false;
                        _isLeftClickDown=true;
                        _view->setState(SELECTED);
                    ok=false;
                        _isLeftClickDown=true;
                        _view->setState(SELECTED);
-                       _model->notifyObservers(getId(),ADD_TO_SELECTED);
+//                     _model->notifyObservers(getId(),ADD_TO_SELECTED);
+                       _model->notifyObservers(getId());
                }
                return ok;
 
                }
                return ok;
 
index 924bd62fccad1a0204434ed2ff24203097e2b238..1d07ba845fe679a10046d4870fd318e371de9608 100644 (file)
@@ -60,6 +60,13 @@ namespace bbtk
        bool GConnectorController::OnMouseMove()
        {
 
        bool GConnectorController::OnMouseMove()
        {
 
+               printf("EED GConnectorController::OnMouseMove  state%d\n", _view->getState() );
+               
+               if (_view->getState() ==SELECTED)
+               {
+                       _controller->GetManualViewBaseContour()->SetSelected(true);
+               }
+               
                if ( _vtkInteractorStyleBaseView!=NULL)
                {
                        int X,Y;
                if ( _vtkInteractorStyleBaseView!=NULL)
                {
                        int X,Y;
index 6c8acf0eae3dcbfb045f94839df4cdaa88e42c09..de910b70ab1f210a3802ba6c2da7d59cdccd81f2 100644 (file)
@@ -755,7 +755,8 @@ void wxVtkSceneManager::update(int idController, int command) {
 
 //=========================================================================
 
 
 //=========================================================================
 
-bool wxVtkSceneManager::OnMouseMove() {
+bool wxVtkSceneManager::OnMouseMove() 
+{
        int X, Y;
        bool okStatusMessage    = false;
        bool okPortMessage              = false;
        int X, Y;
        bool okStatusMessage    = false;
        bool okPortMessage              = false;
@@ -797,16 +798,18 @@ bool wxVtkSceneManager::OnMouseMove() {
                        desc->getModel()->getCenter(px, py, pz);
 
                         // JGRR & CM
                        desc->getModel()->getCenter(px, py, pz);
 
                         // JGRR & CM
-                       if ((state == HIGHLIGHTED) || (state == SELECTED_POSSIBLE_CONNECTION )) {
+                       if ((state == HIGHLIGHTED) || (state == SELECTED_POSSIBLE_CONNECTION )) 
+                       {
                         // EO JGRR & CM    
                                okStatusMessage = true;
                                updateStatusBar(desc->getStatusText());
                         // EO JGRR & CM    
                                okStatusMessage = true;
                                updateStatusBar(desc->getStatusText());
-                               if (type == GBLACKBOX) {
+                               if (type == GBLACKBOX) 
+                               {
                                        GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
                                        GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
-                                       _parent->displayBlackBoxInfo(mod->getBBTKPackage(),
-                                                       mod->getBBTKType());
+                                       _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType());
                                } // if GBLACKBOX
                                } // if GBLACKBOX
-                               if (type == GPORT) {
+                               if (type == GPORT) 
+                               {
                                        // PortText
                                        okPortMessage = true;
                                        py = py + 5;
                                        // PortText
                                        okPortMessage = true;
                                        py = py + 5;
@@ -826,11 +829,13 @@ bool wxVtkSceneManager::OnMouseMove() {
                        } // for controllers it
                }
        }
                        } // for controllers it
                }
        }
-       if (okStatusMessage == false) {
+       if (okStatusMessage == false) 
+       {
                updateStatusBar("");
        }
 
                updateStatusBar("");
        }
 
-       if (okPortMessage == false) {
+       if (okPortMessage == false) 
+       {
                _textActor->SetScale(0.0001);
                _fillObjectActor->SetScale(0.0001);
        }
                _textActor->SetScale(0.0001);
                _fillObjectActor->SetScale(0.0001);
        }
@@ -839,32 +844,35 @@ bool wxVtkSceneManager::OnMouseMove() {
 
 //=========================================================================
 
 
 //=========================================================================
 
-bool wxVtkSceneManager::OnLeftButtonDown() {
-
-       if (_worldState == INIT_CREATION_CONTOUR) {
+bool wxVtkSceneManager::OnLeftButtonDown() 
+{
+       if (_worldState == INIT_CREATION_CONTOUR) 
+       {
                bool isOverPort = false;
                std::map<int, GObjectController*>::iterator it;
                bool isOverPort = false;
                std::map<int, GObjectController*>::iterator it;
-               for (it = _controllers.begin(); it != _controllers.end() && isOverPort
-                               == false; ++it) {
+               for (it = _controllers.begin(); it != _controllers.end() && isOverPort== false; ++it) 
+               {
                        GObjectController *desc = it->second;
                        GObjectController *desc = it->second;
-                       if (desc->getGObjectType() == GPORT) {
+                       if (desc->getGObjectType() == GPORT) 
+                       {
                                GPortModel *portmod = (GPortModel*) desc->getModel();
                                vtkGObjectView *portView = desc->getView();
                                GPortModel *portmod = (GPortModel*) desc->getModel();
                                vtkGObjectView *portView = desc->getView();
-                               if (portmod->getPortType() == GINPUTPORT
-                                               && portView->getState() == HIGHLIGHTED) {
+                               if (portmod->getPortType() == GINPUTPORT && portView->getState() == HIGHLIGHTED) 
+                               {
                                        isOverPort = true;
                                        isOverPort = true;
-                                 } // if
-                                // JGRR & CM                    
-                                if ( portmod->getPortType( ) == GINPUTPORT &&  portView->getState( ) == SELECTED_POSSIBLE_CONNECTION   ) {
-                                    isOverPort = true ;
-                                    portView->setState( HIGHLIGHTED);
-                                }                    
-                                // EO JGRR & CM 
-
-                        } // if
+                               } // if
+                               // JGRR & CM                    
+                               if ( portmod->getPortType( ) == GINPUTPORT &&  portView->getState( ) == SELECTED_POSSIBLE_CONNECTION   ) {
+                                       isOverPort = true ;
+                                       portView->setState( HIGHLIGHTED);
+                               }                    
+                               // EO JGRR & CM 
+
+                       } // if
                } // for
 
                } // for
 
-               if (isOverPort == false) {
+               if (isOverPort == false) 
+               {
                        CancelConnection();
                        UnSelectBlackBoxes();
                } // isOverPort
                        CancelConnection();
                        UnSelectBlackBoxes();
                } // isOverPort
@@ -881,19 +889,20 @@ bool wxVtkSceneManager::OnLeftButtonDown() {
 
                GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
 
 
                GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
 
-               if (GetGBlackBoxControlerPointedByMouse() != NULL) {
+               if (cont != NULL) {
                        int state = cont->getView()->getState();
                        if ((ctrlkey == 0) && (state == HIGHLIGHTED)) {
                                UnSelectBlackBoxes();
                        }
                        int state = cont->getView()->getState();
                        if ((ctrlkey == 0) && (state == HIGHLIGHTED)) {
                                UnSelectBlackBoxes();
                        }
+               } else {
+                       UnSelectBlackBoxes();  // EED 12/07/2012
                }
                for (int i = 0; i < (int) _selectedObjects.size(); i++) {
                        int id = _selectedObjects[i];
                }
                for (int i = 0; i < (int) _selectedObjects.size(); i++) {
                        int id = _selectedObjects[i];
-                       GObjectControllercont = _controllers[id];
+                       GObjectController *cont = _controllers[id];
                        cont->getView()->setState(DRAG);
                        cont->getModel()->notifyObservers(_idManager);
                } // for
                        cont->getView()->setState(DRAG);
                        cont->getModel()->notifyObservers(_idManager);
                } // for
-               
        } // if _selectedObjects.size
 
 
        } // if _selectedObjects.size
 
 
@@ -902,7 +911,8 @@ bool wxVtkSceneManager::OnLeftButtonDown() {
 
 //=========================================================================
 
 
 //=========================================================================
 
-bool wxVtkSceneManager::OnLeftButtonUp() {
+bool wxVtkSceneManager::OnLeftButtonUp() 
+{
        if (_worldState == DRAG_OBJECTS) {
                _worldState = NOTHING_HAPPENS;
 
        if (_worldState == DRAG_OBJECTS) {
                _worldState = NOTHING_HAPPENS;
 
@@ -917,8 +927,10 @@ bool wxVtkSceneManager::OnLeftButtonUp() {
 }
 
 //=========================================================================
 }
 
 //=========================================================================
-void wxVtkSceneManager::CancelConnection() {
-       if (_worldState == INIT_CREATION_CONTOUR) {
+void wxVtkSceneManager::CancelConnection() 
+{
+       if (_worldState == INIT_CREATION_CONTOUR) 
+       {
                _worldState = NOTHING_HAPPENS;
                //int lastId = _controllers.size()-1;
 
                _worldState = NOTHING_HAPPENS;
                //int lastId = _controllers.size()-1;
 
@@ -929,7 +941,8 @@ void wxVtkSceneManager::CancelConnection() {
                _controllers.erase(_idConnectionInCreation);
 
                std::map<int, GObjectController*>::iterator it;
                _controllers.erase(_idConnectionInCreation);
 
                std::map<int, GObjectController*>::iterator it;
-               for (it = _controllers.begin(); it != _controllers.end(); ++it) {
+               for (it = _controllers.begin(); it != _controllers.end(); ++it) 
+               {
                        GObjectController *desc = it->second;
                        desc->SetActive(true);
                        desc->getView()->setState(NOTHING_HAPPENS);
                        GObjectController *desc = it->second;
                        desc->SetActive(true);
                        desc->getView()->setState(NOTHING_HAPPENS);
@@ -1092,7 +1105,8 @@ bool wxVtkSceneManager::OnChar()
 #endif
                if(_selectedObjects.size()){
                        std::cout<<"objects to copy :";
 #endif
                if(_selectedObjects.size()){
                        std::cout<<"objects to copy :";
-                       for(int i=0;i<_selectedObjects.size();i++){
+                       for(int i=0;i<_selectedObjects.size();i++)
+                       {
                                std::cout<<_selectedObjects.at(i)<<" ";
                        }
                        DuplicateObjects(getSelectedObjects());   
                                std::cout<<_selectedObjects.at(i)<<" ";
                        }
                        DuplicateObjects(getSelectedObjects());