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

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

index f407b63..cf3486b 100644 (file)
      "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        \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         \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}"
+        "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         \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",
index 49c5ad9..56ce6df 100644 (file)
@@ -1365,9 +1365,9 @@ public class Xcls_LeftProps : Object
                        
                     mod.get_value(iter,0, out gvaltype);
             
-                    //this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
+                    this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
                        
-                      _this.startEditingKey(path); 
+                    //  _this.startEditingKey(path); 
                      
                     return false;
                 }