{
- "id": "file-gtk-1",
+ "id": "file-gtk-7",
"name": "Window",
"parent": "",
"title": false,
"items": [
{
"listeners": {
- "activate": "function (self) {\n // this does not actually expand it..\n // that is done by GTK..\n \n \n\n if (!this.el.expanded) {\n this.onExpand();\n } else {\n this.onCollapse();\n }\n\t \n}",
+ "activate": "function (self) {\n // this does not actually expand it..\n // that is done by GTK..\n \n \n \tif (!this.get('/Editor').save()) {\n \t // popup!! - click handled.. \n \t return true;\n }\n\n if (!this.el.expanded) {\n this.onExpand();\n } else {\n this.onCollapse();\n }\n\t \n}",
"enter_notify_event": "function (self, event) {\nreturn;\n this.el.expanded = !this.el.expanded;\n//if (this.el.expanded ) {\n this.listeners.activate.call(this);\n// }\n\nreturn true;\n}"
},
"id": "expander",
"label": "Select Project or File",
"pack": "pack_start,false,true",
"xtype": "Expander",
- "|onCollapse": "function() {\n \n var nb = this.get('/LeftTopPanel.notebook');\n nb.el.set_current_page(0);\n}\n",
"|init": "function() {\n XObject.prototype.init.call(this);\n this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );\n}\n",
+ "|onCollapse": "function() {\n \n var nb = this.get('/LeftTopPanel.notebook');\n nb.el.set_current_page(0);\n}\n",
"|onExpand": "function() {\n var nb = this.get('/LeftTopPanel.notebook'); \n var pm = imports.Builder.Provider.ProjectManager.ProjectManager;\n \n \n var model = this.get('/LeftProjectTree.combomodel');\n // print (\"loading Projects?\")\n //console.dump(pm.projects);\n model.loadData(pm.projects);\n \n \n nb.el.set_current_page(1);\n //pm.on('changed', function() {\n\t//console.log(\"CAUGHT project manager change\");\n // _combo.model.loadData(pm.projects);\n //}\n return;\n}\n",
"|xns": "Gtk"
},
"pack": "pack_start,false,false,0",
"xtype": "CheckButton",
"|xns": "Gtk"
+ },
+ {
+ "listeners": {
+ "clicked": "function (self) {\n this.get('/RightBrowser.view').redraws = 99;\n this.get('/RightBrowser.view').renderJS(null,true);\n}"
+ },
+ "label": "Full Redraw",
+ "pack": "pack_start,false,false,0",
+ "xtype": "Button",
+ "|xns": "Gtk"
}
]
},
"|redraw": "function() {\n this.highlightWidget = false;\n print(\"REDRAW CALLED\");\n this.activePath = this.get('/LeftTree').getActivePath();\n if (this.renderedEl) {\n print(\"QUEUE DRAW CALLING\");\n this.renderedEl.queue_draw();\n }\n}\n",
"|renderJS": "function(data, withDebug)\n{\n this.highlightWidget = false;\n \n this.withDebug = false;\n while (this.get('view').el.get_children().length) {\n var c = this.get('view').el.get_children()[0];\n this.get('view').el.remove(c); \n c.destroy();\n }\n if (!data) {\n return; \n }\n \n var tree = this.get('/LeftTree.model').toJS(false,true)[0];\n // in theory tree is actually window.. \n try {\n \n this.renderedEl = this.viewAdd(tree.items[0], this.get('view').el);\n \n } catch (e) {\n print(e.message);\n return;\n }\n this.get('view').el.set_size_request(\n tree.default_width * 1 || 400, tree.default_height * 1 || 400\n ) ;\n if (this.renderedEl) {\n this.renderedEl.set_size_request(\n tree.default_width || 600,\n tree.default_height || 400\n );\n }\n this.get('view').el.show_all();\n \n \n \n}",
"|showInWindow": "function() {\n print(\"GET PROEJCT\");\n\tvar pr = this.get('/LeftProjectTree').getActiveProject();\n \n\tconsole.log(pr.paths);\n return;\n/*\n var src= this.buildJS(\n\t\tthis.get('/LeftTree.model').toJS()[0], \n\t\ttrue);\n // show term?? \n\n\n //var x = new imports.sandbox.Context();\n //x.add_globals();\n //print(src);\n try {\n Seed.check_syntax('var e = ' + src);\n //x.eval(src);\n } catch( e) {\n this.get('/Terminal').feed(e.message || e.toString() + \"\\n\");\n this.get('/Terminal').feed(console._dump(e)+\"\\n\");\n if (e.line) {\n var lines = src.split(\"\\n\");\n var start = Math.max(0, e.line - 10);\n var end = Math.min(lines.length, e.line + 10);\n for (var i =start ; i < end; i++) {\n if (i == e.line) {\n this.get('/Terminal').feed(\">>>>>\" + lines[i] + \"\\n\");\n continue;\n }\n this.get('/Terminal').feed(lines[i] + \"\\n\");\n }\n \n }\n \n return;\n }\n this.get('/BottomPane').el.set_current_page(1);\n this.get('/Terminal').el.fork_command( null , [], [], \"/tmp\", false,false,false); \n var cmd = \"/usr/bin/seed /tmp/BuilderGtkView.js\\n\";\n this.get('/Terminal').el.feed_child(cmd, cmd.length);\n /*\n var _top = x.get_global_object()._top;\n \n _top.el.set_screen(Gdk.Screen.get_default()); // just in case..\n _top.el.show_all();\n if (_top.el.popup) {\n _top.el.popup(null, null, null, null, 3, null);\n }\n*/\n}\n",
- "|viewAdd": "function(item, par)\n {\n // does something similar to xobject..\n item.pack = (typeof(item.pack) == 'undefined') ? 'add' : item.pack;\n \n if (item.pack===false || item.pack === 'false') { // no ;\n return;\n }\n print(\"CREATE: \" + item['|xns'] + '.' + item['xtype']);\n var type = item['|xns'] + '.' + item['xtype'];\n \n if (item['|xns'] == 'GtkClutter') { // we can not add this yet!\n return false;\n }\n var ns = imports.gi[item['|xns']];\n var ctr = ns[item['xtype']];\n var ctr_args = { };\n for(var k in item) {\n var kv = item[k];\n if (typeof(kv) == 'object' || typeof(kv) == 'function') {\n continue;\n }\n if ( \n k == 'pack' ||\n k == 'items' ||\n k == 'id' ||\n k == 'xtype' ||\n k == 'xdebug' ||\n k == 'xns' ||\n k == '|xns'\n ) {\n continue;\n }\n\n\tif (k[0] == '|' && typeof(kv) == 'string') {\n\n\t\tif (kv.match(new RegExp('function'))) {\n\t\t\tcontinue;\n }\n\t\t print(\"WASL \" + k + '=' + kv);\n\t\ttry {\n\t\t\teval( 'kv = ' + kv);\n\t\t} catch(e) { continue; }\n \n\t\tk = k.substring(1);\n // print(k + '=' + kv);\n\t}\n if (k[0] == '|') { // should be boolean or number..\n\t\tk = k.substring(1);\n\t\t//print(k + '=' + kv);\n }\n \n\tif (k == 'show_tabs') { // force tab showing for notebooks.\n kv = true;\n }\n print(k + '=' + typeof(kv) + \" : \" + kv);\n ctr_args[k] = kv;\n \n } \n \n \n var el = new ctr(ctr_args);\n \n print(\"PACK\" + item.pack);\n //console.dump(item.pack);\n \n \n \n \n var args = [];\n var pack_m = false;\n if (typeof(item.pack) == 'string') {\n \n item.pack.split(',').forEach(function(e, i) {\n \n if (e == 'false') { args.push( false); return; }\n if (e == 'true') { args.push( true); return; }\n if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }\n args.push(e);\n });\n //print(args.join(\",\"));\n \n pack_m = args.shift();\n } else {\n pack_m = item.pack.shift();\n args = item.pack;\n }\n \n // handle error.\n if (pack_m && typeof(par[pack_m]) == 'undefined') {\n throw {\n name: \"ArgumentError\", \n message : 'pack method not available : ' + par.id + \" : \" + par + '.' + pack_m +\n \"ADDING : \" + item.id + \" \" + el\n \n\t };\n\n return;\n }\n \n console.dump(args);\n args.unshift(el);\n //if (XObject.debug) print(pack_m + '[' + args.join(',') +']');\n //Seed.print('args: ' + args.length);\n if (pack_m) {\n par[pack_m].apply(par, args);\n }\n \n var _this = this;\n item.items = item.items || [];\n item.items.forEach(function(ch,n) {\n\n print (\"type:\" + type);\n \n print (\"ch.pack:\" + ch.pack);\n if (type == 'Gtk.Table' && ch.pack == 'add') {\n var c = n % item.n_columns;\n var r = Math.floor(n/item.n_columns);\n ch.pack = [ 'attach', c, c+1, r, r+1, \n typeof(ch.x_options) == 'undefined' ? 5 : ch.x_options,\n typeof(ch.y_options) == 'undefined' ? 5 : ch.y_options,\n typeof(ch.x_padding) == 'undefined' ? 0 : ch.x_padding,\n typeof(ch.x_padding) == 'undefined' ? 0 : ch.x_padding\n ].join(',');\n }\n \n _this.viewAdd(ch, el);\n });\n \n \n \n // add the signal handlers.\n // is it a widget!?!!?\n \n \n try {\n \n \n el.signal.expose_event.connect(XObject.createDelegate(this.widgetExposeEvent, this, [ item ], true));\n el.signal.drag_motion.connect(XObject.createDelegate(this.widgetDragMotionEvent, this,[ item ], true));\n el.signal.drag_drop.connect(XObject.createDelegate(this.widgetDragDropEvent, this, [ item ], true));\n el.signal.button_press_event.connect(XObject.createDelegate(this.widgetPressEvent, this, [ item ], true ));\n el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item ], true ));\n } catch(e) {\n // ignore!\n }\n \n \n \n return el;\n \n}",
+ "|viewAdd": "function(item, par)\n{\n\n // does something similar to xobject..\n //item.pack = (typeof(item.pack) == 'undefined') ? 'add' : item.pack;\n \n // pack is forced to 'false'\n if (item.pack===false || item.pack === 'false') { // no ;\n return;\n }\n \n print(\"CREATE: \" + item['|xns'] + '.' + item['xtype']);\n \n \n var type = item['|xns'] + '.' + item['xtype'];\n \n if (item['|xns'] == 'GtkClutter') { // we can not add this yet!\n return false;\n }\n \n var ns = imports.gi[item['|xns']];\n var ctr = ns[item['xtype']]; // why are we using array here..?\n \n\n \n var ctr_args = { };\n for(var k in item) {\n var kv = item[k];\n if (typeof(kv) == 'object' || typeof(kv) == 'function') {\n continue;\n }\n if ( \n k == 'pack' ||\n k == 'items' ||\n k == 'id' ||\n k == 'xtype' ||\n k == 'xdebug' ||\n k == 'xns' ||\n k == '|xns'\n ) {\n continue;\n }\n // value is a function..\n\tif (k[0] == '|' && typeof(kv) == 'string') {\n\n\t\tif (kv.match(new RegExp('function'))) {\n\t\t\tcontinue;\n }\n\t\tprint(\"WASL \" + k + '=' + kv);\n\t\ttry {\n\t\t\teval( 'kv = ' + kv);\n\t\t} catch(e) { continue; }\n \n\t\tk = k.substring(1);\n // print(k + '=' + kv);\n\t}\n if (k[0] == '|') { // should be boolean or number..\n\t\tk = k.substring(1);\n\t\t//print(k + '=' + kv);\n }\n \n\tif (k == 'show_tabs') { // force tab showing for notebooks.\n kv = true;\n }\n print(k + '=' + typeof(kv) + \" : \" + kv);\n ctr_args[k] = kv;\n \n } \n var altctr = XObject.baseXObject({ xtype: ctr} );\n var pack_m = false;\n if (!item.pack && altctr) {\n // try XObject.\n print(\"SETTING PACK TO XObjectBase method\");\n pack_m = altctr.prototype.pack;\n \n \n }\n \n var el = new ctr(ctr_args);\n item.el = el;\n print(\"PACK\" + item.pack);\n //console.dump(item.pack);\n \n \n \n \n var args = [];\n if (!pack_m) {\n item.pack = (typeof(item.pack) == 'undefined') ? 'add' : item.pack;\n if (typeof(item.pack) == 'string') {\n \n item.pack.split(',').forEach(function(e, i) {\n \n if (e == 'false') { args.push( false); return; }\n if (e == 'true') { args.push( true); return; }\n if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }\n args.push(e);\n });\n //print(args.join(\",\"));\n \n pack_m = args.shift();\n } else {\n pack_m = item.pack.shift();\n args = item.pack;\n }\n }\n // handle error.\n if (typeof(pack_m) == 'string' && typeof(par[pack_m]) == 'undefined') {\n throw {\n name: \"ArgumentError\", \n message : 'pack method not available : ' + par.id + \" : \" + par + '.' + pack_m +\n \"ADDING : \" + item.id + \" \" + el\n \n\t };\n\n return;\n }\n \n console.dump(args);\n args.unshift(el);\n //if (XObject.debug) print(pack_m + '[' + args.join(',') +']');\n //Seed.print('args: ' + args.length);\n if (typeof(pack_m) == 'string') {\n par[pack_m].apply(par, args);\n } else if (pack_m) {\n pack_m.call(item, par, item);\n }\n \n var _this = this;\n item.items = item.items || [];\n item.items.forEach(function(ch,n) {\n\n print (\"type:\" + type);\n \n print (\"ch.pack:\" + ch.pack);\n \n \n if (type == 'Gtk.Table' && ch.pack == 'add') {\n var c = n % item.n_columns;\n var r = Math.floor(n/item.n_columns);\n ch.pack = [ 'attach', c, c+1, r, r+1, \n typeof(ch.x_options) == 'undefined' ? 5 : ch.x_options,\n typeof(ch.y_options) == 'undefined' ? 5 : ch.y_options,\n typeof(ch.x_padding) == 'undefined' ? 0 : ch.x_padding,\n typeof(ch.x_padding) == 'undefined' ? 0 : ch.x_padding\n ].join(',');\n }\n \n _this.viewAdd(ch, el);\n });\n \n \n \n // add the signal handlers.\n // is it a widget!?!!?\n \n \n try {\n \n \n el.signal.expose_event.connect(XObject.createDelegate(this.widgetExposeEvent, this, [ item ], true));\n el.signal.drag_motion.connect(XObject.createDelegate(this.widgetDragMotionEvent, this,[ item ], true));\n el.signal.drag_drop.connect(XObject.createDelegate(this.widgetDragDropEvent, this, [ item ], true));\n el.signal.button_press_event.connect(XObject.createDelegate(this.widgetPressEvent, this, [ item ], true ));\n el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item ], true ));\n } catch(e) {\n // ignore!\n }\n \n \n \n return el;\n \n}",
"|widgetDragDropEvent": "function() {\n print(\"WIDGET DRAGDROP\"); \n return true;\n}\n",
"|widgetDragMotionEvent": "function() {\n print(\"WIDGET DRAGMOTION\"); \n return true;\n}\n",
"|widgetExposeEvent": "function(w, evt, ud, item) {\n var widget = w;\n if (this.inRender) {\n return false;\n }\n \n if ( this.highlightWidget) {\n this.inRender = true;\n if (item.xtreepath.substring(0, this.activePath.length) == this.activePath) {\n Gdk.draw_rectangle(this.highlightWidget.window, this.gc, false, this.box.x , this.box.y, this.box.w, this.box.h);\n }\n this.inRender = false;\n return false;\n }\n \n \n if (this.activePath != item.xtreepath) {\n return false;\n }\n \n // print(\"HIGHLIGHT: \" + item.xtreepath ); // draw highlight??\n // work out the coords of the window..\n if (!this.gc) {\n var dr = widget.window;\n this.gc = (new Gdk.GC.c_new(dr));\n this.gc.set_rgb_fg_color(new Gdk.Color({ red: 0xFFFF, green: 0, blue : 0 }));\n this.gc.set_line_attributes(4, Gdk.LineStyle.SOLID, Gdk.CapStyle.ROUND , Gdk.JoinStyle.ROUND);\n }\n\n \n var r = evt.expose.area;\n // console.dump([r.x, r.y, r.width, r.height ] );\n //return false;\n// print(widget.get_parent().toString().match(/GtkScrolledWindow/);\n if (widget.get_parent().toString().match(/GtkScrolledWindow/)) { // eak\n // happens with gtkscrollview embedded stuff..\n var np =this.activePath.split(':');\n np.pop();\n this.activePath = np.join(':');\n this.renderedEl.queue_draw();\n return true;\n\n \n }\n\n \n \n \n this.box = {\n x : r.x - 2,\n y : r.y - 2,\n w: r.width + 4,\n h: r.height + 4\n }; \n // let's draw it..\n this.inRender = true;\n\n \n this.highlightWidget = widget;\n \n \n \n\n // print(\"DRAW BOX\");\n //console.dump(this.box);\n Gdk.draw_rectangle(widget.window, this.gc, false, this.box.x , this.box.y, this.box.w,this.box.h);\n this.inRender = false;\n return false;\n}\n",
"|shadow_type": "Gtk.ShadowType.IN",
"items": [
{
- "|xns": "Gtk",
- "xtype": "TreeView",
- "pack": "add",
- "|init": "function() {\n XObject.prototype.init.call(this);\n this.el.set_size_request(150,-1);\n // set_reorderable: [1]\n \n var description = new Pango.FontDescription.c_new();\n description.set_size(8000);\n this.el.modify_font(description);\n \n this.selection = this.el.get_selection();\n this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n // this.selection.signal['changed'].connect(function() {\n // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n //});\n // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n \n Gtk.drag_source_set (\n this.el, /* widget will be drag-able */\n Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */\n null, /* lists of target to support */\n 0, /* size of list */\n Gdk.DragAction.COPY /* what to do with data after dropped */\n );\n //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n \n Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);\n Gtk.drag_source_add_text_targets(this.el); \n /*\n print(\"RP: TARGET:\" + LeftTree.atoms[\"STRING\"]);\n targets = new Gtk.TargetList();\n targets.add( LeftTree.atoms[\"STRING\"], 0, 0);\n targets.add_text_targets( 1 );\n Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);\n \n //if you want to allow text to be output elsewhere..\n //Gtk.drag_source_add_text_targets(this.el);\n */\n return true; \n}\n",
- "|headers_visible": false,
- "|enable_tree_lines": true,
"listeners": {
"drag_begin": "function (self, ctx) {\n // we could fill this in now...\n Seed.print('SOURCE: drag-begin');\n \n \n \n var iter = new Gtk.TreeIter();\n var s = this.selection;\n s.get_selected(this.get('/RightPalete.model').el, iter);\n var path = this.get('/RightPalete.model').el.get_path(iter);\n \n var pix = this.el.create_row_drag_icon ( path);\n \n \n Gtk.drag_set_icon_pixmap (ctx,\n pix.get_colormap(),\n pix,\n null,\n -10,\n -10);\n \n var value = new GObject.Value('');\n this.get('/RightPalete.model').el.get_value(iter, 0, value);\n if (!this.get('/RightPalete').provider) {\n return false;\n }\n this.el.dropList = this.get('/RightPalete').provider.getDropList(value.value);\n this.el.dragData = value.value;\n \n \n \n \n return true;\n}",
"drag_data_get": "function (self, drag_context, selection_data, info, time) {\n \t//Seed.print('Palete: drag-data-get: ' + target_type);\n if (this.el.dragData && this.el.dragData.length ) {\n selection_data.set_text(this.el.dragData ,this.el.dragData.length);\n }\n \n \n //this.el.dragData = \"TEST from source widget\";\n \n \n}",
- "drag_end": "function (self, drag_context) {\n \tSeed.print('SOURCE: drag-end');\n\tthis.el.dragData = false;\n\tthis.el.dropList = false;\n\tthis.get('/LeftTree.view').highlight(false);\n\treturn true;\n}"
+ "drag_end": "function (self, drag_context) {\n \tSeed.print('SOURCE: drag-end');\n\tthis.el.dragData = false;\n\tthis.el.dropList = false;\n\tthis.get('/LeftTree.view').highlight(false);\n\treturn true;\n}",
+ "button_press_event": "function (self, event) {\n\n \tif (!this.get('/Editor').save()) {\n \t // popup!! - click handled.. \n \t return true;\n }\n return false;\n}"
},
+ "pack": "add",
+ "xtype": "TreeView",
+ "|enable_tree_lines": true,
+ "|headers_visible": false,
+ "|init": "function() {\n XObject.prototype.init.call(this);\n this.el.set_size_request(150,-1);\n // set_reorderable: [1]\n \n var description = new Pango.FontDescription.c_new();\n description.set_size(8000);\n this.el.modify_font(description);\n \n this.selection = this.el.get_selection();\n this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n // this.selection.signal['changed'].connect(function() {\n // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n //});\n // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n \n Gtk.drag_source_set (\n this.el, /* widget will be drag-able */\n Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */\n null, /* lists of target to support */\n 0, /* size of list */\n Gdk.DragAction.COPY /* what to do with data after dropped */\n );\n //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n \n Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);\n Gtk.drag_source_add_text_targets(this.el); \n /*\n print(\"RP: TARGET:\" + LeftTree.atoms[\"STRING\"]);\n targets = new Gtk.TargetList();\n targets.add( LeftTree.atoms[\"STRING\"], 0, 0);\n targets.add_text_targets( 1 );\n Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);\n \n //if you want to allow text to be output elsewhere..\n //Gtk.drag_source_add_text_targets(this.el);\n */\n return true; \n}\n",
+ "|xns": "Gtk",
"items": [
{
"|xns": "Gtk",