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_dir_dropdown_lbl dir_dropdown_lbl;
17 public Xcls_dir_dropdown dir_dropdown;
18 public Xcls_dir_model dir_model;
19 public Xcls_filetype_lbl filetype_lbl;
20 public Xcls_filetype filetype;
21 public Xcls_filetype_model filetype_model;
22 public Xcls_name name;
23 public Xcls_title_lbl title_lbl;
24 public Xcls_title title;
25 public Xcls_region_lbl region_lbl;
26 public Xcls_region region;
27 public Xcls_parent_lbl parent_lbl;
28 public Xcls_parent parent;
29 public Xcls_permname_lbl permname_lbl;
30 public Xcls_permname permname;
31 public Xcls_modOrder_lbl modOrder_lbl;
32 public Xcls_modOrder modOrder;
33 public Xcls_build_module_lbl build_module_lbl;
34 public Xcls_build_module build_module;
35 public Xcls_build_module_model build_module_model;
36 public Xcls_path_lbl path_lbl;
37 public Xcls_path path;
38 public Xcls_gen_lbl gen_lbl;
40 public Xcls_save_btn save_btn;
43 public bool new_window;
44 public signal void success (Project.Project pr, JsRender.JsRender file);
45 public JsRender.JsRender file;
46 public Project.Project project;
47 public uint border_width;
49 public Xcls_MainWindow mainwindow;
52 public Xcls_PopoverFileDetails()
55 this.el = new Gtk.Window();
58 this.new_window = true;
60 this.border_width = 0;
62 this.mainwindow = null;
65 this.el.title = "Add / Edit File";
67 var child_1 = new Xcls_Box2( _this );
69 this.el.set_child ( child_1.el );
70 var child_2 = new Xcls_HeaderBar29( _this );
71 this.el.titlebar = child_2.el;
74 this.el.close_request.connect( ( ) => {
80 // user defined functions
81 public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window)
84 this.project = c.project;
86 this.new_window = new_window;
94 _this.name.el.set_text(c.name);
95 _this.title.el.set_text(c.title);
96 _this.parent.el.set_text(c.parent);
97 _this.region.el.set_text(c.region);
98 _this.modOrder.el.set_text(c.modOrder);
99 _this.permname.el.set_text(c.permname);
101 _this.gen.el.active = c.gen_extended;
103 _this.path_lbl.el.show();
104 _this.path.el.show();
105 _this.dir_dropdown_lbl.el.hide();
106 _this.dir_dropdown.el.hide();
108 _this.path_lbl.el.hide();
109 _this.path.el.hide();
110 this.filetype_model.load();
111 _this.dir_dropdown_lbl.el.show();
112 _this.dir_dropdown.el.show();
115 _this.path.el.set_text(c.relpath);
119 if (this.project.xtype == "Gtk") {
120 var p = (Project.Gtk) this.project;
121 this.build_module_model.load(p.compilegroups);
122 // it will select first if available...
123 // only for new files.
125 this.build_module.setValue(c.build_module);
132 // this.el.set_size_request( 550, 100); // should expand height, but give a min width.
134 this.el.set_transient_for(pwin);
137 print("SHOWALL - POPIP\n");
139 this.name.el.grab_focus();
141 _this.project.loadDirsToStringList(this.dir_model.el);
143 if (c.path.length > 0) {
144 this.save_btn.el.set_label("Save");
145 _this.filetype_lbl.el.hide();
146 _this.filetype.el.hide();
147 _this.filetype.showhide(); // as we only work on bjs files currently
149 this.save_btn.el.set_label("Create");
150 _this.filetype.el.show();
151 _this.filetype_lbl.el.show();
152 _this.filetype.showhide();
156 //this.success = c.success;
160 public void updateFileFromEntry () {
162 _this.file.title = _this.title.el.get_text();
163 _this.file.region = _this.region.el.get_text();
164 _this.file.parent = _this.parent.el.get_text();
165 _this.file.permname = _this.permname.el.get_text();
166 _this.file.modOrder = _this.modOrder.el.get_text();
167 _this.file.gen_extended = _this.gen.el.active;
168 var new_name = _this.name.el.get_text();
169 if (_this.file.name.length > 0 && _this.file.name != new_name) {
171 _this.file.renameTo( new_name );
172 } catch (JsRender.Error e) { } // do nothing?
175 _this.file.build_module = _this.build_module.getValue();
182 public class Xcls_Box2 : Object
185 private Xcls_PopoverFileDetails _this;
191 public Xcls_Box2(Xcls_PopoverFileDetails _owner )
194 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
198 // set gobject values
199 this.el.homogeneous = false;
200 this.el.margin_end = 4;
201 this.el.margin_start = 4;
202 this.el.hexpand = true;
203 this.el.margin_bottom = 4;
204 this.el.margin_top = 4;
205 var child_1 = new Xcls_grid( _this );
206 this.el.append ( child_1.el );
209 // user defined functions
211 public class Xcls_grid : Object
214 private Xcls_PopoverFileDetails _this;
220 public Xcls_grid(Xcls_PopoverFileDetails _owner )
224 this.el = new Gtk.Grid();
228 // set gobject values
229 this.el.margin_end = 4;
230 this.el.margin_start = 4;
231 this.el.hexpand = true;
232 this.el.column_spacing = 4;
233 this.el.row_spacing = 2;
234 var child_1 = new Xcls_dir_dropdown_lbl( _this );
235 this.el.attach( child_1.el, 0, 0, 1, 1 );
236 var child_2 = new Xcls_dir_dropdown( _this );
237 this.el.attach( child_2.el, 1, 0, 1, 1 );
238 var child_3 = new Xcls_filetype_lbl( _this );
239 this.el.attach( child_3.el, 0, 1, 1, 1 );
240 var child_4 = new Xcls_filetype( _this );
241 this.el.attach( child_4.el, 1, 1, 1, 1 );
242 var child_5 = new Xcls_Label10( _this );
244 this.el.attach( child_5.el, 0, 2, 1, 1 );
245 var child_6 = new Xcls_name( _this );
246 this.el.attach( child_6.el, 1, 2, 1, 1 );
247 var child_7 = new Xcls_title_lbl( _this );
248 this.el.attach( child_7.el, 0, 3, 1, 1 );
249 var child_8 = new Xcls_title( _this );
250 this.el.attach ( child_8.el , 1,2,1,1 );
251 var child_9 = new Xcls_region_lbl( _this );
252 this.el.attach( child_9.el, 0, 4, 1, 1 );
253 var child_10 = new Xcls_region( _this );
254 this.el.attach( child_10.el, 1, 4, 1, 1 );
255 var child_11 = new Xcls_parent_lbl( _this );
256 this.el.attach( child_11.el, 0, 5, 1, 1 );
257 var child_12 = new Xcls_parent( _this );
258 this.el.attach( child_12.el, 1, 5, 1, 1 );
259 var child_13 = new Xcls_permname_lbl( _this );
260 this.el.attach( child_13.el, 0, 6, 1, 1 );
261 var child_14 = new Xcls_permname( _this );
262 this.el.attach( child_14.el, 1, 6, 1, 1 );
263 var child_15 = new Xcls_modOrder_lbl( _this );
264 this.el.attach( child_15.el, 0, 7, 1, 1 );
265 var child_16 = new Xcls_modOrder( _this );
266 this.el.attach( child_16.el, 1, 7, 1, 1 );
267 var child_17 = new Xcls_build_module_lbl( _this );
268 this.el.attach( child_17.el, 0, 8, 1, 1 );
269 var child_18 = new Xcls_build_module( _this );
270 this.el.attach( child_18.el, 1, 8, 1, 1 );
271 var child_19 = new Xcls_path_lbl( _this );
272 this.el.attach( child_19.el, 0, 9, 1, 1 );
273 var child_20 = new Xcls_path( _this );
274 this.el.attach( child_20.el, 1, 9, 1, 1 );
275 var child_21 = new Xcls_gen_lbl( _this );
276 this.el.attach( child_21.el, 0, 10, 1, 1 );
277 var child_22 = new Xcls_gen( _this );
278 this.el.attach( child_22.el, 1, 10, 1, 1 );
281 // user defined functions
282 public void showAllRows () {
283 for (var i = 2; i < 10;i++) {
284 var el = _this.grid.el.get_child_at(0,i);
286 el = _this.grid.el.get_child_at(1,i);
290 public void hideRow (int row)
292 var el = _this.grid.el.get_child_at(0,row);
295 el = _this.grid.el.get_child_at(1,row);
300 public class Xcls_dir_dropdown_lbl : Object
303 private Xcls_PopoverFileDetails _this;
309 public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
312 _this.dir_dropdown_lbl = this;
313 this.el = new Gtk.Label( "Create File in this Directory" );
317 // set gobject values
318 this.el.justify = Gtk.Justification.RIGHT;
319 this.el.xalign = 0.900000f;
320 this.el.visible = true;
323 // user defined functions
326 public class Xcls_dir_dropdown : Object
328 public Gtk.DropDown el;
329 private Xcls_PopoverFileDetails _this;
336 public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
339 _this.dir_dropdown = this;
340 var child_1 = new Xcls_dir_model( _this );
341 this.el = new Gtk.DropDown( child_1.el, null );
346 // set gobject values
349 // user defined functions
350 public string getValue () {
351 return _this.dir_model.el.get_string(this.el.selected);
354 public class Xcls_dir_model : Object
356 public Gtk.StringList el;
357 private Xcls_PopoverFileDetails _this;
363 public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
366 _this.dir_model = this;
367 this.el = new Gtk.StringList( {} );
371 // set gobject values
374 // user defined functions
378 public class Xcls_filetype_lbl : Object
381 private Xcls_PopoverFileDetails _this;
387 public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
390 _this.filetype_lbl = this;
391 this.el = new Gtk.Label( "File type" );
395 // set gobject values
396 this.el.justify = Gtk.Justification.RIGHT;
397 this.el.xalign = 0.900000f;
400 // user defined functions
403 public class Xcls_filetype : Object
405 public Gtk.DropDown el;
406 private Xcls_PopoverFileDetails _this;
412 public Xcls_filetype(Xcls_PopoverFileDetails _owner )
415 _this.filetype = this;
416 var child_1 = new Xcls_filetype_model( _this );
417 this.el = new Gtk.DropDown( child_1.el, null );
421 // set gobject values
422 this.el.hexpand = true;
425 this.el.notify["selected"].connect( () => {
429 // directory is only available for non-bjs
435 // user defined functions
436 public string getValue () {
437 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
441 return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
443 public void showhide () {
448 _this.title_lbl.el.hide();
449 _this.title.el.hide();
451 _this.region_lbl.el.hide();
452 _this.region.el.hide();
454 _this.parent_lbl.el.hide();
455 _this.parent.el.hide();
457 _this.permname_lbl.el.hide();
458 _this.permname.el.hide();
460 _this.modOrder_lbl.el.hide();
461 _this.modOrder.el.hide();
463 _this.build_module_lbl.el.hide();
464 _this.build_module.el.hide();
466 _this.gen_lbl.el.hide();
469 var sel = this.getValue();
471 switch(_this.project.xtype) {
475 _this.title_lbl.el.show();
476 _this.title.el.show();
478 _this.region_lbl.el.show();
479 _this.region.el.show();
481 _this.parent_lbl.el.show();
482 _this.parent.el.show();
484 _this.permname_lbl.el.show();
485 _this.permname.el.show();
487 _this.modOrder_lbl.el.show();
488 _this.modOrder.el.show();
491 _this.build_module_model.load(null);
497 _this.build_module_lbl.el.show();
498 _this.build_module.el.show();
500 _this.gen_lbl.el.show();
506 // load up the directories
507 //??? why can we not create bjs files in other directories??
508 //if (!is_bjs && _this.file.path.length < 1) {
517 public void setValue (string cur) {
518 var el = _this.filetype_model.el;
519 for(var i= 0; i < el.get_n_items();i++) {
520 if (el.get_string(i).has_prefix(cur)) {
521 this.el.selected = i;
527 public class Xcls_filetype_model : Object
529 public Gtk.StringList el;
530 private Xcls_PopoverFileDetails _this;
536 public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
539 _this.filetype_model = this;
540 this.el = new Gtk.StringList( {} );
544 // set gobject values
547 // user defined functions
548 public void load () {
551 while (el.get_n_items() > 0) {
554 el.append("bjs - User Interface File");
557 switch(_this.project.xtype) {
559 el.append("js - Javascript File");
560 el.append("css - CSS File");
561 el.append("php - Javascript File");
567 el.append("vala - Vala File");
568 el.append("css - CSS File");
569 el.append("other - Other Type");
582 public class Xcls_Label10 : Object
585 private Xcls_PopoverFileDetails _this;
591 public Xcls_Label10(Xcls_PopoverFileDetails _owner )
594 this.el = new Gtk.Label( "Component Name (File name without extension)" );
598 // set gobject values
599 this.el.justify = Gtk.Justification.RIGHT;
600 this.el.xalign = 0.900000f;
603 // user defined functions
606 public class Xcls_name : Object
609 private Xcls_PopoverFileDetails _this;
615 public Xcls_name(Xcls_PopoverFileDetails _owner )
619 this.el = new Gtk.Entry();
623 // set gobject values
624 this.el.hexpand = true;
625 this.el.visible = true;
628 // user defined functions
631 public class Xcls_title_lbl : Object
634 private Xcls_PopoverFileDetails _this;
640 public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
643 _this.title_lbl = this;
644 this.el = new Gtk.Label( "Title" );
648 // set gobject values
649 this.el.justify = Gtk.Justification.RIGHT;
650 this.el.xalign = 0.900000f;
651 this.el.visible = true;
654 // user defined functions
657 public class Xcls_title : Object
660 private Xcls_PopoverFileDetails _this;
666 public Xcls_title(Xcls_PopoverFileDetails _owner )
670 this.el = new Gtk.Entry();
674 // set gobject values
675 this.el.hexpand = true;
676 this.el.visible = true;
679 // user defined functions
682 public class Xcls_region_lbl : Object
685 private Xcls_PopoverFileDetails _this;
691 public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
694 _this.region_lbl = this;
695 this.el = new Gtk.Label( "Region" );
699 // set gobject values
700 this.el.justify = Gtk.Justification.RIGHT;
701 this.el.xalign = 0.900000f;
702 this.el.tooltip_text = "center, north, south, east, west";
703 this.el.visible = true;
706 // user defined functions
709 public class Xcls_region : Object
712 private Xcls_PopoverFileDetails _this;
718 public Xcls_region(Xcls_PopoverFileDetails _owner )
722 this.el = new Gtk.Entry();
726 // set gobject values
727 this.el.hexpand = true;
728 this.el.visible = true;
731 // user defined functions
734 public class Xcls_parent_lbl : Object
737 private Xcls_PopoverFileDetails _this;
743 public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
746 _this.parent_lbl = this;
747 this.el = new Gtk.Label( "Parent Name" );
751 // set gobject values
752 this.el.justify = Gtk.Justification.RIGHT;
753 this.el.xalign = 0.900000f;
754 this.el.visible = true;
757 // user defined functions
760 public class Xcls_parent : Object
763 private Xcls_PopoverFileDetails _this;
769 public Xcls_parent(Xcls_PopoverFileDetails _owner )
773 this.el = new Gtk.Entry();
777 // set gobject values
778 this.el.visible = true;
781 // user defined functions
784 public class Xcls_permname_lbl : Object
787 private Xcls_PopoverFileDetails _this;
793 public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
796 _this.permname_lbl = this;
797 this.el = new Gtk.Label( "Permission Name" );
801 // set gobject values
802 this.el.justify = Gtk.Justification.RIGHT;
803 this.el.xalign = 0.900000f;
804 this.el.visible = true;
807 // user defined functions
810 public class Xcls_permname : Object
813 private Xcls_PopoverFileDetails _this;
819 public Xcls_permname(Xcls_PopoverFileDetails _owner )
822 _this.permname = this;
823 this.el = new Gtk.Entry();
827 // set gobject values
828 this.el.visible = true;
831 // user defined functions
834 public class Xcls_modOrder_lbl : Object
837 private Xcls_PopoverFileDetails _this;
843 public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
846 _this.modOrder_lbl = this;
847 this.el = new Gtk.Label( "Order (for tabs)" );
851 // set gobject values
852 this.el.justify = Gtk.Justification.RIGHT;
853 this.el.xalign = 0.900000f;
854 this.el.visible = true;
857 // user defined functions
860 public class Xcls_modOrder : Object
863 private Xcls_PopoverFileDetails _this;
869 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
872 _this.modOrder = this;
873 this.el = new Gtk.Entry();
877 // set gobject values
878 this.el.visible = true;
881 // user defined functions
884 public class Xcls_build_module_lbl : Object
887 private Xcls_PopoverFileDetails _this;
893 public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
896 _this.build_module_lbl = this;
897 this.el = new Gtk.Label( "Module to build" );
901 // set gobject values
902 this.el.justify = Gtk.Justification.RIGHT;
903 this.el.xalign = 0.900000f;
904 this.el.visible = true;
907 // user defined functions
910 public class Xcls_build_module : Object
912 public Gtk.DropDown el;
913 private Xcls_PopoverFileDetails _this;
919 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
922 _this.build_module = this;
923 var child_1 = new Xcls_build_module_model( _this );
924 this.el = new Gtk.DropDown( child_1.el, null );
928 // set gobject values
931 // user defined functions
932 public string getValue () {
933 if (this.el.selected < 0) {
937 return _this.build_module_model.el.get_string(this.el.selected);
939 public void setValue (string str) {
940 var m = _this.build_module_model.el;
941 for(var i = 0; i < m.get_n_items(); i++) {
942 if (m.get_string(i) == str) {
943 this.el.selected = i;
950 public class Xcls_build_module_model : Object
952 public Gtk.StringList el;
953 private Xcls_PopoverFileDetails _this;
959 public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
962 _this.build_module_model = this;
963 this.el = new Gtk.StringList( {} );
967 // set gobject values
970 // user defined functions
971 public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
974 _this.build_module.el.hide();
975 _this.build_module_lbl.el.hide();
976 var el = _this.build_module_model.el;
977 while (el.get_n_items() > 0) {
981 if (compilegroups == null) {
984 foreach(var k in compilegroups.keys) {
987 if (compilegroups.keys.size > 0) {
988 _this.build_module.el.selected = 0;
989 _this.build_module.el.show();
990 _this.build_module_lbl.el.show();
999 public class Xcls_path_lbl : Object
1001 public Gtk.Label el;
1002 private Xcls_PopoverFileDetails _this;
1009 public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
1012 _this.path_lbl = this;
1013 this.el = new Gtk.Label( "Full path" );
1018 // set gobject values
1019 this.el.justify = Gtk.Justification.RIGHT;
1020 this.el.xalign = 0.900000f;
1021 this.el.visible = true;
1024 // user defined functions
1027 public class Xcls_path : Object
1029 public Gtk.Entry el;
1030 private Xcls_PopoverFileDetails _this;
1037 public Xcls_path(Xcls_PopoverFileDetails _owner )
1041 this.el = new Gtk.Entry();
1046 // set gobject values
1047 this.el.editable = false;
1048 this.el.hexpand = true;
1049 this.el.visible = true;
1052 // user defined functions
1055 public class Xcls_gen_lbl : Object
1057 public Gtk.Label el;
1058 private Xcls_PopoverFileDetails _this;
1065 public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
1068 _this.gen_lbl = this;
1069 this.el = new Gtk.Label( "Generate as Extended (experimental)" );
1074 // set gobject values
1075 this.el.justify = Gtk.Justification.RIGHT;
1076 this.el.xalign = 0.900000f;
1077 this.el.visible = true;
1080 // user defined functions
1083 public class Xcls_gen : Object
1085 public Gtk.CheckButton el;
1086 private Xcls_PopoverFileDetails _this;
1092 public Xcls_gen(Xcls_PopoverFileDetails _owner )
1096 this.el = new Gtk.CheckButton();
1100 // set gobject values
1101 this.el.label = "Wrapped";
1104 this.el.toggled.connect( ( ) => {
1106 this.el.label = this.el.active ? "Extended" : "Wrapped";
1111 // user defined functions
1116 public class Xcls_HeaderBar29 : Object
1118 public Gtk.HeaderBar el;
1119 private Xcls_PopoverFileDetails _this;
1125 public Xcls_HeaderBar29(Xcls_PopoverFileDetails _owner )
1128 this.el = new Gtk.HeaderBar();
1132 // set gobject values
1133 this.el.show_title_buttons = false;
1134 var child_1 = new Xcls_Button30( _this );
1136 this.el.pack_start ( child_1.el );
1137 var child_2 = new Xcls_save_btn( _this );
1138 this.el.pack_end ( child_2.el );
1141 // user defined functions
1143 public class Xcls_Button30 : Object
1145 public Gtk.Button el;
1146 private Xcls_PopoverFileDetails _this;
1152 public Xcls_Button30(Xcls_PopoverFileDetails _owner )
1155 this.el = new Gtk.Button();
1159 // set gobject values
1160 this.el.label = "Cancel";
1163 this.el.clicked.connect( () => {
1169 // user defined functions
1172 public class Xcls_save_btn : Object
1174 public Gtk.Button el;
1175 private Xcls_PopoverFileDetails _this;
1179 public bool always_show_image;
1182 public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1185 _this.save_btn = this;
1186 this.el = new Gtk.Button();
1189 this.always_show_image = true;
1191 // set gobject values
1192 this.el.icon_name = "document-save";
1193 this.el.hexpand = false;
1194 this.el.css_classes = { "suggested-action" };
1195 this.el.label = "Save";
1198 this.el.clicked.connect( ( ) => {
1203 if (_this.name.el.get_text().length < 1) {
1204 Xcls_StandardErrorDialog.singleton().show(
1205 _this.mainwindow.el,
1206 "You have to set a Component name "
1211 // what does this do?
1213 var isNew = _this.file.name.length > 0 ? false : true;
1215 if (!isNew && this.file.name != _this.name.el.get_text()) {
1216 Xcls_StandardErrorDialog.singleton().show(
1218 "Sorry changing names does not work yet. "
1226 // FIXME - this may be more complicated...
1227 //for (var i in this.def) {
1228 // this.file[i] = this.get(i).el.get_text();
1234 var old_target = _this.file.build_module;
1235 _this.updateFileFromEntry();
1236 if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
1237 var gp = (JsRender.Gtk)_this.file;
1238 gp.updateCompileGroup(old_target, _this.file.build_module);
1247 // ---------------- NEW FILES...
1248 var ftype = _this.filetype.getValue();
1251 // should not happen...
1252 // so we are jut going to return without
1253 Xcls_StandardErrorDialog.singleton().show(
1254 _this.mainwindow.el,
1255 "You must select a file type. "
1262 var fn = _this.name.el.get_text();
1266 //var dir = _this.project.path;
1268 var dir = _this.dir_dropdown.getValue();
1273 var targetfile = _this.project.path;
1277 targetfile += "/" + fn;
1279 // strip the file type off the end..
1282 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1283 fn = rx.replace(targetfile, targetfile.length, 0, "");
1284 } catch (RegexError e) {} // ignore.
1286 targetfile += "." + ext;
1289 if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
1290 Xcls_StandardErrorDialog.singleton().show(
1291 _this.mainwindow.el,
1292 "That file already exists"
1296 JsRender.JsRender f;
1298 f = JsRender.JsRender.factory(
1299 ext == "bjs" ? _this.file.project.xtype : "PlainFile",
1302 } catch (JsRender.Error e) {
1303 Xcls_StandardErrorDialog.singleton().show(
1304 _this.mainwindow.el,
1305 "Error creating file"
1314 _this.updateFileFromEntry();
1315 _this.file.loaded = true;
1317 _this.file.project.addFile(_this.file);
1325 // hopefull this will work with bjs files..
1327 _this.success(_this.project, _this.file);
1332 // user defined functions