Builder4/WindowLeftProps.bjs.HMO7LX
authorAlan Knowles <alan@roojs.com>
Wed, 10 Sep 2014 14:04:00 +0000 (22:04 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 10 Sep 2014 14:04:00 +0000 (22:04 +0800)
Builder4/WindowLeftProps.bjs
Builder4/WindowLeftProps.js.1256LX
Builder4/WindowLeftProps.js
Builder4/WindowLeftProps.vala.O0G8LX
Builder4/WindowLeftProps.vala

Builder4/WindowLeftProps.bjs
Builder4/WindowLeftProps.js
Builder4/WindowLeftProps.vala

index d81ed2a..0e94e27 100644 (file)
@@ -8,26 +8,26 @@
     "items" : [
         {
             "# bool allow_edit" : false,
-            "|             void load" : "(JsRender.JsRender file, JsRender.Node? node) \n{\n    print(\"load leftprops\\n\");\n    this.before_edit();\n    this.node = node;\n    this.file = file;\n    \n \n    this.model.el.clear();\n              \n    //this.get('/RightEditor').el.hide();\n    if (node ==null) {\n        return ;\n    }\n     \n    \n\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    Gtk.TreeIter iter;\n    \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    \n    \n    \n    \n    // really need a way to sort the hashmap...\n    var m = this.model.el;\n    \n    var miter = node.listeners.map_iterator();\n    var i = 0;\n    \n    while(miter.next()) {\n        i++;\n        m.append(out iter,null);\n        \n        this.updateIter(iter,  \"listener\", miter.get_key(), miter.get_value());\n        \n         \n     }\n     \n      \n    miter = node.props.map_iterator();\n    \n    \n   while(miter.next()) {\n           i++;\n        m.append(out iter,null);\n         this.updateIter(iter,  \"prop\", miter.get_key(), miter.get_value());\n         \n   }\n   print(\"clear selection\\n\");\n   // clear selection?\n   this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..\n   \n   this.view.el.get_selection().unselect_all();\n   \n       var pane = _this.main_window.editpane.el;\n    var try_size = (i * 25) + 60; // est. 20px per line + 40px header\n    \n    // max 80%...\n    pane.set_position( \n         ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? \n        (int) (pane.max_position * 0.2f) :\n        pane.max_position-try_size);\n    \n   \n}\n",
-            "|             bool startEditingValue" : "( Gtk.TreePath path) {\n\n    // ONLY return true if editing is allowed - eg. combo..\n    \n            print(\"start editing?\\n\");\n            if (!this.stop_editor()) {\n                print(\"stop editor failed\\n\");\n                return false;\n            }\n            \n            Gtk.TreeIter iter;\n\n            var mod = this.model.el;\n            mod.get_iter (out iter, path);\n             \n            /*\n                m.set(iter, \n                        0, \"listener\",\n                        1, miter.get_key(),\n                        2, \"<b>\" + miter.get_key() + \"</b>\",\n                        3, miter.get_value()\n                    ); \n             \n            */\n            GLib.Value gval;\n            mod.get_value(iter, 3 , out gval);\n            var val = (string)gval;\n        \n            mod.get_value(iter, 1 , out gval);\n            var key = (string)gval;\n            var type_ar = key.split(\" \");\n            \n            \n            \n            mod.get_value(iter, 0 , out gval);\n            var type = (string)gval;\n            \n           \n            \n            var use_textarea = false;\n\n            //------------ things that require the text editor...\n            \n            if (type == \"listener\") {\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '|') { // user defined method\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '$') { // raw string\n                use_textarea = true;\n            }\n            if (key.length > 0 && key == \"* init\") {\n                use_textarea = true;\n            }\n            if (val.length > 40) { // long value...\n                use_textarea = true;\n            }\n            \n            \n            \n            if (use_textarea) {\n                print(\"Call show editor\\n\");\n                GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                    this.view.el.get_selection().select_path(path);\n                    \n                    this.show_editor(file, node, type, key);\n                    \n                    return false;\n                });\n               \n                \n                return false;\n            }\n            // others... - fill in options for true/false?\n           print(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());\n           \n               print (type_ar[0].up());\n                if (type_ar.length > 1 && (\n                        type_ar[0].up() == \"BOOLEAN\"\n                        ||\n                        type_ar[0].up() == \"BOOL\"                        \n                    )) {\n                        print(\"start editing try/false)???\");\n                        this.valrender.el.has_entry = false;\n                        string[] opts =  { \"true\", \"false\" };\n                        this.valrender.setOptions(opts);\n                        \n                        this.valrender.el.has_entry = false;\n                        this.valrender.el.editable = true;\n                         this.allow_edit  = true;\n                         GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n                             this.view.el.set_cursor_on_cell(\n                                path,\n                                this.valcol.el,\n                                this.valrender.el,\n                                true\n                            );\n                            return false;\n                        });\n                        return true;\n                }\n                                      \n                \n           \n             string[] opts =  {  };\n            this.valrender.setOptions(opts);\n           \n           GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                \n                // at this point - work out the type...\n                // if its' a combo... then show the options..\n                this.valrender.el.has_entry = true;\n                \n                this.valrender.el.editable = true;            \n            \n                \n                this.allow_edit  = true;\n                \n                \n                \n                \n\n                this.view.el.set_cursor_on_cell(\n                    path,\n                    this.valcol.el,\n                    this.valrender.el,\n                    true\n                );\n                return false;\n            });\n            return false;\n        }\n",
             "id" : "LeftProps",
-            "|             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 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}",
+            "|              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}",
+            "|              void finish_editing" : "() {\n     // \n    this.before_edit();\n}",
+            "|              bool startEditingValue" : "( Gtk.TreePath path) {\n\n    // ONLY return true if editing is allowed - eg. combo..\n    \n            print(\"start editing?\\n\");\n            if (!this.stop_editor()) {\n                print(\"stop editor failed\\n\");\n                return false;\n            }\n            \n            Gtk.TreeIter iter;\n\n            var mod = this.model.el;\n            mod.get_iter (out iter, path);\n             \n            /*\n                m.set(iter, \n                        0, \"listener\",\n                        1, miter.get_key(),\n                        2, \"<b>\" + miter.get_key() + \"</b>\",\n                        3, miter.get_value()\n                    ); \n             \n            */\n            GLib.Value gval;\n            mod.get_value(iter, 3 , out gval);\n            var val = (string)gval;\n        \n            mod.get_value(iter, 1 , out gval);\n            var key = (string)gval;\n            var type_ar = key.split(\" \");\n            \n            \n            \n            mod.get_value(iter, 0 , out gval);\n            var type = (string)gval;\n            \n           \n            \n            var use_textarea = false;\n\n            //------------ things that require the text editor...\n            \n            if (type == \"listener\") {\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '|') { // user defined method\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '$') { // raw string\n                use_textarea = true;\n            }\n            if (key.length > 0 && key == \"* init\") {\n                use_textarea = true;\n            }\n            if (val.length > 40) { // long value...\n                use_textarea = true;\n            }\n            \n            \n            \n            if (use_textarea) {\n                print(\"Call show editor\\n\");\n                GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                    this.view.el.get_selection().select_path(path);\n                    \n                    this.show_editor(file, node, type, key);\n                    \n                    return false;\n                });\n               \n                \n                return false;\n            }\n            // others... - fill in options for true/false?\n           print(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());\n           \n               print (type_ar[0].up());\n                if (type_ar.length > 1 && (\n                        type_ar[0].up() == \"BOOLEAN\"\n                        ||\n                        type_ar[0].up() == \"BOOL\"                        \n                    )) {\n                        print(\"start editing try/false)???\");\n                        this.valrender.el.has_entry = false;\n                        string[] opts =  { \"true\", \"false\" };\n                        this.valrender.setOptions(opts);\n                        \n                        this.valrender.el.has_entry = false;\n                        this.valrender.el.editable = true;\n                         this.allow_edit  = true;\n                         GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n                             this.view.el.set_cursor_on_cell(\n                                path,\n                                this.valcol.el,\n                                this.valrender.el,\n                                true\n                            );\n                            return false;\n                        });\n                        return true;\n                }\n                                      \n                \n           \n             string[] opts =  {  };\n            this.valrender.setOptions(opts);\n           \n           GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                \n                // at this point - work out the type...\n                // if its' a combo... then show the options..\n                this.valrender.el.has_entry = true;\n                \n                this.valrender.el.editable = true;            \n            \n                \n                this.allow_edit  = true;\n                \n                \n                \n                \n\n                this.view.el.set_cursor_on_cell(\n                    path,\n                    this.valcol.el,\n                    this.valrender.el,\n                    true\n                );\n                return false;\n            });\n            return false;\n        }\n",
+            "|              void load" : "(JsRender.JsRender file, JsRender.Node? node) \n{\n    print(\"load leftprops\\n\");\n    this.before_edit();\n    this.node = node;\n    this.file = file;\n    \n \n    this.model.el.clear();\n              \n    //this.get('/RightEditor').el.hide();\n    if (node ==null) {\n        return ;\n    }\n     \n    \n\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    Gtk.TreeIter iter;\n    \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    \n    \n    \n    \n    // really need a way to sort the hashmap...\n    var m = this.model.el;\n    \n    var miter = node.listeners.map_iterator();\n    var i = 0;\n    \n    while(miter.next()) {\n        i++;\n        m.append(out iter,null);\n        \n        this.updateIter(iter,  \"listener\", miter.get_key(), miter.get_value());\n        \n         \n     }\n     \n      \n    miter = node.props.map_iterator();\n    \n    \n   while(miter.next()) {\n           i++;\n        m.append(out iter,null);\n         this.updateIter(iter,  \"prop\", miter.get_key(), miter.get_value());\n         \n   }\n   print(\"clear selection\\n\");\n   // clear selection?\n   this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..\n   \n   this.view.el.get_selection().unselect_all();\n   \n       var pane = _this.main_window.editpane.el;\n    var try_size = (i * 25) + 60; // est. 20px per line + 40px header\n    \n    // max 80%...\n    pane.set_position( \n         ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? \n        (int) (pane.max_position * 0.2f) :\n        pane.max_position-try_size);\n    \n   \n}\n",
             "xtype" : "VBox",
-            "|             void deleteSelected" : " () {\n    \n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        \n        var s = this.view.el.get_selection();\n        s.get_selected(out mod, out iter);\n             \n              \n        GLib.Value gval;\n        mod.get_value(iter, 0 , out gval);\n        var type = (string)gval;\n        \n        mod.get_value(iter, 1 , out gval);\n        var key = (string)gval;\n        \n        switch(type) {\n            case \"listener\":\n                this.node.listeners.remove(key);\n                break;\n                \n            case \"props\":\n                this.node.props.remove(key);\n                break;\n        }\n        this.load(this.file, this.node);\n        \n        _this.changed();\n}",
-            "|             string keyFormat" : "(string val, string type) {\n    \n    // Glib.markup_escape_text(val);\n\n    if (type == \"listener\") {\n        return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + \n            GLib.Markup.escape_text(val) +\n             \"</span>\";\n    }\n    // property..\n    if (val.length < 1) {\n        return \"<span  color=\\\"#FF0000\\\">--empty--</span>\";\n    }\n    \n    //@ = signal\n    //$ = property with \n    //# - object properties\n    //* = special\n    // all of these... - display value is last element..\n    var ar = val.strip().split(\" \");\n    \n    \n    var dval = GLib.Markup.escape_text(ar[ar.length-1]);\n    \n    \n    \n    \n    switch(val[0]) {\n        case '@': // signal // just bold balck?\n            if (dval[0] == '@') {\n                dval = dval.substring(1);\n            }\n        \n            return @\"<span  font_weight=\\\"bold\\\">@ $dval</span>\";        \n        case '#': // object properties?\n            if (dval[0] == '#') {\n                dval = dval.substring(1);\n            }\n            return @\"<span  font_weight=\\\"bold\\\">$dval</span>\";\n        case '*': // special\n            if (dval[0] == '*') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\";            \n        case '$':\n            if (dval[0] == '$') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   style=\\\"italic\\\">$dval</span>\";\n       case '|': // user defined methods\n            if (dval[0] == '|') {\n                dval = dval.substring(1);\n            }\n            return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";\n            \n              \n            \n        default:\n            return dval;\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}",
+            "|              string keyFormat" : "(string val, string type) {\n    \n    // Glib.markup_escape_text(val);\n\n    if (type == \"listener\") {\n        return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + \n            GLib.Markup.escape_text(val) +\n             \"</span>\";\n    }\n    // property..\n    if (val.length < 1) {\n        return \"<span  color=\\\"#FF0000\\\">--empty--</span>\";\n    }\n    \n    //@ = signal\n    //$ = property with \n    //# - object properties\n    //* = special\n    // all of these... - display value is last element..\n    var ar = val.strip().split(\" \");\n    \n    \n    var dval = GLib.Markup.escape_text(ar[ar.length-1]);\n    \n    \n    \n    \n    switch(val[0]) {\n        case '@': // signal // just bold balck?\n            if (dval[0] == '@') {\n                dval = dval.substring(1);\n            }\n        \n            return @\"<span  font_weight=\\\"bold\\\">@ $dval</span>\";        \n        case '#': // object properties?\n            if (dval[0] == '#') {\n                dval = dval.substring(1);\n            }\n            return @\"<span  font_weight=\\\"bold\\\">$dval</span>\";\n        case '*': // special\n            if (dval[0] == '*') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\";            \n        case '$':\n            if (dval[0] == '$') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   style=\\\"italic\\\">$dval</span>\";\n       case '|': // user defined methods\n            if (dval[0] == '|') {\n                dval = dval.substring(1);\n            }\n            return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";\n            \n              \n            \n        default:\n            return dval;\n    }\n      \n    \n\n}",
             "# JsRender.JsRender file" : "",
             "@ bool stop_editor" : "()",
             "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, string type, string key)",
             "@ void changed" : "()",
