]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
2149 bbGEditor Bug New Normal Conflict creating inpus and outputs with the same name...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
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
 }
 
 //=========================================================================