]> 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 ca7bb43a364a791e5c626c73cc711543c96bb975..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
 }
 
 //=========================================================================
@@ -1164,7 +1185,12 @@ void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event)
                if(userResponse==wxID_OK)
                {
                        std::string path = wx2std (FD->GetPath()) ;
+                       #ifdef WIN32
+                       std::string fname = path + "\\bbtkPackage";
+                       #else
                        std::string fname = path + "/bbtkPackage";
+                       #endif
+                       
                        std::cout << "Path chosen = \"" << FD->GetPath() << "\"" << std::endl;
                        if ( Utilities::FileExists( fname ) )
                        {
@@ -1172,6 +1198,11 @@ void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event)
                                f.open(fname.c_str());
                                std::string pname;
                                f >> pname;
+                               while(pname[0] == '#')
+                               {
+                                       getline(f, pname, '\n');
+                                       f >> pname;
+                               }
                                f.close();
 
                                bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );