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_Box1( _this );
72 this.el.set_child ( child_1.el );
73 var child_2 = new Xcls_HeaderBar28( _this );
75 this.el.titlebar = child_2.el;
78 this.el.close_request.connect( ( ) => {
84 // user defined functions
85 public void onDirChanged () {
86 if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {
87 this.build_module_lbl.el.hide();
88 this.build_module.el.hide();
89 this.name_lbl.el.hide();
92 this.gen_lbl.el.hide();
100 var sel = this.filetype.getValue();
102 if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
103 this.build_module_lbl.el.show();
104 this.build_module.el.show();
106 this.name_lbl.el.show();
110 _this.gen_lbl.el.show();
114 if (this.file.project.xtype == "Roo" && sel == "bjs") {
115 this.title_lbl.el.show();
116 this.title.el.show();
118 this.region_lbl.el.show();
119 this.region.el.show();
121 this.parent_lbl.el.show();
122 this.parent.el.show();
124 this.permname_lbl.el.show();
125 this.permname.el.show();
127 this.modOrder_lbl.el.show();
128 this.modOrder.el.show();
133 public void showEditFile () {
134 this.save_btn.el.set_label("Save");
135 this.filetype_lbl.el.hide();
136 this.filetype.el.hide();
138 var sel = this.filetype.getValue();
139 switch(_this.project.xtype) {
142 _this.title_lbl.el.show();
143 _this.title.el.show();
145 _this.region_lbl.el.show();
146 _this.region.el.show();
148 _this.parent_lbl.el.show();
149 _this.parent.el.show();
151 _this.permname_lbl.el.show();
152 _this.permname.el.show();
154 _this.modOrder_lbl.el.show();
155 _this.modOrder.el.show();
160 _this.build_module_lbl.el.show();
161 _this.build_module.el.show();
165 _this.gen_lbl.el.show();
171 this.path_lbl.el.show();
172 this.path.el.set_text(_this.file.relpath);
174 public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window)
177 this.project = c.project;
179 this.new_window = new_window;
185 this.is_new = c.name == "";
187 _this.name.el.set_text(c.name);
188 _this.title.el.set_text(c.title);
189 _this.parent.el.set_text(c.parent);
190 _this.region.el.set_text(c.region);
191 _this.modOrder.el.set_text(c.modOrder);
192 _this.permname.el.set_text(c.permname);
194 _this.gen.el.active = c.gen_extended;
198 if (this.project.xtype == "Gtk") {
199 var p = (Project.Gtk) this.project;
200 this.build_module_model.load(p.compilegroups);
201 // it will select first if available...
202 // only for new files.
204 this.build_module.setValue(c.build_module);
211 // this.el.set_size_request( 550, 100); // should expand height, but give a min width.
213 this.el.set_transient_for(pwin);
218 // this.name.el.grab_focus();
231 //this.success = c.success;
235 public void updateFileFromEntry () {
237 _this.file.title = _this.title.el.get_text();
238 _this.file.region = _this.region.el.get_text();
239 _this.file.parent = _this.parent.el.get_text();
240 _this.file.permname = _this.permname.el.get_text();
241 _this.file.modOrder = _this.modOrder.el.get_text();
242 _this.file.gen_extended = _this.gen.el.active;
243 var new_name = _this.name.el.get_text();
244 if (_this.file.name.length > 0 && _this.file.name != new_name) {
246 _this.file.renameTo( new_name );
247 } catch (JsRender.Error e) { } // do nothing?
250 _this.file.build_module = _this.build_module.getValue();
257 public void onFileTypeChange () {
258 if (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {
259 this.dir_dropdown.el.hide();
260 this.dir_dropdown_lbl.el.hide();
261 this.build_module_lbl.el.hide();
262 this.build_module.el.hide();
263 this.name_lbl.el.hide();
266 this.gen_lbl.el.hide();
270 this.title_lbl.el.hide();
271 this.title.el.hide();
273 this.region_lbl.el.hide();
274 this.region.el.hide();
276 this.parent_lbl.el.hide();
277 this.parent.el.hide();
279 this.permname_lbl.el.hide();
280 this.permname.el.hide();
282 this.modOrder_lbl.el.hide();
283 this.modOrder.el.hide();
289 this.dir_dropdown.el.show();
290 this.dir_dropdown_lbl.el.show();
291 var sel = this.filetype.getValue();
293 var old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;
294 var olddir = this.dir_dropdown.getValue();
295 GLib.debug("old dir = %s", olddir);
296 if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
297 _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
298 if (old_sel && olddir.has_prefix("/src")) {
299 this.dir_dropdown.setValue(olddir);
301 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
306 _this.project.loadDirsToStringList(_this.dir_model.el, "");
308 this.dir_dropdown.setValue(olddir);
310 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
316 // is this confusing? - should we just strip out / add if necessary..
317 if (sel == "bjs" || sel == "vala" || sel == "js" || sel == "css" || sel == "php") {
318 _this.name_lbl.el.label = "Component Name (Filename with-out extension)";
320 _this.name_lbl.el.label = "File Name (with extension)";
324 public void showNewFile () {
325 this.save_btn.el.set_label("Create");
327 this.filetype.el.show();
328 this.filetype_lbl.el.show();
329 this.filetype_model.load();
330 this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
334 public void hideAll () {
337 this.path_lbl.el.hide();
341 this.name_lbl.el.hide();
344 this.dir_dropdown_lbl.el.hide();
345 this.dir_dropdown.el.hide();
347 this.title_lbl.el.hide();
348 this.title.el.hide();
350 this.region_lbl.el.hide();
351 this.region.el.hide();
353 this.parent_lbl.el.hide();
354 this.parent.el.hide();
356 this.permname_lbl.el.hide();
357 this.permname.el.hide();
359 this.modOrder_lbl.el.hide();
360 this.modOrder.el.hide();
362 this.build_module_lbl.el.hide();
363 this.build_module.el.hide();
365 this.gen_lbl.el.hide();
367 this.filetype_lbl.el.hide();
368 this.filetype.el.hide();
370 public class Xcls_Box1 : Object
373 private Xcls_PopoverFileDetails _this;
379 public Xcls_Box1(Xcls_PopoverFileDetails _owner )
382 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
386 // set gobject values
387 this.el.homogeneous = false;
388 this.el.margin_end = 4;
389 this.el.margin_start = 4;
390 this.el.hexpand = true;
391 this.el.margin_bottom = 4;
392 this.el.margin_top = 4;
393 new Xcls_grid( _this );
394 this.el.append ( _this.grid.el );
397 // user defined functions
399 public class Xcls_grid : Object
402 private Xcls_PopoverFileDetails _this;
408 public Xcls_grid(Xcls_PopoverFileDetails _owner )
412 this.el = new Gtk.Grid();
416 // set gobject values
417 this.el.margin_end = 4;
418 this.el.margin_start = 4;
419 this.el.hexpand = true;
420 this.el.column_spacing = 4;
421 this.el.row_spacing = 2;
422 new Xcls_filetype_lbl( _this );
423 this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
424 new Xcls_filetype( _this );
425 this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
426 new Xcls_dir_dropdown_lbl( _this );
427 this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
428 new Xcls_dir_dropdown( _this );
429 this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
430 new Xcls_name_lbl( _this );
431 this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
432 new Xcls_name( _this );
433 this.el.attach( _this.name.el, 1, 2, 1, 1 );
434 new Xcls_title_lbl( _this );
435 this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
436 new Xcls_title( _this );
437 this.el.attach( _this.title.el, 1, 3, 1, 1 );
438 new Xcls_region_lbl( _this );
439 this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
440 new Xcls_region( _this );
441 this.el.attach( _this.region.el, 1, 4, 1, 1 );
442 new Xcls_parent_lbl( _this );
443 this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
444 new Xcls_parent( _this );
445 this.el.attach( _this.parent.el, 1, 5, 1, 1 );
446 new Xcls_permname_lbl( _this );
447 this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
448 new Xcls_permname( _this );
449 this.el.attach( _this.permname.el, 1, 6, 1, 1 );
450 new Xcls_modOrder_lbl( _this );
451 this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
452 new Xcls_modOrder( _this );
453 this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
454 new Xcls_build_module_lbl( _this );
455 this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
456 new Xcls_build_module( _this );
457 this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
458 new Xcls_path_lbl( _this );
459 this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
460 new Xcls_path( _this );
461 this.el.attach( _this.path.el, 1, 9, 1, 1 );
462 new Xcls_gen_lbl( _this );
463 this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
464 new Xcls_gen( _this );
465 this.el.attach( _this.gen.el, 1, 10, 1, 1 );
468 // user defined functions
469 public void xhideRow (int row)
471 var el = _this.grid.el.get_child_at(0,row);
474 el = _this.grid.el.get_child_at(1,row);
478 public void xshowAllRows () {
479 for (var i = 2; i < 10;i++) {
480 var el = _this.grid.el.get_child_at(0,i);
482 el = _this.grid.el.get_child_at(1,i);
487 public class Xcls_filetype_lbl : Object
490 private Xcls_PopoverFileDetails _this;
496 public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
499 _this.filetype_lbl = this;
500 this.el = new Gtk.Label( "File type" );
504 // set gobject values
505 this.el.justify = Gtk.Justification.RIGHT;
506 this.el.xalign = 0.900000f;
509 // user defined functions
512 public class Xcls_filetype : Object
514 public Gtk.DropDown el;
515 private Xcls_PopoverFileDetails _this;
519 public bool in_showhide;
522 public Xcls_filetype(Xcls_PopoverFileDetails _owner )
525 _this.filetype = this;
526 new Xcls_filetype_model( _this );
527 this.el = new Gtk.DropDown( _this.filetype_model.el, null );
530 this.in_showhide = false;
532 // set gobject values
533 this.el.hexpand = true;
536 this.el.notify["selected"].connect( () => {
538 _this.onFileTypeChange();
543 // user defined functions
544 public string getValue () {
547 return _this.file.xtype != "Plainfile" ? "bjs" : _this.file.file_ext;
550 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
554 return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
556 public void setValue (string cur) {
557 var el = _this.filetype_model.el;
558 for(var i= 0; i < el.get_n_items();i++) {
559 if (el.get_string(i).has_prefix(cur)) {
560 this.el.selected = i;
566 public class Xcls_filetype_model : Object
568 public Gtk.StringList el;
569 private Xcls_PopoverFileDetails _this;
575 public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
578 _this.filetype_model = this;
579 this.el = new Gtk.StringList( {} );
583 // set gobject values
586 // user defined functions
587 public void load () {
590 while (el.get_n_items() > 0) {
593 el.append("bjs - User Interface File");
596 switch(_this.project.xtype) {
598 el.append("js - Javascript File");
599 el.append("css - CSS File");
600 el.append("php - Javascript File");
606 el.append("vala - Vala File");
607 el.append("css - CSS File");
608 el.append("other - Other Type");
621 public class Xcls_dir_dropdown_lbl : Object
624 private Xcls_PopoverFileDetails _this;
630 public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
633 _this.dir_dropdown_lbl = this;
634 this.el = new Gtk.Label( "Create File in this Directory" );
638 // set gobject values
639 this.el.justify = Gtk.Justification.RIGHT;
640 this.el.xalign = 0.900000f;
641 this.el.visible = true;
644 // user defined functions
647 public class Xcls_dir_dropdown : Object
649 public Gtk.DropDown el;
650 private Xcls_PopoverFileDetails _this;
657 public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
660 _this.dir_dropdown = this;
661 new Xcls_dir_model( _this );
662 this.el = new Gtk.DropDown( _this.dir_model.el, null );
667 // set gobject values
670 this.el.notify["selected"].connect( () => {
672 _this.onDirChanged();
679 // user defined functions
680 public string getValue () {
681 return _this.dir_model.el.get_string(this.el.selected);
683 public void setValue (string cur) {
684 var el = _this.dir_model.el;
685 for(var i= 0; i < el.get_n_items();i++) {
686 if (el.get_string(i) == cur) {
687 this.el.selected = i;
693 public class Xcls_dir_model : Object
695 public Gtk.StringList el;
696 private Xcls_PopoverFileDetails _this;
702 public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
705 _this.dir_model = this;
706 this.el = new Gtk.StringList( {} );
710 // set gobject values
713 // user defined functions
717 public class Xcls_name_lbl : Object
720 private Xcls_PopoverFileDetails _this;
726 public Xcls_name_lbl(Xcls_PopoverFileDetails _owner )
729 _this.name_lbl = this;
730 this.el = new Gtk.Label( "Component Name (File name without extension)" );
734 // set gobject values
735 this.el.justify = Gtk.Justification.RIGHT;
736 this.el.xalign = 0.900000f;
739 // user defined functions
742 public class Xcls_name : Object
745 private Xcls_PopoverFileDetails _this;
751 public Xcls_name(Xcls_PopoverFileDetails _owner )
755 this.el = new Gtk.Entry();
759 // set gobject values
760 this.el.hexpand = true;
761 this.el.visible = true;
764 // user defined functions
767 public class Xcls_title_lbl : Object
770 private Xcls_PopoverFileDetails _this;
776 public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
779 _this.title_lbl = this;
780 this.el = new Gtk.Label( "Title" );
784 // set gobject values
785 this.el.justify = Gtk.Justification.RIGHT;
786 this.el.xalign = 0.900000f;
787 this.el.visible = true;
790 // user defined functions
793 public class Xcls_title : Object
796 private Xcls_PopoverFileDetails _this;
802 public Xcls_title(Xcls_PopoverFileDetails _owner )
806 this.el = new Gtk.Entry();
810 // set gobject values
811 this.el.hexpand = true;
812 this.el.visible = true;
815 // user defined functions
818 public class Xcls_region_lbl : Object
821 private Xcls_PopoverFileDetails _this;
827 public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
830 _this.region_lbl = this;
831 this.el = new Gtk.Label( "Region" );
835 // set gobject values
836 this.el.justify = Gtk.Justification.RIGHT;
837 this.el.xalign = 0.900000f;
838 this.el.tooltip_text = "center, north, south, east, west";
839 this.el.visible = true;
842 // user defined functions
845 public class Xcls_region : Object
848 private Xcls_PopoverFileDetails _this;
854 public Xcls_region(Xcls_PopoverFileDetails _owner )
858 this.el = new Gtk.Entry();
862 // set gobject values
863 this.el.hexpand = true;
864 this.el.visible = true;
867 // user defined functions
870 public class Xcls_parent_lbl : Object
873 private Xcls_PopoverFileDetails _this;
879 public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
882 _this.parent_lbl = this;
883 this.el = new Gtk.Label( "Parent Name" );
887 // set gobject values
888 this.el.justify = Gtk.Justification.RIGHT;
889 this.el.xalign = 0.900000f;
890 this.el.visible = true;
893 // user defined functions
896 public class Xcls_parent : Object
899 private Xcls_PopoverFileDetails _this;
905 public Xcls_parent(Xcls_PopoverFileDetails _owner )
909 this.el = new Gtk.Entry();
913 // set gobject values
914 this.el.visible = true;
917 // user defined functions
920 public class Xcls_permname_lbl : Object
923 private Xcls_PopoverFileDetails _this;
929 public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
932 _this.permname_lbl = this;
933 this.el = new Gtk.Label( "Permission Name" );
937 // set gobject values
938 this.el.justify = Gtk.Justification.RIGHT;
939 this.el.xalign = 0.900000f;
940 this.el.visible = true;
943 // user defined functions
946 public class Xcls_permname : Object
949 private Xcls_PopoverFileDetails _this;
955 public Xcls_permname(Xcls_PopoverFileDetails _owner )
958 _this.permname = this;
959 this.el = new Gtk.Entry();
963 // set gobject values
964 this.el.visible = true;
967 // user defined functions
970 public class Xcls_modOrder_lbl : Object
973 private Xcls_PopoverFileDetails _this;
979 public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
982 _this.modOrder_lbl = this;
983 this.el = new Gtk.Label( "Order (for tabs)" );
987 // set gobject values
988 this.el.justify = Gtk.Justification.RIGHT;
989 this.el.xalign = 0.900000f;
990 this.el.visible = true;
993 // user defined functions
996 public class Xcls_modOrder : Object
999 private Xcls_PopoverFileDetails _this;
1005 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
1008 _this.modOrder = this;
1009 this.el = new Gtk.Entry();
1013 // set gobject values
1014 this.el.visible = true;
1017 // user defined functions
1020 public class Xcls_build_module_lbl : Object
1022 public Gtk.Label el;
1023 private Xcls_PopoverFileDetails _this;
1029 public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
1032 _this.build_module_lbl = this;
1033 this.el = new Gtk.Label( "Module to build" );
1037 // set gobject values
1038 this.el.justify = Gtk.Justification.RIGHT;
1039 this.el.xalign = 0.900000f;
1040 this.el.visible = true;
1043 // user defined functions
1046 public class Xcls_build_module : Object
1048 public Gtk.DropDown el;
1049 private Xcls_PopoverFileDetails _this;
1055 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
1058 _this.build_module = this;
1059 new Xcls_build_module_model( _this );
1060 this.el = new Gtk.DropDown( _this.build_module_model.el, null );
1064 // set gobject values
1067 // user defined functions
1068 public string getValue () {
1069 if (this.el.selected < 0) {
1073 return _this.build_module_model.el.get_string(this.el.selected);
1075 public void setValue (string str) {
1076 var m = _this.build_module_model.el;
1077 for(var i = 0; i < m.get_n_items(); i++) {
1078 if (m.get_string(i) == str) {
1079 this.el.selected = i;
1086 public class Xcls_build_module_model : Object
1088 public Gtk.StringList el;
1089 private Xcls_PopoverFileDetails _this;
1095 public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
1098 _this.build_module_model = this;
1099 this.el = new Gtk.StringList( {} );
1103 // set gobject values
1106 // user defined functions
1107 public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
1110 _this.build_module.el.hide();
1111 _this.build_module_lbl.el.hide();
1112 var el = _this.build_module_model.el;
1113 while (el.get_n_items() > 0) {
1117 if (compilegroups == null) {
1120 foreach(var k in compilegroups.keys) {
1123 if (compilegroups.keys.size > 0) {
1124 _this.build_module.el.selected = 0;
1125 _this.build_module.el.show();
1126 _this.build_module_lbl.el.show();
1135 public class Xcls_path_lbl : Object
1137 public Gtk.Label el;
1138 private Xcls_PopoverFileDetails _this;
1145 public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
1148 _this.path_lbl = this;
1149 this.el = new Gtk.Label( "Full path" );
1154 // set gobject values
1155 this.el.justify = Gtk.Justification.RIGHT;
1156 this.el.xalign = 0.900000f;
1157 this.el.visible = true;
1160 // user defined functions
1163 public class Xcls_path : Object
1165 public Gtk.Entry el;
1166 private Xcls_PopoverFileDetails _this;
1173 public Xcls_path(Xcls_PopoverFileDetails _owner )
1177 this.el = new Gtk.Entry();
1182 // set gobject values
1183 this.el.editable = false;
1184 this.el.hexpand = true;
1185 this.el.visible = true;
1188 // user defined functions
1191 public class Xcls_gen_lbl : Object
1193 public Gtk.Label el;
1194 private Xcls_PopoverFileDetails _this;
1201 public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
1204 _this.gen_lbl = this;
1205 this.el = new Gtk.Label( "Generate as Extended (no working)" );
1210 // set gobject values
1211 this.el.justify = Gtk.Justification.RIGHT;
1212 this.el.xalign = 0.900000f;
1213 this.el.visible = true;
1216 // user defined functions
1219 public class Xcls_gen : Object
1221 public Gtk.CheckButton el;
1222 private Xcls_PopoverFileDetails _this;
1228 public Xcls_gen(Xcls_PopoverFileDetails _owner )
1232 this.el = new Gtk.CheckButton();
1236 // set gobject values
1237 this.el.label = "Wrapped";
1240 this.el.toggled.connect( ( ) => {
1242 this.el.label = this.el.active ? "Extended" : "Wrapped";
1247 // user defined functions
1252 public class Xcls_HeaderBar28 : Object
1254 public Gtk.HeaderBar el;
1255 private Xcls_PopoverFileDetails _this;
1261 public Xcls_HeaderBar28(Xcls_PopoverFileDetails _owner )
1264 this.el = new Gtk.HeaderBar();
1268 // set gobject values
1269 this.el.show_title_buttons = false;
1270 var child_1 = new Xcls_Button29( _this );
1272 this.el.pack_start ( child_1.el );
1273 new Xcls_save_btn( _this );
1274 this.el.pack_end ( _this.save_btn.el );
1277 // user defined functions
1279 public class Xcls_Button29 : Object
1281 public Gtk.Button el;
1282 private Xcls_PopoverFileDetails _this;
1288 public Xcls_Button29(Xcls_PopoverFileDetails _owner )
1291 this.el = new Gtk.Button();
1295 // set gobject values
1296 this.el.label = "Cancel";
1299 this.el.clicked.connect( () => {
1305 // user defined functions
1308 public class Xcls_save_btn : Object
1310 public Gtk.Button el;
1311 private Xcls_PopoverFileDetails _this;
1315 public bool always_show_image;
1318 public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1321 _this.save_btn = this;
1322 this.el = new Gtk.Button();
1325 this.always_show_image = true;
1327 // set gobject values
1328 this.el.icon_name = "document-save";
1329 this.el.hexpand = false;
1330 this.el.css_classes = { "suggested-action" };
1331 this.el.label = "Save";
1334 this.el.clicked.connect( ( ) => {
1339 if (_this.name.el.get_text().length < 1) {
1340 var msg = new Adw.MessageDialog(
1341 _this.mainwindow.el,
1343 "You have to set a Component name "
1352 if (!_this.is_new) {
1355 var old_target = _this.file.build_module;
1356 _this.updateFileFromEntry();
1357 if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
1358 var gp = (JsRender.Gtk)_this.file;
1359 gp.updateCompileGroup(old_target, _this.file.build_module);
1368 // ---------------- NEW FILES...
1369 var ftype = _this.filetype.getValue();
1372 // should not happen...
1373 // so we are jut going to return without
1374 Xcls_StandardErrorDialog.singleton().show(
1375 _this.mainwindow.el,
1376 "You must select a file type. "
1383 var fn = _this.name.el.get_text();
1387 //var dir = _this.project.path;
1389 var dir = _this.dir_dropdown.getValue();
1394 var targetfile = _this.project.path;
1398 targetfile += "/" + fn;
1400 // strip the file type off the end..
1403 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1404 fn = rx.replace(targetfile, targetfile.length, 0, "");
1405 } catch (RegexError e) {} // ignore.
1407 targetfile += "." + ext;
1410 if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
1411 Xcls_StandardErrorDialog.singleton().show(
1412 _this.mainwindow.el,
1413 "That file already exists"
1417 JsRender.JsRender f;
1419 f = JsRender.JsRender.factory(
1420 ext == "bjs" ? _this.file.project.xtype : "PlainFile",
1423 } catch (JsRender.Error e) {
1424 Xcls_StandardErrorDialog.singleton().show(
1425 _this.mainwindow.el,
1426 "Error creating file"
1435 _this.updateFileFromEntry();
1436 _this.file.loaded = true;
1438 _this.file.project.addFile(_this.file);
1439 var sel = _this.filetype.getValue();
1440 if (_this.file.project.xtype == "Gtk" &&
1441 _this.file.build_module.length > 0 &&
1442 ( sel == "bjs" || sel == "vala")) {
1444 var pr = (Project.Gtk) _this.file.project;
1445 if (pr.compilegroups.has_key(_this.file.build_module)) {
1446 var cg = pr.compilegroups.get(_this.file.build_module);
1447 if (!cg.sources.contains(_this.file.relpath)) {
1448 cg.sources.add(_this.file.relpath);
1459 // hopefull this will work with bjs files..
1461 _this.success(_this.project, _this.file);
1466 // user defined functions