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 show (JsRender.JsRender c, Gtk.Window pwin, bool new_window)
87 this.project = c.project;
89 this.new_window = new_window;
95 this.is_new = c.name == "";
97 _this.name.el.set_text(c.name);
98 _this.title.el.set_text(c.title);
99 _this.parent.el.set_text(c.parent);
100 _this.region.el.set_text(c.region);
101 _this.modOrder.el.set_text(c.modOrder);
102 _this.permname.el.set_text(c.permname);
104 _this.gen.el.active = c.gen_extended;
108 if (this.project.xtype == "Gtk") {
109 var p = (Project.Gtk) this.project;
110 this.build_module_model.load(p.compilegroups);
111 // it will select first if available...
112 // only for new files.
114 this.build_module.setValue(c.build_module);
121 // this.el.set_size_request( 550, 100); // should expand height, but give a min width.
123 this.el.set_transient_for(pwin);
128 // this.name.el.grab_focus();
132 this.save_btn.el.set_label("Save");
133 this.filetype_lbl.el.hide();
134 this.filetype.el.hide();
135 this.filetype.showhide(); // as we only work on bjs files currently
138 //_this.project.loadDirsToStringList(this.dir_model.el, "");
139 //_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
141 this.save_btn.el.set_label("Create");
142 this.filetype.el.show();
143 this.filetype_lbl.el.show();
144 this.filetype_model.load();
145 this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
146 this.filetype.showhide();
151 //this.success = c.success;
155 public void updateFileFromEntry () {
157 _this.file.title = _this.title.el.get_text();
158 _this.file.region = _this.region.el.get_text();
159 _this.file.parent = _this.parent.el.get_text();
160 _this.file.permname = _this.permname.el.get_text();
161 _this.file.modOrder = _this.modOrder.el.get_text();
162 _this.file.gen_extended = _this.gen.el.active;
163 var new_name = _this.name.el.get_text();
164 if (_this.file.name.length > 0 && _this.file.name != new_name) {
166 _this.file.renameTo( new_name );
167 } catch (JsRender.Error e) { } // do nothing?
170 _this.file.build_module = _this.build_module.getValue();
177 public class Xcls_Box2 : Object
180 private Xcls_PopoverFileDetails _this;
186 public Xcls_Box2(Xcls_PopoverFileDetails _owner )
189 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
193 // set gobject values
194 this.el.homogeneous = false;
195 this.el.margin_end = 4;
196 this.el.margin_start = 4;
197 this.el.hexpand = true;
198 this.el.margin_bottom = 4;
199 this.el.margin_top = 4;
200 new Xcls_grid( _this );
201 this.el.append ( _this.grid.el );
204 // user defined functions
206 public class Xcls_grid : Object
209 private Xcls_PopoverFileDetails _this;
215 public Xcls_grid(Xcls_PopoverFileDetails _owner )
219 this.el = new Gtk.Grid();
223 // set gobject values
224 this.el.margin_end = 4;
225 this.el.margin_start = 4;
226 this.el.hexpand = true;
227 this.el.column_spacing = 4;
228 this.el.row_spacing = 2;
229 new Xcls_filetype_lbl( _this );
230 this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
231 new Xcls_filetype( _this );
232 this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
233 new Xcls_dir_dropdown_lbl( _this );
234 this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
235 new Xcls_dir_dropdown( _this );
236 this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
237 new Xcls_name_lbl( _this );
238 this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
239 new Xcls_name( _this );
240 this.el.attach( _this.name.el, 1, 2, 1, 1 );
241 new Xcls_title_lbl( _this );
242 this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
243 new Xcls_title( _this );
244 this.el.attach ( _this.title.el , 1,2,1,1 );
245 new Xcls_region_lbl( _this );
246 this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
247 new Xcls_region( _this );
248 this.el.attach( _this.region.el, 1, 4, 1, 1 );
249 new Xcls_parent_lbl( _this );
250 this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
251 new Xcls_parent( _this );
252 this.el.attach( _this.parent.el, 1, 5, 1, 1 );
253 new Xcls_permname_lbl( _this );
254 this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
255 new Xcls_permname( _this );
256 this.el.attach( _this.permname.el, 1, 6, 1, 1 );
257 new Xcls_modOrder_lbl( _this );
258 this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
259 new Xcls_modOrder( _this );
260 this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
261 new Xcls_build_module_lbl( _this );
262 this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
263 new Xcls_build_module( _this );
264 this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
265 new Xcls_path_lbl( _this );
266 this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
267 new Xcls_path( _this );
268 this.el.attach( _this.path.el, 1, 9, 1, 1 );
269 new Xcls_gen_lbl( _this );
270 this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
271 new Xcls_gen( _this );
272 this.el.attach( _this.gen.el, 1, 10, 1, 1 );
275 // user defined functions
276 public void xhideRow (int row)
278 var el = _this.grid.el.get_child_at(0,row);
281 el = _this.grid.el.get_child_at(1,row);
285 public void xshowAllRows () {
286 for (var i = 2; i < 10;i++) {
287 var el = _this.grid.el.get_child_at(0,i);
289 el = _this.grid.el.get_child_at(1,i);
294 public class Xcls_filetype_lbl : Object
297 private Xcls_PopoverFileDetails _this;
303 public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
306 _this.filetype_lbl = this;
307 this.el = new Gtk.Label( "File type" );
311 // set gobject values
312 this.el.justify = Gtk.Justification.RIGHT;
313 this.el.xalign = 0.900000f;
316 // user defined functions
319 public class Xcls_filetype : Object
321 public Gtk.DropDown el;
322 private Xcls_PopoverFileDetails _this;
328 public Xcls_filetype(Xcls_PopoverFileDetails _owner )
331 _this.filetype = this;
332 new Xcls_filetype_model( _this );
333 this.el = new Gtk.DropDown( _this.filetype_model.el, null );
337 // set gobject values
338 this.el.hexpand = true;
341 this.el.notify["selected"].connect( () => {
345 // directory is only available for non-bjs
351 // user defined functions
352 public string getValue () {
355 return _this.file.xtype != "Plainfile" ? "bjs" : _this.file.file_ext;
358 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
362 return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
364 public void showhide () {
367 _this.path_lbl.el.hide();
368 _this.path.el.hide();
371 _this.name_lbl.el.hide();
372 _this.name.el.hide();
374 _this.dir_dropdown_lbl.el.hide();
375 _this.dir_dropdown.el.hide();
377 _this.title_lbl.el.hide();
378 _this.title.el.hide();
380 _this.region_lbl.el.hide();
381 _this.region.el.hide();
383 _this.parent_lbl.el.hide();
384 _this.parent.el.hide();
386 _this.permname_lbl.el.hide();
387 _this.permname.el.hide();
389 _this.modOrder_lbl.el.hide();
390 _this.modOrder.el.hide();
392 _this.build_module_lbl.el.hide();
393 _this.build_module.el.hide();
395 _this.gen_lbl.el.hide();
399 var sel = this.getValue();
401 GLib.debug("showhide is new ? %s / sel = '%s'" , _this.is_new ? "YES" :"NO", sel);
404 if (sel == "" && _this.project.xtype == "Gtk") {
409 _this.dir_dropdown_lbl.el.show();
410 _this.dir_dropdown.el.show();
412 _this.name_lbl.el.show();
413 _this.name.el.show();
418 _this.path.el.set_text(_this.file.relpath);
424 switch(_this.project.xtype) {
428 _this.title_lbl.el.show();
429 _this.title.el.show();
431 _this.region_lbl.el.show();
432 _this.region.el.show();
434 _this.parent_lbl.el.show();
435 _this.parent.el.show();
437 _this.permname_lbl.el.show();
438 _this.permname.el.show();
440 _this.modOrder_lbl.el.show();
441 _this.modOrder.el.show();
444 _this.build_module_model.load(null);
450 _this.build_module_lbl.el.show();
451 _this.build_module.el.show();
455 if (sel == "bjs" || sel == "vala") {
456 _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
457 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
458 _this.name_lbl.el.label = "Component Name (Filename with-out extension)";
461 _this.gen_lbl.el.show();
468 _this.project.loadDirsToStringList(_this.dir_model.el, "");
469 _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
470 _this.name_lbl.el.label = "File Name (with extension)";
475 // load up the directories
476 //??? why can we not create bjs files in other directories??
477 //if (!is_bjs && _this.file.path.length < 1) {
486 public void setValue (string cur) {
487 var el = _this.filetype_model.el;
488 for(var i= 0; i < el.get_n_items();i++) {
489 if (el.get_string(i).has_prefix(cur)) {
490 this.el.selected = i;
496 public class Xcls_filetype_model : Object
498 public Gtk.StringList el;
499 private Xcls_PopoverFileDetails _this;
505 public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
508 _this.filetype_model = this;
509 this.el = new Gtk.StringList( {} );
513 // set gobject values
516 // user defined functions
517 public void load () {
520 while (el.get_n_items() > 0) {
523 el.append("bjs - User Interface File");
526 switch(_this.project.xtype) {
528 el.append("js - Javascript File");
529 el.append("css - CSS File");
530 el.append("php - Javascript File");
536 el.append("vala - Vala File");
537 el.append("css - CSS File");
538 el.append("other - Other Type");
551 public class Xcls_dir_dropdown_lbl : Object
554 private Xcls_PopoverFileDetails _this;
560 public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
563 _this.dir_dropdown_lbl = this;
564 this.el = new Gtk.Label( "Create File in this Directory" );
568 // set gobject values
569 this.el.justify = Gtk.Justification.RIGHT;
570 this.el.xalign = 0.900000f;
571 this.el.visible = true;
574 // user defined functions
577 public class Xcls_dir_dropdown : Object
579 public Gtk.DropDown el;
580 private Xcls_PopoverFileDetails _this;
587 public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
590 _this.dir_dropdown = this;
591 new Xcls_dir_model( _this );
592 this.el = new Gtk.DropDown( _this.dir_model.el, null );
597 // set gobject values
600 // user defined functions
601 public string getValue () {
602 return _this.dir_model.el.get_string(this.el.selected);
605 public class Xcls_dir_model : Object
607 public Gtk.StringList el;
608 private Xcls_PopoverFileDetails _this;
614 public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
617 _this.dir_model = this;
618 this.el = new Gtk.StringList( {} );
622 // set gobject values
625 // user defined functions
629 public class Xcls_name_lbl : Object
632 private Xcls_PopoverFileDetails _this;
638 public Xcls_name_lbl(Xcls_PopoverFileDetails _owner )
641 _this.name_lbl = this;
642 this.el = new Gtk.Label( "Component Name (File name without extension)" );
646 // set gobject values
647 this.el.justify = Gtk.Justification.RIGHT;
648 this.el.xalign = 0.900000f;
651 // user defined functions
654 public class Xcls_name : Object
657 private Xcls_PopoverFileDetails _this;
663 public Xcls_name(Xcls_PopoverFileDetails _owner )
667 this.el = new Gtk.Entry();
671 // set gobject values
672 this.el.hexpand = true;
673 this.el.visible = true;
676 // user defined functions
679 public class Xcls_title_lbl : Object
682 private Xcls_PopoverFileDetails _this;
688 public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
691 _this.title_lbl = this;
692 this.el = new Gtk.Label( "Title" );
696 // set gobject values
697 this.el.justify = Gtk.Justification.RIGHT;
698 this.el.xalign = 0.900000f;
699 this.el.visible = true;
702 // user defined functions
705 public class Xcls_title : Object
708 private Xcls_PopoverFileDetails _this;
714 public Xcls_title(Xcls_PopoverFileDetails _owner )
718 this.el = new Gtk.Entry();
722 // set gobject values
723 this.el.hexpand = true;
724 this.el.visible = true;
727 // user defined functions
730 public class Xcls_region_lbl : Object
733 private Xcls_PopoverFileDetails _this;
739 public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
742 _this.region_lbl = this;
743 this.el = new Gtk.Label( "Region" );
747 // set gobject values
748 this.el.justify = Gtk.Justification.RIGHT;
749 this.el.xalign = 0.900000f;
750 this.el.tooltip_text = "center, north, south, east, west";
751 this.el.visible = true;
754 // user defined functions
757 public class Xcls_region : Object
760 private Xcls_PopoverFileDetails _this;
766 public Xcls_region(Xcls_PopoverFileDetails _owner )
770 this.el = new Gtk.Entry();
774 // set gobject values
775 this.el.hexpand = true;
776 this.el.visible = true;
779 // user defined functions
782 public class Xcls_parent_lbl : Object
785 private Xcls_PopoverFileDetails _this;
791 public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
794 _this.parent_lbl = this;
795 this.el = new Gtk.Label( "Parent Name" );
799 // set gobject values
800 this.el.justify = Gtk.Justification.RIGHT;
801 this.el.xalign = 0.900000f;
802 this.el.visible = true;
805 // user defined functions
808 public class Xcls_parent : Object
811 private Xcls_PopoverFileDetails _this;
817 public Xcls_parent(Xcls_PopoverFileDetails _owner )
821 this.el = new Gtk.Entry();
825 // set gobject values
826 this.el.visible = true;
829 // user defined functions
832 public class Xcls_permname_lbl : Object
835 private Xcls_PopoverFileDetails _this;
841 public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
844 _this.permname_lbl = this;
845 this.el = new Gtk.Label( "Permission Name" );
849 // set gobject values
850 this.el.justify = Gtk.Justification.RIGHT;
851 this.el.xalign = 0.900000f;
852 this.el.visible = true;
855 // user defined functions
858 public class Xcls_permname : Object
861 private Xcls_PopoverFileDetails _this;
867 public Xcls_permname(Xcls_PopoverFileDetails _owner )
870 _this.permname = this;
871 this.el = new Gtk.Entry();
875 // set gobject values
876 this.el.visible = true;
879 // user defined functions
882 public class Xcls_modOrder_lbl : Object
885 private Xcls_PopoverFileDetails _this;
891 public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
894 _this.modOrder_lbl = this;
895 this.el = new Gtk.Label( "Order (for tabs)" );
899 // set gobject values
900 this.el.justify = Gtk.Justification.RIGHT;
901 this.el.xalign = 0.900000f;
902 this.el.visible = true;
905 // user defined functions
908 public class Xcls_modOrder : Object
911 private Xcls_PopoverFileDetails _this;
917 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
920 _this.modOrder = this;
921 this.el = new Gtk.Entry();
925 // set gobject values
926 this.el.visible = true;
929 // user defined functions
932 public class Xcls_build_module_lbl : Object
935 private Xcls_PopoverFileDetails _this;
941 public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
944 _this.build_module_lbl = this;
945 this.el = new Gtk.Label( "Module to build" );
949 // set gobject values
950 this.el.justify = Gtk.Justification.RIGHT;
951 this.el.xalign = 0.900000f;
952 this.el.visible = true;
955 // user defined functions
958 public class Xcls_build_module : Object
960 public Gtk.DropDown el;
961 private Xcls_PopoverFileDetails _this;
967 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
970 _this.build_module = this;
971 new Xcls_build_module_model( _this );
972 this.el = new Gtk.DropDown( _this.build_module_model.el, null );
976 // set gobject values
979 // user defined functions
980 public string getValue () {
981 if (this.el.selected < 0) {
985 return _this.build_module_model.el.get_string(this.el.selected);
987 public void setValue (string str) {
988 var m = _this.build_module_model.el;
989 for(var i = 0; i < m.get_n_items(); i++) {
990 if (m.get_string(i) == str) {
991 this.el.selected = i;
998 public class Xcls_build_module_model : Object
1000 public Gtk.StringList el;
1001 private Xcls_PopoverFileDetails _this;
1007 public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
1010 _this.build_module_model = this;
1011 this.el = new Gtk.StringList( {} );
1015 // set gobject values
1018 // user defined functions
1019 public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
1022 _this.build_module.el.hide();
1023 _this.build_module_lbl.el.hide();
1024 var el = _this.build_module_model.el;
1025 while (el.get_n_items() > 0) {
1029 if (compilegroups == null) {
1032 foreach(var k in compilegroups.keys) {
1035 if (compilegroups.keys.size > 0) {
1036 _this.build_module.el.selected = 0;
1037 _this.build_module.el.show();
1038 _this.build_module_lbl.el.show();
1047 public class Xcls_path_lbl : Object
1049 public Gtk.Label el;
1050 private Xcls_PopoverFileDetails _this;
1057 public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
1060 _this.path_lbl = this;
1061 this.el = new Gtk.Label( "Full path" );
1066 // set gobject values
1067 this.el.justify = Gtk.Justification.RIGHT;
1068 this.el.xalign = 0.900000f;
1069 this.el.visible = true;
1072 // user defined functions
1075 public class Xcls_path : Object
1077 public Gtk.Entry el;
1078 private Xcls_PopoverFileDetails _this;
1085 public Xcls_path(Xcls_PopoverFileDetails _owner )
1089 this.el = new Gtk.Entry();
1094 // set gobject values
1095 this.el.editable = false;
1096 this.el.hexpand = true;
1097 this.el.visible = true;
1100 // user defined functions
1103 public class Xcls_gen_lbl : Object
1105 public Gtk.Label el;
1106 private Xcls_PopoverFileDetails _this;
1113 public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
1116 _this.gen_lbl = this;
1117 this.el = new Gtk.Label( "Generate as Extended (no working)" );
1122 // set gobject values
1123 this.el.justify = Gtk.Justification.RIGHT;
1124 this.el.xalign = 0.900000f;
1125 this.el.visible = true;
1128 // user defined functions
1131 public class Xcls_gen : Object
1133 public Gtk.CheckButton el;
1134 private Xcls_PopoverFileDetails _this;
1140 public Xcls_gen(Xcls_PopoverFileDetails _owner )
1144 this.el = new Gtk.CheckButton();
1148 // set gobject values
1149 this.el.label = "Wrapped";
1152 this.el.toggled.connect( ( ) => {
1154 this.el.label = this.el.active ? "Extended" : "Wrapped";
1159 // user defined functions
1164 public class Xcls_HeaderBar29 : Object
1166 public Gtk.HeaderBar el;
1167 private Xcls_PopoverFileDetails _this;
1173 public Xcls_HeaderBar29(Xcls_PopoverFileDetails _owner )
1176 this.el = new Gtk.HeaderBar();
1180 // set gobject values
1181 this.el.show_title_buttons = false;
1182 var child_1 = new Xcls_Button30( _this );
1184 this.el.pack_start ( child_1.el );
1185 new Xcls_save_btn( _this );
1186 this.el.pack_end ( _this.save_btn.el );
1189 // user defined functions
1191 public class Xcls_Button30 : Object
1193 public Gtk.Button el;
1194 private Xcls_PopoverFileDetails _this;
1200 public Xcls_Button30(Xcls_PopoverFileDetails _owner )
1203 this.el = new Gtk.Button();
1207 // set gobject values
1208 this.el.label = "Cancel";
1211 this.el.clicked.connect( () => {
1217 // user defined functions
1220 public class Xcls_save_btn : Object
1222 public Gtk.Button el;
1223 private Xcls_PopoverFileDetails _this;
1227 public bool always_show_image;
1230 public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1233 _this.save_btn = this;
1234 this.el = new Gtk.Button();
1237 this.always_show_image = true;
1239 // set gobject values
1240 this.el.icon_name = "document-save";
1241 this.el.hexpand = false;
1242 this.el.css_classes = { "suggested-action" };
1243 this.el.label = "Save";
1246 this.el.clicked.connect( ( ) => {
1251 if (_this.name.el.get_text().length < 1) {
1252 Xcls_StandardErrorDialog.singleton().show(
1253 _this.mainwindow.el,
1254 "You have to set a Component name "
1259 // what does this do?
1261 var isNew = _this.file.name.length > 0 ? false : true;
1263 if (!isNew && this.file.name != _this.name.el.get_text()) {
1264 Xcls_StandardErrorDialog.singleton().show(
1266 "Sorry changing names does not work yet. "
1274 // FIXME - this may be more complicated...
1275 //for (var i in this.def) {
1276 // this.file[i] = this.get(i).el.get_text();
1282 var old_target = _this.file.build_module;
1283 _this.updateFileFromEntry();
1284 if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
1285 var gp = (JsRender.Gtk)_this.file;
1286 gp.updateCompileGroup(old_target, _this.file.build_module);
1295 // ---------------- NEW FILES...
1296 var ftype = _this.filetype.getValue();
1299 // should not happen...
1300 // so we are jut going to return without
1301 Xcls_StandardErrorDialog.singleton().show(
1302 _this.mainwindow.el,
1303 "You must select a file type. "
1310 var fn = _this.name.el.get_text();
1314 //var dir = _this.project.path;
1316 var dir = _this.dir_dropdown.getValue();
1321 var targetfile = _this.project.path;
1325 targetfile += "/" + fn;
1327 // strip the file type off the end..
1330 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1331 fn = rx.replace(targetfile, targetfile.length, 0, "");
1332 } catch (RegexError e) {} // ignore.
1334 targetfile += "." + ext;
1337 if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
1338 Xcls_StandardErrorDialog.singleton().show(
1339 _this.mainwindow.el,
1340 "That file already exists"
1344 JsRender.JsRender f;
1346 f = JsRender.JsRender.factory(
1347 ext == "bjs" ? _this.file.project.xtype : "PlainFile",
1350 } catch (JsRender.Error e) {
1351 Xcls_StandardErrorDialog.singleton().show(
1352 _this.mainwindow.el,
1353 "Error creating file"
1362 _this.updateFileFromEntry();
1363 _this.file.loaded = true;
1365 _this.file.project.addFile(_this.file);
1373 // hopefull this will work with bjs files..
1375 _this.success(_this.project, _this.file);
1380 // user defined functions