revamp the new file dialog - show hide setting in correct config - mostly
[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// what does this do?",
474          "\t",
475          " ",
476          "\t/*",
477          "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
478          "\t    Xcls_StandardErrorDialog.singleton().show(",
479          "\t        this.el,",
480          "\t        \"Sorry changing names does not work yet. \"",
481          "\t    );",
482          "\t     ",
483          "\t    return;",
484          "\t}",
485          "\t*/",
486          "\t  ",
487          "  ",
488          "\t// FIXME - this may be more complicated...",
489          "\t//for (var i in this.def) {",
490          "\t//    this.file[i] =  this.get(i).el.get_text();",
491          "\t//}",
492          "",
493          "\tif (!_this.is_new) {",
494          "\t  //  try {",
495          "\t  ",
496          "\t  \tvar old_target = _this.file.build_module;",
497          "         _this.updateFileFromEntry();",
498          "\t    if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
499          "\t    \tvar gp = (JsRender.Gtk)_this.file;",
500          "\t    \tgp.updateCompileGroup(old_target,  _this.file.build_module);",
501          "    \t}",
502          "",
503          "\t      _this.done = true;",
504          "\t    _this.file.save();",
505          "\t    _this.el.hide();",
506          "\t    return;",
507          "\t}  ",
508          "\t",
509          "\t// ---------------- NEW FILES...",
510          "\tvar ftype = _this.filetype.getValue();",
511          "",
512          "\tif (ftype == \"\") {",
513          "\t\t// should not happen...",
514          "\t\t// so we are jut going to return without ",
515          "\t\tXcls_StandardErrorDialog.singleton().show(",
516          "\t        _this.mainwindow.el,",
517          "\t        \"You must select a file type. \"",
518          "\t    );",
519          "\t    return;",
520          "\t\t ",
521          "\t}",
522          "\t",
523          "\t",
524          "\tvar fn = _this.name.el.get_text();",
525          "\t",
526          "\t ",
527          "\tvar ext = ftype;",
528          "\t//var dir = _this.project.path; ",
529          "\t ",
530          "\t var dir = _this.dir_dropdown.getValue();",
531          "\t",
532          "\t ",
533          "\t",
534          "\t ",
535          "\tvar targetfile  = _this.project.path;",
536          "\tif (dir != \"\") {",
537          "\t\ttargetfile += dir;",
538          "\t}",
539          "\ttargetfile += \"/\" + fn;",
540          "\t",
541          "\t// strip the file type off the end..",
542          "\t",
543          "\ttry {",
544          "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
545          "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
546          "\t  } catch (RegexError e) {} // ignore.",
547          "\t  ",
548          "\t  targetfile += \".\" + ext;",
549          "\t  ",
550          "\t  ",
551          "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
552          "\t    Xcls_StandardErrorDialog.singleton().show(",
553          "\t        _this.mainwindow.el,",
554          "\t        \"That file already exists\"",
555          "\t    ); ",
556          "\t    return;",
557          "\t}",
558          "\tJsRender.JsRender f;",
559          "   try {",
560          "\t   f =  JsRender.JsRender.factory(",
561          "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
562          "\t\t\t_this.file.project, ",
563          "\t\t\ttargetfile);",
564          "\t} catch (JsRender.Error e) {",
565          "\t\tXcls_StandardErrorDialog.singleton().show(",
566          "\t        _this.mainwindow.el,",
567          "\t        \"Error creating file\"",
568          "\t    ); ",
569          "\t\treturn;",
570          "\t}",
571          "\t_this.file = f;",
572          "\t",
573          "\t",
574          "",
575          "\t",
576          "\t_this.updateFileFromEntry();",
577          "\t_this.file.loaded = true;",
578          "\t_this.file.save();",
579          "     _this.file.project.addFile(_this.file);",
580          "     var sel = _this.filetype.getValue();",
581          "\t if (_this.file.project.xtype == \"Gtk\" && ",
582          "\t \t_this.file.build_module.length > 0 &&",
583          "\t \t( sel == \"bjs\" || sel == \"vala\")) {",
584          "\t ",
585          "\t\tvar pr = (Project.Gtk) _this.file.project;",
586          "\t\tif (pr.compilegroups.has_key(_this.file.build_module)) {",
587          "\t\t\tvar cg = pr.compilegroups.get(_this.file.build_module);",
588          "\t\t\tif (!cg.sources.contains(_this.file.relpath)) {",
589          "\t\t\t\tcg.sources.add(_this.file.relpath);",
590          "\t\t\t}",
591          "\t\t}",
592          "\t",
593          "\t}",
594          "\t ",
595          " ",
596          "\t// what about .js ?",
597          "   _this.done = true;",
598          "\t_this.el.hide();",
599          "",
600          "// hopefull this will work with bjs files..",
601          "\t",
602          "\t_this.success(_this.project, _this.file);",
603          "   ",
604          "}"
605         ]
606        },
607        "string icon_name" : "document-save",
608        "string label" : "Save",
609        "xtype" : "Button"
610       }
611      ],
612      "title" : "Add / Edit File",
613      "xtype" : "HeaderBar"
614     }
615    ],
616    "listeners" : {
617     "close_request" : [
618      "( ) => {",
619      "\t_this.el.hide();",
620      "\treturn true;",
621      "}",
622      ""
623     ]
624    },
625    "string title" : "Add / Edit File",
626    "uint border_width" : 0,
627    "xtype" : "Window",
628    "| void hideAll" : [
629     "() {",
630     "",
631     "\t// exiting only",
632     "\tthis.path_lbl.el.hide();",
633     "    this.path.el.hide();",
634     "     ",
635     "    // new ",
636     "    this.name_lbl.el.hide();",
637     "    this.name.el.hide();",
638     "    //new ",
639     "    this.dir_dropdown_lbl.el.hide();",
640     "    this.dir_dropdown.el.hide();",
641     "\t// roo",
642     "\tthis.title_lbl.el.hide();",
643     "\tthis.title.el.hide();",
644     "\t",
645     "\tthis.region_lbl.el.hide();",
646     "\tthis.region.el.hide();",
647     "\t",
648     "\tthis.parent_lbl.el.hide();",
649     "\tthis.parent.el.hide();",
650     "\t",
651     "\tthis.permname_lbl.el.hide();",
652     "\tthis.permname.el.hide();",
653     "\t",
654     "\tthis.modOrder_lbl.el.hide();",
655     "\tthis.modOrder.el.hide();",
656     "\t",
657     "\tthis.build_module_lbl.el.hide();",
658     "\tthis.build_module.el.hide();",
659     "\t",
660     "\tthis.gen_lbl.el.hide();",
661     "\tthis.gen.el.hide();",
662     "\t\tthis.filetype_lbl.el.hide();",
663     "\t\tthis.filetype.el.hide();",
664     "}\t"
665    ],
666    "| void onDirChanged" : [
667     "() {",
668     "if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {",
669     "\t\tthis.build_module_lbl.el.hide();",
670     "\t\tthis.build_module.el.hide();",
671     "\t\tthis.name_lbl.el.hide();",
672     "\t\tthis.name.el.hide();",
673     "\t\t ",
674     "    \tthis.gen_lbl.el.hide();",
675     "\t\tthis.gen.el.hide();",
676     "    ",
677     "\t\treturn;",
678     "\t\t",
679     "\t",
680     "\t}",
681     "\t// directory selected",
682     "\tvar sel = this.filetype.getValue();",
683     "\t",
684     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
685     "\t\tthis.build_module_lbl.el.show();",
686     "\t\tthis.build_module.el.show();",
687     "\t}",
688     "\tthis.name_lbl.el.show();",
689     "\tthis.name.el.show();",
690     "\t",
691     "\tif (sel == \"bjs\") {",
692     "        _this.gen_lbl.el.show();",
693     "        _this.gen.el.show();",
694     "    }",
695     "    ",
696     "    if (this.file.project.xtype == \"Roo\" && sel == \"bjs\") {",
697     "    \tthis.title_lbl.el.show();",
698     "\t\tthis.title.el.show();",
699     "\t\t",
700     "\t\tthis.region_lbl.el.show();",
701     "\t\tthis.region.el.show();",
702     "\t\t",
703     "\t\tthis.parent_lbl.el.show();",
704     "\t\tthis.parent.el.show();",
705     "\t\t",
706     "\t\tthis.permname_lbl.el.show();",
707     "\t\tthis.permname.el.show();",
708     "\t\t",
709     "\t\tthis.modOrder_lbl.el.show();",
710     "\t\tthis.modOrder.el.show();",
711     "\t}",
712     "    ",
713     "        ",
714     "}"
715    ],
716    "| void onFileTypeChange" : [
717     "() {",
718     "\tif (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {",
719     "\t\tthis.dir_dropdown.el.hide();",
720     "\t\tthis.dir_dropdown_lbl.el.hide();",
721     "\t\tthis.build_module_lbl.el.hide();",
722     "\t\tthis.build_module.el.hide();",
723     "\t\tthis.name_lbl.el.hide();",
724     "\t\tthis.name.el.hide();",
725     "\t ",
726     "    \tthis.gen_lbl.el.hide();",
727     "\t\tthis.gen.el.hide();",
728     "    ",
729     "    ",
730     "    \tthis.title_lbl.el.hide();",
731     "\t\tthis.title.el.hide();",
732     "\t\t",
733     "\t\tthis.region_lbl.el.hide();",
734     "\t\tthis.region.el.hide();",
735     "\t\t",
736     "\t\tthis.parent_lbl.el.hide();",
737     "\t\tthis.parent.el.hide();",
738     "\t\t",
739     "\t\tthis.permname_lbl.el.hide();",
740     "\t\tthis.permname.el.hide();",
741     "\t\t",
742     "\t\tthis.modOrder_lbl.el.hide();",
743     "\t\tthis.modOrder.el.hide();",
744     " ",
745     "\t\treturn;",
746     "\t\t ",
747     "\t}",
748     "\t",
749     "\tthis.dir_dropdown.el.show();",
750     "\tthis.dir_dropdown_lbl.el.show();",
751     "\tvar sel = this.filetype.getValue();",
752     "\t",
753     "\tvar old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;",
754     "\tvar olddir = this.dir_dropdown.getValue();",
755     "\tGLib.debug(\"old dir = %s\", olddir);",
756     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
757     "\t\t_this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
758     "\t\tif (old_sel && olddir.has_prefix(\"/src\")) {",
759     "\t\t \tthis.dir_dropdown.setValue(olddir);",
760     " \t\t} else {",
761     "\t \t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
762     " \t    }",
763     "         ",
764     "\t} else {",
765     "",
766     "        _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
767     "\t\tif (old_sel) {",
768     "\t\t\tthis.dir_dropdown.setValue(olddir);",
769     "\t\t} else {",
770     "\t\t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
771     "\t     }",
772     "       ",
773     "    }",
774     "",
775     " ",
776     "    // is this confusing?  - should we just strip out / add if necessary..",
777     "    if (sel == \"bjs\" || sel == \"vala\" || sel == \"js\" || sel == \"css\" || sel == \"php\") {",
778     "        _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
779     "    } else {",
780     "\t    _this.name_lbl.el.label = \"File Name (with extension)\";",
781     "    }",
782     " ",
783     "}"
784    ],
785    "| void show" : [
786     "(JsRender.JsRender  c, Gtk.Window pwin, bool new_window) ",
787     "{",
788     "    ",
789     "    this.project = c.project;",
790     "    this.done = false;",
791     "    this.new_window = new_window;",
792     "    ",
793     "    //if (!this.el) {",
794     "        //this.init();",
795     "     //} ",
796     "     ",
797     "      this.is_new = c.name == \"\";",
798     "",
799     "    _this.name.el.set_text(c.name);",
800     "    _this.title.el.set_text(c.title);",
801     "    _this.parent.el.set_text(c.parent);    ",
802     "    _this.region.el.set_text(c.region);",
803     "    _this.modOrder.el.set_text(c.modOrder);",
804     "    _this.permname.el.set_text(c.permname);",
805     " ",
806     "   _this.gen.el.active = c.gen_extended;",
807     "   ",
808     "",
809     "    ",
810     "    if (this.project.xtype == \"Gtk\") {",
811     "    \tvar p = (Project.Gtk) this.project;",
812     "\t    this.build_module_model.load(p.compilegroups);",
813     "\t    // it will select first if available...",
814     "\t    // only for new files.",
815     "\t    if (!this.is_new) {",
816     "\t\t    this.build_module.setValue(c.build_module);",
817     "\t    }",
818     "    }",
819     "\t     ",
820     "     ",
821     "    _this.file = c;",
822     "   ",
823     "   // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
824     "",
825     "    this.el.set_transient_for(pwin);",
826     "    ",
827     "    // window + header?",
828     "     this.hideAll();",
829     "    this.el.show();",
830     "   // this.name.el.grab_focus();",
831     "    ",
832     "    ",
833     "    if (!this.is_new) {",
834     "\t   this.showEditFile();",
835     "    } else {",
836     "    \tthis.showNewFile();",
837     "\t\t ",
838     "      ",
839     "\t    ",
840     "    }",
841     "    ",
842     "    ",
843     "    //this.success = c.success;",
844     "    ",
845     "    ",
846     "}"
847    ],
848    "| void showEditFile" : [
849     "() {",
850     " \tthis.save_btn.el.set_label(\"Save\");",
851     "\tthis.filetype_lbl.el.hide();",
852     "\tthis.filetype.el.hide();",
853     "\t\t ",
854     "\tvar sel = this.filetype.getValue();",
855     "\tswitch(_this.project.xtype) {",
856     "\t\tcase \"Roo\":\t ",
857     "\t\t\t if (sel == \"bjs\") {",
858     "\t\t\t\t_this.title_lbl.el.show();",
859     "\t\t\t\t_this.title.el.show();",
860     "\t\t\t\t",
861     "\t\t\t\t_this.region_lbl.el.show();",
862     "\t\t\t\t_this.region.el.show();",
863     "\t\t\t\t",
864     "\t\t\t\t_this.parent_lbl.el.show();",
865     "\t\t\t\t_this.parent.el.show();",
866     "\t\t\t\t",
867     "\t\t\t\t_this.permname_lbl.el.show();",
868     "\t\t\t\t_this.permname.el.show();",
869     "\t\t\t\t",
870     "\t\t\t\t_this.modOrder_lbl.el.show();",
871     "\t\t\t\t_this.modOrder.el.show();",
872     "\t\t\t",
873     "\t\t\t}",
874     "\t\t\tbreak;",
875     "\t\tdefault:",
876     "\t\t\t_this.build_module_lbl.el.show();",
877     "\t\t\t_this.build_module.el.show();\t",
878     "\t\t\t",
879     "\t\t\tif (sel == \"bjs\") {",
880     "\t\t\t",
881     "\t\t\t\t _this.gen_lbl.el.show();",
882     "\t\t\t\t_this.gen.el.show();",
883     "\t\t\t}",
884     "\t\t\tbreak;",
885     "\t}",
886     "\tthis.path.el.show();",
887     "\tthis.path_lbl.el.show();",
888     "\tthis.path.el.set_text(_this.file.relpath);",
889     "}"
890    ],
891    "| void showNewFile" : [
892     "() {",
893     " \tthis.save_btn.el.set_label(\"Create\");",
894     " \tthis.hideAll();",
895     " \tthis.filetype.el.show();",
896     "    this.filetype_lbl.el.show();",
897     "    this.filetype_model.load();",
898     "\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
899     " ",
900     "\t    ",
901     "}"
902    ],
903    "| void updateFileFromEntry" : [
904     "() {",
905     "",
906     "        _this.file.title = _this.title.el.get_text();",
907     "        _this.file.region = _this.region.el.get_text();            ",
908     "        _this.file.parent = _this.parent.el.get_text();                        ",
909     "        _this.file.permname = _this.permname.el.get_text();                                    ",
910     "        _this.file.modOrder = _this.modOrder.el.get_text();",
911     "        _this.file.gen_extended = _this.gen.el.active;",
912     "        var new_name =  _this.name.el.get_text();",
913     "        if (_this.file.name.length  > 0 && _this.file.name != new_name) {",
914     "            try {",
915     "            \t_this.file.renameTo( new_name );",
916     "        \t} catch (JsRender.Error e) { } // do nothing?",
917     "        }",
918     "        ",
919     "        _this.file.build_module = _this.build_module.getValue();",
920     "\t\t",
921     "        ",
922     "        ",
923     "",
924     "                                                    ",
925     "}    "
926    ]
927   }
928  ],
929  "name" : "PopoverFileDetails"
930 }