]> Creatis software - bbtkGEditor.git/commitdiff
1497 BUG
authordavila <>
Mon, 9 Jul 2012 14:54:06 +0000 (14:54 +0000)
committerdavila <>
Mon, 9 Jul 2012 14:54:06 +0000 (14:54 +0000)
   Read problem in mac/linux with bbg generated in windows

lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h

index a3c0af043f251c6f1c282da9724812b09ee7f093..6548a8d406b5317f12dc1bb081ce97d87de36b1c 100644 (file)
@@ -60,7 +60,6 @@ namespace bbtk
        //=========================================================================
        void wxTabPanelsManager::addNewTab(wxString tabName)
        {
-printf("EED wxTabPanelsManager::addNewTab 0\n");
 
                _lastId++;
                wxGEditorTabPanel *newPanel         = new wxGEditorTabPanel(_notebook,_lastId);
@@ -69,8 +68,6 @@ printf("EED wxTabPanelsManager::addNewTab 0\n");
                _actual                             = newPanel;
 
                _notebook->AddPage(newPanel, tabName  ,true);
-
-printf("EED wxTabPanelsManager::addNewTab 1\n");
        }
 
 
index b88f527cad467418da510f634b114e5d0e33699f..6c8acf0eae3dcbfb045f94839df4cdaa88e42c09 100644 (file)
@@ -1735,21 +1735,35 @@ void wxVtkSceneManager::saveDiagram(std::string &content) {
 
 }
 
+//=========================================================================
+void wxVtkSceneManager::getCleanLine(stringstream &inputStream, std::string &line)
+{
+       getline(inputStream, line,'\n');
+       int size = line.length();
+       if ( line[ size-1 ]==13  )
+       {
+               line.erase(size-1,1);
+       }
+}
+       
 //=========================================================================
 
