new files need adding to full file list
[roobuilder] / src / Builder4 / PopoverFileDetails.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# JsRender.JsRender file" : "null",
7    "# Project.Project project" : "",
8    "# bool new_window" : true,
9    "$ xns" : "Gtk",
10    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
11    "Xcls_MainWindow mainwindow" : "null",
12    "bool done" : false,
13    "bool is_new" : true,
14    "bool modal" : true,
15    "id" : "PopoverFileDetails",
16    "items" : [
17     {
18      "$ pack" : "add",
19      "$ xns" : "Gtk",
20      "* pack" : "set_child",
21      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
22      "bool hexpand" : true,
23      "bool homogeneous" : false,
24      "int margin_bottom" : 4,
25      "int margin_end" : 4,
26      "int margin_start" : 4,
27      "int margin_top" : 4,
28      "items" : [
29       {
30        "$ xns" : "Gtk",
31        "* columns" : 2,
32        "* pack" : "append",
33        "bool hexpand" : true,
34        "id" : "grid",
35        "int column_spacing" : 4,
36        "int margin_end" : 4,
37        "int margin_start" : 4,
38        "items" : [
39         {
40          "$ justify" : "Gtk.Justification.RIGHT",
41          "$ xns" : "Gtk",
42          "id" : "filetype_lbl",
43          "label" : "File type",
44          "x_options" : 4,
45          "xalign" : 0.90000000000000002,
46          "xtype" : "Label"
47         },
48         {
49          "$ xns" : "Gtk",
50          "bool hexpand" : true,
51          "bool in_showhide" : false,
52          "id" : "filetype",
53          "items" : [
54           {
55            "$ xns" : "Gtk",
56            "* prop" : "model",
57            "id" : "filetype_model",
58            "strings" : "{}",
59            "xtype" : "StringList",
60            "| void load" : [
61             "() {",
62             "    var el = this.el;",
63             "    ",
64             "    while (el.get_n_items() > 0) {",
65             "    \tel.remove(0);",
66             "\t}",
67             " \tel.append(\"bjs - User Interface File\");",
68             " ",
69             "    ",
70             " switch(_this.project.xtype) {",
71             " \tcase \"Roo\":",
72             " \t \tel.append(\"js - Javascript File\");",
73             " \t \tel.append(\"css - CSS File\");",
74             " \t \tel.append(\"php - Javascript File\");",
75             " \t \t",
76             "\t\tbreak;",
77             "",
78             "\tcase \"Gtk\":\t\t",
79             "\t\t\t",
80             " \t \tel.append(\"vala - Vala File\");",
81             " \t \tel.append(\"css - CSS File\");",
82             " \t \tel.append(\"other - Other Type\");",
83             " \t \tbreak;",
84             " \t default : ",
85             " \t \tbreak;",
86             "\t}",
87             "",
88             "\t",
89             "\t",
90             "\t",
91             "}"
92            ]
93           }
94          ],
95          "listeners" : {
96           "notify[\"selected\"]" : [
97            "() => {",
98            "",
99            " \t_this.onFileTypeChange();",
100            "",
101            " }"
102           ]
103          },
104          "xtype" : "DropDown",
105          "| string getValue" : [
106           "() {",
107           "\t",
108           "\tif (!_this.is_new) {",
109           "\t\treturn _this.file.xtype != \"Plainfile\" ? \"bjs\" :  _this.file.file_ext;",
110           "\t}",
111           "\t",
112           "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
113           "\t\treturn \"\";",
114           "\t}",
115           "\t",
116           "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
117           "}"
118          ],
119          "| void setValue" : [
120           "(string cur) {",
121           "\tvar el  = _this.filetype_model.el;",
122           "\tfor(var i= 0; i < el.get_n_items();i++)  {",
123           "\t\tif (el.get_string(i).has_prefix(cur)) {",
124           "\t\t\tthis.el.selected = i;",
125           "\t\t\tbreak;",
126           "\t\t}",
127           "\t}",
128           "}"
129          ]
130         },
131         {
132          "$ justify" : "Gtk.Justification.RIGHT",
133          "$ visible" : true,
134          "$ xns" : "Gtk",
135          "id" : "dir_dropdown_lbl",
136          "label" : "Create File in this Directory",
137          "x_options" : 4,
138          "xalign" : 0.90000000000000002,
139          "xtype" : "Label"
140         },
141         {
142          "$ xns" : "Gtk",
143          "id" : "dir_dropdown",
144          "int colspan" : 1,
145          "items" : [
146           {
147            "$ xns" : "Gtk",
148            "* prop" : "model",
149            "id" : "dir_model",
150            "strings" : "{}",
151            "xtype" : "StringList"
152           }
153          ],
154          "listeners" : {
155           "notify[\"selected\"]" : [
156            "() => {",
157            "",
158            "\t _this.onDirChanged();",
159            "\t",
160            "\t",
161            "\t",
162            " } "
163           ]
164          },
165          "xtype" : "DropDown",
166          "| string getValue" : [
167           "() {",
168           "\treturn _this.dir_model.el.get_string(this.el.selected);",
169           "}"
170          ],
171          "| void setValue" : [
172           "(string cur) {",
173           "\tvar el  = _this.dir_model.el;",
174           "\tfor(var i= 0; i < el.get_n_items();i++)  {",
175           "\t\tif (el.get_string(i) == cur) {",
176           "\t\t\tthis.el.selected = i;",
177           "\t\t\tbreak;",
178           "\t\t}",
179           "\t}",
180           "}"
181          ]
182         },
183         {
184          "$ justify" : "Gtk.Justification.RIGHT",
185          "$ xns" : "Gtk",
186          "id" : "name_lbl",
187          "label" : "Component Name (File name without extension)",
188          "x_options" : 4,
189          "xalign" : 0.90000000000000002,
190          "xtype" : "Label"
191         },
192         {
193          "$ visible" : true,
194          "$ xns" : "Gtk",
195          "bool hexpand" : true,
196          "id" : "name",
197          "xtype" : "Entry"
198         },
199         {
200          "$ justify" : "Gtk.Justification.RIGHT",
201          "$ visible" : true,
202          "$ xns" : "Gtk",
203          "id" : "title_lbl",
204          "label" : "Title",
205          "x_options" : 4,
206          "xalign" : 0.90000000000000002,
207          "xtype" : "Label"
208         },
209         {
210          "$ visible" : true,
211          "$ xns" : "Gtk",
212          "* pack" : "attach,1,2,1,1",
213          "bool hexpand" : true,
214          "id" : "title",
215          "xtype" : "Entry"
216         },
217         {
218          "$ justify" : "Gtk.Justification.RIGHT",
219          "$ visible" : true,
220          "$ xns" : "Gtk",
221          "id" : "region_lbl",
222          "label" : "Region",
223          "tooltip_text" : "center, north, south, east, west",
224          "x_options" : 4,
225          "xalign" : 0.90000000000000002,
226          "xtype" : "Label"
227         },
228         {
229          "$ visible" : true,
230          "$ xns" : "Gtk",
231          "bool hexpand" : true,
232          "id" : "region",
233          "xtype" : "Entry"
234         },
235         {
236          "$ justify" : "Gtk.Justification.RIGHT",
237          "$ visible" : true,
238          "$ xns" : "Gtk",
239          "id" : "parent_lbl",
240          "label" : "Parent Name",
241          "x_options" : 4,
242          "xalign" : 0.90000000000000002,
243          "xtype" : "Label"
244         },
245         {
246          "$ visible" : true,
247          "$ xns" : "Gtk",
248          "id" : "parent",
249          "xtype" : "Entry"
250         },
251         {
252          "$ justify" : "Gtk.Justification.RIGHT",
253          "$ visible" : true,
254          "$ xns" : "Gtk",
255          "id" : "permname_lbl",
256          "label" : "Permission Name",
257          "x_options" : 4,
258          "xalign" : 0.90000000000000002,
259          "xtype" : "Label"
260         },
261         {
262          "$ visible" : true,
263          "$ xns" : "Gtk",
264          "id" : "permname",
265          "xtype" : "Entry"
266         },
267         {
268          "$ justify" : "Gtk.Justification.RIGHT",
269          "$ visible" : true,
270          "$ xns" : "Gtk",
271          "id" : "modOrder_lbl",
272          "label" : "Order (for tabs)",
273          "x_options" : 4,
274          "xalign" : 0.90000000000000002,
275          "xtype" : "Label"
276         },
277         {
278          "$ visible" : true,
279          "$ xns" : "Gtk",
280          "id" : "modOrder",
281          "xtype" : "Entry"
282         },
283         {
284          "$ justify" : "Gtk.Justification.RIGHT",
285          "$ visible" : true,
286          "$ xns" : "Gtk",
287          "id" : "build_module_lbl",
288          "label" : "Module to build",
289          "x_options" : 4,
290          "xalign" : 0.90000000000000002,
291          "xtype" : "Label"
292         },
293         {
294          "$ xns" : "Gtk",
295          "id" : "build_module",
296          "items" : [
297           {
298            "$ xns" : "Gtk",
299            "* prop" : "model",
300            "id" : "build_module_model",
301            "strings" : "{}",
302            "xtype" : "StringList",
303            "| void load" : [
304             "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
305             "{",
306             "\t",
307             "\t_this.build_module.el.hide();",
308             "\t\t_this.build_module_lbl.el.hide();",
309             "\tvar el = _this.build_module_model.el;",
310             "\t while (el.get_n_items() > 0) {",
311             "\t\t\tel.remove(0);",
312             "\t}",
313             "\t",
314             "\tif (compilegroups == null) {",
315             "\t\treturn;",
316             "\t}",
317             "\tforeach(var k in compilegroups.keys) {",
318             "\t\tthis.el.append(k);",
319             "\t}",
320             "\tif (compilegroups.keys.size > 0) {",
321             "\t\t_this.build_module.el.selected = 0;",
322             "\t\t_this.build_module.el.show();",
323             "\t\t_this.build_module_lbl.el.show();",
324             "\t} else {",
325             "\t\t",
326             "\t}",
327             "\t",
328             "}"
329            ]
330           }
331          ],
332          "xtype" : "DropDown",
333          "| string getValue" : [
334           " ",
335           "() {",
336           "\tif (this.el.selected < 0) {",
337           "\t\treturn \"\";",
338           "\t}",
339           "\t",
340           "\treturn _this.build_module_model.el.get_string(this.el.selected);",
341           "}",
342           " "
343          ],
344          "| void setValue" : [
345           "(string str) {",
346           "\tvar m = _this.build_module_model.el;",
347           "\tfor(var i = 0; i < m.get_n_items(); i++) {",
348           "\t\tif (m.get_string(i) == str) {",
349           "\t\t\tthis.el.selected = i;",
350           "\t\t\treturn;",
351           "\t\t}",
352           "\t}",
353           "\t\t",
354           "}"
355          ]
356         },
357         {
358          "$ justify" : "Gtk.Justification.RIGHT",
359          "$ visible" : true,
360          "$ xns" : "Gtk",
361          "id" : "path_lbl",
362          "int colspan" : 1,
363          "label" : "Full path",
364          "x_options" : 4,
365          "xalign" : 0.90000000000000002,
366          "xtype" : "Label"
367         },
368         {
369          "$ visible" : true,
370          "$ xns" : "Gtk",
371          "bool editable" : false,
372          "bool hexpand" : true,
373          "id" : "path",
374          "int colspan" : 1,
375          "xtype" : "Entry"
376         },
377         {
378          "$ justify" : "Gtk.Justification.RIGHT",
379          "$ visible" : true,
380          "$ xns" : "Gtk",
381          "id" : "gen_lbl",
382          "int colspan" : 1,
383          "label" : "Generate as Extended (no working)",
384          "x_options" : 4,
385          "xalign" : 0.90000000000000002,
386          "xtype" : "Label"
387         },
388         {
389          "$ xns" : "Gtk",
390          "id" : "gen",
391          "listeners" : {
392           "toggled" : [
393            "( ) => {",
394            "\t  ",
395            "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
396            "",
397            "}",
398            ""
399           ]
400          },
401          "string label" : "Wrapped",
402          "xtype" : "CheckButton"
403         }
404        ],
405        "uint row_spacing" : 2,
406        "xtype" : "Grid",
407        "| void xhideRow" : [
408         "(int row) ",
409         "{",
410         "\tvar el = _this.grid.el.get_child_at(0,row);",
411         "",
412         "\tel.hide();",
413         "\tel = _this.grid.el.get_child_at(1,row);",
414         "\tel.hide();",
415         "",
416         "}"
417        ],
418        "| void xshowAllRows" : [
419         "() {",
420         "\tfor (var i = 2; i < 10;i++) {",
421         "\t\tvar el = _this.grid.el.get_child_at(0,i);",
422         "\t\tel.show();",
423         "\t\tel = _this.grid.el.get_child_at(1,i);",
424         "\t\tel.show();",
425         "    }",
426         "}"
427        ]
428       }
429      ],
430      "xtype" : "Box"
431     },
432     {
433      "$ xns" : "Gtk",
434      "* prop" : "titlebar",
435      "bool show_title_buttons" : false,
436      "items" : [
437       {
438        "$ xns" : "Gtk",
439        "* pack" : "pack_start",
440        "listeners" : {
441         "clicked" : [
442          "() => { ",
443          "  \t_this.done = true;",
444          "    _this.el.hide(); ",
445          "}"
446         ]
447        },
448        "string label" : "Cancel",
449        "xtype" : "Button"
450       },
451       {
452        "$ css_classes" : "{ \"suggested-action\" }",
453        "$ xns" : "Gtk",
454        "* pack" : "pack_end",
455        "bool always_show_image" : true,
456        "bool hexpand" : false,
457        "id" : "save_btn",
458        "listeners" : {
459         "clicked" : [
460          "( ) =>  { ",
461          "",
462          " ",
463          "",
464          "",
465          "\tif (_this.name.el.get_text().length  < 1) {",
466          "\t    Xcls_StandardErrorDialog.singleton().show(",
467          "\t        _this.mainwindow.el,",
468          "\t        \"You have to set a Component name \"",
469          "\t    );",
470          "\t     ",
471          "\t    return;",
472          "\t}",
473          "\t ",
474          "",
475          "\tif (!_this.is_new) {",
476          "\t  //  try {",
477          "\t  ",
478          "\t  \tvar old_target = _this.file.build_module;",
479          "         _this.updateFileFromEntry();",
480          "\t    if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
481          "\t    \tvar gp = (JsRender.Gtk)_this.file;",
482          "\t    \tgp.updateCompileGroup(old_target,  _this.file.build_module);",
483          "    \t}",
484          "",
485          "\t      _this.done = true;",
486          "\t    _this.file.save();",
487          "\t    _this.el.hide();",
488          "\t    return;",
489          "\t}  ",
490          "\t",
491          "\t// ---------------- NEW FILES...",
492          "\tvar ftype = _this.filetype.getValue();",
493          "",
494          "\tif (ftype == \"\") {",
495          "\t\t// should not happen...",
496          "\t\t// so we are jut going to return without ",
497          "\t\tXcls_StandardErrorDialog.singleton().show(",
498          "\t        _this.mainwindow.el,",
499          "\t        \"You must select a file type. \"",
500          "\t    );",
501          "\t    return;",
502          "\t\t ",
503          "\t}",
504          "\t",
505          "\t",
506          "\tvar fn = _this.name.el.get_text();",
507          "\t",
508          "\t ",
509          "\tvar ext = ftype;",
510          "\t//var dir = _this.project.path; ",
511          "\t ",
512          "\t var dir = _this.dir_dropdown.getValue();",
513          "\t",
514          "\t ",
515          "\t",
516          "\t ",
517          "\tvar targetfile  = _this.project.path;",
518          "\tif (dir != \"\") {",
519          "\t\ttargetfile += dir;",
520          "\t}",
521          "\ttargetfile += \"/\" + fn;",
522          "\t",
523          "\t// strip the file type off the end..",
524          "\t",
525          "\ttry {",
526          "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
527          "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
528          "\t  } catch (RegexError e) {} // ignore.",
529          "\t  ",
530          "\t  targetfile += \".\" + ext;",
531          "\t  ",
532          "\t  ",
533          "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
534          "\t    Xcls_StandardErrorDialog.singleton().show(",
535          "\t        _this.mainwindow.el,",
536          "\t        \"That file already exists\"",
537          "\t    ); ",
538          "\t    return;",
539          "\t}",
540          "\tJsRender.JsRender f;",
541          "   try {",
542          "\t   f =  JsRender.JsRender.factory(",
543          "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
544          "\t\t\t_this.file.project, ",
545          "\t\t\ttargetfile);",
546          "\t} catch (JsRender.Error e) {",
547          "\t\tXcls_StandardErrorDialog.singleton().show(",
548          "\t        _this.mainwindow.el,",
549          "\t        \"Error creating file\"",
550          "\t    ); ",
551          "\t\treturn;",
552          "\t}",
553          "\t_this.file = f;",
554          "\t",
555          "\t",
556          "",
557          "\t",
558          "\t_this.updateFileFromEntry();",
559          "\t_this.file.loaded = true;",
560          "\t_this.file.save();",
561          "     _this.file.project.addFile(_this.file);",
562          "     var sel = _this.filetype.getValue();",
563          "\t if (_this.file.project.xtype == \"Gtk\" && ",
564          "\t \t_this.file.build_module.length > 0 &&",
565          "\t \t( sel == \"bjs\" || sel == \"vala\")) {",
566          "\t ",
567          "\t\tvar pr = (Project.Gtk) _this.file.project;",
568          "\t\tif (pr.compilegroups.has_key(_this.file.build_module)) {",
569          "\t\t\tvar cg = pr.compilegroups.get(_this.file.build_module);",
570          "\t\t\tif (!cg.sources.contains(_this.file.relpath)) {",
571          "\t\t\t\tcg.sources.add(_this.file.relpath);",
572          "\t\t\t}",
573          "\t\t}",
574          "\t",
575          "\t}",
576          "\t ",
577          " ",
578          "\t// what about .js ?",
579          "   _this.done = true;",
580          "\t_this.el.hide();",
581          "",
582          "// hopefull this will work with bjs files..",
583          "\t",
584          "\t_this.success(_this.project, _this.file);",
585          "   ",
586          "}"
587         ]
588        },
589        "string icon_name" : "document-save",
590        "string label" : "Save",
591        "xtype" : "Button"
592       }
593      ],
594      "title" : "Add / Edit File",
595      "xtype" : "HeaderBar"
596     }
597    ],
598    "listeners" : {
599     "close_request" : [
600      "( ) => {",
601      "\t_this.el.hide();",
602      "\treturn true;",
603      "}",
604      ""
605     ]
606    },
607    "string title" : "Add / Edit File",
608    "uint border_width" : 0,
609    "xtype" : "Window",
610    "| void hideAll" : [
611     "() {",
612     "",
613     "\t// exiting only",
614     "\tthis.path_lbl.el.hide();",
615     "    this.path.el.hide();",
616     "     ",
617     "    // new ",
618     "    this.name_lbl.el.hide();",
619     "    this.name.el.hide();",
620     "    //new ",
621     "    this.dir_dropdown_lbl.el.hide();",
622     "    this.dir_dropdown.el.hide();",
623     "\t// roo",
624     "\tthis.title_lbl.el.hide();",
625     "\tthis.title.el.hide();",
626     "\t",
627     "\tthis.region_lbl.el.hide();",
628     "\tthis.region.el.hide();",
629     "\t",
630     "\tthis.parent_lbl.el.hide();",
631     "\tthis.parent.el.hide();",
632     "\t",
633     "\tthis.permname_lbl.el.hide();",
634     "\tthis.permname.el.hide();",
635     "\t",
636     "\tthis.modOrder_lbl.el.hide();",
637     "\tthis.modOrder.el.hide();",
638     "\t",
639     "\tthis.build_module_lbl.el.hide();",
640     "\tthis.build_module.el.hide();",
641     "\t",
642     "\tthis.gen_lbl.el.hide();",
643     "\tthis.gen.el.hide();",
644     "\t\tthis.filetype_lbl.el.hide();",
645     "\t\tthis.filetype.el.hide();",
646     "}\t"
647    ],
648    "| void onDirChanged" : [
649     "() {",
650     "if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {",
651     "\t\tthis.build_module_lbl.el.hide();",
652     "\t\tthis.build_module.el.hide();",
653     "\t\tthis.name_lbl.el.hide();",
654     "\t\tthis.name.el.hide();",
655     "\t\t ",
656     "    \tthis.gen_lbl.el.hide();",
657     "\t\tthis.gen.el.hide();",
658     "    ",
659     "\t\treturn;",
660     "\t\t",
661     "\t",
662     "\t}",
663     "\t// directory selected",
664     "\tvar sel = this.filetype.getValue();",
665     "\t",
666     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
667     "\t\tthis.build_module_lbl.el.show();",
668     "\t\tthis.build_module.el.show();",
669     "\t}",
670     "\tthis.name_lbl.el.show();",
671     "\tthis.name.el.show();",
672     "\t",
673     "\tif (sel == \"bjs\") {",
674     "        _this.gen_lbl.el.show();",
675     "        _this.gen.el.show();",
676     "    }",
677     "    ",
678     "    if (this.file.project.xtype == \"Roo\" && sel == \"bjs\") {",
679     "    \tthis.title_lbl.el.show();",
680     "\t\tthis.title.el.show();",
681     "\t\t",
682     "\t\tthis.region_lbl.el.show();",
683     "\t\tthis.region.el.show();",
684     "\t\t",
685     "\t\tthis.parent_lbl.el.show();",
686     "\t\tthis.parent.el.show();",
687     "\t\t",
688     "\t\tthis.permname_lbl.el.show();",
689     "\t\tthis.permname.el.show();",
690     "\t\t",
691     "\t\tthis.modOrder_lbl.el.show();",
692     "\t\tthis.modOrder.el.show();",
693     "\t}",
694     "    ",
695     "        ",
696     "}"
697    ],
698    "| void onFileTypeChange" : [
699     "() {",
700     "\tif (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {",
701     "\t\tthis.dir_dropdown.el.hide();",
702     "\t\tthis.dir_dropdown_lbl.el.hide();",
703     "\t\tthis.build_module_lbl.el.hide();",
704     "\t\tthis.build_module.el.hide();",
705     "\t\tthis.name_lbl.el.hide();",
706     "\t\tthis.name.el.hide();",
707     "\t ",
708     "    \tthis.gen_lbl.el.hide();",
709     "\t\tthis.gen.el.hide();",
710     "    ",
711     "    ",
712     "    \tthis.title_lbl.el.hide();",
713     "\t\tthis.title.el.hide();",
714     "\t\t",
715     "\t\tthis.region_lbl.el.hide();",
716     "\t\tthis.region.el.hide();",
717     "\t\t",
718     "\t\tthis.parent_lbl.el.hide();",
719     "\t\tthis.parent.el.hide();",
720     "\t\t",
721     "\t\tthis.permname_lbl.el.hide();",
722     "\t\tthis.permname.el.hide();",
723     "\t\t",
724     "\t\tthis.modOrder_lbl.el.hide();",
725     "\t\tthis.modOrder.el.hide();",
726     " ",
727     "\t\treturn;",
728     "\t\t ",
729     "\t}",
730     "\t",
731     "\tthis.dir_dropdown.el.show();",
732     "\tthis.dir_dropdown_lbl.el.show();",
733     "\tvar sel = this.filetype.getValue();",
734     "\t",
735     "\tvar old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;",
736     "\tvar olddir = this.dir_dropdown.getValue();",
737     "\tGLib.debug(\"old dir = %s\", olddir);",
738     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
739     "\t\t_this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
740     "\t\tif (old_sel && olddir.has_prefix(\"/src\")) {",
741     "\t\t \tthis.dir_dropdown.setValue(olddir);",
742     " \t\t} else {",
743     "\t \t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
744     " \t    }",
745     "         ",
746     "\t} else {",
747     "",
748     "        _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
749     "\t\tif (old_sel) {",
750     "\t\t\tthis.dir_dropdown.setValue(olddir);",
751     "\t\t} else {",
752     "\t\t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
753     "\t     }",
754     "       ",
755     "    }",
756     "",
757     " ",
758     "    // is this confusing?  - should we just strip out / add if necessary..",
759     "    if (sel == \"bjs\" || sel == \"vala\" || sel == \"js\" || sel == \"css\" || sel == \"php\") {",
760     "        _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
761     "    } else {",
762     "\t    _this.name_lbl.el.label = \"File Name (with extension)\";",
763     "    }",
764     " ",
765     "}"
766    ],
767    "| void show" : [
768     "(JsRender.JsRender  c, Gtk.Window pwin, bool new_window) ",
769     "{",
770     "    ",
771     "    this.project = c.project;",
772     "    this.done = false;",
773     "    this.new_window = new_window;",
774     "    ",
775     "    //if (!this.el) {",
776     "        //this.init();",
777     "     //} ",
778     "     ",
779     "      this.is_new = c.name == \"\";",
780     "",
781     "    _this.name.el.set_text(c.name);",
782     "    _this.title.el.set_text(c.title);",
783     "    _this.parent.el.set_text(c.parent);    ",
784     "    _this.region.el.set_text(c.region);",
785     "    _this.modOrder.el.set_text(c.modOrder);",
786     "    _this.permname.el.set_text(c.permname);",
787     " ",
788     "   _this.gen.el.active = c.gen_extended;",
789     "   ",
790     "",
791     "    ",
792     "    if (this.project.xtype == \"Gtk\") {",
793     "    \tvar p = (Project.Gtk) this.project;",
794     "\t    this.build_module_model.load(p.compilegroups);",
795     "\t    // it will select first if available...",
796     "\t    // only for new files.",
797     "\t    if (!this.is_new) {",
798     "\t\t    this.build_module.setValue(c.build_module);",
799     "\t    }",
800     "    }",
801     "\t     ",
802     "     ",
803     "    _this.file = c;",
804     "   ",
805     "   // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
806     "",
807     "    this.el.set_transient_for(pwin);",
808     "    ",
809     "    // window + header?",
810     "     this.hideAll();",
811     "    this.el.show();",
812     "   // this.name.el.grab_focus();",
813     "    ",
814     "    ",
815     "    if (!this.is_new) {",
816     "\t   this.showEditFile();",
817     "    } else {",
818     "    \tthis.showNewFile();",
819     "\t\t ",
820     "      ",
821     "\t    ",
822     "    }",
823     "    ",
824     "    ",
825     "    //this.success = c.success;",
826     "    ",
827     "    ",
828     "}"
829    ],
830    "| void showEditFile" : [
831     "() {",
832     " \tthis.save_btn.el.set_label(\"Save\");",
833     "\tthis.filetype_lbl.el.hide();",
834     "\tthis.filetype.el.hide();",
835     "\t\t ",
836     "\tvar sel = this.filetype.getValue();",
837     "\tswitch(_this.project.xtype) {",
838     "\t\tcase \"Roo\":\t ",
839     "\t\t\t if (sel == \"bjs\") {",
840     "\t\t\t\t_this.title_lbl.el.show();",
841     "\t\t\t\t_this.title.el.show();",
842     "\t\t\t\t",
843     "\t\t\t\t_this.region_lbl.el.show();",
844     "\t\t\t\t_this.region.el.show();",
845     "\t\t\t\t",
846     "\t\t\t\t_this.parent_lbl.el.show();",
847     "\t\t\t\t_this.parent.el.show();",
848     "\t\t\t\t",
849     "\t\t\t\t_this.permname_lbl.el.show();",
850     "\t\t\t\t_this.permname.el.show();",
851     "\t\t\t\t",
852     "\t\t\t\t_this.modOrder_lbl.el.show();",
853     "\t\t\t\t_this.modOrder.el.show();",
854     "\t\t\t",
855     "\t\t\t}",
856     "\t\t\tbreak;",
857     "\t\tdefault:",
858     "\t\t\t_this.build_module_lbl.el.show();",
859     "\t\t\t_this.build_module.el.show();\t",
860     "\t\t\t",
861     "\t\t\tif (sel == \"bjs\") {",
862     "\t\t\t",
863     "\t\t\t\t _this.gen_lbl.el.show();",
864     "\t\t\t\t_this.gen.el.show();",
865     "\t\t\t}",
866     "\t\t\tbreak;",
867     "\t}",
868     "\tthis.path.el.show();",
869     "\tthis.path_lbl.el.show();",
870     "\tthis.path.el.set_text(_this.file.relpath);",
871     "}"
872    ],
873    "| void showNewFile" : [
874     "() {",
875     " \tthis.save_btn.el.set_label(\"Create\");",
876     " \tthis.hideAll();",
877     " \tthis.filetype.el.show();",
878     "    this.filetype_lbl.el.show();",
879     "    this.filetype_model.load();",
880     "\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
881     " ",
882     "\t    ",
883     "}"
884    ],
885    "| void updateFileFromEntry" : [
886     "() {",
887     "",
888     "        _this.file.title = _this.title.el.get_text();",
889     "        _this.file.region = _this.region.el.get_text();            ",
890     "        _this.file.parent = _this.parent.el.get_text();                        ",
891     "        _this.file.permname = _this.permname.el.get_text();                                    ",
892     "        _this.file.modOrder = _this.modOrder.el.get_text();",
893     "        _this.file.gen_extended = _this.gen.el.active;",
894     "        var new_name =  _this.name.el.get_text();",
895     "        if (_this.file.name.length  > 0 && _this.file.name != new_name) {",
896     "            try {",
897     "            \t_this.file.renameTo( new_name );",
898     "        \t} catch (JsRender.Error e) { } // do nothing?",
899     "        }",
900     "        ",
901     "        _this.file.build_module = _this.build_module.getValue();",
902     "\t\t",
903     "        ",
904     "        ",
905     "",
906     "                                                    ",
907     "}    "
908    ]
909   }
910  ],
911  "name" : "PopoverFileDetails"
912 }