1 static Xcls_PopoverFileDetails _PopoverFileDetails;
3 public class Xcls_PopoverFileDetails : Object
6 private Xcls_PopoverFileDetails _this;
8 public static Xcls_PopoverFileDetails singleton()
10 if (_PopoverFileDetails == null) {
11 _PopoverFileDetails= new Xcls_PopoverFileDetails();
13 return _PopoverFileDetails;
15 public Xcls_grid grid;
16 public Xcls_filetype_lbl filetype_lbl;
17 public Xcls_filetype filetype;
18 public Xcls_filetype_model filetype_model;
19 public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
20 public Xcls_dir_dropdown dir_dropdown;
21 public Xcls_dir_model dir_model;
22 public Xcls_name_lbl name_lbl;
23 public Xcls_name name;
24 public Xcls_title_lbl title_lbl;
25 public Xcls_title title;
26 public Xcls_region_lbl region_lbl;
27 public Xcls_region region;
28 public Xcls_parent_lbl parent_lbl;
29 public Xcls_parent parent;
30 public Xcls_permname_lbl permname_lbl;
31 public Xcls_permname permname;
32 public Xcls_modOrder_lbl modOrder_lbl;
33 public Xcls_modOrder modOrder;
34 public Xcls_build_module_lbl build_module_lbl;
35 public Xcls_build_module build_module;
36 public Xcls_build_module_model build_module_model;
37 public Xcls_path_lbl path_lbl;
38 public Xcls_path path;
39 public Xcls_gen_lbl gen_lbl;
41 public Xcls_save_btn save_btn;
45 public bool new_window;
46 public signal void success (Project.Project pr, JsRender.JsRender file);
47 public JsRender.JsRender file;
48 public Project.Project project;
49 public uint border_width;
51 public Xcls_MainWindow mainwindow;
54 public Xcls_PopoverFileDetails()
57 this.el = new Gtk.Window();
61 this.new_window = true;
63 this.border_width = 0;
65 this.mainwindow = null;
68 this.el.title = "Add / Edit File";
70 var child_1 = new Xcls_Box2( _this );
72 this.el.set_child ( child_1.el );
73 var child_2 = new Xcls_HeaderBar29( _this );
74 this.el.titlebar = child_2.el;
77 this.el.close_request.connect( ( ) => {
83 // user defined functions
84 public void onDirChanged () {
85 if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {
86 this.build_module_lbl.el.hide();
87 this.build_module.el.hide();
88 this.name_lbl.el.hide();
91 this.gen_lbl.el.hide();
99 var sel = this.filetype.getValue();
101 if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
102 this.build_module_lbl.el.show();
103 this.build_module.el.show();
105 this.name_lbl.el.show();
109 _this.gen_lbl.el.show();
113 if (this.file.project.xtype == "Roo" && sel == "bjs") {
114 this.title_lbl.el.show();
115 this.title.el.show();
117 this.region_lbl.el.show();
118 this.region.el.show();
120 this.parent_lbl.el.show();
121 this.parent.el.show();
123 this.permname_lbl.el.show();
124 this.permname.el.show();
126 this.modOrder_lbl.el.show();
127 this.modOrder.el.show();
132 public void showEditFile () {
133 this.save_btn.el.set_label("Save");
134 this.filetype_lbl.el.hide();
135 this.filetype.el.hide();
137 var sel = this.filetype.getValue();
138 switch(_this.project.xtype) {
141 _this.title_lbl.el.show();
142 _this.title.el.show();
144 _this.region_lbl.el.show();
145 _this.region.el.show();
147 _this.parent_lbl.el.show();
148 _this.parent.el.show();
150 _this.permname_lbl.el.show();
151 _this.permname.el.show();
153 _this.modOrder_lbl.el.show();
154 _this.modOrder.el.show();
159 _this.build_module_lbl.el.show();
160 _this.build_module.el.show();
164 _this.gen_lbl.el.show();
170 this.path_lbl.el.show();
171 this.path.el.set_text(_this.file.relpath);
173 public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window)
176 this.project = c.project;
178 this.new_window = new_window;
184 this.is_new = c.name == "";
186 _this.name.el.set_text(c.name);
187 _this.title.el.set_text(c.title);
188 _this.parent.el.set_text(c.parent);
189 _this.region.el.set_text(c.region);
190 _this.modOrder.el.set_text(c.modOrder);
191 _this.permname.el.set_text(c.permname);
193 _this.gen.el.active = c.gen_extended;
197 if (this.project.xtype == "Gtk") {
198 var p = (Project.Gtk) this.project;
199 this.build_module_model.load(p.compilegroups);
200 // it will select first if available...
201 // only for new files.
203 this.build_module.setValue(c.build_module);
210 // this.el.set_size_request( 550, 100); // should expand height, but give a min width.
212 this.el.set_transient_for(pwin);
217 // this.name.el.grab_focus();
230 //this.success = c.success;
234 public void updateFileFromEntry () {
236 _this.file.title = _this.title.el.get_text();
237 _this.file.region = _this.region.el.get_text();
238 _this.file.parent = _this.parent.el.get_text();
239 _this.file.permname = _this.permname.el.get_text();
240 _this.file.modOrder = _this.modOrder.el.get_text();
241 _this.file.gen_extended = _this.gen.el.active;
242 var new_name = _this.name.el.get_text();
243 if (_this.file.name.length > 0 && _this.file.name != new_name) {
245 _this.file.renameTo( new_name );
246 } catch (JsRender.Error e) { } // do nothing?
249 _this.file.build_module = _this.build_module.getValue();
256 public void onFileTypeChange () {
257 if (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {
258 this.dir_dropdown.el.hide();
259 this.dir_dropdown_lbl.el.hide();
260 this.build_module_lbl.el.hide();
261 this.build_module.el.hide();
262 this.name_lbl.el.hide();
265 this.gen_lbl.el.hide();
269 this.title_lbl.el.hide();
270 this.title.el.hide();
272 this.region_lbl.el.hide();
273 this.region.el.hide();
275 this.parent_lbl.el.hide();
276 this.parent.el.hide();
278 this.permname_lbl.el.hide();
279 this.permname.el.hide();
281 this.modOrder_lbl.el.hide();
282 this.modOrder.el.hide();
288 this.dir_dropdown.el.show();
289 this.dir_dropdown_lbl.el.show();
290 var sel = this.filetype.getValue();
292 var old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;
293 var olddir = this.dir_dropdown.getValue();
294 GLib.debug("old dir = %s", olddir);
295 if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
296 _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
297 if (old_sel && olddir.has_prefix("/src")) {
298 this.dir_dropdown.setValue(olddir);
300 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
305 _this.project.loadDirsToStringList(_this.dir_model.el, "");
307 this.dir_dropdown.setValue(olddir);
309 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
315 // is this confusing? - should we just strip out / add if necessary..
316 if (sel == "bjs" || sel == "vala" || sel == "js" || sel == "css" || sel == "php") {
317 _this.name_lbl.el.label = "Component Name (Filename with-out extension)";
319 _this.name_lbl.el.label = "File Name (with extension)";
323 public void showNewFile () {
324 this.save_btn.el.set_label("Create");
326 this.filetype.el.show();
327 this.filetype_lbl.el.show();
328 this.filetype_model.load();
329 this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
333 public void hideAll () {
336 this.path_lbl.el.hide();
340 this.name_lbl.el.hide();
343 this.dir_dropdown_lbl.el.hide();
344 this.dir_dropdown.el.hide();
346 this.title_lbl.el.hide();
347 this.title.el.hide();
349 this.region_lbl.el.hide();
350 this.region.el.hide();
352 this.parent_lbl.el.hide();
353 this.parent.el.hide();
355 this.permname_lbl.el.hide();
356 this.permname.el.hide();
358 this.modOrder_lbl.el.hide();
359 this.modOrder.el.hide();
361 this.build_module_lbl.el.hide();
362 this.build_module.el.hide();
364 this.gen_lbl.el.hide();
366 this.filetype_lbl.el.hide();
367 this.filetype.el.hide();
369 public class Xcls_Box2 : Object
372 private Xcls_PopoverFileDetails _this;
378 public Xcls_Box2(Xcls_PopoverFileDetails _owner )
381 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
385 // set gobject values
386 this.el.homogeneous = false;
387 this.el.margin_end = 4;
388 this.el.margin_start = 4;
389 this.el.hexpand = true;
390 this.el.margin_bottom = 4;
391 this.el.margin_top = 4;
392 new Xcls_grid( _this );
393 this.el.append ( _this.grid.el );
396 // user defined functions
398 public class Xcls_grid : Object
401 private Xcls_PopoverFileDetails _this;
407 public Xcls_grid(Xcls_PopoverFileDetails _owner )
411 this.el = new Gtk.Grid();
415 // set gobject values
416 this.el.margin_end = 4;
417 this.el.margin_start = 4;
418 this.el.hexpand = true;
419 this.el.column_spacing = 4;
420 this.el.row_spacing = 2;
421 new Xcls_filetype_lbl( _this );
422 this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
423 new Xcls_filetype( _this );
424 this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
425 new Xcls_dir_dropdown_lbl( _this );
426 this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
427 new Xcls_dir_dropdown( _this );
428 this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
429 new Xcls_name_lbl( _this );
430 this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
431 new Xcls_name( _this );
432 this.el.attach( _this.name.el, 1, 2, 1, 1 );
433 new Xcls_title_lbl( _this );
434 this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
435 new Xcls_title( _this );
436 this.el.attach ( _this.title.el , 1,2,1,1 );
437 new Xcls_region_lbl( _this );
438 this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
439 new Xcls_region( _this );
440 this.el.attach( _this.region.el, 1, 4, 1, 1 );
441 new Xcls_parent_lbl( _this );
442 this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
443 new Xcls_parent( _this );
444 this.el.attach( _this.parent.el, 1, 5, 1, 1 );
445 new Xcls_permname_lbl( _this );
446 this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
447 new Xcls_permname( _this );
448 this.el.attach( _this.permname.el, 1, 6, 1, 1 );
449 new Xcls_modOrder_lbl( _this );
450 this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
451 new Xcls_modOrder( _this );
452 this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
453 new Xcls_build_module_lbl( _this );
454 this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
455 new Xcls_build_module( _this );
456 this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
457 new Xcls_path_lbl( _this );
458 this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
459 new Xcls_path( _this );
460 this.el.attach( _this.path.el, 1, 9, 1, 1 );
461 new Xcls_gen_lbl( _this );
462 this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
463 new Xcls_gen( _this );
464 this.el.attach( _this.gen.el, 1, 10, 1, 1 );
467 // user defined functions
468 public void xhideRow (int row)
470 var el = _this.grid.el.get_child_at(0,row);
473 el = _this.grid.el.get_child_at(1,row);
477 public void xshowAllRows () {
478 for (var i = 2; i < 10;i++) {
479 var el = _this.grid.el.get_child_at(0,i);
481 el = _this.grid.el.get_child_at(1,i);
486 public class Xcls_filetype_lbl : Object
489 private Xcls_PopoverFileDetails _this;
495 public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
498 _this.filetype_lbl = this;
499 this.el = new Gtk.Label( "File type" );
503 // set gobject values
504 this.el.justify = Gtk.Justification.RIGHT;
505 this.el.xalign = 0.900000f;
508 // user defined functions
511 public class Xcls_filetype : Object
513 public Gtk.DropDown el;
514 private Xcls_PopoverFileDetails _this;
518 public bool in_showhide;
521 public Xcls_filetype(Xcls_PopoverFileDetails _owner )
524 _this.filetype = this;
525 new Xcls_filetype_model( _this );
526 this.el = new Gtk.DropDown( _this.filetype_model.el, null );
529 this.in_showhide = false;
531 // set gobject values
532 this.el.hexpand = true;
535 this.el.notify["selected"].connect( () => {
537 _this.onFileTypeChange();
542 // user defined functions
543 public string getValue () {
546 return _this.file.xtype != "Plainfile" ? "bjs" : _this.file.file_ext;
549 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
553 return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
555 public void setValue (string cur) {
556 var el = _this.filetype_model.el;
557 for(var i= 0; i < el.get_n_items();i++) {
558 if (el.get_string(i).has_prefix(cur)) {
559 this.el.selected = i;
565 public class Xcls_filetype_model : Object
567 public Gtk.StringList el;
568 private Xcls_PopoverFileDetails _this;
574 public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
577 _this.filetype_model = this;
578 this.el = new Gtk.StringList( {} );
582 // set gobject values
585 // user defined functions
586 public void load () {
589 while (el.get_n_items() > 0) {
592 el.append("bjs - User Interface File");
595 switch(_this.project.xtype) {
597 el.append("js - Javascript File");
598 el.append("css - CSS File");
599 el.append("php - Javascript File");
605 el.append("vala - Vala File");
606 el.append("css - CSS File");
607 el.append("other - Other Type");
620 public class Xcls_dir_dropdown_lbl : Object
623 private Xcls_PopoverFileDetails _this;
629 public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
632 _this.dir_dropdown_lbl = this;
633 this.el = new Gtk.Label( "Create File in this Directory" );
637 // set gobject values
638 this.el.justify = Gtk.Justification.RIGHT;
639 this.el.xalign = 0.900000f;
640 this.el.visible = true;
643 // user defined functions
646 public class Xcls_dir_dropdown : Object
648 public Gtk.DropDown el;
649 private Xcls_PopoverFileDetails _this;
656 public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
659 _this.dir_dropdown = this;
660 new Xcls_dir_model( _this );
661 this.el = new Gtk.DropDown( _this.dir_model.el, null );
666 // set gobject values
669 this.el.notify["selected"].connect( () => {
671 _this.onDirChanged();
678 // user defined functions
679 public string getValue () {
680 return _this.dir_model.el.get_string(this.el.selected);
682 public void setValue (string cur) {
683 var el = _this.dir_model.el;
684 for(var i= 0; i < el.get_n_items();i++) {
685 if (el.get_string(i) == cur) {
686 this.el.selected = i;
692 public class Xcls_dir_model : Object
694 public Gtk.StringList el;
695 private Xcls_PopoverFileDetails _this;
701 public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
704 _this.dir_model = this;
705 this.el = new Gtk.StringList( {} );
709 // set gobject values
712 // user defined functions
716 public class Xcls_name_lbl : Object
719 private Xcls_PopoverFileDetails _this;
725 public Xcls_name_lbl(Xcls_PopoverFileDetails _owner )
728 _this.name_lbl = this;
729 this.el = new Gtk.Label( "Component Name (File name without extension)" );
733 // set gobject values
734 this.el.justify = Gtk.Justification.RIGHT;
735 this.el.xalign = 0.900000f;
738 // user defined functions
741 public class Xcls_name : Object
744 private Xcls_PopoverFileDetails _this;
750 public Xcls_name(Xcls_PopoverFileDetails _owner )
754 this.el = new Gtk.Entry();
758 // set gobject values
759 this.el.hexpand = true;
760 this.el.visible = true;
763 // user defined functions
766 public class Xcls_title_lbl : Object
769 private Xcls_PopoverFileDetails _this;
775 public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
778 _this.title_lbl = this;
779 this.el = new Gtk.Label( "Title" );
783 // set gobject values
784 this.el.justify = Gtk.Justification.RIGHT;
785 this.el.xalign = 0.900000f;
786 this.el.visible = true;
789 // user defined functions
792 public class Xcls_title : Object
795 private Xcls_PopoverFileDetails _this;
801 public Xcls_title(Xcls_PopoverFileDetails _owner )
805 this.el = new Gtk.Entry();
809 // set gobject values
810 this.el.hexpand = true;
811 this.el.visible = true;
814 // user defined functions
817 public class Xcls_region_lbl : Object
820 private Xcls_PopoverFileDetails _this;
826 public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
829 _this.region_lbl = this;
830 this.el = new Gtk.Label( "Region" );
834 // set gobject values
835 this.el.justify = Gtk.Justification.RIGHT;
836 this.el.xalign = 0.900000f;
837 this.el.tooltip_text = "center, north, south, east, west";
838 this.el.visible = true;
841 // user defined functions
844 public class Xcls_region : Object
847 private Xcls_PopoverFileDetails _this;
853 public Xcls_region(Xcls_PopoverFileDetails _owner )
857 this.el = new Gtk.Entry();
861 // set gobject values
862 this.el.hexpand = true;
863 this.el.visible = true;
866 // user defined functions
869 public class Xcls_parent_lbl : Object
872 private Xcls_PopoverFileDetails _this;
878 public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
881 _this.parent_lbl = this;
882 this.el = new Gtk.Label( "Parent Name" );
886 // set gobject values
887 this.el.justify = Gtk.Justification.RIGHT;
888 this.el.xalign = 0.900000f;
889 this.el.visible = true;
892 // user defined functions
895 public class Xcls_parent : Object
898 private Xcls_PopoverFileDetails _this;
904 public Xcls_parent(Xcls_PopoverFileDetails _owner )
908 this.el = new Gtk.Entry();
912 // set gobject values
913 this.el.visible = true;
916 // user defined functions
919 public class Xcls_permname_lbl : Object
922 private Xcls_PopoverFileDetails _this;
928 public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
931 _this.permname_lbl = this;
932 this.el = new Gtk.Label( "Permission Name" );
936 // set gobject values
937 this.el.justify = Gtk.Justification.RIGHT;
938 this.el.xalign = 0.900000f;
939 this.el.visible = true;
942 // user defined functions
945 public class Xcls_permname : Object
948 private Xcls_PopoverFileDetails _this;
954 public Xcls_permname(Xcls_PopoverFileDetails _owner )
957 _this.permname = this;
958 this.el = new Gtk.Entry();
962 // set gobject values
963 this.el.visible = true;
966 // user defined functions
969 public class Xcls_modOrder_lbl : Object
972 private Xcls_PopoverFileDetails _this;
978 public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
981 _this.modOrder_lbl = this;
982 this.el = new Gtk.Label( "Order (for tabs)" );
986 // set gobject values
987 this.el.justify = Gtk.Justification.RIGHT;
988 this.el.xalign = 0.900000f;
989 this.el.visible = true;
992 // user defined functions
995 public class Xcls_modOrder : Object
998 private Xcls_PopoverFileDetails _this;
1004 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
1007 _this.modOrder = this;
1008 this.el = new Gtk.Entry();
1012 // set gobject values
1013 this.el.visible = true;
1016 // user defined functions
1019 public class Xcls_build_module_lbl : Object
1021 public Gtk.Label el;
1022 private Xcls_PopoverFileDetails _this;
1028 public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
1031 _this.build_module_lbl = this;
1032 this.el = new Gtk.Label( "Module to build" );
1036 // set gobject values
1037 this.el.justify = Gtk.Justification.RIGHT;
1038 this.el.xalign = 0.900000f;
1039 this.el.visible = true;
1042 // user defined functions
1045 public class Xcls_build_module : Object
1047 public Gtk.DropDown el;
1048 private Xcls_PopoverFileDetails _this;
1054 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
1057 _this.build_module = this;
1058 new Xcls_build_module_model( _this );
1059 this.el = new Gtk.DropDown( _this.build_module_model.el, null );
1063 // set gobject values
1066 // user defined functions
1067 public string getValue () {
1068 if (this.el.selected < 0) {
1072 return _this.build_module_model.el.get_string(this.el.selected);
1074 public void setValue (string str) {
1075 var m = _this.build_module_model.el;
1076 for(var i = 0; i < m.get_n_items(); i++) {
1077 if (m.get_string(i) == str) {
1078 this.el.selected = i;
1085 public class Xcls_build_module_model : Object
1087 public Gtk.StringList el;
1088 private Xcls_PopoverFileDetails _this;
1094 public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
1097 _this.build_module_model = this;
1098 this.el = new Gtk.StringList( {} );
1102 // set gobject values
1105 // user defined functions
1106 public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
1109 _this.build_module.el.hide();
1110 _this.build_module_lbl.el.hide();
1111 var el = _this.build_module_model.el;
1112 while (el.get_n_items() > 0) {
1116 if (compilegroups == null) {
1119 foreach(var k in compilegroups.keys) {
1122 if (compilegroups.keys.size > 0) {
1123 _this.build_module.el.selected = 0;
1124 _this.build_module.el.show();
1125 _this.build_module_lbl.el.show();
1134 public class Xcls_path_lbl : Object
1136 public Gtk.Label el;
1137 private Xcls_PopoverFileDetails _this;
1144 public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
1147 _this.path_lbl = this;
1148 this.el = new Gtk.Label( "Full path" );
1153 // set gobject values
1154 this.el.justify = Gtk.Justification.RIGHT;
1155 this.el.xalign = 0.900000f;
1156 this.el.visible = true;
1159 // user defined functions
1162 public class Xcls_path : Object
1164 public Gtk.Entry el;
1165 private Xcls_PopoverFileDetails _this;
1172 public Xcls_path(Xcls_PopoverFileDetails _owner )
1176 this.el = new Gtk.Entry();
1181 // set gobject values
1182 this.el.editable = false;
1183 this.el.hexpand = true;
1184 this.el.visible = true;
1187 // user defined functions
1190 public class Xcls_gen_lbl : Object
1192 public Gtk.Label el;
1193 private Xcls_PopoverFileDetails _this;
1200 public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
1203 _this.gen_lbl = this;
1204 this.el = new Gtk.Label( "Generate as Extended (no working)" );
1209 // set gobject values
1210 this.el.justify = Gtk.Justification.RIGHT;
1211 this.el.xalign = 0.900000f;
1212 this.el.visible = true;
1215 // user defined functions
1218 public class Xcls_gen : Object
1220 public Gtk.CheckButton el;
1221 private Xcls_PopoverFileDetails _this;
1227 public Xcls_gen(Xcls_PopoverFileDetails _owner )
1231 this.el = new Gtk.CheckButton();
1235 // set gobject values
1236 this.el.label = "Wrapped";
1239 this.el.toggled.connect( ( ) => {
1241 this.el.label = this.el.active ? "Extended" : "Wrapped";
1246 // user defined functions
1251 public class Xcls_HeaderBar29 : Object
1253 public Gtk.HeaderBar el;
1254 private Xcls_PopoverFileDetails _this;
1260 public Xcls_HeaderBar29(Xcls_PopoverFileDetails _owner )
1263 this.el = new Gtk.HeaderBar();
1267 // set gobject values
1268 this.el.show_title_buttons = false;
1269 var child_1 = new Xcls_Button30( _this );
1271 this.el.pack_start ( child_1.el );
1272 new Xcls_save_btn( _this );
1273 this.el.pack_end ( _this.save_btn.el );
1276 // user defined functions
1278 public class Xcls_Button30 : Object
1280 public Gtk.Button el;
1281 private Xcls_PopoverFileDetails _this;
1287 public Xcls_Button30(Xcls_PopoverFileDetails _owner )
1290 this.el = new Gtk.Button();
1294 // set gobject values
1295 this.el.label = "Cancel";
1298 this.el.clicked.connect( () => {
1304 // user defined functions
1307 public class Xcls_save_btn : Object
1309 public Gtk.Button el;
1310 private Xcls_PopoverFileDetails _this;
1314 public bool always_show_image;
1317 public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1320 _this.save_btn = this;
1321 this.el = new Gtk.Button();
1324 this.always_show_image = true;
1326 // set gobject values
1327 this.el.icon_name = "document-save";
1328 this.el.hexpand = false;
1329 this.el.css_classes = { "suggested-action" };
1330 this.el.label = "Save";
1333 this.el.clicked.connect( ( ) => {
1338 if (_this.name.el.get_text().length < 1) {
1339 Xcls_StandardErrorDialog.singleton().show(
1340 _this.mainwindow.el,
1341 "You have to set a Component name "
1348 if (!_this.is_new) {
1351 var old_target = _this.file.build_module;
1352 _this.updateFileFromEntry();
1353 if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
1354 var gp = (JsRender.Gtk)_this.file;
1355 gp.updateCompileGroup(old_target, _this.file.build_module);
1364 // ---------------- NEW FILES...
1365 var ftype = _this.filetype.getValue();
1368 // should not happen...
1369 // so we are jut going to return without
1370 Xcls_StandardErrorDialog.singleton().show(
1371 _this.mainwindow.el,
1372 "You must select a file type. "
1379 var fn = _this.name.el.get_text();
1383 //var dir = _this.project.path;
1385 var dir = _this.dir_dropdown.getValue();
1390 var targetfile = _this.project.path;
1394 targetfile += "/" + fn;
1396 // strip the file type off the end..
1399 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1400 fn = rx.replace(targetfile, targetfile.length, 0, "");
1401 } catch (RegexError e) {} // ignore.
1403 targetfile += "." + ext;
1406 if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
1407 Xcls_StandardErrorDialog.singleton().show(
1408 _this.mainwindow.el,
1409 "That file already exists"
1413 JsRender.JsRender f;
1415 f = JsRender.JsRender.factory(
1416 ext == "bjs" ? _this.file.project.xtype : "PlainFile",
1419 } catch (JsRender.Error e) {
1420 Xcls_StandardErrorDialog.singleton().show(
1421 _this.mainwindow.el,
1422 "Error creating file"
1431 _this.updateFileFromEntry();
1432 _this.file.loaded = true;
1434 _this.file.project.addFile(_this.file);
1435 var sel = _this.filetype.getValue();
1436 if (_this.file.project.xtype == "Gtk" &&
1437 _this.file.build_module.length > 0 &&
1438 ( sel == "bjs" || sel == "vala")) {
1440 var pr = (Project.Gtk) _this.file.project;
1441 if (pr.compilegroups.has_key(_this.file.build_module)) {
1442 var cg = pr.compilegroups.get(_this.file.build_module);
1443 if (!cg.sources.contains(_this.file.relpath)) {
1444 cg.sources.add(_this.file.relpath);
1455 // hopefull this will work with bjs files..
1457 _this.success(_this.project, _this.file);
1462 // user defined functions