]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
Bug #1682 Crash deleting the actual connection creation
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxVtkSceneManager.cxx
index bc9e4b53033c649d7a2ce7250bfdd11ae6e4487f..3a411d84aae13f951de908eb7ca225c46b5dfe04 100644 (file)
@@ -507,7 +507,11 @@ GPortController* wxVtkSceneManager::createGPort(int portType,
 
 //=========================================================================
 
-int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
+int wxVtkSceneManager::createGConnector(GPortModel* startPort) 
+{
+       
+               
+
        int type = GCONNECTOR;
 
        manualConnectorContourController        *manContourControl              = new manualConnectorContourController();
@@ -530,6 +534,8 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
        manContourView->SetColorEditContour(0.5, 0.5, 0.5);
        manContourView->SetColorSelectContour(1, 0.8, 0);
         
+       
+
         /**
          * JGRR AND CM
          * Width increased from 2 to 3, it simplifies line handling and spline control :P
@@ -677,6 +683,7 @@ void wxVtkSceneManager::update(int idController, int command) {
                        // The last one is the controller of the connector
                        std::map<int, GObjectController*>::iterator it2;
 
+
                        for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
                                GObjectController *cont = it2->second;
                                if (cont->getGObjectType() == GPORT) {
@@ -953,8 +960,10 @@ void wxVtkSceneManager::CancelConnection()
 
 //=========================================================================
 
-bool wxVtkSceneManager::OnRightButtonUp() {
-       if (_worldState == INIT_CREATION_CONTOUR) {
+bool wxVtkSceneManager::OnRightButtonUp() 
+{
+       if (_worldState == INIT_CREATION_CONTOUR) 
+       {
                CancelConnection();
        }
        UnSelectBlackBoxes();
@@ -1079,8 +1088,21 @@ bool wxVtkSceneManager::OnChar()
         
        // KeyCode 127 : Delete Key
        // KeyCode 8 : Backspace Key
+
+
+       if (keyCode == 8 || keyCode == 127 || keyCode == 27) 
+       {
+               if (_worldState == INIT_CREATION_CONTOUR) 
+               {
+                       CancelConnection();
+                       UnSelectBlackBoxes();
+               }
+       }
+
+
        if (keyCode == 8 || keyCode == 127) 
        {
+
                        for (int i = 0; i < (int) _selectedObjects.size(); i++) 
                        {
                                int id = _selectedObjects[i];