fix windows compilation, rename CONTEXT in scicos MVC to DIAGRAM_CONTEXT ( CONTEXT... 45/15145/3
Antoine ELIAS [Tue, 2 Sep 2014 16:17:58 +0000 (18:17 +0200)]
Change-Id: I0055b0284626442a0db5776c96541e1b7356aff6

scilab/modules/scicos/includes/utilities.hxx
scilab/modules/scicos/src/cpp/LoggerView.cpp
scilab/modules/scicos/src/cpp/Model_getObjectProperties.cpp
scilab/modules/scicos/src/cpp/Model_setObjectProperties.cpp
scilab/modules/scicos/src/cpp/view_scilab/ParamsAdapter.cpp
scilab/modules/scicos/src/cpp/view_scilab/ports_management.hxx
scilab/modules/xcos/src/java/org/scilab/modules/xcos/ObjectProperties.java

index 1e4a439..07196ad 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef UTILITIES_HXX_
 #define UTILITIES_HXX_
 
-#include <iostream>
+//#include <iostream>
 
 /**
  * A unique ID is used to represent a reference to any object in the model.
@@ -105,7 +105,7 @@ enum object_properties_t
     TITLE,              //!< model::Diagram::title file name value
     PATH,               //!< model::Diagram::title file path value
     PROPERTIES,         //!< model::Diagram::tol & tf values
-    CONTEXT,            //!< model::Diagram::context value
+    DIAGRAM_CONTEXT,    //!< model::Diagram::context value
 };
 
 #endif /* UTILITIES_HXX_ */
index a636d40..8325932 100644 (file)
@@ -232,7 +232,7 @@ std::ostream& operator<<(std::ostream& os, object_properties_t p)
         case PROPERTIES:
             os << "PROPERTIES";
             break;
-        case CONTEXT:
+        case DIAGRAM_CONTEXT:
             os << "CONTEXT";
             break;
     }
