manage border layout 32/17832/1
Antoine ELIAS [Tue, 1 Mar 2016 10:48:11 +0000 (11:48 +0100)]
Change-Id: Ibf050d6939a774a0a484e852154e4643919d66f5

scilab/modules/graphic_objects/src/c/graphic_objects.vcxproj
scilab/modules/graphic_objects/src/cpp/ScilabWebView.cpp
scilab/modules/graphic_objects/src/cpp/webutils.cpp
scilab/modules/graphic_objects/src/cpp/webutils.hxx
scilab/node/html/index.html
scilab/node/loader.sce

index c5585c7..8b0d995 100644 (file)
@@ -85,7 +85,7 @@
     <ClCompile>
       <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../graphics/src/c/getHandleProperty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../graphics/src/c/getHandleProperty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK32)/include;$(SCILAB_JDK32)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../graphics/src/c/getHandleProperty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../jni;../cpp;../../includes;$(SCILAB_JDK64)/include;$(SCILAB_JDK64)/include/win32;../../../../libs/intl;../../../../libs/sioclient/includes;../../../api_scilab/includes;../../../core/includes;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../functions/includes;../../../fileio/includes;../../../commons/src/jni;../../../commons/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../graphics/src/c/getHandleProperty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_OBJECTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
index 8605c6c..57b0bf6 100644 (file)
@@ -236,17 +236,32 @@ void ScilabWebView::updateObject(int uid, int prop)
                 s->emit("graphic_update", str);
                 return;
             }
+            case __GO_LAYOUT__:
+            {
+                std::string str;
+                WebUtils::setUILayout(uid, str);
+                s->emit("graphic_update", str);
+                return;
+            }
         }
     }
 
     if (WebUtils::isUIcontrol(uid))
     {
-        std::string str;
-        if (WebUtils::set(prop, uid, str))
+        std::cerr << uid << ":" << prop << std::endl;
+        if (WebUtils::hasValidParent(uid) || prop == __GO_PARENT__)
         {
-            s->emit("graphic_update", str);
+            std::string str;
+            if (WebUtils::set(prop, uid, str))
+            {
+                s->emit("graphic_update", str);
+            }
+        }
+        else
+        {
+            //parent is not already set, put update in waiting queue
+            WebUtils::addInWaitingQueue(uid, prop);
         }
-
         return;
     }
 }
index b9c6be9..eef1e7b 100644 (file)
@@ -21,9 +21,12 @@ extern "C"
 #include "setGraphicObjectProperty.h"
 #include "getGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
+#include "LayoutType.h"
+#include "BorderLayoutType.h"
 }
 
-std::unordered_map<int, setFunction> WebUtils::setter;
+WebUtils::SETTER WebUtils::setter;
+WebUtils::WAITING_PROP WebUtils::waitprop;
 
 int WebUtils::getIntProperty(int uid, int prop)
 {
@@ -154,6 +157,28 @@ std::string WebUtils::getColor(const std::vector<double>& c)
     return str;
 }
 
+std::string WebUtils::getSubPadding(int val)
+{
+    if (val)
+    {
+        return std::to_string(val) + "px ";
+    }
+
+    return "0 ";
+}
+
+std::string WebUtils::getPadding(int t, int r, int b, int l)
+{
+    std::string ret;
+
+    ret += getSubPadding(t);
+    ret += getSubPadding(r);
+    ret += getSubPadding(b);
+    ret += getSubPadding(l);
+
+    return ret;
+}
+
 bool WebUtils::isManaged(int uid)
 {
     int type = getType(uid);
@@ -178,6 +203,11 @@ int WebUtils::getStyle(int uid)
     return getIntProperty(uid, __GO_STYLE__);
 }
 
