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