+            "|              void deleteSelected" : " () {\n    \n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        \n        var s = this.view.el.get_selection();\n        s.get_selected(out mod, out iter);\n             \n              \n        GLib.Value gval;\n        mod.get_value(iter, 0 , out gval);\n        var type = (string)gval;\n        \n        mod.get_value(iter, 1 , out gval);\n        var key = (string)gval;\n        \n        switch(type) {\n            case \"listener\":\n                this.node.listeners.remove(key);\n                break;\n                \n            case \"props\":\n                this.node.props.remove(key);\n                break;\n        }\n        this.load(this.file, this.node);\n        \n        _this.changed();\n}",
             "$ xns" : "Gtk",
+            "|              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)",
-            "|             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",
             "$ homogeneous" : "false   ",
             "# Xcls_MainWindow main_window" : "null",
-            "|             void finish_editing" : "() {\n     // \n    this.before_edit();\n}",
+            "|              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}",
             "# JsRender.Node node" : "",
             "items" : [
                 {
                                     "$ xns" : "Gtk",
                                     "items" : [
                                         {
+                                            "$ stock" : "Gtk.STOCK_ADD",
                                             "* pack" : "add",
                                             "xtype" : "Image",
-                                            "$ stock" : "Gtk.STOCK_ADD",
                                             "$ xns" : "Gtk",
                                             "$ icon_size" : "Gtk.IconSize.MENU"
                                         },
                                         {
                                             "label" : "Other",
-                                            "* pack" : "add",
                                             "xtype" : "Label",
+                                            "* pack" : "add",
                                             "$ xns" : "Gtk"
                                         }
                                     ]
                                 },
                                 {
                                     "id" : "AddPropertyPopup",
-                                    "* pack" : false,
                                     "xtype" : "Menu",
+                                    "* pack" : false,
                                     "$ xns" : "Gtk",
                                     "items" : [
                                         {
@@ -74,8 +74,8 @@
                                                 "activate" : " ()  => {\n    _this.addProp( \"prop\", \"id\", \"\", \"string\");\n}"
                                             },
                                             "label" : "ID",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Using this.get('*someid') will find any id in an application.",
                                             "$ xns" : "Gtk"
                                         },
@@ -84,8 +84,8 @@
                                                 "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"pack\",\"add\", \"*\");\n}"
                                             },
                                             "label" : "PACK",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add what type of packing is to be used",
                                             "$ xns" : "Gtk"
                                         },