+bool WebUtils::hasValidParent(int uid)
+{
+    return getParent(uid) != 0;
+}
+
 int WebUtils::getParent(int uid)
 {
     return getIntProperty(uid, __GO_PARENT__);
@@ -194,6 +224,14 @@ void WebUtils::setParent(int uid, std::string& str, bool append)
 
     str += "var __parent__ = " + getElementById(parent);
     str += "__parent__.appendChild(__child__);";
+
+    if (getUILayout(parent) == LAYOUT_BORDER)
+    {
+        //force update of border position, especially for center
+        addInWaitingQueue(uid, __GO_UI_BORDER_POSITION__);
+    }
+
+    setWaitingProperties(uid, str, false);
 }
 
 void WebUtils::getFigureSize(int uid, std::vector<int>& vect)
@@ -544,6 +582,117 @@ int WebUtils::getUILayout(int uid)
 
 void WebUtils::setUILayout(int uid, std::string& str, bool append)
 {
+    if (isFigure(uid) || hasStyle(uid, __GO_UI_FRAME__))
+    {
+        //TODO clean previous layout before create new one
+
+        if (append == false)
+        {
+            str = "var __child__ = " + getElementById(uid) + ";";
+        }
+
+        int layout = getUILayout(uid);
+        switch (layout)
+        {
+            case LAYOUT_BORDER:
+            {
+                //create a table ( ascii art powa ! )
+                //+---------------------+
+                //|         TOP         |
+                //+---+-------------+---+
+                //| L |             | R |
+                //| E |             | I |
+                //| F |   CENTER    | G |
+                //| T |             | H |
+                //|   |             | T |
+                //+---+-------------+---+
+                //|       BOTTOM        |
+                //+---------------------+
+
+                //table
+                str += "var __table__ = " + createElement("TABLE");
+                str += "__table__.id = " + getIdString(uid, "_table") + ";";
+                str += "__table__.style.margin = '0';";
+                str += "__table__.style.padding = '0';";
+                str += "__table__.style.width = '100%';";
+                str += "__table__.style.height = '100%';";
+                str += "__table__.style.borderCollapse = 'collapse';";
+
+                //rows
+                str += "var __tr_top__ = " + createElement("TR");
+                str += "var __tr_middle__ = " + createElement("TR");
+                str += "var __tr_bottom__ = " + createElement("TR");
+
+                //cell in rows
+                str += "var __td_top__ = " + createElement("TD");
+                str += "__td_top__.colSpan = '3';";
+                str += "__td_top__.id = " + getIdString(uid, "_top") + ";";
+                str += "__td_top__.style.width = '100%';";
+
+                str += "var __td_left__ = " + createElement("TD");
+                str += "__td_left__.id = " + getIdString(uid, "_left") + ";";
+                str += "__td_left__.style.height = '100%';";
+
+                str += "var __td_center__ = " + createElement("TD");
+                str += "__td_center__.id = " + getIdString(uid, "_center") + ";";
+                str += "__td_center__.style.width = '100%';";
+                str += "__td_center__.style.height = '100%';";
+
+                str += "var __td_right__ = " + createElement("TD");
+                str += "__td_right__.id = " + getIdString(uid, "_right") + ";";
+                str += "__td_right__.style.height = '100%';";
+
+                str += "var __td_bottom__ = " + createElement("TD");
+                str += "__td_bottom__.colSpan = '3';";
+                str += "__td_bottom__.id = " + getIdString(uid, "_bottom") + ";";
+                str += "__td_bottom__.style.width = '100%';";
+
+                //hierarchy
+
+                //td in tr
+                str += "__tr_top__.appendChild(__td_top__);";
+                str += "__tr_middle__.appendChild(__td_left__);";
+                str += "__tr_middle__.appendChild(__td_center__);";
+                str += "__tr_middle__.appendChild(__td_right__);";
+                str += "__tr_bottom__.appendChild(__td_bottom__);";
+
+                //tr in table
+                str += "__table__.appendChild(__tr_top__);";
+                str += "__table__.appendChild(__tr_middle__);";
+                str += "__table__.appendChild(__tr_bottom__);";
+
+                //table in parent
+                str += "__child__.appendChild(__table__);";
+
+                break;
+            }
+            case LAYOUT_GRID:
+            {
+                break;
+            }
+            case LAYOUT_GRIDBAG:
+            {
+                //add empty table
+                str += "var __table__ = " + createElement("TABLE");
+                str += "__table__.id = " + getIdString(uid, "_table") + ";";
+                str += "__table__.style.margin = '0';";
+                str += "__table__.style.padding = '0';";
+                str += "__table__.style.width = '100%';";
+                str += "__table__.style.height = '100%';";
+                str += "__table__.style.borderCollapse = 'collapse';";
+  
+                //table in parent
+                str += "__child__.appendChild(__table__);";
+                break;
+            }
+            default:
+            case LAYOUT_NONE:
+            {
+                break;
+            }
+
+        }
+    }
 }
 
 double WebUtils::getUIMin(int uid)
