From 4ae977dc1e1f5de07dedfe39a4fbc6d3f22d0bb8 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 1 Nov 2010 14:33:15 +0800 Subject: [PATCH] Sample/Window.bjs --- Sample/Window.bjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sample/Window.bjs b/Sample/Window.bjs index 91b7e0deb..d9afc54e3 100644 --- a/Sample/Window.bjs +++ b/Sample/Window.bjs @@ -873,7 +873,7 @@ "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\t\n if (this.pendingRedraw) {\n this.pendingRedraw = false;\n this.refreshRequired = true;\n }\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 \n\n if (object.match(/^\\{/)) {\n this.refreshRequired = true;\n this.lastRedraw = 0;\n this.runRefresh();\n }\n \n \n if (!object.match(/^\\{/)) {\n \n //this.get('/Terminal').feed(object);\n return true; // do not handle!!! -> later maybe in console..\n }\n \n \n \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}", + "console_message": "function (self, object, p0, p1) {\n print(object);\n // console.log(object);\n \n\n if (object.match(/variable: Builder/)) {\n this.refreshRequired = true;\n this.lastRedraw = 0;\n this.runRefresh();\n return true;\n }\n \n \n if (!object.match(/^\\{/)) {\n \n //this.get('/Terminal').feed(object);\n return true; // do not handle!!! -> later maybe in console..\n }\n \n \n \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}", "drag_drop": "function (w, ctx, x, y,time, ud) {\n\tprint(\"TARGET: drag-drop\");\n var is_valid_drop_site = true;\n \n \n Gtk.drag_get_data\n (\n w, /* will receive 'drag-data-received' signal */\n ctx, /* represents the current state of the DnD */\n this.get('/Window').atoms[\"STRING\"], /* the target type we want */\n time /* time stamp */\n );\n \n \n /* No target offered by source => error */\n \n\n\treturn is_valid_drop_site;\n}", "drag_data_received": "function (w, ctx, x, y, sel_data, target_type, time, ud) \n {\n print(\"Browser: drag-data-received\");\n var delete_selection_data = false;\n vardnd_success = false;\n /* Deal with what we are given from source */\n if( sel_data && sel_data.length ) {\n \n if (ctx.action == Gdk.DragAction.ASK) {\n /* Ask the user to move or copy, then set the ctx action. */\n }\n\n if (ctx.action == Gdk.DragAction.MOVE) {\n delete_selection_data = true;\n }\n var source = Gtk.drag_get_source_widget(ctx);\n\n print(\"Browser: source.DRAGDATA? \" + source.dragData);\n if (this.targetData) {\n print(this.targetData);\n this.get('/LeftTree.model').dropNode(this.targetData, source.dragData);\n }\n \n \n \n dnd_success = true;\n\n }\n\n if (dnd_success == false)\n {\n Seed.print (\"DnD data transfer failed!\\n\");\n }\n \n Gtk.drag_finish (ctx, dnd_success, delete_selection_data, time);\n return true;\n }", -- 2.39.2