]> Creatis software - bbtkGEditor.git/commitdiff
2149 bbGEditor Bug New Normal Conflict creating inpus and outputs with the same name...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 2 Oct 2013 05:37:29 +0000 (07:37 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 2 Oct 2013 05:37:29 +0000 (07:37 +0200)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index 55cdf5e3849f0c327affed677a00e275e34f2478..cb7b9116be6dac37e80c1ecefd2b6fab72c7f4dd 100644 (file)
@@ -229,7 +229,6 @@ namespace bbtk
        //JPR
        void GBoxModel::addColons(std::string &text)
        {
-               printf("EED JPR >>>>>>>>>>>>>>> %s\n",text.c_str() );
                std::string character("&&2P&&");                                
                size_t pos;
                pos = text.find(character);
index 93596627446f3930b78bfa3236751bb5df35d858..978202515800e80f31016afc4d9319792412b0b7 100644 (file)
@@ -1094,18 +1094,28 @@ void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
 }
 
 //=========================================================================
-
+//EED01
 void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event) 
 {
        wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
                        wxT("Name of input port"));
-       if (nameDialog->ShowModal() == wxID_OK) {
+       if (nameDialog->ShowModal() == wxID_OK) 
+        {
                wxString fileName = nameDialog->GetValue();
-               if (!fileName.IsEmpty()) {
+               if (!fileName.IsEmpty()) 
+                {
                        std::string portName = (const char*) (fileName.mb_str());
-                       _tabsMgr->addActualDiagramComplexInputPort(portName);
-               }
-       }
+                       if ( !boxNameExists(portName) )
+                       {
+                          _tabsMgr->addActualDiagramComplexInputPort(portName);
+                       } else {
+                          wxMessageDialog *dial = new wxMessageDialog(NULL,
+                                      wxT("Impossible to create Box. The name already exists. Please provide another name"),
+                                      wxT("Change name: name already exists"), wxOK | wxICON_EXCLAMATION | wxSTAY_ON_TOP);
+                          dial->ShowModal();
+                       }
+               } // if !fileName
+       } // if namaDialog
 }
 
 //=========================================================================
@@ -1113,13 +1123,24 @@ void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event)
 {
        wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
                        wxT("Name of output port"));
-       if (nameDialog->ShowModal() == wxID_OK) {
+       if (nameDialog->ShowModal() == wxID_OK) 
+        {
                wxString fileName = nameDialog->GetValue();
-               if (!fileName.IsEmpty()) {
+               if (!fileName.IsEmpty()) 
+                {
                        std::string portName = (const char*) (fileName.mb_str());
+                       if ( !boxNameExists(portName) )
+                       {
                        _tabsMgr->addActualDiagramComplexOutputPort(portName);
-               }
-       }
+                       } else {
+                          wxMessageDialog *dial = new wxMessageDialog(NULL,
+                                      wxT("Impossible to create Box. The name already exists. Please provide another name"),
+                                      wxT("Change name: name already exists"), wxOK | wxICON_EXCLAMATION | wxSTAY_ON_TOP);
+                          dial->ShowModal();
+                       }
+
+               } // if !filename
+       } // namaDialog
 }
 
 //=========================================================================
index 387924595fad242bf42b9a9a4ff340acb434dbd8..ca8d541dcb63085981ecc1708557ecbb9487488d 100644 (file)
@@ -1874,6 +1874,7 @@ void wxVtkSceneManager::getCleanLine(stringstream &inputStream, std::string &lin
 //=========================================================================
 void wxVtkSceneManager::loadDiagram(stringstream &inputStream) 
 {
+
        int size;
        std::string version = "<void>";
        std::string line = "";
@@ -2016,6 +2017,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream)
                        }
 
 
+
                        //-----------------------
                        //- COMPLEX OUTPUT PORTS
                        //-----------------------
@@ -2145,6 +2147,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream)
                        result = strtok(NULL, delims);//name
                        std::string name(result);
 
+
                        getCleanLine(inputStream, line);//ISEXEC:TRUE|FALSE
                        char exec[15];
                        strcpy(exec, line.c_str());
@@ -2276,6 +2279,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream)
                        result = strtok(NULL, delims);
                        std::string nameEndPort(result);
 
+
                        int idCon = configGConnetion(nameStartBox, nameStartPort,nameEndBox, nameEndPort);
 
                        if (version != "1.0") {
@@ -2352,7 +2356,8 @@ GBoxModel* wxVtkSceneManager::findGBox(std::string boxname)
        for (j = 0; j < (int) lstB.size(); j++) {
                idB = lstB[j];
                bMod = (GBoxModel*) _controllers[idB]->getModel();
-               if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
+               if (_controllers[idB]->getModel()->getBBTKName() == boxname) 
+                {
                        boxModel = bMod;
                }
        } // for
@@ -2364,7 +2369,8 @@ GBoxModel* wxVtkSceneManager::findGBox(std::string boxname)
                for (j = 0; j < (int) lstInputs.size(); j++) {
                        idB = lstInputs[j];
                        bMod = (GBoxModel*) _controllers[idB]->getModel();
-                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
+                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) 
+                        {
                                boxModel = bMod;
                        }
                } // for
@@ -2375,7 +2381,8 @@ GBoxModel* wxVtkSceneManager::findGBox(std::string boxname)
                for (j = 0; j < (int) lstOutputs.size(); j++) {
                        int idB = lstOutputs[j];
                        bMod = (GBoxModel*) _controllers[idB]->getModel();
-                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
+                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) 
+                        {
                                boxModel = bMod;
                        }
                } // for
@@ -2405,7 +2412,7 @@ int wxVtkSceneManager::configGConnetion(std::string nameStartBox,
        if (boxModel != NULL) {
                startP = boxModel->getOutputPort(nameStartPort);
                if(startP == NULL){
-                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion start port %s is null. Port name is probably wrong.\n", nameStartPort.c_str());
+                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion start port is null. Port name is probably wrong.  Start>%s::%s  End>%s::%s\n", nameStartBox.c_str(), nameStartPort.c_str(), nameEndBox.c_str(), nameEndPort.c_str() );
                }
        }
 
@@ -2417,7 +2424,7 @@ int wxVtkSceneManager::configGConnetion(std::string nameStartBox,
        if (boxModel != NULL) {
                endP = boxModel->getInputPort(nameEndPort);
                if(endP == NULL){
-                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion end port %s is null. Port name is probably wrong\n", nameStartPort.c_str(), nameEndPort.c_str());
+                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion end port is null. Port name is probably wrong. Start>%s::%s  End>%s::%s \n", nameStartBox.c_str(), nameStartPort.c_str(), nameEndBox.c_str(), nameEndPort.c_str());
                }
        }