index 741245e..0123385 100644 (file)
@@ -523,7 +523,7 @@ bool Model::getObjectProperty(ScicosID uid, kind_t k, object_properties_t p, std
         model::Diagram* o = static_cast<model::Diagram*>(getObject(uid));
         switch (p)
         {
-            case CONTEXT:
+            case DIAGRAM_CONTEXT:
                 o->getContext(v);
                 return true;
             default:
index e02870b..77f3d72 100644 (file)
@@ -483,7 +483,7 @@ update_status_t Model::setObjectProperty(ScicosID uid, kind_t k, object_properti
         model::Diagram* o = static_cast<model::Diagram*>(getObject(uid));
         switch (p)
         {
-            case CONTEXT:
+            case DIAGRAM_CONTEXT:
                 return o->setContext(v);
             default:
                 break;
index fe4a25d..53bc987 100644 (file)
@@ -196,10 +196,10 @@ struct context
         model::Diagram* adaptee = adaptor.getAdaptee();
 
         std::vector<std::string> context;
-        controller.getObjectProperty(adaptee->id(), adaptee->kind(), CONTEXT, context);
+        controller.getObjectProperty(adaptee->id(), adaptee->kind(), DIAGRAM_CONTEXT, context);
 
-        types::String* o = new types::String(context.size(), 1);
-        for (size_t i = 0; i < context.size(); ++i)
+        types::String* o = new types::String((int)context.size(), 1);
+        for (int i = 0; i < (int)context.size(); ++i)
         {
             o->set(i, context[i].data());
         }
@@ -220,14 +220,14 @@ struct context
             model::Diagram* adaptee = adaptor.getAdaptee();
 
             std::vector<std::string> context (current->getSize());
-            for (size_t i = 0; i < context.size(); ++i)
+            for (int i = 0; i < (int)context.size(); ++i)
             {
                 char* c_str = wide_string_to_UTF8(current->get(i));
                 context[i] = std::string(c_str);
                 FREE(c_str);
             }
 
-            controller.setObjectProperty(adaptee->id(), adaptee->kind(), CONTEXT, context);
+            controller.setObjectProperty(adaptee->id(), adaptee->kind(), DIAGRAM_CONTEXT, context);
             return true;
         }
         else if (v->getType() == types::InternalType::ScilabDouble)
@@ -241,7 +241,7 @@ struct context
             model::Diagram* adaptee = adaptor.getAdaptee();
 
             std::vector<std::string> context;
-            controller.setObjectProperty(adaptee->id(), adaptee->kind(), CONTEXT, context);
+            controller.setObjectProperty(adaptee->id(), adaptee->kind(), DIAGRAM_CONTEXT, context);
             return true;
         }
         return false;
index b089edb..7d0104f 100644 (file)
@@ -50,7 +50,7 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
         case STYLE:
         case LABEL:
         {
-            types::String* o = new types::String(ids.size(), 1);
+            types::String* o = new types::String((int)ids.size(), 1);
             for (std::vector<ScicosID>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
             {
                 std::string s;
@@ -61,15 +61,15 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
         }
         case DATATYPE_TYPE:
             datatypeIndex++;
-        // no break
+            // no break
         case DATATYPE_COLS:
             datatypeIndex++;
-        // no break
+            // no break
         case DATATYPE_ROWS:
         {
             datatypeIndex++;
             double* data;
-            types::Double* o = new types::Double(ids.size(), 1, &data);
+            types::Double* o = new types::Double((int)ids.size(), 1, &data);
             for (std::vector<ScicosID>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
             {
                 std::vector<int> v;
@@ -81,7 +81,7 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
         case FIRING:
         {
             double* data;
-            types::Double* o = new types::Double(ids.size(), 1, &data);
+            types::Double* o = new types::Double((int)ids.size(), 1, &data);
             for (std::vector<ScicosID>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
             {
                 controller.getObjectProperty(*it, PORT, p, data[i]);
@@ -90,7 +90,7 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
         }
         case IMPLICIT:
         {
-            types::String* o = new types::String(ids.size(), 1);
+            types::String* o = new types::String((int)ids.size(), 1);
             for (std::vector<ScicosID>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
             {
                 bool v;
@@ -102,7 +102,7 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
         case CONNECTED_SIGNALS:
         {
             double* v;
-            types::Double* o = new types::Double(ids.size(), 1, &v);
+            types::Double* o = new types::Double((int)ids.size(), 1, &v);
 
             ScicosID diagram;
             controller.getObjectProperty(adaptee->id(), adaptee->kind(), PARENT_DIAGRAM, diagram);
@@ -122,7 +122,7 @@ types::InternalType* get_ports_property(const Adaptor& adaptor, object_propertie
 
                 if (found != children.end())
                 {
-                    v[i] = std::distance(found, children.begin());
+                    v[i] = (double)std::distance(found, children.begin());
                 }
                 else
                 {
@@ -232,10 +232,10 @@ bool set_ports_property(const Adaptor& adaptor, object_properties_t port_kind, C
 
             case DATATYPE_TYPE:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_COLS:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_ROWS:
             {
                 datatypeIndex++;
@@ -333,10 +333,10 @@ void updateNewPort(ScicosID oldPort, int newPort, Controller& controller,
         {
             case DATATYPE_TYPE:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_COLS:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_ROWS:
             {
                 datatypeIndex++;
@@ -362,7 +362,7 @@ bool addNewPort(ScicosID newPortID, int newPort, const std::vector<ScicosID>& ch
         if (newPort != 0)
         {
             ScicosID signal = children[newPort];
-            status = controller.setObjectProperty(newPortID, PORT, CONNECTED_SIGNALS, signal);
+            status = controller.setObjectProperty(newPortID, PORT, CONNECTED_SIGNALS, signal) != FAIL;
         }
     }
     else
@@ -373,20 +373,20 @@ bool addNewPort(ScicosID newPortID, int newPort, const std::vector<ScicosID>& ch
         {
             case DATATYPE_TYPE:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_COLS:
                 datatypeIndex++;
-            // no break
+                // no break
             case DATATYPE_ROWS:
             {
                 datatypeIndex++;
                 std::vector<int> datatype;
                 controller.getObjectProperty(newPortID, PORT, DATATYPE, datatype);
                 datatype[datatypeIndex] = newPort;
-                return controller.setObjectProperty(newPortID, PORT, DATATYPE, datatype);
+                return controller.setObjectProperty(newPortID, PORT, DATATYPE, datatype) != FAIL;
             }
             default:
-                return controller.setObjectProperty(newPortID, PORT, p, newPort);
+                return controller.setObjectProperty(newPortID, PORT, p, newPort) != FAIL;
         }
     }
 
index e19d81a..cd47fbb 100644 (file)
@@ -9,58 +9,58 @@
 package org.scilab.modules.xcos;
 
 public enum ObjectProperties {
-  PARENT_DIAGRAM,
-  GEOMETRY,
-  DESCRIPTION,
-  RELATED_TO,
-  INTERFACE_FUNCTION,
-  SIM_FUNCTION_NAME,
-  SIM_FUNCTION_API,
-  SIM_SCHEDULE,
-  SIM_BLOCKTYPE,
-  SIM_DEP_UT,
-  ANGLE,
-  EXPRS,
-  INPUTS,
-  OUTPUTS,
-  EVENT_INPUTS,
-  EVENT_OUTPUTS,
-  STATE,
-  DSTATE,
-  ODSTATE,
-  NZCROSS,
-  NMODE,
-  RPAR,
-  IPAR,
-  OPAR,
-  EQUATIONS,
-  UID,
-  PARENT_BLOCK,
-  CHILDREN,
-  PORT_REFERENCE,
-  STYLE,
-  LABEL,
-  DESTINATION_PORT,
-  SOURCE_PORT,
-  CONTROL_POINTS,
-  THICK,
-  COLOR,
-  KIND,
-  FROM,
-  TO,
-  DATATYPE,
-  DATATYPE_ROWS,
-  DATATYPE_COLS,
-  DATATYPE_TYPE,
-  FIRING,
-  SOURCE_BLOCK,
-  PORT_KIND,
-  IMPLICIT,
-  PORT_NUMBER,
-  CONNECTED_SIGNALS,
-  TITLE,
-  PATH,
-  PROPERTIES,
-  CONTEXT;
+    PARENT_DIAGRAM,
+    GEOMETRY,
+    DESCRIPTION,
+    RELATED_TO,
+    INTERFACE_FUNCTION,
+    SIM_FUNCTION_NAME,
+    SIM_FUNCTION_API,
+    SIM_SCHEDULE,
+    SIM_BLOCKTYPE,
+    SIM_DEP_UT,
+    ANGLE,
+    EXPRS,
+    INPUTS,
+    OUTPUTS,
+    EVENT_INPUTS,
+    EVENT_OUTPUTS,
+    STATE,
+    DSTATE,
+    ODSTATE,
+    NZCROSS,
+    NMODE,
+    RPAR,
+    IPAR,
+    OPAR,
+    EQUATIONS,
+    UID,
+    PARENT_BLOCK,
+    CHILDREN,
+    PORT_REFERENCE,
+    STYLE,
+    LABEL,
+    DESTINATION_PORT,
+    SOURCE_PORT,
+    CONTROL_POINTS,
+    THICK,
+    COLOR,
+    KIND,
+    FROM,
+    TO,
+    DATATYPE,
+    DATATYPE_ROWS,
+    DATATYPE_COLS,
+    DATATYPE_TYPE,
+    FIRING,
+    SOURCE_BLOCK,
+    PORT_KIND,
+    IMPLICIT,
+    PORT_NUMBER,
+    CONNECTED_SIGNALS,
+    TITLE,
+    PATH,
+    PROPERTIES,
+    DIAGRAM_CONTEXT;
 }