5 "# JsRender.JsRender file" : "null",
6 "# Project.Project project" : "",
10 "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
11 "default_height" : 200,
12 "default_width" : 500,
13 "id" : "DialogNewComponent",
16 "$ pack" : "get_content_area().add",
18 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "$ homogeneous" : true,
23 "* pack" : "pack_start,false,false,0",
27 "* pack" : "attach_defaults,0,1,0,1",
28 "Gtk.Justification justify" : "Gtk.Justification.RIGHT",
29 "label" : "Component Name",
31 "xalign" : 0.90000000000000002,
37 "* pack" : "attach_defaults,1,2,0,1",
42 "$ justify" : "Gtk.Justification.RIGHT",
45 "* pack" : "attach_defaults,0,1,1,2",
46 "Gtk.Justification justify" : "Gtk.Justification.RIGHT",
49 "xalign" : 0.90000000000000002,
55 "* pack" : "attach_defaults,1,2,1,2",
60 "$ justify" : "Gtk.Justification.RIGHT",
63 "* pack" : "attach_defaults,0,1,2,3",
65 "tooltip_text" : "center, north, south, east, west",
67 "xalign" : 0.90000000000000002,
73 "* pack" : "attach_defaults,1,2,2,3",
78 "$ justify" : "Gtk.Justification.RIGHT",
81 "* pack" : "attach_defaults,0,1,3,4",
82 "label" : "Parent Name",
84 "xalign" : 0.90000000000000002,
90 "* pack" : "attach_defaults,1,2,3,4",
95 "$ justify" : "Gtk.Justification.RIGHT",
98 "* pack" : "attach_defaults,0,1,4,5",
99 "label" : "Permission Name",
101 "xalign" : 0.90000000000000002,
107 "* pack" : "attach_defaults,1,2,4,5",
112 "$ justify" : "Gtk.Justification.RIGHT",
115 "* pack" : "attach_defaults,0,1,5,6",
116 "label" : "Order (for tabs)",
118 "xalign" : 0.90000000000000002,
124 "* pack" : "attach_defaults,1,2,5,6",
129 "$ justify" : "Gtk.Justification.RIGHT",
132 "* pack" : "attach_defaults,0,1,6,7",
133 "label" : "Module to build (Vala only)",
135 "xalign" : 0.90000000000000002,
140 "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
141 "* pack" : "attach_defaults,1,2,6,7",
142 "id" : "build_module",
146 "* pack" : "pack_start,true",
147 "id" : "dbcellrenderer",
148 "xtype" : "CellRendererText"
151 "$ columns" : "typeof(string),typeof(string)",
153 "* pack" : "set_model",
156 "xtype" : "ListStore",
157 "| void loadData" : [
158 " (Gee.ArrayList<string> data, string cur) {",
159 " this.el.clear(); ",
160 " Gtk.TreeIter iter;",
161 " var el = this.el;",
163 " /// el.append(out iter);",
166 " // el.set_value(iter, 0, \"\");",
167 " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
169 " el.append(out iter);",
172 " el.set_value(iter, 0, \"\");",
173 " el.set_value(iter, 1, \"-- select a module --\");",
174 " _this.build_module.el.set_active_iter(iter);",
176 " for (var i = 0; i < data.size;i++) {",
179 " el.append(out iter);",
181 " el.set_value(iter, 0, data.get(i));",
182 " el.set_value(iter, 1, data.get(i));",
184 " if (data.get(i) == cur) {",
185 " _this.build_module.el.set_active_iter(iter);",
189 " this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); ",
208 "* pack" : "add_action_widget,0",
214 "* pack" : "add_action_widget,1",
221 "(self, event) => {",
228 " (self, response_id) => { ",
230 "\tif (response_id < 1) { // cancel!",
237 " if (_this.name.el.get_text().length < 1) {",
238 " Xcls_StandardErrorDialog.singleton().show(",
240 " \"You have to set Component name \"",
245 " // what does this do?",
247 " var isNew = _this.file.name.length > 0 ? false : true;",
249 " if (!isNew && this.file.name != _this.name.el.get_text()) {",
250 " Xcls_StandardErrorDialog.singleton().show(",
252 " \"Sorry changing names does not work yet. \"",
261 " // FIXME - this may be more complicated...",
262 " //for (var i in this.def) {",
263 " // this.file[i] = this.get(i).el.get_text();",
268 " this.updateFileFromEntry();",
269 " } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
270 " Xcls_StandardErrorDialog.singleton().show(",
272 " \"The name you used already exists \"",
279 " _this.file.save();",
283 " var fn = this.name.el.get_text();",
284 " var dir = _this.project.firstPath();",
286 " if (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {",
287 " Xcls_StandardErrorDialog.singleton().show(",
289 " \"That file already exists\"",
294 " var f = JsRender.JsRender.factory(",
295 " _this.file.project.xtype, ",
296 " _this.file.project, ",
297 " dir + \"/\" + fn + \".bjs\");",
303 " this.updateFileFromEntry();",
304 " _this.file.save();",
305 " _this.file.project.addFile(_this.file);",
308 " // what about .js ?",
313 " //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());",
315 " //var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");",
316 " //for (var i in this.file) {",
317 " // nf[i] = this.file[i];",
319 " _this.success(_this.project, _this.file);",
322 " -- fixme -- needs to be a signal..",
323 " if (DialogNewComponent.success != null) {",
324 " DialogNewComponent.success(_this.project, nf);",
331 " this.el.show_all();",
336 "title" : "New Component",
339 "(JsRender.JsRender c) ",
341 " this.project = c.project;",
343 " //if (!this.el) {",
347 " _this.name.el.set_text(c.name);",
348 " _this.title.el.set_text(c.title);",
349 " _this.parent.el.set_text(c.parent); ",
350 " _this.region.el.set_text(c.region);",
351 " _this.modOrder.el.set_text(c.modOrder);",
352 " _this.permname.el.set_text(c.permname);",
354 " if (c.path.length > 0) {",
355 " this.el.set_title(\"Edit File Details - \" + c.name);",
357 " this.el.set_title(\"Create New File\");",
360 " var ar = new Gee.ArrayList<string>();",
361 " _this.dbmodel.loadData(ar,\"\");",
362 " // load the modules... if relivant..",
363 " if (this.project.xtype == \"Gtk\") {",
364 " var p = (Project.Gtk)c.project;",
365 " var cg = p.compilegroups;",
367 " var iter = cg.map_iterator();",
368 " while(iter.next()) {",
369 " var key = iter.get_key();",
370 " if (key == \"_default_\") {",
375 " _this.dbmodel.loadData(ar, c.build_module);",
380 " //console.log('show all');",
381 " this.el.show_all();",
383 " //this.success = c.success;",
388 "| void updateFileFromEntry" : [
391 " _this.file.title = _this.title.el.get_text();",
392 " _this.file.region = _this.region.el.get_text(); ",
393 " _this.file.parent = _this.parent.el.get_text(); ",
394 " _this.file.permname = _this.permname.el.get_text(); ",
395 " _this.file.modOrder = _this.modOrder.el.get_text();",
397 " if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
398 " _this.file.renameTo(_this.name.el.get_text());",
400 " // store the module...",
401 " _this.file.build_module = \"\"; ",
402 " Gtk.TreeIter iter; ",
403 " if (_this.build_module.el.get_active_iter (out iter)) {",
405 " this.dbmodel.el.get_value (iter, 0, out vfname);",
406 " if (((string)vfname).length > 0) {",
407 " _this.file.build_module = (string)vfname;",
420 "name" : "DialogNewComponent",
422 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogNewComponent.bjs",