Sample/Window.bjs
authorAlan Knowles <alan@akbkhome.com>
Thu, 5 Aug 2010 01:32:02 +0000 (09:32 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 5 Aug 2010 01:32:02 +0000 (09:32 +0800)
Sample/Window.bjs

index 37568c3..d0355b6 100644 (file)
                                                                                     "items": [
                                                                                         {
                                                                                             "listeners": {
-                                                                                                "load_finished": "function (self, object) {\n    print(\"load finished\");\n//    print(\"load_finished\"); return;\n\t// if (this.ready) { // dont do it twice!\n\t //   return; \n\t//}\n\tif (!this.inspectorShown) {\n           this.el.get_inspector().show();\n           this.inspectorShown = true;\n\t}\n\n\tthis.ready = true;\n\tifpendingRedraw\n        this.pendingRedraw = false;\n        \n        this.refreshRequired  = true;\n        //var js = this.get('/LeftTree.model').toJS();\n        //if (js && js[0]) {\n    \t//    this.renderJS(js[0]);\n    \t//}\n\n}",
+                                                                                                "load_finished": "function (self, object) {\n    print(\"load finished\");\n//    print(\"load_finished\"); return;\n\t// if (this.ready) { // dont do it twice!\n\t //   return; \n\t//}\n\tif (!this.inspectorShown) {\n           this.el.get_inspector().show();\n           this.inspectorShown = true;\n\t}\n\n\tthis.ready = true;\n        ifpendingRedraw\n        this.pendingRedraw = false;\n        \n        this.refreshRequired  = true;\n        //var js = this.get('/LeftTree.model').toJS();\n        //if (js && js[0]) {\n    \t//    this.renderJS(js[0]);\n    \t//}\n\n}",
                                                                                                 "script_alert": "function (self, object, p0) {\n    // \tprint(p0);\n        return false;\n        return true; // do not display anything...\n}",
                                                                                                 "console_message": "function (self, object, p0, p1) {\n    print(object);\n   //  console.log(object);\n        if (!object.match(/^\\{/)) {\n        \n            //this.get('/Terminal').feed(object);\n            return true; // do not handle!!! -> later maybe in console..\n        }\n       // console.log(object);\n        var val =  JSON.parse(object);\n\n        if (typeof(val['hover-node']) != 'undefined') {\n            this.activeNode = val['hover-node'];\n            console.log('active node: ' + this.activeNode);\n            return true;\n        }\n\n         var ret = false;\n         if (typeof(val['id']) != 'undefined') {\n           // this.activeNode = val['id'];\n            var tg = this.get('/LeftTree.model').findDropNode(val['id'], true); \n            if (!tg || typeof(tg[0]) == 'undefined') {\n                return false;\n            }\n            print(\"SELECT node \" + tg[0]);\n            \n            this.get('/LeftTree.view').selectNode(tg[0]);\n            ret  = true;\n            \n        } \n        if (ret && typeof(val['set']) != 'undefined') {\n           this.get('/LeftPanel.model').add({\n                key : val['set'],\n                val : val['value']\n            });\n            //console.log('active node: ' + this.activeNode);\n            \n        }\n        //Seed.print('a:'+a);\n        //Seed.print('b:'+b);\n        //Seed.print('c:'+c);\n        return ret;\n}",
                                                                                                 "drag_motion": "function (w, ctx,  x,   y,   time, ud) {\n   // console.log('DRAG MOTION'); \n        // status:\n        // if lastCurrentNode == this.currentNode.. -- don't change anything..\n        this.targetData = [];\n        this.el.execute_script(\"Builder.overPos(\" + x +','+ y + \");\");\n        \n        // A) find out from drag all the places that node could be dropped.\n        var src = Gtk.drag_get_source_widget(ctx);\n        if (!src.dropList) {\n            Gdk.drag_status(ctx, 0, time);\n            return true;\n        }\n        // b) get what we are over.. (from activeNode)\n        // tree is empty.. - list should be correct..\n        if (!this.get('/LeftTree.model').currentTree) {\n            Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n            return true;\n            \n        }\n        // c) ask tree where it should be dropped... - eg. parent.. (after node ontop)\n        \n        var tg = this.get('/LeftTree.model').findDropNode(this.activeNode, src.dropList);\n        console.dump(tg);\n        if (!tg.length) {\n            Gdk.drag_status(ctx, 0,time);\n            this.get('/LeftTree.view').highlight(false);\n            return true;\n        }\n         \n        // if we have a target..\n        // -> highlight it! (in browser)\n        // -> highlight it! (in tree)\n        \n        Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n        this.get('/LeftTree.view').highlight(tg);\n        this.targetData = tg;\n        // for tree we should handle this...\n        return true;\n}",