@@ -94,8 +94,8 @@
                                                 "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\",  \"init\", \"{\\n\\n}\\n\", \"*\" );\n}"
                                             },
                                             "label" : "INIT",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Override the init method",
                                             "$ xns" : "Gtk"
                                         },
                                                 "activate" : "  (self) => {\n\n    _this.addProp( \"prop\", \"XXXX\", \"\",\"string\");\n\n}"
                                             },
                                             "label" : "String",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add a user defined string property",
                                             "$ xns" : "Gtk"
                                         },
                                                 "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXX\", \"0\", \"int\");\n}"
                                             },
                                             "label" : "Number",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add a user defined number property",
                                             "$ xns" : "Gtk"
                                         },
                                                 "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXX\", \"true\", \"bool\");\n}"
                                             },
                                             "label" : "Boolean",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add a user defined boolean property",
                                             "$ xns" : "Gtk"
                                         },
                                                 "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXXX\", \"function() { }\", \"| function\");\n}"
                                             },
                                             "label" : "Javascript Function",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add a user function boolean property",
                                             "$ xns" : "Gtk"
                                         },
                                                 "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXXX\", \"() {\\n\\n}\\n\", \"| return_type\");\n}"
                                             },
                                             "label" : "Vala Method",
-                                            "* pack" : "append",
                                             "xtype" : "MenuItem",
