From: Alan Knowles Date: Mon, 1 Jun 2015 08:50:16 +0000 (+0800) Subject: src/Builder4/WindowLeftProps.bjs X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=commitdiff_plain;h=4bc9495330f0a40aa31ebd0b7b8d15e87d3afc2b src/Builder4/WindowLeftProps.bjs src/Builder4/WindowLeftProps.vala --- diff --git a/src/Builder4/WindowLeftProps.bjs b/src/Builder4/WindowLeftProps.bjs index 3a16fd0de..8c1341e83 100644 --- a/src/Builder4/WindowLeftProps.bjs +++ b/src/Builder4/WindowLeftProps.bjs @@ -236,7 +236,7 @@ "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 \n this.popover.show(this.el, _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 \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 \n /*\n m.set(iter, \n 0, \"listener\",\n 1, miter.get_key(),\n 2, \"\" + miter.get_key() + \"\",\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 this.popover.show(this.el, _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}" }, "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", diff --git a/src/Builder4/WindowLeftProps.vala b/src/Builder4/WindowLeftProps.vala index 19ed19916..87506d49a 100644 --- a/src/Builder4/WindowLeftProps.vala +++ b/src/Builder4/WindowLeftProps.vala @@ -1326,7 +1326,22 @@ public class Xcls_LeftProps : Object _this.valrender.el.stop_editing(false); _this.valrender.el.editable =false; - + Gtk.TreeIter iter; + var mod = this.el.get_model(); + mod.get_iter (out iter, path); + + /* + m.set(iter, + 0, "listener", + 1, miter.get_key(), + 2, "" + miter.get_key() + "", + 3, miter.get_value() + ); + + */ + GLib.Value gval; + mod.get_value(iter, 3 , out gval); + var val = (string)gval; this.popover.show(this.el, _this.node, "test"); // _this.startEditingKey(path);