@@ -636,6 +785,142 @@ void WebUtils::setUIValue(int uid, std::string& str, bool append)
     }
 }
 
+void WebUtils::getUIBorderPreferredSize(int uid, std::vector<int>& vect)
+{
+    vect.resize(2, 0);
+    getIntVectorProterty(uid, __GO_UI_BORDER_PREFERREDSIZE__, vect);
+}
+
+void WebUtils::getUIBorderPadding(int uid, std::vector<int>& vect)
+{
+    vect.resize(2, 0);
+    getIntVectorProterty(uid, __GO_BORDER_OPT_PADDING__, vect);
+}
+
+int WebUtils::getUIBorderPosition(int uid)
+{
+    return getIntProperty(uid, __GO_UI_BORDER_POSITION__);
+}
+
+void WebUtils::setUIBorder(int uid, std::string& str, bool append)
+{
+    int parent = getParent(uid);
+    std::string position;
+    std::string padding;
+    int border = getUIBorderPosition(uid);
+
+    std::vector<int> pad;
+    getUIBorderPadding(parent, pad);
+
+    std::vector<int> size;
+    getUIBorderPreferredSize(uid, size);
+
+
+
+    if (append == false)
+    {
+        str = "var __child__ = " + getElementById(uid);
+    }
+
+    switch (border)
+    {
+        default:
+        case BORDER_CENTER:
+            position = "_center";
+            str += "__child__.style.width = '100%';";
+            str += "__child__.style.height = '100%';";
+            padding = getPadding(0, 0, 0, 0);
+            break;
+        case BORDER_BOTTOM:
+            position = "_bottom";
+            str += "__child__.style.width = '100%';";
+
+            if (size[1] == -1)
+            {
+                str += "__child__.style.height = 'inherit';";
+            }
+            else
+            {
+                str += "__child__.style.height = '" + getSubPadding(size[1]) + "';";
+            }
+
+            padding = getPadding(pad[1], 0, 0, 0);
+            break;
+        case BORDER_TOP:
+            position = "_top";
+            str += "__child__.style.width = '100%';";
+
+            if (size[1] == -1)
+            {
+                str += "__child__.style.height = 'inherit';";
+            }
+            else
+            {
+                str += "__child__.style.height = '" + getSubPadding(size[1]) + "';";
+            }
+
+            padding = getPadding(0, 0, pad[1], 0);
+            break;
+        case BORDER_LEFT:
+            position = "_left";
+
+            if (size[0] == -1)
+            {
+                str += "__child__.style.width = 'inherit';";
+            }
+            else
+            {
+                str += "__child__.style.width = '" + getSubPadding(size[0]) + "';";
+            }
+
+            str += "__child__.style.height = '100%';";
+            padding = getPadding(0, pad[0], 0, 0);
+            break;
+        case BORDER_RIGHT:
+            position = "_right";
+
+            if (size[0] == -1)
+            {
+                str += "__child__.style.width = 'inherit';";
+            }
+            else
+            {
+                str += "__child__.style.width = '" + getSubPadding(size[0]) + "';";
+            }
+
+            str += "__child__.style.height = '100%';";
+            padding = getPadding(0, 0, 0, pad[0]);
+            break;
+    }
+
+
+    //move child in targeted cell
+    str += "__parent__ = " + getElementById(parent, position);
+    str += "__parent__.appendChild(__child__);";
+    str += "__parent__.style.padding = '" + padding + "';";
+
+    //to well perform positionning, we must clear some default properties
+    //position left, right, width, height, 
+
+    str += "__child__.style.position = 'inherit';";
+    str += "__child__.style.left = 'inherit';";
+    str += "__child__.style.bottom = 'inherit';";
+}
+
+void WebUtils::getUIGridBagGrid(int uid, std::vector<int>& vect)
+{
+    vect.resize(4, 0);
+    getIntVectorProterty(uid, __GO_UI_GRIDBAG_GRID__, vect);
+}
+
+
+void WebUtils::setUIGridBag(int uid, std::string& str, bool append)
+{
+    std::vector<int> grid;
+    getUIGridBagGrid(uid, grid);
+
+}
+
 bool WebUtils::hasCallback(int uid)
 {
     return getStringProperty(uid, __GO_CALLBACK__) != "";
@@ -882,7 +1167,7 @@ bool WebUtils::createRadio(int uid, std::string& str)
     str += "__main__.className = 'GO_RADIO';";
     //add item temporary in main div waiting __GO_PARENT__ update
     str += "var __parent__ = document.getElementById('scilab');";
-    str += "__parent__.appendChild(__main__);";
+    str += "__parent__.appendChild(__main__)";;
 
     //the radio itself
     str += "var __temp__ = " + createElement("INPUT");
@@ -1041,12 +1326,12 @@ bool WebUtils::updateDefaultProperties(int uid, std::string& update)
     return true;
 }
 