+                                            "* pack" : "append",
                                             "tooltip_markup" : "Add a user function boolean property",
                                             "$ xns" : "Gtk"
                                         }
                                                 "edited" : "  (path, newtext) => {\n        print(\"Keyrender  - signal:edited\\n\");\n    \n    this.el.editable = false;\n  \n \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n       \n        _this.model.el.set_value(iter, 1, newtext);\n        \n        print(\"ktype: %s\\n\",ktype);\n        switch(ktype) {\n            case \"listener\":\n                var ov = _this.node.listeners.get(oldval);\n                _this.node.listeners.set(newtext, ov);\n                _this.node.listeners.remove(oldval);\n                \n                _this.updateIter(iter,  ktype, newtext, ov);\n                \n                break;\n            case \"props\":\n                var ov = _this.node.props.get(oldval);\n                _this.node.props.set(newtext, ov);\n                _this.node.props.remove(oldval);\n                _this.updateIter(iter,  ktype, newtext, ov);\n                break;\n         }\n         _this.changed();\n          \n}"
                                             },
                                             "id" : "keyrender",
-                                            "xtype" : "CellRendererText",
                                             "* pack" : "pack_start,false",
+                                            "xtype" : "CellRendererText",
                                             "$ xns" : "Gtk"
                                         }
                                     ]
                                                 "edited" : "  (path, newtext) => {\n    print(\"Valrender  - signal:edited\\n\");\n  \n        this.el.editable = false;\n/*  \n m.set(iter, \n                0, \"listener\",\n                1, miter.get_key(),\n                2, \"<b>\" + miter.get_key() + \"</b>\",\n                3, miter.get_value(),\n                4, display_value(short);\n            ); \n\n  */      \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n        \n        \n         _this.model.el.get_value(iter,3, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var key = (string)gval;\n        \n         \n        \n        switch(ktype) {\n            case \"listener\":\n                _this.node.listeners.set(key, newtext);\n                _this.updateIter(iter,ktype,key,newtext);\n                break;\n            case \"props\":\n                _this.node.props.set(key,newtext);\n                _this.updateIter(iter,ktype, key,newtext);                \n                break;\n         }\n//         _this.load(_this.file,_this.node);\n         _this.changed();\n          \n}"
                                             },
                                             "id" : "valrender",
-                                            "|             void setOptions" : "(string[] ar) {\n      var m = _this.valrendermodel.el;\n        m.clear();\n     Gtk.TreeIter iret;\n    for (var i =0; i < ar.length; i++) {\n            m.append(out iret);\n            m.set_value(iret, 0, ar[i]);\n    }\n\n}",
                                             "xtype" : "CellRendererCombo",
                                             "* pack" : "pack_start,true",
                                             "$ editable" : false,
                                             "$ has_entry" : true,
                                             "$ xns" : "Gtk",
+                                            "|              void setOptions" : "(string[] ar) {\n      var m = _this.valrendermodel.el;\n        m.clear();\n     Gtk.TreeIter iret;\n    for (var i =0; i < ar.length; i++) {\n            m.append(out iret);\n            m.set_value(iret, 0, ar[i]);\n    }\n\n}",
                                             "text_column" : 0,
                                             "items" : [
                                                 {
                                                     "id" : "valrendermodel",
-                                                    "* pack" : false,
                                                     "xtype" : "ListStore",
+                                                    "* pack" : false,
                                                     "$ columns" : "typeof(string)",
                                                     "n_columns" : 1,
                                                     "$ xns" : "Gtk",
                         },
                         {
                             "id" : "ContextMenu",
-                            "xtype" : "Menu",
                             "* pack" : false,
+                            "xtype" : "Menu",
                             "$ xns" : "Gtk",
                             "items" : [
                                 {
                                         "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}"
                                     },
                                     "label" : "Edit",
-                                    "xtype" : "MenuItem",
                                     "* pack" : "append",
+                                    "xtype" : "MenuItem",
                                     "$ xns" : "Gtk"
                                 },
                                 {
                                         "activate" : "  ( )  =>{\n\t_this.deleteSelected();\n}"
                                     },
                                     "label" : "Delete",
-                                    "xtype" : "MenuItem",
                                     "* pack" : "append",
+                                    "xtype" : "MenuItem",
                                     "$ xns" : "Gtk"
                                 }
                             ]
