1 //<Script type="text/javascript">
4 console = imports.console;
5 XObject = imports.XObject.XObject;
6 File = imports.File.File;
8 //----------------------- our roo verison
9 Base = imports.Builder.Provider.File.Base.Base;
17 //"name":"Edit Module Details",
19 //"btype":"FORM", // was to be components...
21 //"module":"Pman.Tab.BuilderTop2"
23 cfg.parent = cfg.parent || '';
24 if (!cfg.name || !cfg.fullname ) {
26 // name is in theory filename without .bjs (or .js eventually...)
27 cfg.name = cfg.path.split('/').pop().replace(/\.(bjs|js)$/, '');
29 cfg.fullname = (cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
35 var jstr = JSON.parse(cfg.json);
36 this.items = [ jstr ];
37 //console.log(cfg.items.length);
38 delete cfg.json; // not needed!
42 var p = cfg.items && cfg.items.length && cfg.items[0].parent ? cfg.items[0].parent : false;
44 // ensure real data is set...
55 Gtk.superclass.constructor.call(this, cfg);
59 this.id = 'file-gtk-' + gid++;
60 // various loader methods..
66 setNSID : function(id)
69 this.items[0]['*class'] = id;
77 loadItems : function(cb)
80 console.log("load Items!");
81 if (this.items !== false) {
85 throw "no callback for loadItems";
87 Seed.print("load: " + this.path);
93 var src = File.read(this.path);
95 var cfg = JSON.parse(src);
99 _this.name = cfg.name;
100 _this.parent = cfg.parent;
101 _this.title = cfg.title;
102 _this.items = cfg.items || [];
105 // update to new JSDOC api!?
107 var tstream = new JSDOC.TextStream(src);
108 var tr = new JSDOC.TokenReader( {
112 var toks = tr.tokenize(tstream);
113 //console.dump(toks);
115 var ts = new JSDOC.Collapse(toks);
116 //console.dump(ts.tokens);
117 var rd = new JSDOC.GtkFile(ts.tokens);
122 _this.items = [ src ];
127 console.dump(rd.cfg);
128 //!!??? have we got engouth!
129 // try parsing self..
130 _this.items = [ rd.cfg ];
131 _this.imports = rd.imports;
132 _this.giImports = rd.giImports ;
145 * save as a javascript file.
154 var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject', 'GtkSource', 'WebKit', 'Vte' ];
156 i.forEach(function(e) {
157 src += e+" = imports.gi." + e +";\n";
160 src += "console = imports.console;\n"; // path?!!?
161 src += "XObject = imports.XObject.XObject;\n"; // path?!!?
164 src += this.name + '=new XObject('+ this.mungeToString(data) + ')\n;';
165 src += this.name + '.init();\n';
168 File.write('/tmp/BuilderGtkView.js', src);
169 print("Test code in /tmp/BuilderGtkView.js");
173 getTree : function( o ) {