-bool WebUtils::set(int prop, int uid, std::string& str)
+bool WebUtils::set(int prop, int uid, std::string& str, bool append)
 {
     SETTER::iterator it = setter.find(prop);
     if (it != setter.end())
     {
-        it->second(uid, str, false);
+        it->second(uid, str, append);
 
         return true;
     }
@@ -1076,6 +1361,10 @@ void WebUtils::fillSetter()
     setter[__GO_UI_MAX__] = WebUtils::setUIMax;
     setter[__GO_UI_SLIDERSTEP__] = WebUtils::setUIStep;
     setter[__GO_UI_VALUE__] = WebUtils::setUIValue;
+    //preferred size is the last property to be set for border constraints
+    setter[__GO_UI_BORDER_PREFERREDSIZE__] = WebUtils::setUIBorder;
+    //preferred size is the last property to be set for gridbag constraints
+    setter[__GO_UI_GRIDBAG_PREFERREDSIZE__] = WebUtils::setUIGridBag;
     //setter[__GO_CALLBACK__] = WebUtils::setCallback;
 }
 
@@ -1110,3 +1399,20 @@ bool WebUtils::updateValue(int uid, bool value)
     return false;
 }
 
+void WebUtils::addInWaitingQueue(int uid, int prop)
+{
+    waitprop[uid].push_back(prop);
+}
+
+void WebUtils::setWaitingProperties(int uid, std::string& str, bool append)
+{
+    WAITING_PROP::iterator it = waitprop.find(uid);
+    if (it != waitprop.end())
+    {
+        for (int prop : it->second)
+        {
+            set(prop, uid, str, append);
+        }
+        waitprop.erase(it);
+    }
+}
index 2aec463..ef0acbf 100644 (file)
@@ -30,6 +30,9 @@ class WebUtils
     typedef std::unordered_map<int, setFunction> SETTER;
     static SETTER setter;
 
