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) => {",
229 " (self, response_id) => { ",
231 "\tif (response_id < 1) { // cancel!",
238 " if (_this.name.el.get_text().length < 1) {",
239 " StandardErrorDialog.show(",
241 " \"You have to set Component name \"",
246 " // what does this do?",
248 " var isNew = _this.file.name.length > 0 ? false : true;",
250 " if (!isNew && this.file.name != _this.name.el.get_text()) {",
251 " Xcls_StandardErrorDialog.singleton().show(",
253 " \"Sorry changing names does not work yet. \"",
262 " // FIXME - this may be more complicated...",
263 " //for (var i in this.def) {",
264 " // this.file[i] = this.get(i).el.get_text();",
269 " this.updateFileFromEntry();",
270 " } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
271 " Xcls_StandardErrorDialog.singleton().show(",
273 " \"The name you used already exists \"",
280 " _this.file.save();",
284 " var fn = this.name.el.get_text();",
285 " var dir = _this.project.firstPath();",
287 " if (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {",
288 " Xcls_StandardErrorDialog.singleton().show(",
290 " \"That file already exists\"",
295 " var f = JsRender.JsRender.factory(",
296 " _this.file.project.xtype, ",
297 " _this.file.project, ",
298 " dir + \"/\" + fn + \".bjs\");",
304 " this.updateFileFromEntry();",
305 " _this.file.save();",
306 " _this.file.project.addFile(_this.file);",
309 " // what about .js ?",
314 " //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());",
316 " //var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");",
317 " //for (var i in this.file) {",
318 " // nf[i] = this.file[i];",
320 " _this.success(_this.project, _this.file);",
323 " -- fixme -- needs to be a signal..",
324 " if (DialogNewComponent.success != null) {",
325 " DialogNewComponent.success(_this.project, nf);",
332 " this.el.show_all();",
337 "title" : "New Component",
340 "(JsRender.JsRender c) ",
342 " this.project = c.project;",
344 " //if (!this.el) {",
348 " _this.name.el.set_text(c.name);",
349 " _this.title.el.set_text(c.title);",
350 " _this.parent.el.set_text(c.parent); ",
351 " _this.region.el.set_text(c.region);",
352 " _this.modOrder.el.set_text(c.modOrder);",
353 " _this.permname.el.set_text(c.permname);",
355 " if (c.path.length > 0) {",
356 " this.el.set_title(\"Edit File Details - \" + c.name);",
358 " this.el.set_title(\"Create New File\");",
361 " var ar = new Gee.ArrayList<string>();",
362 " _this.dbmodel.loadData(ar,\"\");",
363 " // load the modules... if relivant..",
364 " if (this.project.xtype == \"Gtk\") {",
365 " var p = (Project.Gtk)c.project;",
366 " var cg = p.compilegroups;",
368 " var iter = cg.map_iterator();",
369 " while(iter.next()) {",
370 " var key = iter.get_key();",
371 " if (key == \"_default_\") {",
376 " _this.dbmodel.loadData(ar, c.build_module);",
381 " //console.log('show all');",
382 " this.el.show_all();",
384 " //this.success = c.success;",
389 "| void updateFileFromEntry" : [
392 " _this.file.title = _this.title.el.get_text();",
393 " _this.file.region = _this.region.el.get_text(); ",
394 " _this.file.parent = _this.parent.el.get_text(); ",
395 " _this.file.permname = _this.permname.el.get_text(); ",
396 " _this.file.modOrder = _this.modOrder.el.get_text();",
398 " if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
399 " _this.file.renameTo(_this.name.el.get_text());",
401 " // store the module...",
402 " _this.file.build_module = \"\"; ",
403 " Gtk.TreeIter iter; ",
404 " if (_this.build_module.el.get_active_iter (out iter)) {",
406 " this.dbmodel.el.get_value (iter, 0, out vfname);",
407 " if (((string)vfname).length > 0) {",
408 " _this.file.build_module = (string)vfname;",
421 "name" : "DialogNewComponent",
423 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogNewComponent.bjs",