+ addall([this.currentTree]);
+
+ // only if we have nothing, should we add '*top'
+ if (!ret.length) {
+ ret = [ '*top' ];
+ }
+ //console.log('all types in tree');
+ //console.dump(ret);
+
+ return ret;
+
+ },
+ load : function(tr,iter)
+ {
+ var citer = new Gtk.TreeIter();
+ //this.insert(citer,iter,0);
+ for(var i =0 ; i < tr.length; i++) {
+ if (iter) {
+ this.el.insert(citer,iter,-1);
+ } else {
+ this.el.append(citer);
+ }
+
+ this.el.set_value(citer, 0, [GObject.TYPE_STRING, this.nodeTitle(tr[i]) ]);
+ this.el.set_value(citer, 1, [GObject.TYPE_STRING, this.nodeTip(tr[i]) ]);
+ this.el.set_value(citer, 2, [GObject.TYPE_STRING, this.nodeToJSON(tr[i])]);
+ if (tr[i].items && tr[i].items.length) {
+ this.load(tr[i].items, citer);
+ }
+ }
+ },
+ loadFile : function(f) {
+ //console.dump(f);
+ this.el.clear();
+ this.file = f;
+
+ if (!f) {
+ console.log('missing file');
+ return;
+ }
+
+ // load the file if not loaded..
+ if (f.items === false) {
+ var _this = this;
+ f.loadItems(function() {
+ _this.loadFile(f);
+ });
+ return;
+
+ }
+ this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name);
+
+ if (f.items.length && typeof(f.items[0]) == 'string') {
+
+ this.get('/RightEditor').el.show();
+ this.get('/RightEditor.view').load( f.items[0]);
+ return;
+ }
+ print("LOAD");
+ //console.dump(f.items);
+ this.load(f.items);
+ this.get('/LeftTree.view').el.expand_all();
+
+ if (!f.items.length) {
+ // single item..
+
+ this.get('/Window.leftvpaned').el.set_position(80);
+ // select first...
+ this.get('/LeftTree.view').el.set_cursor(
+ new Gtk.TreePath.from_string('0'), null, false);
+
+
+ } else {
+ this.get('/Window.leftvpaned').el.set_position(200);
+ }
+
+
+ //print("hide right editior");
+ this.get('/RightEditor').el.hide();
+ //print("set current tree");
+ this.currentTree = this.toJS(false, false)[0];
+ //console.dump(this.currentTree);
+ this.currentTree = this.currentTree || { items: [] };
+ this.get('/LeftTree').renderView();
+ //console.dump(this.map);
+ //var RightPalete = imports.Builder.RightPalete.RightPalete;
+ var pm = this.get('/RightPalete.model');
+ // set up provider..
+
+ this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider();
+
+ if (!this.get('/RightPalete').provider) {
+ print ("********* PALETE PROVIDER MISSING?!!");
+ }
+ this.get('/LeftTree').renderView();
+
+ pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes()));
+
+
+
+ this.get('/Window.view-notebook').el.set_current_page(
+ this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1);
+
+ },
+ moveNode : function(target_data, action) {
+ //print("MOVE NODE");
+ // console.dump(target_data);
+ var old_iter = new Gtk.TreeIter();
+ var s = this.get('/LeftTree.view').selection;
+ s.get_selected(this.el, old_iter);
+ var node = this.nodeToJS(old_iter,false);
+ //console.dump(node);
+
+
+ // needs to drop first, otherwise the target_data
+ // treepath will be invalid.
+
+ this.dropNode(target_data, node);
+ if (action & Gdk.DragAction.MOVE) {
+ // print("REMOVING OLD NODE");
+ this.el.remove(old_iter);
+
+ }
+
+ this.activePath= false;
+ this.changed(false,true);
+ },
+ nodeTip : function(c) {
+ var ret = this.nodeTitle(c,true);
+ var funcs = '';
+
+
+ for( var i in c) {
+
+ if (!i.length || i[0] != '|') {
+ continue;
+ }
+ if (i == '|init') {
+ continue;
+ }
+ if (typeof(c[i]) != 'string') {
+ continue;
+ }
+ //print("prop : " + i + ':' + c[i]);
+ if (!c[i].match(new RegExp('function'))) {
+ continue;
+ }
+ funcs += "\n<b>" + i.substring(1) + '</b> : ' + c[i].split(/\n/).shift();
+
+ }
+ if (funcs.length) {
+ ret+="\n\nMethods:" + funcs;
+ }
+ return ret;
+
+ },
+ nodeTitle : function(c, renderfull) {
+ var txt = [];
+ c = c || {};
+ var sr = (typeof(c['+buildershow']) != 'undefined') && !c['+buildershow'] ? true : false;
+ if (sr) txt.push('<s>');
+ if (typeof(c['*prop']) != 'undefined') { txt.push(c['*prop']+ ':'); }