index a893d06..fd55747 100644 (file)
@@ -11,77 +11,54 @@ console = imports.console;
 XObject = imports.XObject.XObject;
 WindowLeftProps=new XObject({
     allow_edit : false,
-    load : (JsRender.JsRender file, JsRender.Node? node) 
+    id : "LeftProps",
+    before_edit : ()
     {
-        print("load leftprops\n");
-        this.before_edit();
-        this.node = node;
-        this.file = file;
-        
-     
-        this.model.el.clear();
-                  
-        //this.get('/RightEditor').el.hide();
-        if (node ==null) {
-            return ;
-        }
-         
-        
     
-        //var provider = this.get('/LeftTree').getPaleteProvider();
-        Gtk.TreeIter iter;
-        
-        //typeof(string),  // 0 key type
-         //typeof(string),  // 1 key
-         //typeof(string),  // 2 key (display)
-         //typeof(string),  // 3 value
-         //typeof(string),  // 4 value (display)
-         //typeof(string),  // 5 both (tooltip)
-        
+        print("before edit - stop editing\n");
         
+      // these do not appear to trigger save...
+        _this.keyrender.el.stop_editing(false);
+        _this.keyrender.el.editable  =false;
+    
+        _this.valrender.el.stop_editing(false);
+        _this.valrender.el.editable  =false;    
         
         
-        // really need a way to sort the hashmap...
-        var m = this.model.el;
+    // technicall stop the popup editor..
+    
+    },
+    keySortFormat : (string key) {
+        // listeners first - with 0
+        // specials
+        if (key[0] == '*') {
+            return "1 " + key;
+        }
+        // functions
         
-        var miter = node.listeners.map_iterator();
-        var i = 0;
+        var bits = key.split(" ");
         
-        while(miter.next()) {
-            i++;
-            m.append(out iter,null);
-            
-            this.updateIter(iter,  "listener", miter.get_key(), miter.get_value());
+        if (key[0] == '|') {
+            return "2 " + bits[bits.length -1];
+        }
+        // signals
+        if (key[0] == '@') {
+            return "3 " + bits[bits.length -1];
+        }
             
-             
-         }
-         
-          
-        miter = node.props.map_iterator();
-        
-        
-       while(miter.next()) {
-               i++;
-            m.append(out iter,null);
-             this.updateIter(iter,  "prop", miter.get_key(), miter.get_value());
-             
-       }
-       print("clear selection\n");
-       // clear selection?
-       this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
-       
-       this.view.el.get_selection().unselect_all();
-       
-           var pane = _this.main_window.editpane.el;
-        var try_size = (i * 25) + 60; // est. 20px per line + 40px header
-        
-        // max 80%...
-        pane.set_position( 
-             ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
-            (int) (pane.max_position * 0.2f) :
-            pane.max_position-try_size);
-        
-       
+        // props
+        if (key[0] == '#') {
+            return "4 " + bits[bits.length -1];
+        }
+        // the rest..
+        return "5 " + bits[bits.length -1];    
+    
+    
+    
+    },
+    finish_editing : () {
+         // 
+        this.before_edit();
     },
     startEditingValue : ( Gtk.TreePath path) {
     
@@ -216,145 +193,79 @@ WindowLeftProps=new XObject({
                 });
                 return false;
             },
-    id : "LeftProps",
-    addProp : (string in_type, string key, string value, string value_type) {
-          // info includes key, val, skel, etype..
-          //console.dump(info);
-            //type = info.type.toLowerCase();
-            //var data = this.toJS();
-              
-        var type = in_type == "signals" ? "listener" : in_type;
-          
-        var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
-                  
-        if (type == "listener") {
-            if (this.node.listeners.has_key(key)) {
-                return;
-            }
-            this.node.listeners.set(key,value);
-        } else  {
+    load : (JsRender.JsRender file, JsRender.Node? node) 
+    {
+        print("load leftprops\n");
+        this.before_edit();
+        this.node = node;
+        this.file = file;
         
-            if (this.node.props.has_key(fkey)) {
-                return;
-            }
-            this.node.props.set(fkey,value);
+     
+        this.model.el.clear();
+                  
+        //this.get('/RightEditor').el.hide();
+        if (node ==null) {
+            return ;
         }
-               
-          
-        // add a row???
-        this.load(this.file, this.node);
-        
-        
-        
-        /// need to find the row which I've just added..
+         
         
+    
+        //var provider = this.get('/LeftTree').getPaleteProvider();
+        Gtk.TreeIter iter;
         
-        var s = this.view.el.get_selection();
-        s.unselect_all();
+        //typeof(string),  // 0 key type
+         //typeof(string),  // 1 key
+         //typeof(string),  // 2 key (display)
+         //typeof(string),  // 3 value
+         //typeof(string),  // 4 value (display)
+         //typeof(string),  // 5 both (tooltip)
         
-        print("trying to find new iter");
-      
-        this.model.el.foreach((model, path, iter) => {
-            GLib.Value gval;
         
-            this.model.el.get_value(iter, 0 , out gval);
-            if ((string)gval != type) {
-                print("not type: %s = %s\n", (string)gval , type);
-                return false;
-            }
-            this.model.el.get_value(iter, 1 , out gval);
-            if ((string)gval != fkey) {
-                print("not key: %s = %s\n", (string)gval , fkey);
-                return false;
-            }
-            // delay this?
-            GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
-            
-                this.startEditingValue(this.model.el.get_path(iter));
-                return false;
-            });
-            //s.select_iter(iter);
-            return true; 
-        });
         
         
+        // really need a way to sort the hashmap...
+        var m = this.model.el;
         
-                  
-    },
-    before_edit : ()
-    {
-    
-        print("before edit - stop editing\n");
+        var miter = node.listeners.map_iterator();
+        var i = 0;
         
-      // these do not appear to trigger save...
-        _this.keyrender.el.stop_editing(false);
-        _this.keyrender.el.editable  =false;
-    
-        _this.valrender.el.stop_editing(false);
-        _this.valrender.el.editable  =false;    
+        while(miter.next()) {
+            i++;
+            m.append(out iter,null);
+            
+            this.updateIter(iter,  "listener", miter.get_key(), miter.get_value());
+            
+             
+         }
+         
+          
+        miter = node.props.map_iterator();
         
         
-    // technicall stop the popup editor..
-    
-    },
-    keySortFormat : (string key) {
-        // listeners first - with 0
-        // specials
-        if (key[0] == '*') {
-            return "1 " + key;
-        }
-        // functions
+       while(miter.next()) {
+               i++;
+            m.append(out iter,null);
+             this.updateIter(iter,  "prop", miter.get_key(), miter.get_value());
+             
+       }
+       print("clear selection\n");
+       // clear selection?
+       this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
+       
+       this.view.el.get_selection().unselect_all();
+       
+           var pane = _this.main_window.editpane.el;
+        var try_size = (i * 25) + 60; // est. 20px per line + 40px header
         
-        var bits = key.split(" ");
+        // max 80%...
+        pane.set_position( 
+             ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
+            (int) (pane.max_position * 0.2f) :
+            pane.max_position-try_size);
         
-        if (key[0] == '|') {
-            return "2 " + bits[bits.length -1];
-        }
-        // signals
-        if (key[0] == '@') {
-            return "3 " + bits[bits.length -1];
-        }
-            
-        // props
-        if (key[0] == '#') {
-            return "4 " + bits[bits.length -1];
-        }
-        // the rest..
-        return "5 " + bits[bits.length -1];    
-    
-    
-    
+       
     },
     xtype : "VBox",
-    deleteSelected : () {
-        
-            Gtk.TreeIter iter;
-            Gtk.TreeModel mod;
-            
-            var s = this.view.el.get_selection();
-            s.get_selected(out mod, out iter);
-                 
-                  
-            GLib.Value gval;
-            mod.get_value(iter, 0 , out gval);
-            var type = (string)gval;
-            
-            mod.get_value(iter, 1 , out gval);
-            var key = (string)gval;
-            
-            switch(type) {
-                case "listener":
-                    this.node.listeners.remove(key);
-                    break;
-                    
-                case "props":
-                    this.node.props.remove(key);
-                    break;
-            }
-            this.load(this.file, this.node);
-            
-            _this.changed();
-    },
     keyFormat : (string val, string type) {
         
         // Glib.markup_escape_text(val);
@@ -418,6 +329,132 @@ WindowLeftProps=new XObject({
           
         
     
+    },
+    file : "",
+    stop_editor : "()",
+    show_editor : "(JsRender.JsRender file, JsRender.Node node, string type, string key)",
+    changed : "()",
+    deleteSelected : () {
+        
+            Gtk.TreeIter iter;
+            Gtk.TreeModel mod;
+            
+            var s = this.view.el.get_selection();
+            s.get_selected(out mod, out iter);
+                 
+                  
+            GLib.Value gval;
+            mod.get_value(iter, 0 , out gval);
+            var type = (string)gval;
+            
+            mod.get_value(iter, 1 , out gval);
+            var key = (string)gval;
+            
+            switch(type) {
+                case "listener":
+                    this.node.listeners.remove(key);
+                    break;
+                    
+                case "props":
+                    this.node.props.remove(key);
+                    break;
+            }
+            this.load(this.file, this.node);
+            
+            _this.changed();
+    },
+    xns : Gtk,
+    startEditingKey : ( Gtk.TreePath path) {
+        
+         if (!this.stop_editor()) {
+            return;
+         }
+      
+        // others... - fill in options for true/false?
+        
+           
+        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+            this.allow_edit  = true;
+            this.keyrender.el.editable = true;
+         
+            this.view.el.set_cursor_on_cell(
+                path,
+                this.keycol.el,
+                this.keyrender.el,
+                true
+            );
+                   
+            return false;
+        });
+          
+        
+    },
+    show_add_props : "(string type)",
+    homogeneous : false,
+    main_window : "null",
+    addProp : (string in_type, string key, string value, string value_type) {
+          // info includes key, val, skel, etype..
+          //console.dump(info);
+            //type = info.type.toLowerCase();
+            //var data = this.toJS();
+              
+        var type = in_type == "signals" ? "listener" : in_type;
+          
+        var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
+                  
+        if (type == "listener") {
+            if (this.node.listeners.has_key(key)) {
+                return;
+            }
+            this.node.listeners.set(key,value);
+        } else  {
+        
+            if (this.node.props.has_key(fkey)) {
+                return;
+            }
+            this.node.props.set(fkey,value);
+        }
+               
+          
+        // add a row???
+        this.load(this.file, this.node);
+        
+        
+        
+        /// need to find the row which I've just added..
+        
+        
+        var s = this.view.el.get_selection();
+        s.unselect_all();
+        
+        print("trying to find new iter");
+      
+        this.model.el.foreach((model, path, iter) => {
+            GLib.Value gval;
+        
+            this.model.el.get_value(iter, 0 , out gval);
+            if ((string)gval != type) {
+                print("not type: %s = %s\n", (string)gval , type);
+                return false;
+            }
+            this.model.el.get_value(iter, 1 , out gval);
+            if ((string)gval != fkey) {
+                print("not key: %s = %s\n", (string)gval , fkey);
+                return false;
+            }
+            // delay this?
+            GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
+            
+                this.startEditingValue(this.model.el.get_path(iter));
+                return false;
+            });
+            //s.select_iter(iter);
+            return true; 
+        });
+        
+        
+        
+                  
     },
     updateIter : (Gtk.TreeIter iter,  string type, string key, string value) {
     
@@ -462,43 +499,6 @@ WindowLeftProps=new XObject({
                  6,  this.keySortFormat(key)
             ); 
     },
-    file : "",
-    stop_editor : "()",
-    show_editor : "(JsRender.JsRender file, JsRender.Node node, string type, string key)",
-    changed : "()",
-    xns : Gtk,
-    show_add_props : "(string type)",
-    startEditingKey : ( Gtk.TreePath path) {
-        
-         if (!this.stop_editor()) {
-            return;
-         }
-      
-        // others... - fill in options for true/false?
-        
-           
-        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-            this.allow_edit  = true;
-            this.keyrender.el.editable = true;
-         
-            this.view.el.set_cursor_on_cell(
-                path,
-                this.keycol.el,
-                this.keyrender.el,
-                true
-            );
-                   
-            return false;
-        });
-          
-        
-    },
-    homogeneous : false,
-    main_window : "null",
-    finish_editing : () {
-         // 
-        this.before_edit();
-    },
     node : "",
     items : [
        {
@@ -526,8 +526,8 @@ WindowLeftProps=new XObject({
                             xns : Gtk,
                             items : [
                                {
-                                    xtype : "Image",
                                     stock : Gtk.STOCK_ADD,
+                                    xtype : "Image",
                                     xns : Gtk,
                                     icon_size : Gtk.IconSize.MENU
                                 },
@@ -917,6 +917,10 @@ WindowLeftProps=new XObject({
                                         xns : Gtk
                                     },
                                     id : "valrender",
+                                    xtype : "CellRendererCombo",
+                                    editable : FALSE,
+                                    has_entry : TRUE,
+                                    xns : Gtk,
                                     setOptions : (string[] ar) {
                                           var m = _this.valrendermodel.el;
                                             m.clear();
@@ -927,10 +931,6 @@ WindowLeftProps=new XObject({
                                         }
                                     
                                     },
-                                    xtype : "CellRendererCombo",
-                                    editable : FALSE,
-                                    has_entry : TRUE,
-                                    xns : Gtk,
                                     text_column : 0,
                                     listeners : {
                                        editing_started : ( editable, path) => {
index ff84cf2..e22472f 100644 (file)
@@ -53,79 +53,55 @@ public class Xcls_LeftProps : Object
     }
 
     // user defined functions 
-    public             void load (JsRender.JsRender file, JsRender.Node? node) 
+    public              void before_edit ()
     {
-        print("load leftprops\n");
-        this.before_edit();
-        this.node = node;
-        this.file = file;
-        
-     
-        this.model.el.clear();
-                  
-        //this.get('/RightEditor').el.hide();
-        if (node ==null) {
-            return ;
-        }
-         
-        
     
-        //var provider = this.get('/LeftTree').getPaleteProvider();
-        Gtk.TreeIter iter;
-        
-        //typeof(string),  // 0 key type
-         //typeof(string),  // 1 key
-         //typeof(string),  // 2 key (display)
-         //typeof(string),  // 3 value
-         //typeof(string),  // 4 value (display)
-         //typeof(string),  // 5 both (tooltip)
-        
+        print("before edit - stop editing\n");
         
+      // these do not appear to trigger save...
+        _this.keyrender.el.stop_editing(false);
+        _this.keyrender.el.editable  =false;
+    
+        _this.valrender.el.stop_editing(false);
+        _this.valrender.el.editable  =false;    
         
         
-        // really need a way to sort the hashmap...
-        var m = this.model.el;
+    // technicall stop the popup editor..
+    
+    }
+    public              string keySortFormat (string key) {
+        // listeners first - with 0
+        // specials
+        if (key[0] == '*') {
+            return "1 " + key;
+        }
+        // functions
         
-        var miter = node.listeners.map_iterator();
-        var i = 0;
+        var bits = key.split(" ");
         
-        while(miter.next()) {
-            i++;
-            m.append(out iter,null);
-            
-            this.updateIter(iter,  "listener", miter.get_key(), miter.get_value());
+        if (key[0] == '|') {
+            return "2 " + bits[bits.length -1];
+        }
+        // signals
+        if (key[0] == '@') {
+            return "3 " + bits[bits.length -1];
+        }
             
-             
-         }
-         
-          
-        miter = node.props.map_iterator();
-        
-        
-       while(miter.next()) {
-               i++;
-            m.append(out iter,null);
-             this.updateIter(iter,  "prop", miter.get_key(), miter.get_value());
-             
-       }
-       print("clear selection\n");
-       // clear selection?
-       this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
-       
-       this.view.el.get_selection().unselect_all();
-       
-           var pane = _this.main_window.editpane.el;
-        var try_size = (i * 25) + 60; // est. 20px per line + 40px header
-        
-        // max 80%...
-        pane.set_position( 
-             ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
-            (int) (pane.max_position * 0.2f) :
-            pane.max_position-try_size);
-        
-       
+        // props
+        if (key[0] == '#') {
+            return "4 " + bits[bits.length -1];
+        }
+        // the rest..
+        return "5 " + bits[bits.length -1];    
+    
+    
+    
+    }
+    public              void finish_editing () {
+         // 
+        this.before_edit();
     }
-    public             bool startEditingValue ( Gtk.TreePath path) {
+    public              bool startEditingValue ( Gtk.TreePath path) {
     
         // ONLY return true if editing is allowed - eg. combo..
         
@@ -258,144 +234,79 @@ public class Xcls_LeftProps : Object
                 });
                 return false;
             }
-    public             void addProp (string in_type, string key, string value, string value_type) {
-          // info includes key, val, skel, etype..
-          //console.dump(info);
-            //type = info.type.toLowerCase();
-            //var data = this.toJS();
-              
-        var type = in_type == "signals" ? "listener" : in_type;
-          
-        var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
-                  
-        if (type == "listener") {
-            if (this.node.listeners.has_key(key)) {
-                return;
-            }
-            this.node.listeners.set(key,value);
-        } else  {
+    public              void load (JsRender.JsRender file, JsRender.Node? node) 
+    {
+        print("load leftprops\n");
+        this.before_edit();
+        this.node = node;
+        this.file = file;
         
-            if (this.node.props.has_key(fkey)) {
-                return;
-            }
-            this.node.props.set(fkey,value);
+     
+        this.model.el.clear();
+                  
+        //this.get('/RightEditor').el.hide();
+        if (node ==null) {
+            return ;
         }
-               
-          
-        // add a row???
-        this.load(this.file, this.node);
-        
+         
         
+    
+        //var provider = this.get('/LeftTree').getPaleteProvider();
+        Gtk.TreeIter iter;
         
-        /// need to find the row which I've just added..
+        //typeof(string),  // 0 key type
+         //typeof(string),  // 1 key
+         //typeof(string),  // 2 key (display)
+         //typeof(string),  // 3 value
+         //typeof(string),  // 4 value (display)
+         //typeof(string),  // 5 both (tooltip)
         
         
-        var s = this.view.el.get_selection();
-        s.unselect_all();
         
-        print("trying to find new iter");
-      
-        this.model.el.foreach((model, path, iter) => {
-            GLib.Value gval;
         
-            this.model.el.get_value(iter, 0 , out gval);
-            if ((string)gval != type) {
-                print("not type: %s = %s\n", (string)gval , type);
-                return false;
-            }
-            this.model.el.get_value(iter, 1 , out gval);
-            if ((string)gval != fkey) {
-                print("not key: %s = %s\n", (string)gval , fkey);
-                return false;
-            }
-            // delay this?
-            GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
-            
-                this.startEditingValue(this.model.el.get_path(iter));
-                return false;
-            });
-            //s.select_iter(iter);
-            return true; 
-        });
-        
-        
-        
-                  
-    }
-    public             void before_edit ()
-    {
-    
-        print("before edit - stop editing\n");
+        // really need a way to sort the hashmap...
+        var m = this.model.el;
         
-      // these do not appear to trigger save...
-        _this.keyrender.el.stop_editing(false);
-        _this.keyrender.el.editable  =false;
-    
-        _this.valrender.el.stop_editing(false);
-        _this.valrender.el.editable  =false;    
+        var miter = node.listeners.map_iterator();
+        var i = 0;
         
+        while(miter.next()) {
+            i++;
+            m.append(out iter,null);
+            
+            this.updateIter(iter,  "listener", miter.get_key(), miter.get_value());
+            
+             
+         }
+         
+          
+        miter = node.props.map_iterator();
         
-    // technicall stop the popup editor..
-    
-    }
-    public             string keySortFormat (string key) {
-        // listeners first - with 0
-        // specials
-        if (key[0] == '*') {
-            return "1 " + key;
-        }
-        // functions
         
-        var bits = key.split(" ");
+       while(miter.next()) {
+               i++;
+            m.append(out iter,null);
+             this.updateIter(iter,  "prop", miter.get_key(), miter.get_value());
+             
+       }
+       print("clear selection\n");
+       // clear selection?
+       this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
+       
+       this.view.el.get_selection().unselect_all();
+       
+           var pane = _this.main_window.editpane.el;
+        var try_size = (i * 25) + 60; // est. 20px per line + 40px header
         
-        if (key[0] == '|') {
-            return "2 " + bits[bits.length -1];
-        }
-        // signals
-        if (key[0] == '@') {
-            return "3 " + bits[bits.length -1];
-        }
-            
-        // props
-        if (key[0] == '#') {
-            return "4 " + bits[bits.length -1];
-        }
-        // the rest..
-        return "5 " + bits[bits.length -1];    
-    
-    
-    
-    }
-    public             void deleteSelected () {
+        // max 80%...
+        pane.set_position( 
+             ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
+            (int) (pane.max_position * 0.2f) :
+            pane.max_position-try_size);
         
-            Gtk.TreeIter iter;
-            Gtk.TreeModel mod;
-            
-            var s = this.view.el.get_selection();
-            s.get_selected(out mod, out iter);
-                 
-                  
-            GLib.Value gval;
-            mod.get_value(iter, 0 , out gval);
-            var type = (string)gval;
-            
-            mod.get_value(iter, 1 , out gval);
-            var key = (string)gval;
-            
-            switch(type) {
-                case "listener":
-                    this.node.listeners.remove(key);
-                    break;
-                    
-                case "props":
-                    this.node.props.remove(key);
-                    break;
-            }
-            this.load(this.file, this.node);
-            
-            _this.changed();
+       
     }
-    public             string keyFormat (string val, string type) {
+    public              string keyFormat (string val, string type) {
         
         // Glib.markup_escape_text(val);
     
@@ -459,7 +370,125 @@ public class Xcls_LeftProps : Object
         
     
     }
-    public             void updateIter (Gtk.TreeIter iter,  string type, string key, string value) {
+    public              void deleteSelected () {
+        
+            Gtk.TreeIter iter;
+            Gtk.TreeModel mod;
+            
+            var s = this.view.el.get_selection();
+            s.get_selected(out mod, out iter);
+                 
+                  
+            GLib.Value gval;
+            mod.get_value(iter, 0 , out gval);
+            var type = (string)gval;
+            
+            mod.get_value(iter, 1 , out gval);
+            var key = (string)gval;
+            
+            switch(type) {
+                case "listener":
+                    this.node.listeners.remove(key);
+                    break;
+                    
+                case "props":
+                    this.node.props.remove(key);
+                    break;
+            }
+            this.load(this.file, this.node);
+            
+            _this.changed();
+    }
+    public              void startEditingKey ( Gtk.TreePath path) {
+        
+         if (!this.stop_editor()) {
+            return;
+         }
+      
+        // others... - fill in options for true/false?
+        
+           
+        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+            this.allow_edit  = true;
+            this.keyrender.el.editable = true;
+         
+            this.view.el.set_cursor_on_cell(
+                path,
+                this.keycol.el,
+                this.keyrender.el,
+                true
+            );
+                   
+            return false;
+        });
+          
+        
+    }
+    public              void addProp (string in_type, string key, string value, string value_type) {
+          // info includes key, val, skel, etype..
+          //console.dump(info);
+            //type = info.type.toLowerCase();
+            //var data = this.toJS();
+              
+        var type = in_type == "signals" ? "listener" : in_type;
+          
+        var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
+                  
+        if (type == "listener") {
+            if (this.node.listeners.has_key(key)) {
+                return;
+            }
+            this.node.listeners.set(key,value);
+        } else  {
+        
+            if (this.node.props.has_key(fkey)) {
+                return;
+            }
+            this.node.props.set(fkey,value);
+        }
+               
+          
+        // add a row???
+        this.load(this.file, this.node);
+        
+        
+        
+        /// need to find the row which I've just added..
+        
+        
+        var s = this.view.el.get_selection();
+        s.unselect_all();
+        
+        print("trying to find new iter");
+      
+        this.model.el.foreach((model, path, iter) => {
+            GLib.Value gval;
+        
+            this.model.el.get_value(iter, 0 , out gval);
+            if ((string)gval != type) {
+                print("not type: %s = %s\n", (string)gval , type);
+                return false;
+            }
+            this.model.el.get_value(iter, 1 , out gval);
+            if ((string)gval != fkey) {
+                print("not key: %s = %s\n", (string)gval , fkey);
+                return false;
+            }
+            // delay this?
+            GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
+            
+                this.startEditingValue(this.model.el.get_path(iter));
+                return false;
+            });
+            //s.select_iter(iter);
+            return true; 
+        });
+        
+        
+        
+                  
+    }
+    public              void updateIter (Gtk.TreeIter iter,  string type, string key, string value) {
     
         print("update Iter %s, %s\n", key,value);
         //typeof(string),  // 0 key type
@@ -502,35 +531,6 @@ public class Xcls_LeftProps : Object
                  6,  this.keySortFormat(key)
             ); 
     }
-    public             void startEditingKey ( Gtk.TreePath path) {
-        
-         if (!this.stop_editor()) {
-            return;
-         }
-      
-        // others... - fill in options for true/false?
-        
-           
-        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-            this.allow_edit  = true;
-            this.keyrender.el.editable = true;
-         
-            this.view.el.set_cursor_on_cell(
-                path,
-                this.keycol.el,
-                this.keyrender.el,
-                true
-            );
-                   
-            return false;
-        });
-          
-        
-    }
-    public             void finish_editing () {
-         // 
-        this.before_edit();
-    }
     public class Xcls_HBox2 : Object 
     {
         public Gtk.HBox el;
@@ -1487,7 +1487,7 @@ public class Xcls_LeftProps : Object
         }
 
         // user defined functions 
-        public             void setOptions (string[] ar) {
+        public              void setOptions (string[] ar) {
               var m = _this.valrendermodel.el;
                 m.clear();
              Gtk.TreeIter iret;