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 );
41 this.el.position = Gtk.PositionType.RIGHT;
42 var child_0 = new Xcls_VBox2( _this );
44 this.el.get_content_area().add ( child_0.el );
47 // user defined functions
48 public void show (JsRender.JsRender c, Gtk.Widget btn)
50 this.project = c.project;
58 _this.name.el.set_text(c.name);
59 _this.title.el.set_text(c.title);
60 _this.parent.el.set_text(c.parent);
61 _this.region.el.set_text(c.region);
62 _this.modOrder.el.set_text(c.modOrder);
63 _this.permname.el.set_text(c.permname);
65 if (c.path.length > 0) {
67 this.save_btn.el.set_label("Save");
69 this.save_btn.el.set_label("Create");
72 var ar = new Gee.ArrayList<string>();
73 _this.dbmodel.loadData(ar,"");
74 // load the modules... if relivant..
75 if (this.project.xtype == "Gtk") {
76 var p = (Project.Gtk)c.project;
77 var cg = p.compilegroups;
79 var iter = cg.map_iterator();
81 var key = iter.get_key();
82 if (key == "_default_") {
87 _this.dbmodel.loadData(ar, c.build_module);
93 //console.log('show all');
94 this.el.set_relative_to(btn);
99 //this.success = c.success;
103 public class Xcls_VBox2 : Object
106 private Xcls_PopoverFileDetails _this;
112 public Xcls_VBox2(Xcls_PopoverFileDetails _owner )
115 this.el = new Gtk.VBox( true, 0 );
119 // set gobject values
120 var child_0 = new Xcls_Table3( _this );
122 this.el.pack_start ( child_0.el , false,false,0 );
123 var child_1 = new Xcls_HButtonBox20( _this );
125 this.el.pack_end ( child_1.el , false,false,5 );
128 // user defined functions
130 public class Xcls_Table3 : Object
133 private Xcls_PopoverFileDetails _this;
139 public Xcls_Table3(Xcls_PopoverFileDetails _owner )
142 this.el = new Gtk.Table( 3, 2, true );
146 // set gobject values
147 var child_0 = new Xcls_Label4( _this );
149 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
150 var child_1 = new Xcls_name( _this );
152 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
153 var child_2 = new Xcls_Label6( _this );
155 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
156 var child_3 = new Xcls_title( _this );
158 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
159 var child_4 = new Xcls_Label8( _this );
161 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
162 var child_5 = new Xcls_region( _this );
164 this.el.attach_defaults ( child_5.el , 1,2,2,3 );
165 var child_6 = new Xcls_Label10( _this );
167 this.el.attach_defaults ( child_6.el , 0,1,3,4 );
168 var child_7 = new Xcls_parent( _this );
170 this.el.attach_defaults ( child_7.el , 1,2,3,4 );
171 var child_8 = new Xcls_Label12( _this );
173 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
174 var child_9 = new Xcls_permname( _this );
176 this.el.attach_defaults ( child_9.el , 1,2,4,5 );
177 var child_10 = new Xcls_Label14( _this );
179 this.el.attach_defaults ( child_10.el , 0,1,5,6 );
180 var child_11 = new Xcls_modOrder( _this );
182 this.el.attach_defaults ( child_11.el , 1,2,5,6 );
183 var child_12 = new Xcls_Label16( _this );
185 this.el.attach_defaults ( child_12.el , 0,1,6,7 );
186 var child_13 = new Xcls_build_module( _this );
188 this.el.attach_defaults ( child_13.el , 1,2,6,7 );
191 // user defined functions
193 public class Xcls_Label4 : Object
196 private Xcls_PopoverFileDetails _this;
202 public Xcls_Label4(Xcls_PopoverFileDetails _owner )
205 this.el = new Gtk.Label( "Component Name" );
209 // set gobject values
210 this.el.justify = Gtk.Justification.RIGHT;
211 this.el.xalign = 0.900000f;
214 // user defined functions
216 public class Xcls_name : Object
219 private Xcls_PopoverFileDetails _this;
225 public Xcls_name(Xcls_PopoverFileDetails _owner )
229 this.el = new Gtk.Entry();
233 // set gobject values
234 this.el.visible = true;
237 // user defined functions
239 public class Xcls_Label6 : Object
242 private Xcls_PopoverFileDetails _this;
248 public Xcls_Label6(Xcls_PopoverFileDetails _owner )
251 this.el = new Gtk.Label( "Title" );
255 // set gobject values
256 this.el.justify = Gtk.Justification.RIGHT;
257 this.el.xalign = 0.900000f;
258 this.el.visible = true;
261 // user defined functions
263 public class Xcls_title : Object
266 private Xcls_PopoverFileDetails _this;
272 public Xcls_title(Xcls_PopoverFileDetails _owner )
276 this.el = new Gtk.Entry();
280 // set gobject values
281 this.el.visible = true;
284 // user defined functions
286 public class Xcls_Label8 : Object
289 private Xcls_PopoverFileDetails _this;
295 public Xcls_Label8(Xcls_PopoverFileDetails _owner )
298 this.el = new Gtk.Label( "Region" );
302 // set gobject values
303 this.el.justify = Gtk.Justification.RIGHT;
304 this.el.xalign = 0.900000f;
305 this.el.tooltip_text = "center, north, south, east, west";
306 this.el.visible = true;
309 // user defined functions
311 public class Xcls_region : Object
314 private Xcls_PopoverFileDetails _this;
320 public Xcls_region(Xcls_PopoverFileDetails _owner )
324 this.el = new Gtk.Entry();
328 // set gobject values
329 this.el.visible = true;
332 // user defined functions
334 public class Xcls_Label10 : Object
337 private Xcls_PopoverFileDetails _this;
343 public Xcls_Label10(Xcls_PopoverFileDetails _owner )
346 this.el = new Gtk.Label( "Parent Name" );
350 // set gobject values
351 this.el.justify = Gtk.Justification.RIGHT;
352 this.el.xalign = 0.900000f;
353 this.el.visible = true;
356 // user defined functions
358 public class Xcls_parent : Object
361 private Xcls_PopoverFileDetails _this;
367 public Xcls_parent(Xcls_PopoverFileDetails _owner )
371 this.el = new Gtk.Entry();
375 // set gobject values
376 this.el.visible = true;
379 // user defined functions
381 public class Xcls_Label12 : Object
384 private Xcls_PopoverFileDetails _this;
390 public Xcls_Label12(Xcls_PopoverFileDetails _owner )
393 this.el = new Gtk.Label( "Permission Name" );
397 // set gobject values
398 this.el.justify = Gtk.Justification.RIGHT;
399 this.el.xalign = 0.900000f;
400 this.el.visible = true;
403 // user defined functions
405 public class Xcls_permname : Object
408 private Xcls_PopoverFileDetails _this;
414 public Xcls_permname(Xcls_PopoverFileDetails _owner )
417 _this.permname = this;
418 this.el = new Gtk.Entry();
422 // set gobject values
423 this.el.visible = true;
426 // user defined functions
428 public class Xcls_Label14 : Object
431 private Xcls_PopoverFileDetails _this;
437 public Xcls_Label14(Xcls_PopoverFileDetails _owner )
440 this.el = new Gtk.Label( "Order (for tabs)" );
444 // set gobject values
445 this.el.justify = Gtk.Justification.RIGHT;
446 this.el.xalign = 0.900000f;
447 this.el.visible = true;
450 // user defined functions
452 public class Xcls_modOrder : Object
455 private Xcls_PopoverFileDetails _this;
461 public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
464 _this.modOrder = this;
465 this.el = new Gtk.Entry();
469 // set gobject values
470 this.el.visible = true;
473 // user defined functions
475 public class Xcls_Label16 : Object
478 private Xcls_PopoverFileDetails _this;
484 public Xcls_Label16(Xcls_PopoverFileDetails _owner )
487 this.el = new Gtk.Label( "Module to build (Vala only)" );
491 // set gobject values
492 this.el.justify = Gtk.Justification.RIGHT;
493 this.el.xalign = 0.900000f;
494 this.el.visible = true;
497 // user defined functions
499 public class Xcls_build_module : Object
501 public Gtk.ComboBox el;
502 private Xcls_PopoverFileDetails _this;
508 public Xcls_build_module(Xcls_PopoverFileDetails _owner )
511 _this.build_module = this;
512 this.el = new Gtk.ComboBox();
516 // set gobject values
517 var child_0 = new Xcls_dbcellrenderer( _this );
519 this.el.pack_start ( child_0.el , true );
520 var child_1 = new Xcls_dbmodel( _this );
522 this.el.set_model ( child_1.el );
526 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
529 // user defined functions
531 public class Xcls_dbcellrenderer : Object
533 public Gtk.CellRendererText el;
534 private Xcls_PopoverFileDetails _this;
540 public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
543 _this.dbcellrenderer = this;
544 this.el = new Gtk.CellRendererText();
548 // set gobject values
551 // user defined functions
553 public class Xcls_dbmodel : Object
555 public Gtk.ListStore el;
556 private Xcls_PopoverFileDetails _this;
562 public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
565 _this.dbmodel = this;
566 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
570 // set gobject values
573 // user defined functions
574 public void loadData (Gee.ArrayList<string> data, string cur) {
579 /// el.append(out iter);
582 // el.set_value(iter, 0, "");
583 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
588 el.set_value(iter, 0, "");
589 el.set_value(iter, 1, "-- select a module --");
590 _this.build_module.el.set_active_iter(iter);
592 for (var i = 0; i < data.size;i++) {
597 el.set_value(iter, 0, data.get(i));
598 el.set_value(iter, 1, data.get(i));
600 if (data.get(i) == cur) {
601 _this.build_module.el.set_active_iter(iter);
605 this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
609 public class Xcls_HButtonBox20 : Object
611 public Gtk.HButtonBox el;
612 private Xcls_PopoverFileDetails _this;
618 public Xcls_HButtonBox20(Xcls_PopoverFileDetails _owner )
621 this.el = new Gtk.HButtonBox();
625 // set gobject values
626 var child_0 = new Xcls_Button21( _this );
628 this.el.add ( child_0.el );
629 var child_1 = new Xcls_save_btn( _this );
631 this.el.add ( child_1.el );
634 // user defined functions
636 public class Xcls_Button21 : Object
638 public Gtk.Button el;
639 private Xcls_PopoverFileDetails _this;
645 public Xcls_Button21(Xcls_PopoverFileDetails _owner )
648 this.el = new Gtk.Button();
652 // set gobject values
653 this.el.label = "Cancel";
656 this.el.activate.connect( () => { this.el.hide(); });
659 // user defined functions
661 public class Xcls_save_btn : Object
663 public Gtk.Button el;
664 private Xcls_PopoverFileDetails _this;
668 public signal void success (Project.Project pr, JsRender.JsRender file);
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