Builder4/WindowLeftProps.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 24 Sep 2014 07:46:03 +0000 (15:46 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 24 Sep 2014 07:46:03 +0000 (15:46 +0800)
Builder4/WindowLeftProps.vala

Builder4/WindowLeftProps.bjs
Builder4/WindowLeftProps.vala

index c071cf6..4003910 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     // right click.\n     if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1) {    \n        // show popup!.   \n        if (col.title == \"Value\") {\n             \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    \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    \n    // currently editing???\n//    if (  this.activePath) {\n        \n     //   this.activePath = false;\n       // stop editing!!!!\n     /*\n        if (this.get('/Editor').dirty) {\n            //if (!this.get('/Editor.buffer').checkSyntax()) {\n            //   this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n            //   return true;\n            //    // error Dialog\n            //}\n            if (!this.get('/Editor.view').save()) {\n                return true;\n            }\n        }   \n        */\n        \n        //this.EditProps.editableColumn.items[0].el.stop_editing();\n        //this.EditProps.editing = false;\n    \n    //    XObject.error(\"Currently editing?\");\n     //   return false;\n   // }\n    \n   // var renderer = this.valrender.el; // set has_entry..\n    \n    //var type = this.get('/LeftPanel.model').getType(res.path.to_string());\n        \n    // get options for this type -- this is to support option lists etc..\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    //var opts = provider.findOptions(type);\n    \n//    if (opts === false) {\n        // it's text etnry\n//         this.get('/LeftPanel').editableColumn.setOptions([]);\n//        renderer.has_entry = true;\n//    } else {\n//         this.get('/LeftPanel').editableColumn.setOptions(opts);\n//        renderer.has_entry = false;\n//    }\n\n    // we need to set the selected row..\n    \n     //Gtk.TreePath path;\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     // right click.\n     if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == \"Name\") {    \n        // show popup!.   \n        \n \n         _this.before_edit();\n         \n         \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    \n    // currently editing???\n//    if (  this.activePath) {\n        \n     //   this.activePath = false;\n       // stop editing!!!!\n     /*\n        if (this.get('/Editor').dirty) {\n            //if (!this.get('/Editor.buffer').checkSyntax()) {\n            //   this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n            //   return true;\n            //    // error Dialog\n            //}\n            if (!this.get('/Editor.view').save()) {\n                return true;\n            }\n        }   \n        */\n        \n        //this.EditProps.editableColumn.items[0].el.stop_editing();\n        //this.EditProps.editing = false;\n    \n    //    XObject.error(\"Currently editing?\");\n     //   return false;\n   // }\n    \n   // var renderer = this.valrender.el; // set has_entry..\n    \n    //var type = this.get('/LeftPanel.model').getType(res.path.to_string());\n        \n    // get options for this type -- this is to support option lists etc..\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    //var opts = provider.findOptions(type);\n    \n//    if (opts === false) {\n        // it's text etnry\n//         this.get('/LeftPanel').editableColumn.setOptions([]);\n//        renderer.has_entry = true;\n//    } else {\n//         this.get('/LeftPanel').editableColumn.setOptions(opts);\n//        renderer.has_entry = false;\n//    }\n\n    // we need to set the selected row..\n    \n     //Gtk.TreePath path;\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(8000);\n    this.el.modify_font(description);\n}\n",
index 80546ad..6959f14 100644 (file)
@@ -1088,26 +1088,14 @@ public class Xcls_LeftProps : Object
                 
                 
                  // right click.
-                 if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1) {    
+                 if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == "Name") {    
                     // show popup!.   
-                    if (col.title == "Value") {
-                         
-                        return false;
-                    }
-            
-                    var p = _this.ContextMenu;
-            
-                    p.el.set_screen(Gdk.Screen.get_default());
-                    p.el.show_all();
-                    p.el.popup(null, null, null,  ev.button, ev.time);
-                    //Seed.print("click:" + res.column.title);
-                    // select the 
-                    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-              
-                        this.el.get_selection().select_path(path);
-                        return false;
-                    });
+                    
+             
                      _this.before_edit();
+                     
+                     
+                     
                     return false;
                 }