+    typedef std::unordered_map<int, std::list<int>> WAITING_PROP;
+    static WAITING_PROP waitprop;
+
     static bool hasStyle(int uid, int style);
     static bool isInputType(int uid);
 
@@ -38,10 +41,17 @@ class WebUtils
     static std::string createElement(const std::string& type);
 
     static std::string getColor(const std::vector<double>& c);
+
+    static std::string getSubPadding(int val);
+    static std::string getPadding(int t, int r, int b, int l);
 public:
 
+    static bool hasValidParent(int uid);
+    static void addInWaitingQueue(int uid, int prop);
+    static void setWaitingProperties(int uid, std::string& str, bool append);
+
     static void fillSetter();
-    static bool set(int prop, int uid, std::string& str);
+    static bool set(int prop, int uid, std::string& str, bool append = false);
 
     static bool updateValue(int uid, bool value);
     static bool updateValue(int uid, double value);
@@ -127,6 +137,16 @@ public:
     static bool getUIValue(int uid, std::vector<double>& vect);
     static void setUIValue(int uid, std::string& str, bool append = false);
 
+    //border layout
+    static int getUIBorderPosition(int uid);
+    static void getUIBorderPadding(int uid, std::vector<int>& vect);
+    static void getUIBorderPreferredSize(int uid, std::vector<int>& vect);
+    static void setUIBorder(int uid, std::string& str, bool append = false);
+
+    //gridbag layout
+    static void getUIGridBagGrid(int uid, std::vector<int>& vect);
+    static void setUIGridBag(int uid, std::string& str, bool append = false);
+
     static bool hasCallback(int uid);
     static void setCallback(int uid, std::string& str, bool append = false);
 
@@ -156,9 +176,6 @@ public:
     static bool updateDefaultProperties(int uid, std::string& str);
     //delete
     static bool deleteObject(int uid, std::string& str);
-
-
-    //cupdate
 };
 #endif /* !__WEB_UTILS_HXX__ */
 
