resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / WindowLeftProps.bjs
index 588bb23..cbe08fc 100644 (file)
@@ -9,6 +9,7 @@
  "items" : [
   {
    "# bool allow_edit" : false,
+   "| void updateKey" : "(string oldkey,  string type, string key ) {\n\n \n\t\n\t_this.model.el.foreach((mod, 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      \n\t\t  \t  //print(\"update iter type=%s, key=%s value=%s\\n\", type, key,(string) kvalue);\n\t      \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\tthis.changed();\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}",
@@ -29,7 +30,7 @@
    "$ 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",
-   "|              void updateIter" : "(Gtk.TreeIter iter,  string type, string key, string value) {\n\n    print(\"update Iter %s, %s\\n\", key,value);\n    //typeof(string),  // 0 key type\n     //typeof(string),  // 1 key\n     //typeof(string),  // 2 key (display)\n     //typeof(string),  // 3 value\n     //typeof(string),  // 4 value (display)\n     //typeof(string),  // 5 both (tooltip)\n     //typeof(string),  // 6 key (sort)\n    \n    var dl = value.strip().split(\"\\n\");\n\n    var dis_val = dl.length > 1 ? (dl[0].strip()+ \"...\") : dl[0];\n    \n    if (type == \"listener\") {\n     \n       \n        \n        this.model.el.set(iter, \n                0, type,\n            1, key,\n            2, this.keyFormat(key ,type),\n            3, value,\n            4, dis_val,\n            5, \"<tt>\" +  GLib.Markup.escape_text(key + \" \" +value) + \"</tt>\",\n            6,  \"0 \" + key\n        ); \n        return;\n    }\n    \n\n\n    this.model.el.set(iter, \n            0, \"props\",\n            1, key,\n            2,  this.keyFormat(key , \"prop\"),\n            3, value,\n            4, dis_val,\n             5, \"<tt>\" + GLib.Markup.escape_text(key + \" \" + value) + \"</tt>\",\n             6,  this.keySortFormat(key)\n        ); \n}",
+   "|              void updateIter" : "(Gtk.TreeIter iter,  string type, string key, string kvalue) {\n\n    //print(\"update Iter %s, %s\\n\", key,kvalue);\n    //typeof(string),  // 0 key type\n     //typeof(string),  // 1 key\n     //typeof(string),  // 2 key (display)\n     //typeof(string),  // 3 value\n     //typeof(string),  // 4 value (display)\n     //typeof(string),  // 5 both (tooltip)\n     //typeof(string),  // 6 key (sort)\n    \n    var dl = kvalue.strip().split(\"\\n\");\n\n    var dis_val = dl.length > 1 ? (dl[0].strip()+ \"...\") : dl[0];\n    \n    if (type == \"listener\") {\n     \n       \n        \n        this.model.el.set(iter, \n                0, type,\n            1, key,\n            2, this.keyFormat(key ,type),\n            3, kvalue,\n            4, dis_val,\n            5, \"<tt>\" +  GLib.Markup.escape_text(key + \" \" +kvalue) + \"</tt>\",\n            6,  \"0 \" + key\n        ); \n        return;\n    }\n    \n\n\n    this.model.el.set(iter, \n            0, \"props\",\n            1, key,\n            2,  this.keyFormat(key , \"prop\"),\n            3, kvalue,\n            4, dis_val,\n             5, \"<tt>\" + GLib.Markup.escape_text(key + \" \" + kvalue) + \"</tt>\",\n             6,  this.keySortFormat(key)\n        ); \n}",
    "# JsRender.Node node" : "",
    "items" : [
     {
@@ -98,7 +99,7 @@
            "listeners" : {
             "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"ctor\",\"\", \"*\");\n}"
            },
-           "label" : "ctor: Alterative to default contructor",
+           "label" : "ctor: Alterative to default contructor (Vala)",
            "xtype" : "MenuItem",
            "* pack" : "append",
            "tooltip_markup" : "eg. \n\nnew Clutter.Image.from_file(.....)",
            "tooltip_markup" : "This code is called after the ctor",
            "$ xns" : "Gtk"
           },
+          {
+           "listeners" : {
+            "activate" : " ()  => {\n    _this.addProp( \"prop\", \"cms-id\", \"\", \"string\");\n}"
+           },
+           "label" : "cms-id: (Roo JS/Pman library)",
+           "* pack" : "append",
+           "xtype" : "MenuItem",
+           "tooltip_markup" : "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n",
+           "$ xns" : "Gtk"
+          },
           {
            "* pack" : "add",
            "xtype" : "SeparatorMenuItem",
      "items" : [
       {
        "listeners" : {
-        "button_press_event" : "  ( ev)  => {\n \n    Gtk.TreeViewColumn col;\n    int cell_x;\n    int cell_y;\n    Gtk.TreePath path;\n    if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {\n        print(\"nothing selected on click\");\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().unselect_all();\n\n            return false;\n        });\n         _this.before_edit();\n        return false; //not on a element.\n    }\n    \n     \n     // double click on name..\n     if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == \"Name\") {    \n        // show popup!.   \n         if (this.popover == null) {\n     \t\t   this.popover = Xcls_PopoverProperty();\n \t\t}\n \t\t\n \n         _this.before_edit();\n         \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        this.popover.show(this.node, \"test\");\n           \n          _this.startEditingKey(path); \n         \n        return false;\n    }\n    \n    \n    \n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button == 3) {    \n        // show popup!.   \n        //if (col.title == \"Value\") {\n         //     _this.before_edit();\n         //    return false;\n         //}\n\n        var p = _this.ContextMenu;\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null,  ev.button, ev.time);\n        //Seed.print(\"click:\" + res.column.title);\n        // select the \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n  \n            this.el.get_selection().select_path(path);\n            return false;\n        });\n         _this.before_edit();\n        return false;\n    }\n    \n     \n    if (col.title != \"Value\") {\n        print(\"col title != Value\");\n        \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().select_path(path);\n            return false;\n        });\n        \n        _this.before_edit();\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    \n    // if the cell can be edited with a pulldown\n    // then we should return true... - and let the start_editing handle it?\n    \n    \n    \n    \n    \n      \n   //             _this.before_edit(); <<< we really need to stop the other editor..\n     _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n    \n           \n    return _this.startEditingValue(path); // assumes selected row..\n        \n   \n\n              \n   \n}"
+        "button_press_event" : "  ( ev)  => {\n \n    Gtk.TreeViewColumn col;\n    int cell_x;\n    int cell_y;\n    Gtk.TreePath path;\n    if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {\n        print(\"nothing selected on click\");\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().unselect_all();\n\n            return false;\n        });\n         _this.before_edit();\n        return false; //not on a element.\n    }\n    \n     \n     // double click on name..\n     if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == \"Name\") {    \n        // show popup!.   \n        \n         if (this.popover == null) {\n     \t\t   this.popover = new Xcls_PopoverProperty();\n     \t\t   this.popover.mainwindow = _this.main_window;\n \t\t}\n \t\t\n \n         _this.before_edit();\n          _this.stop_editor();\n\t\t  \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         Gtk.TreeIter iter;\n          var mod = this.el.get_model();\n\t\t  mod.get_iter (out iter, path);\n\t\t  \n       \n\t\tGLib.Value gvaltype, gval;\n\t\tmod.get_value(iter, 1 , out gval); // one is key..\n\t\t\n\t     mod.get_value(iter,0, out gvaltype);\n\n        this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);\n           \n        //  _this.startEditingKey(path); \n         \n        return false;\n    }\n    \n    \n    \n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button == 3) {    \n        // show popup!.   \n        //if (col.title == \"Value\") {\n         //     _this.before_edit();\n         //    return false;\n         //}\n\n        var p = _this.ContextMenu;\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null,  ev.button, ev.time);\n        //Seed.print(\"click:\" + res.column.title);\n        // select the \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n  \n            this.el.get_selection().select_path(path);\n            return false;\n        });\n         _this.before_edit();\n        return false;\n    }\n    \n     \n    if (col.title != \"Value\") {\n        print(\"col title != Value\");\n        \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().select_path(path);\n            return false;\n        });\n        \n        _this.before_edit();\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    \n    // if the cell can be edited with a pulldown\n    // then we should return true... - and let the start_editing handle it?\n    \n    \n    \n    \n    \n      \n   //             _this.before_edit(); <<< we really need to stop the other editor..\n     _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n    \n           \n    return _this.startEditingValue(path); // assumes selected row..\n        \n   \n\n              \n   \n}"
        },
        "id" : "view",
        "* init" : "{\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    var description = new Pango.FontDescription();\n    description.set_size(10000);\n    this.el.override_font(description);\n}\n",
          "items" : [
           {
            "listeners" : {
-            "activate" : "  ( )  =>{\n  \n    var s = _this.view.el.get_selection();\n    Gtk.TreeIter iter;\n    Gtk.TreeModel model;\n    s.get_selected (out  model, out  iter);\n    _this.startEditingKey(model.get_path(iter));\n}"
+            "activate" : "  ( )  =>{\n  \n    var s = _this.view.el.get_selection();\n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n    s.get_selected (out  mod, out  iter);\n    \n      if (_this.view.popover == null) {\n     \t\t   _this.view.popover = new Xcls_PopoverProperty();\n     \t\t   _this.view.popover.mainwindow = _this.main_window;\n \t\t}\n \t\t\n \n      _this.before_edit();\n      _this.stop_editor();\n\t  \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\tGLib.Value gvaltype, gval;\n\tmod.get_value(iter, 1 , out gval); // one is key..\n\t\n     mod.get_value(iter,0, out gvaltype);\n\n\t_this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);\n       \n    \n    \n   // _this.startEditingKey(model.get_path(iter));\n}"
            },
-           "label" : "Edit",
+           "label" : "Edit (double click)",
            "* pack" : "append",
            "xtype" : "MenuItem",
            "$ xns" : "Gtk"