src/Builder4/WindowLeftProps.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 09:22:55 +0000 (17:22 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 09:22:55 +0000 (17:22 +0800)
src/Builder4/WindowLeftProps.vala

src/Builder4/WindowLeftProps.bjs
src/Builder4/WindowLeftProps.vala

index 5b2a1a0..da84ae5 100644 (file)
@@ -9,6 +9,7 @@
  "items" : [
   {
    "# bool allow_edit" : false,
+   "| void updateKey" : "(string oldkey,  string type, string key ) {\n\n\tvar m = _this.model.el;\n\t\n\t\n\tm.foreach((model, path,  iter) => {\n\t\t \n        \n        \t  \n       \n\t\t GLib.Value gvaltype, gval,kvalue;\n\t\t mod.get_value(iter, 1 , out gval); // one is key..\n\t\t\n\t     mod.get_value(iter,0, out gvaltype);\n\t     \n \t     mod.get_value(iter,3, out kvalue);\n\t     \n\t      if (oldkey == ((string)gval) && type == ((string)gvaltype)) {\n   \t \t      this.updateIter(iter, type, key, (string)kvalue);\n   \t \t      return true;\n\t \t  }\n\t     \n\n\t\treturn false;\n\t});\n\t\n\t\n\n\n}\n",
    "id" : "LeftProps",
    "|              void before_edit" : "()\n{\n\n    print(\"before edit - stop editing\\n\");\n    \n  // these do not appear to trigger save...\n    _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n\n    _this.valrender.el.stop_editing(false);\n    _this.valrender.el.editable  =false;    \n    \n    \n// technicall stop the popup editor..\n\n}\n",
    "|              string keySortFormat" : "(string key) {\n    // listeners first - with 0\n    // specials\n    if (key[0] == '*') {\n        return \"1 \" + key;\n    }\n    // functions\n    \n    var bits = key.split(\" \");\n    \n    if (key[0] == '|') {\n        return \"2 \" + bits[bits.length -1];\n    }\n    // signals\n    if (key[0] == '@') {\n        return \"3 \" + bits[bits.length -1];\n    }\n        \n    // props\n    if (key[0] == '#') {\n        return \"4 \" + bits[bits.length -1];\n    }\n    // the rest..\n    return \"5 \" + bits[bits.length -1];    \n\n\n\n}",
@@ -26,7 +27,6 @@
    "|              void startEditingKey" : "( Gtk.TreePath path) {\n    \n     if (!this.stop_editor()) {\n        return;\n     }\n  \n    // others... - fill in options for true/false?\n    \n       \n    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n        this.allow_edit  = true;\n        this.keyrender.el.editable = true;\n     \n        this.view.el.set_cursor_on_cell(\n            path,\n            this.keycol.el,\n            this.keyrender.el,\n            true\n        );\n               \n        return false;\n    });\n      \n    \n}\n",
    "@ void show_add_props" : "(string type)",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-   "| Gtk.TreeIter keyToIter" : "(string oldkey,  string type, string key ) {\n\n\tvar m = _this.model.el;\n\t\n\t\n\tm.foreach((model, path,  iter) => {\n\t\t \n        \n        \t  \n       \n\t\t GLib.Value gvaltype, gval,kvalue;\n\t\t mod.get_value(iter, 1 , out gval); // one is key..\n\t\t\n\t     mod.get_value(iter,0, out gvaltype);\n\t     \n \t     mod.get_value(iter,3, out kvalue);\n\t     \n\t      if (oldkey == ((string)gval) && type == ((string)gvaltype)) {\n   \t \t      this.updateIter(iter, type, key, (string)kvalue);\n   \t \t      return true;\n\t \t  }\n\t     \n\n\t\treturn false;\n\t});\n\t\n\t\n\n\n}\n",
    "$ homogeneous" : "false   ",
    "# Xcls_MainWindow main_window" : "null",
    "|              void addProp" : " (string in_type, string key, string value, string value_type) {\n      // info includes key, val, skel, etype..\n      //console.dump(info);\n        //type = info.type.toLowerCase();\n        //var data = this.toJS();\n          \n    var type = in_type == \"signals\" ? \"listener\" : in_type;\n      \n    var fkey = (value_type.length > 0 ? value_type + \" \" : \"\") + key;\n              \n    if (type == \"listener\") {\n        if (this.node.listeners.has_key(key)) {\n            return;\n        }\n        this.node.listeners.set(key,value);\n    } else  {\n    \n        if (this.node.props.has_key(fkey)) {\n            return;\n        }\n        this.node.props.set(fkey,value);\n    }\n            \n      \n    // add a row???\n    this.load(this.file, this.node);\n    \n    \n    \n    /// need to find the row which I've just added..\n    \n    \n    var s = this.view.el.get_selection();\n    s.unselect_all();\n    \n    print(\"trying to find new iter\");\n  \n    this.model.el.foreach((model, path, iter) => {\n        GLib.Value gval;\n    \n        this.model.el.get_value(iter, 0 , out gval);\n        if ((string)gval != type) {\n            print(\"not type: %s = %s\\n\", (string)gval , type);\n            return false;\n        }\n        this.model.el.get_value(iter, 1 , out gval);\n        if ((string)gval != fkey) {\n            print(\"not key: %s = %s\\n\", (string)gval , fkey);\n            return false;\n        }\n        // delay this?\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {\n        \n            this.startEditingValue(this.model.el.get_path(iter));\n            return false;\n        });\n        //s.select_iter(iter);\n        return true; \n    });\n    \n    \n    \n              \n}\n",
index d946266..ddc3233 100644 (file)
@@ -54,6 +54,36 @@ public class Xcls_LeftProps : Object
     }
 
     // user defined functions
+    public void updateKey (string oldkey,  string type, string key ) {
+    
+       var m = _this.model.el;
+       
+       
+       m.foreach((model, path,  iter) => {
+                
+            
+                 
+           
+                GLib.Value gvaltype, gval,kvalue;
+                mod.get_value(iter, 1 , out gval); // one is key..
+               
+            mod.get_value(iter,0, out gvaltype);
+            
+            mod.get_value(iter,3, out kvalue);
+            
+             if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
+                             this.updateIter(iter, type, key, (string)kvalue);
+                             return true;
+                 }
+            
+    
+               return false;
+       });
+       
+       
+    
+    
+    }
     public              void before_edit ()
     {
     
@@ -434,36 +464,6 @@ public class Xcls_LeftProps : Object
         });
           
         
-    }
-    public Gtk.TreeIter keyToIter (string oldkey,  string type, string key ) {
-    
-       var m = _this.model.el;
-       
-       
-       m.foreach((model, path,  iter) => {
-                
-            
-                 
-           
-                GLib.Value gvaltype, gval,kvalue;
-                mod.get_value(iter, 1 , out gval); // one is key..
-               
-            mod.get_value(iter,0, out gvaltype);
-            
-            mod.get_value(iter,3, out kvalue);
-            
-             if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
-                             this.updateIter(iter, type, key, (string)kvalue);
-                             return true;
-                 }
-            
-    
-               return false;
-       });
-       
-       
-    
-    
     }
     public              void addProp (string in_type, string key, string value, string value_type) {
           // info includes key, val, skel, etype..