index e435c02..4e99571 100644 (file)
@@ -34,17 +34,13 @@ body {
     width : 610px;
     height : 460px;
     margin : auto;
-    border : 2px rgb(0,0,0) solid;
+    //border : 2px rgb(0,0,0) solid;
     overflow : auto;
     text-align: left;
 }
 
 .GO_PUSHBUTTON {
     position: absolute;
-    left: 20px;
-    bottom: 40px;
-    width : 40px;
-    height : 20px;
     text-align:center;
     overflow : hidden;
     font-family: Tahoma, Verdana, Segoe, sans-serif;
@@ -63,7 +59,7 @@ body {
     overflow : hidden;
     font-family: Tahoma, Verdana, Segoe, sans-serif;
     font-size:11px;
-    border : 1px rgb(0,0,0) solid;
+    //border : 1px rgb(0,0,0) solid;
     visibility:inherit;
 }
 
@@ -246,6 +242,36 @@ body {
     </head>
     <body>
         <h1>Scilab WebView</h1>
+        <table width=200 height=100>
+            <tr>
+                <td bgcolor="red"></td>
+                <td bgcolor="yellow" colspan="2"></td>
+            </tr>
+            <tr>
+                <td bgcolor="lime"></td>
+                <td bgcolor="magenta"></td>
+                <td bgcolor="cyan" rowspan="2"></td>
+            </tr>
+            <tr>
+                <td bgcolor="blue" colspan="2"></td>
+            </tr>
+        </table>
+        <br>
+        <table width=200 height=100>
+            <tr>
+                <td bgcolor="red"></td>
+                <td bgcolor="yellow" rowspan="2"></td>
+                <td bgcolor="magenta"></td>
+            </tr>
+            <tr>
+                <td bgcolor="lime"></td>
+                <td bgcolor="cyan" rowspan="2"></td>
+            </tr>
+            <tr>
+                <td bgcolor="blue" colspan="2"></td>
+            </tr>
+        </table>
+        
         <div id='infobar'></div>
         <h3>Logger:</h3>
         <div class='log' id='logger'></div>
index c5a34c2..c1755e6 100644 (file)
@@ -1,4 +1,4 @@
-if 1 then
+if 0 then
     f1 = createWindow();
     f1.position(3:4) = [250, 100];
 
@@ -110,3 +110,114 @@ if 0 then
     
     f.visible = %t;
 end
+
+//layout border
+if 1 then
+    
+    f = createWindow();
+    f.layout = "border";
+    f.layout_options = createLayoutOptions("border", [10, 10]);
+    //f.layout_options = createLayoutOptions("border");
+
+    c = createConstraints("border", "top", [50,20]);
+
+    t = %t;
+    l = %t;
+    m = %t;
+    r = %t;
+    b = %t;
+    
+    if t then
+        u_grid1 = uicontrol(f,...
+            "style", "frame",...
+            "backgroundcolor", [1 0 0], ...
+            "constraints", c);
+    end
+    
+    if l then
+        c.position = "left";
+        u_grid2 = uicontrol(f,...
+            "style", "frame",...
+            "backgroundcolor", [0 1 0], ...
+            "constraints", c);
+    end
+    
+    if m then
+        c.position = "center";
+        u_grid3 = uicontrol(f,...
+            "style", "frame",...
+            "backgroundcolor", [0 0 1], ...
+            "constraints", c);
+    end
+    
+    if r then
+        c.preferredsize = [100, 100];
+        c.position = "right";
+        u_grid4 = uicontrol(f,...
+            "style", "frame",...
+            "backgroundcolor", [1 1 0], ...
+            "constraints", c);
+    end
+    
+    if b then
+        c.position = "bottom";
+        u_grid5 = uicontrol(f,...
+            "style", "frame",...
+            "backgroundcolor", [1 0 1], ...
+            "constraints", c);
+    end
+end
+
+//gridbag
+if 0 then
+    f = createWindow();
+    f.position = [200 200 200 100];
+    f.layout = "gridbag";
+    
+    c = createConstraints("gridbag",[1, 1, 1, 1], [1, 1], "both", "center", [0, 0], [50, 50]);
+
+    redf_grid   = [1, 1, 1, 1];
+    greenf_grid = [1, 2, 1, 1];
+    bluef_grid  = [1, 3, 2, 1];
+    yelf_grid   = [2, 1, 1, 2];
+    magf_grid   = [3, 1, 1, 1];
+    cyanf_grid  = [3, 2, 1, 2];
+
+    c.grid = redf_grid;
+    u_grid1 = uicontrol(f , ...
+        "style"               , "frame" , ...
+        "backgroundcolor"     , [1 0 0] , ...
+        "constraints"         , c);
+
+    if 0 then
+        c.grid = greenf_grid;
+        u_grid2 = uicontrol(f , ...
+            "style"               , "frame", ...
+            "backgroundcolor"     , [0 1 0], ...
+            "constraints"         , c);
+
+        c.grid = bluef_grid;
+        u_grid3 = uicontrol(f , ...
+            "style"               , "frame", ...
+            "backgroundcolor"     , [0 0 1], ...
+            "constraints"         , c);
+
+        c.grid = yelf_grid;
+        u_grid4 = uicontrol(f , ...
+            "style"               , "frame", ...
+            "backgroundcolor"     , [1 1 0], ...
+            "constraints"         , c);
+
+        c.grid = magf_grid;
+        u_grid5 = uicontrol(f , ...
+            "style"               , "frame", ...
+            "backgroundcolor"     , [1 0 1], ...
+            "constraints"         , c);
+       
+        c.grid = cyanf_grid;
+        u_grid1 = uicontrol(f , ...
+            "style"               , "frame", ...
+            "backgroundcolor"     , [0 1 1], ...
+            "constraints"         , c);
+    end
+end