Sample/Window.bjs
authorAlan Knowles <alan@akbkhome.com>
Mon, 1 Nov 2010 03:22:24 +0000 (11:22 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 1 Nov 2010 03:22:24 +0000 (11:22 +0800)
Sample/Window.bjs

index 89fb706..7cd32bd 100644 (file)
                                                             "items": [
                                                                 {
                                                                     "listeners": {
-                                                                        "button_press_event": "function (self, ev) {\n\n    \n    var res = { }; \n    \n    if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {\n        return false; //not on a element.\n    }\n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button.button == 3) {    \n        // show popup!.   \n        if (res.column.title == 'value' && this.get('/LeftPanel').editing) {\n            return false;\n        }\n        //if (! this.get('/LeftPanelPopup')LeftPanelPopup.el) LeftPanelPopup.init();\n        var p = this.get('/LeftPanelPopup');\n        if (!p.el) {\n            p.init();\n        }\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null, null, 3, ev.button.time);\n        //Seed.print(\"click:\" + res.column.title);\n        \n        \n        return false;\n    }\n    \n     \n    if (res.column.title != 'value') {\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    // currently editing???\n//    if (  this.activePath) {\n        \n     //   this.activePath = false;\n       // stop editing!!!!\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            this.get('/Editor.view').save();\n        }   \n        this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();\n        this.get('/LeftPanel').editing = false;\n    \n    //    XObject.error(\"Currently editing?\");\n     //   return false;\n   // }\n    \n    var renderer = this.get('/LeftPanel').editableColumn.items[0].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    this.get('/LeftPanel.model').startEditing(res.path.to_string(), 1);\n        \n   //Seed.print(\"click\" + ev.type);\n    //console.dump(res);\n    return false;\n\n              \n   \n}"
+                                                                        "button_press_event": "function (self, ev) {\n\n    \n    var res = { }; \n    \n    if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {\n        return false; //not on a element.\n    }\n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button.button == 3) {    \n        // show popup!.   \n        if (res.column.title == 'value' && this.get('/LeftPanel').editing) {\n            return false;\n        }\n        //if (! this.get('/LeftPanelPopup')LeftPanelPopup.el) LeftPanelPopup.init();\n        var p = this.get('/LeftPanelPopup');\n        if (!p.el) {\n            p.init();\n        }\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null, null, 3, ev.button.time);\n        //Seed.print(\"click:\" + res.column.title);\n        \n        \n        return false;\n    }\n    \n     \n    if (res.column.title != 'value') {\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    // currently editing???\n//    if (  this.activePath) {\n        \n     //   this.activePath = false;\n       // stop editing!!!!\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            ifthis.get('/Editor.view').save();\n        }   \n        this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();\n        this.get('/LeftPanel').editing = false;\n    \n    //    XObject.error(\"Currently editing?\");\n     //   return false;\n   // }\n    \n    var renderer = this.get('/LeftPanel').editableColumn.items[0].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    this.get('/LeftPanel.model').startEditing(res.path.to_string(), 1);\n        \n   //Seed.print(\"click\" + ev.type);\n    //console.dump(res);\n    return false;\n\n              \n   \n}"
                                                                     },
                                                                     "id": "view",
                                                                     "tooltip_column": 5,