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_name name;
16 public Xcls_title title;
17 public Xcls_region region;
18 public Xcls_parent parent;
19 public Xcls_permname permname;
20 public Xcls_modOrder modOrder;
21 public Xcls_build_module build_module;
22 public Xcls_dbcellrenderer dbcellrenderer;
23 public Xcls_dbmodel dbmodel;
24 public Xcls_save_btn save_btn;
27 public Project.Project project;
28 public JsRender.JsRender file;
31 public Xcls_PopoverFileDetails()
34 this.el = new Gtk.Popover( null );
40 this.el.border_width = 6;
42 this.el.position = Gtk.PositionType.RIGHT;
43 var child_0 = new Xcls_VBox2( _this );
45 this.el.add ( child_0.el );
48 // user defined functions
49 public void show (JsRender.JsRender c, Gtk.Widget btn)
51 this.project = c.project;
59 _this.name.el.set_text(c.name);
60 _this.title.el.set_text(c.title);
61 _this.parent.el.set_text(c.parent);
62 _this.region.el.set_text(c.region);
63 _this.modOrder.el.set_text(c.modOrder);
64 _this.permname.el.set_text(c.permname);
66 if (c.path.length > 0) {
68 this.save_btn.el.set_label("Save");
70 this.save_btn.el.set_label("Create");
73 var ar = new Gee.ArrayList<string>();
74 _this.dbmodel.loadData(ar,"");
75 // load the modules... if relivant..
76 if (this.project.xtype == "Gtk") {
77 var p = (Project.Gtk)c.project;
78 var cg = p.compilegroups;
80 var iter = cg.map_iterator();
82 var key = iter.get_key();
83 if (key == "_default_") {
88 _this.dbmodel.loadData(ar, c.build_module);
94 //console.log('show all');
95 this.el.set_relative_to(btn);
100 //this.success = c.success;
104 public class Xcls_VBox2 : Object
107 private Xcls_PopoverFileDetails _this;
113 public Xcls_VBox2(Xcls_PopoverFileDetails _owner )
116 this.el = new Gtk.VBox( true, 0 );
120 // set gobject values
121 var child_0 = new Xcls_Table3( _this );
123 this.el.pack_start ( child_0.el , false,false,0 );
124 var child_1 = new Xcls_HButtonBox20( _this );
126 this.el.pack_end ( child_1.el , false,false,5 );
129 // user defined functions
131 public class Xcls_Table3 : Object
134 private Xcls_PopoverFileDetails _this;
140 public Xcls_Table3(Xcls_PopoverFileDetails _owner )
143 this.el = new Gtk.Table( 3, 2, true );
147 // set gobject values
148 var child_0 = new Xcls_Label4( _this );
150 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
151 var child_1 = new Xcls_name( _this );
153 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
154 var child_2 = new Xcls_Label6( _this );
156 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
157 var child_3 = new Xcls_title( _this );
159 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
160 var child_4 = new Xcls_Label8( _this );
162 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
163 var child_5 = new Xcls_region( _this );
165 this.el.attach_defaults ( child_5.el , 1,2,2,3 );
166 var child_6 = new Xcls_Label10( _this );
168 this.el.attach_defaults ( child_6.el , 0,1,3,4 );
169 var child_7 = new Xcls_parent( _this );
171 this.el.attach_defaults ( child_7.el , 1,2,3,4 );
172 var child_8 = new Xcls_Label12( _this );
174 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
175 var child_9 = new Xcls_permname( _this );
177 this.el.attach_defaults ( child_9.el , 1,2,4,5 );
178 var child_10 = new Xcls_Label14( _this );
180 this.el.attach_defaults ( child_10.el , 0,1,5,6 );
181 var child_11 = new Xcls_modOrder( _this );
183 this.el.attach_defaults ( child_11.el , 1,2,5,6 );
184 var child_12 = new Xcls_Label16( _this );
186 this.el.attach_defaults ( child_12.el , 0,1,6,7 );
187 var child_13 = new Xcls_build_module( _this );
189 this.el.attach_defaults ( child_13.el , 1,2,6,7 );
192 // user defined functions
194 public class Xcls_Label4 : Object
197 private Xcls_PopoverFileDetails _this;
203 public Xcls_Label4(Xcls_PopoverFileDetails _owner )
206 this.el = new Gtk.Label( "Component Name" );
210 // set gobject values
211 this.el.justify = Gtk.Justification.RIGHT;
212 this.el.xalign = 0.900000f;
215 // user defined functions
217 public class Xcls_name : Object
220 private Xcls_PopoverFileDetails _this;
226 public Xcls_name(Xcls_PopoverFileDetails _owner )
230 this.el = new Gtk.Entry();
234 // set gobject values
235 this.el.visible = true;
238 // user defined functions
240 public class Xcls_Label6 : Object
243 private Xcls_PopoverFileDetails _this;
249 public Xcls_Label6(Xcls_PopoverFileDetails _owner )
252 this.el = new Gtk.Label( "Title" );
256 // set gobject values
257 this.el.justify = Gtk.Justification.RIGHT;
258 this.el.xalign = 0.900000f;
259 this.el.visible = true;
262 // user defined functions
264 public class Xcls_title : Object
267 private Xcls_PopoverFileDetails _this;
273 public Xcls_title(Xcls_PopoverFileDetails _owner )
277 this.el = new Gtk.Entry();
281 // set gobject values
282 this.el.visible = true;
285 // user defined functions
287 public class Xcls_Label8 : Object
290 private Xcls_PopoverFileDetails _this;
296 public Xcls_Label8(Xcls_PopoverFileDetails _owner )
299 this.el = new Gtk.Label( "Region" );
303 // set gobject values
304 this.el.justify = Gtk.Justification.RIGHT;
305 this.el.xalign = 0.900000f;
306 this.el.tooltip_text = "center, north, south, east, west";
307 this.el.visible = true;
310 // user defined functions
312 public class Xcls_region : Object
315 private Xcls_PopoverFileDetails _this;
321 public Xcls_region(Xcls_PopoverFileDetails _owner )
325 this.el = new Gtk.Entry();
329 // set gobject values
330 this.el.visible = true;
333 // user defined functions
335 public class Xcls_Label10 : Object
338 private Xcls_PopoverFileDetails _this;
344 public Xcls_Label10(Xcls_PopoverFileDetails _owner )
347 this.el = new Gtk.Label( "Parent Name" );
351 // set gobject values
352 this.el.justify = Gtk.Justification.RIGHT;
353 this.el.xalign = 0.900000f;
354 this.el.visible = true;
357 // user defined functions
359 public class Xcls_parent : Object
362 private Xcls_PopoverFileDetails _this;
368 public Xcls_parent(Xcls_PopoverFileDetails _owner )
372 this.el = new Gtk.Entry();
376 // set gobject values
377 this.el.visible = true;
380 // user defined functions
382 public class Xcls_Label12 : Object
385 private Xcls_PopoverFileDetails _this;
391 public Xcls_Label12(Xcls_PopoverFileDetails _owner )
394 this.el = new Gtk.Label( "Permission Name" );
398 // set gobject values
399 this.el.justify = Gtk.Justification.RIGHT;
400 this.el.xalign = 0.900000f;
401 this.el.visible = true;
404 // user defined functions
406 public class Xcls_permname : Object
409 private Xcls_PopoverFileDetails _this;
415 public Xcls_permname(Xcls_PopoverFileDetails _owner )
418 _this.permname = this;
419 this.el = new Gtk.Entry();
423 // set gobject values
424 this.el.visible = true;
427 // user defined functions
429 public class Xcls_Label14 : Object
432 private Xcls_PopoverFileDetails _this;
438 public Xcls_Label14(Xcls_PopoverFileDetails _owner )
441 this.el = new Gtk.Label( "Order (for tabs)" );
445 // set gobject values
446 this.el.justify = Gtk.Justification.RIGHT;
447 this.el.xalign = 0.900000f;
448 this.el.visible = true;
451 // user defined functions
453 public class Xcls_modOrder : Object
456 private Xcls_PopoverFileDetails _this;
462 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
465 _this.modOrder = this;
466 this.el = new Gtk.Entry();
470 // set gobject values
471 this.el.visible = true;
474 // user defined functions
476 public class Xcls_Label16 : Object
479 private Xcls_PopoverFileDetails _this;
485 public Xcls_Label16(Xcls_PopoverFileDetails _owner )
488 this.el = new Gtk.Label( "Module to build (Vala only)" );
492 // set gobject values
493 this.el.justify = Gtk.Justification.RIGHT;
494 this.el.xalign = 0.900000f;
495 this.el.visible = true;
498 // user defined functions
500 public class Xcls_build_module : Object
502 public Gtk.ComboBox el;
503 private Xcls_PopoverFileDetails _this;
509 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
512 _this.build_module = this;
513 this.el = new Gtk.ComboBox();
517 // set gobject values
518 var child_0 = new Xcls_dbcellrenderer( _this );
520 this.el.pack_start ( child_0.el , true );
521 var child_1 = new Xcls_dbmodel( _this );
523 this.el.set_model ( child_1.el );
527 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
530 // user defined functions
532 public class Xcls_dbcellrenderer : Object
534 public Gtk.CellRendererText el;
535 private Xcls_PopoverFileDetails _this;
541 public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
544 _this.dbcellrenderer = this;
545 this.el = new Gtk.CellRendererText();
549 // set gobject values
552 // user defined functions
554 public class Xcls_dbmodel : Object
556 public Gtk.ListStore el;
557 private Xcls_PopoverFileDetails _this;
563 public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
566 _this.dbmodel = this;
567 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
571 // set gobject values
574 // user defined functions
575 public void loadData (Gee.ArrayList<string> data, string cur) {
580 /// el.append(out iter);
583 // el.set_value(iter, 0, "");
584 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
589 el.set_value(iter, 0, "");
590 el.set_value(iter, 1, "-- select a module --");
591 _this.build_module.el.set_active_iter(iter);
593 for (var i = 0; i < data.size;i++) {
598 el.set_value(iter, 0, data.get(i));
599 el.set_value(iter, 1, data.get(i));
601 if (data.get(i) == cur) {
602 _this.build_module.el.set_active_iter(iter);
606 this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
610 public class Xcls_HButtonBox20 : Object
612 public Gtk.HButtonBox el;
613 private Xcls_PopoverFileDetails _this;
619 public Xcls_HButtonBox20(Xcls_PopoverFileDetails _owner )
622 this.el = new Gtk.HButtonBox();
626 // set gobject values
627 var child_0 = new Xcls_Button21( _this );
629 this.el.add ( child_0.el );
630 var child_1 = new Xcls_save_btn( _this );
632 this.el.add ( child_1.el );
635 // user defined functions
637 public class Xcls_Button21 : Object
639 public Gtk.Button el;
640 private Xcls_PopoverFileDetails _this;
646 public Xcls_Button21(Xcls_PopoverFileDetails _owner )
649 this.el = new Gtk.Button();
653 // set gobject values
654 this.el.label = "Cancel";
657 this.el.activate.connect( () => { this.el.hide(); });
660 // user defined functions
662 public class Xcls_save_btn : Object
664 public Gtk.Button el;
665 private Xcls_PopoverFileDetails _this;
671 public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
674 _this.save_btn = this;
675 this.el = new Gtk.Button();
679 // set gobject values
680 this.el.label = "Save";
683 this.el.activate.connect( ( ) => {
688 if (_this.name.el.get_text().length < 1) {
689 StandardErrorDialog.show(
691 "You have to set Component name "
696 // what does this do?
698 var isNew = _this.file.name.length > 0 ? false : true;
700 if (!isNew && this.file.name != _this.name.el.get_text()) {
701 Xcls_StandardErrorDialog.singleton().show(
703 "Sorry changing names does not work yet. "
712 // FIXME - this may be more complicated...
713 //for (var i in this.def) {
714 // this.file[i] = this.get(i).el.get_text();
719 this.updateFileFromEntry();
720 } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
721 Xcls_StandardErrorDialog.singleton().show(
723 "The name you used already exists "
734 var fn = this.name.el.get_text();
735 var dir = _this.project.firstPath();
737 if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
738 Xcls_StandardErrorDialog.singleton().show(
740 "That file already exists"
745 var f = JsRender.JsRender.factory(
746 _this.file.project.xtype,
748 dir + "/" + fn + ".bjs");
754 this.updateFileFromEntry();
756 _this.file.project.addFile(_this.file);
765 _this.success(_this.project, _this.file);
770 // user defined functions