-void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
-
+void wxVtkSceneManager::loadDiagram(stringstream &inputStream) 
+{
+       int size;
        std::string version = "<void>";
        std::string line = "";
        char delims[] = ":";
        char *result = NULL;
 
-       getline(inputStream, line);
+       getCleanLine(inputStream, line);
 
        bool start = false;
        while (!inputStream.eof()) {
                if (line == "" || line[0] == '#') {
-                       getline(inputStream, line);
+                       line="";
+                       getCleanLine(inputStream, line);
+                       
                        if (line == "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file") {
                                version = line.substr(18, 3);
                        }
@@ -1768,26 +1782,25 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                }
        }
 
-       printf("EED wxVtkSceneManager::loadDiagram  version=%s\n", version.c_str());
 
        if (start) {
 
                if ((version != "1.0") && (version != "1.1")) {
-                       getline(inputStream, line);//CATEGORY:<category of the box>
+                       getCleanLine(inputStream, line);//CATEGORY:<category of the box>
                        char categoryTmp[30];
                        strcpy(categoryTmp, line.c_str());
                        result = strtok(categoryTmp, delims);
                        result = strtok(NULL, delims);
                        SetCategory(result);
 
-                       getline(inputStream, line);//DESCRIPTION:<description of the box>
+                       getCleanLine(inputStream, line);//DESCRIPTION:<description of the box>
                        char descriptionTmp[1024];
                        strcpy(descriptionTmp, line.c_str());
                        result = strtok(descriptionTmp, delims);
                        result = strtok(NULL, delims);
                        SetDescription(result);
 
-                       getline(inputStream, line);//AUTHOR:<author>
+                       getCleanLine(inputStream, line);//AUTHOR:<author>
                        char authorTmp[255];
                        strcpy(authorTmp, line.c_str());
                        result = strtok(authorTmp, delims);
@@ -1796,7 +1809,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                }
 
                //----------
-               getline(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
+               getCleanLine(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
                char complexTmp[30];
                strcpy(complexTmp, line.c_str());
                result = strtok(complexTmp, delims);
@@ -1807,14 +1820,14 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        _isComplexBox = true;
 
                        if ((version != "1.0") && (version != "1.1")) {
-                               getline(inputStream, line);//COMPLEXNAME:<name of the complex box>
+                               getCleanLine(inputStream, line);//COMPLEXNAME:<name of the complex box>
                                char complexboxnameTmp[255];
                                strcpy(complexboxnameTmp, line.c_str());
                                result = strtok(complexboxnameTmp, delims);
                                result = strtok(NULL, delims);
                                SetCbName(result);
 
-                               getline(inputStream, line);//PACKAGENAME:<name of the package of the box>
+                               getCleanLine(inputStream, line);//PACKAGENAME:<name of the package of the box>
                                char packagenameTmp[255];
                                strcpy(packagenameTmp, line.c_str());
                                result = strtok(packagenameTmp, delims);
@@ -1825,7 +1838,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        //-----------------------
                        //- COMPLEX INPUT PORTS
                        //-----------------------
-                       getline(inputStream, line);//COMPLEXINPUTS:num
+                       getCleanLine(inputStream, line);//COMPLEXINPUTS:num
                        char inputs[30];
                        strcpy(inputs, line.c_str());
                        result = strtok(inputs, delims);
@@ -1837,12 +1850,12 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
                        for (int i = 0; i < numInputs; i++) {
                                //----------
-                               getline(inputStream, line);//COMPLEX_PORT
-                               getline(inputStream, line);//name
+                               getCleanLine(inputStream, line);//COMPLEX_PORT
+                               getCleanLine(inputStream, line);//name
                                std::string inputPortName(line);
 
                                //----------
-                               getline(inputStream, line);//xInic:yInic:zInic
+                               getCleanLine(inputStream, line);//xInic:yInic:zInic
                                char coord[80];
                                strcpy(coord, line.c_str());
                                result = strtok(coord, delims);//xInic
@@ -1865,7 +1878,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                                        if (zIn==900) zIn=GPOSITION_Z;
                                }
                                
-                               getline(inputStream, line);//FIN_COMPLEX_PORT
+                               getCleanLine(inputStream, line);//FIN_COMPLEX_PORT
 
                                configGComBoxInputOutputPort(true, inputPortName, xIn, yIn, zIn);
 
@@ -1876,7 +1889,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        //- COMPLEX OUTPUT PORTS
                        //-----------------------
 
-                       getline(inputStream, line);//COMPLEXOUTPUTS:num
+                       getCleanLine(inputStream, line);//COMPLEXOUTPUTS:num
                        char outputs[30];
                        strcpy(outputs, line.c_str());
                        result = strtok(outputs, delims);
@@ -1888,12 +1901,12 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
                        for (int i = 0; i < numOutputs; i++) {
                                //----------
-                               getline(inputStream, line);//COMPLEX_PORT
-                               getline(inputStream, line);//name
+                               getCleanLine(inputStream, line);//COMPLEX_PORT
+                               getCleanLine(inputStream, line);//name
                                std::string outputPortName(line);
 
                                //----------
-                               getline(inputStream, line);//xInic:yInic:zInic
+                               getCleanLine(inputStream, line);//xInic:yInic:zInic
                                char coord[80];
                                strcpy(coord, line.c_str());
                                result = strtok(coord, delims);//xInic
@@ -1916,7 +1929,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                                        if (zIn==900) zIn=GPOSITION_Z;
                                }
                                
-                               getline(inputStream, line);//FIN_COMPLEX_PORT
+                               getCleanLine(inputStream, line);//FIN_COMPLEX_PORT
 
                                configGComBoxInputOutputPort(false, outputPortName, xIn, yIn, zIn);
 
@@ -1925,7 +1938,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                } // complex box
 
                //----------
-               getline(inputStream, line);//BOXES:num
+               getCleanLine(inputStream, line);//BOXES:num
                char boxes[9];
                strcpy(boxes, line.c_str());
                result = strtok(boxes, delims);
@@ -1937,8 +1950,8 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
                for (int i = 0; i < numBoxes; i++) {
                        //----------
-                       getline(inputStream, line);//BOX
-                       getline(inputStream, line);//package:type:name
+                       getCleanLine(inputStream, line);//BOX
+                       getCleanLine(inputStream, line);//package:type:name
                        char box[150];
                        strcpy(box, line.c_str());
                        result = strtok(box, delims);//package
@@ -1948,7 +1961,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        result = strtok(NULL, delims);//name
                        std::string name(result);
 
-                       getline(inputStream, line);//ISEXEC:TRUE|FALSE
+                       getCleanLine(inputStream, line);//ISEXEC:TRUE|FALSE
                        char exec[15];
                        strcpy(exec, line.c_str());
                        result = strtok(exec, delims);//ISEXEC
@@ -1956,7 +1969,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        std::string isExec(result);
 
                        //----------
-                       getline(inputStream, line);//xInic:yInic:zInic
+                       getCleanLine(inputStream, line);//xInic:yInic:zInic
                        char coord[80];
                        strcpy(coord, line.c_str());
                        result = strtok(coord, delims);//xInic
@@ -1982,7 +1995,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        
                        
                        //----------
-                       getline(inputStream, line);//xEnd:yEnd:zEnd
+                       getCleanLine(inputStream, line);//xEnd:yEnd:zEnd
                        strcpy(coord, line.c_str());
                        result = strtok(coord, delims);//xEnd
                        std::string xEnd(result);
@@ -2017,10 +2030,10 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                        GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
 
                        //----------
-                       getline(inputStream, line);//PORT o FIN_BOX
+                       getCleanLine(inputStream, line);//PORT o FIN_BOX
                        std::string port = line.substr(0, 4);
                        while (port == "PORT") {
-                               getline(inputStream, line);//name:value
+                               getCleanLine(inputStream, line);//name:value
                                char poort[150];
                                strcpy(poort, line.c_str());
                                result = strtok(poort, delims);//name
@@ -2030,7 +2043,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
                                bbmod->setValueToInput(name, value);
 
-                               getline(inputStream, line);//PORT o FIN_BOX
+                               getCleanLine(inputStream, line);//PORT o FIN_BOX
                                port = line.substr(0, 4);
                        } // while
 
@@ -2039,7 +2052,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
                /// CONNECTIONS
                //----------
-               getline(inputStream, line);//CONNECTIONS:num
+               getCleanLine(inputStream, line);//CONNECTIONS:num
                char conns[30];
                strcpy(conns, line.c_str());
                result = strtok(conns, delims);
@@ -2048,11 +2061,12 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                int numConns;
                std::istringstream isCons(result);
                isCons >> numConns;
-
+               
+               
                for (int i = 0; i < numConns; i++) {
                        //----------
-                       getline(inputStream, line);//CONNECTION
-                       getline(inputStream, line);//Startbox.PortName:EndBox.PortName
+                       getCleanLine(inputStream, line);//CONNECTION
+                       getCleanLine(inputStream, line);//Startbox.PortName:EndBox.PortName
 
                        char connec[200];
                        strcpy(connec, line.c_str());
@@ -2072,7 +2086,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                                GConnectorController *tempp             = (GConnectorController*) _controllers[idCon];
                                GConnectorModel *conMod                 = (GConnectorModel*) tempp->getModel();
                                vtkGConnectorView *conView              = (vtkGConnectorView*) tempp->getView();
-                               getline(inputStream, line); //NumberOfControlPoints:##
+                               getCleanLine(inputStream, line); //NumberOfControlPoints:##
                                strcpy(conns, line.c_str());
                                result = strtok(conns, delims);
                                result = strtok(NULL, delims);
@@ -2082,7 +2096,7 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
                                isCons >> numberOfControlPoints;
 
                                for (int ii = 0; ii < numberOfControlPoints; ii++) {
-                                       getline(inputStream, line); //XX:YY:ZZ
+                                       getCleanLine(inputStream, line); //XX:YY:ZZ
                                        char connec[200];
                                        strcpy(connec, line.c_str());
 
index 417131192ee3f02c5e2852cd1e6f4059771c76ec..9203963e8636e6686d9a00682fee5f4526f48573 100644 (file)
@@ -209,9 +209,13 @@ namespace bbtk
         std::string GetCategory();
         std::string GetDescription();
   
+               void getCleanLine(std::stringstream &inputStream, std::string &line);
+               
         // JGRR & CM
         void printAll( int com, int sta );
 
+               
+               
        private:
 
         std::string                         _cbName;