1 static Xcls_DialogNewComponent _DialogNewComponent;
3 public class Xcls_DialogNewComponent : Object
6 private Xcls_DialogNewComponent _this;
8 public static Xcls_DialogNewComponent singleton()
10 if (_DialogNewComponent == null) {
11 _DialogNewComponent= new Xcls_DialogNewComponent();
13 return _DialogNewComponent;
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;
26 public signal void success (Project.Project pr, JsRender.JsRender file);
27 public Project.Project project;
28 public JsRender.JsRender file;
31 public Xcls_DialogNewComponent()
34 this.el = new Gtk.Dialog();
40 this.el.title = "New Component";
41 this.el.default_height = 200;
42 this.el.default_width = 500;
43 this.el.deletable = true;
45 var child_0 = new Xcls_VBox2( _this );
47 this.el.get_content_area().add ( child_0.el );
48 var child_1 = new Xcls_Button20( _this );
50 this.el.add_action_widget ( child_1.el , 0 );
51 var child_2 = new Xcls_Button21( _this );
53 this.el.add_action_widget ( child_2.el , 1 );
56 this.el.delete_event.connect( (self, event) => {
61 this.el.response.connect( (self, response_id) => {
65 this.el.show.connect( (self) => {
71 // user defined functions
72 public void updateFileFromEntry () {
74 _this.file.title = _this.title.el.get_text();
75 _this.file.region = _this.region.el.get_text();
76 _this.file.parent = _this.parent.el.get_text();
77 _this.file.permname = _this.permname.el.get_text();
78 _this.file.modOrder = _this.modOrder.el.get_text();
80 if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
81 _this.file.renameTo(_this.name.el.get_text());
83 // store the module...
84 _this.file.build_module = "";
86 if (_this.build_module.el.get_active_iter (out iter)) {
88 this.dbmodel.el.get_value (iter, 0, out vfname);
89 if (((string)vfname).length > 0) {
90 _this.file.build_module = (string)vfname;
99 public void show (JsRender.JsRender c)
101 this.project = c.project;
107 _this.name.el.set_text(c.name);
108 _this.title.el.set_text(c.title);
109 _this.parent.el.set_text(c.parent);
110 _this.region.el.set_text(c.region);
111 _this.modOrder.el.set_text(c.modOrder);
112 _this.permname.el.set_text(c.permname);
114 if (c.path.length > 0) {
115 this.el.set_title("Edit File Details - " + c.name);
117 this.el.set_title("Create New File");
120 var ar = new Gee.ArrayList<string>();
121 _this.dbmodel.loadData(ar,"");
122 // load the modules... if relivant..
123 if (this.project.xtype == "Gtk") {
124 var p = (Project.Gtk)c.project;
125 var cg = p.compilegroups;
127 var iter = cg.map_iterator();
129 var key = iter.get_key();
130 if (key == "_default_") {
135 _this.dbmodel.loadData(ar, c.build_module);
141 //console.log('show all');
144 //this.success = c.success;
148 public class Xcls_VBox2 : Object
151 private Xcls_DialogNewComponent _this;
157 public Xcls_VBox2(Xcls_DialogNewComponent _owner )
160 this.el = new Gtk.VBox( true, 0 );
164 // set gobject values
165 var child_0 = new Xcls_Table3( _this );
167 this.el.pack_start ( child_0.el , false,false,0 );
170 // user defined functions
172 public class Xcls_Table3 : Object
175 private Xcls_DialogNewComponent _this;
181 public Xcls_Table3(Xcls_DialogNewComponent _owner )
184 this.el = new Gtk.Table( 3, 2, true );
188 // set gobject values
189 var child_0 = new Xcls_Label4( _this );
191 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
192 var child_1 = new Xcls_name( _this );
194 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
195 var child_2 = new Xcls_Label6( _this );
197 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
198 var child_3 = new Xcls_title( _this );
200 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
201 var child_4 = new Xcls_Label8( _this );
203 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
204 var child_5 = new Xcls_region( _this );
206 this.el.attach_defaults ( child_5.el , 1,2,2,3 );
207 var child_6 = new Xcls_Label10( _this );
209 this.el.attach_defaults ( child_6.el , 0,1,3,4 );
210 var child_7 = new Xcls_parent( _this );
212 this.el.attach_defaults ( child_7.el , 1,2,3,4 );
213 var child_8 = new Xcls_Label12( _this );
215 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
216 var child_9 = new Xcls_permname( _this );
218 this.el.attach_defaults ( child_9.el , 1,2,4,5 );
219 var child_10 = new Xcls_Label14( _this );
221 this.el.attach_defaults ( child_10.el , 0,1,5,6 );
222 var child_11 = new Xcls_modOrder( _this );
224 this.el.attach_defaults ( child_11.el , 1,2,5,6 );
225 var child_12 = new Xcls_Label16( _this );
227 this.el.attach_defaults ( child_12.el , 0,1,6,7 );
228 var child_13 = new Xcls_build_module( _this );
230 this.el.attach_defaults ( child_13.el , 1,2,6,7 );
233 // user defined functions
235 public class Xcls_Label4 : Object
238 private Xcls_DialogNewComponent _this;
244 public Xcls_Label4(Xcls_DialogNewComponent _owner )
247 this.el = new Gtk.Label( "Component Name" );
251 // set gobject values
252 this.el.justify = Gtk.Justification.RIGHT;
253 this.el.xalign = 0.900000f;
256 // user defined functions
259 public class Xcls_name : Object
262 private Xcls_DialogNewComponent _this;
268 public Xcls_name(Xcls_DialogNewComponent _owner )
272 this.el = new Gtk.Entry();
276 // set gobject values
277 this.el.visible = true;
280 // user defined functions
283 public class Xcls_Label6 : Object
286 private Xcls_DialogNewComponent _this;
292 public Xcls_Label6(Xcls_DialogNewComponent _owner )
295 this.el = new Gtk.Label( "Title" );
299 // set gobject values
300 this.el.justify = Gtk.Justification.RIGHT;
301 this.el.xalign = 0.900000f;
302 this.el.visible = true;
305 // user defined functions
308 public class Xcls_title : Object
311 private Xcls_DialogNewComponent _this;
317 public Xcls_title(Xcls_DialogNewComponent _owner )
321 this.el = new Gtk.Entry();
325 // set gobject values
326 this.el.visible = true;
329 // user defined functions
332 public class Xcls_Label8 : Object
335 private Xcls_DialogNewComponent _this;
341 public Xcls_Label8(Xcls_DialogNewComponent _owner )
344 this.el = new Gtk.Label( "Region" );
348 // set gobject values
349 this.el.justify = Gtk.Justification.RIGHT;
350 this.el.xalign = 0.900000f;
351 this.el.tooltip_text = "center, north, south, east, west";
352 this.el.visible = true;
355 // user defined functions
358 public class Xcls_region : Object
361 private Xcls_DialogNewComponent _this;
367 public Xcls_region(Xcls_DialogNewComponent _owner )
371 this.el = new Gtk.Entry();
375 // set gobject values
376 this.el.visible = true;
379 // user defined functions
382 public class Xcls_Label10 : Object
385 private Xcls_DialogNewComponent _this;
391 public Xcls_Label10(Xcls_DialogNewComponent _owner )
394 this.el = new Gtk.Label( "Parent 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
407 public class Xcls_parent : Object
410 private Xcls_DialogNewComponent _this;
416 public Xcls_parent(Xcls_DialogNewComponent _owner )
420 this.el = new Gtk.Entry();
424 // set gobject values
425 this.el.visible = true;
428 // user defined functions
431 public class Xcls_Label12 : Object
434 private Xcls_DialogNewComponent _this;
440 public Xcls_Label12(Xcls_DialogNewComponent _owner )
443 this.el = new Gtk.Label( "Permission Name" );
447 // set gobject values
448 this.el.justify = Gtk.Justification.RIGHT;
449 this.el.xalign = 0.900000f;
450 this.el.visible = true;
453 // user defined functions
456 public class Xcls_permname : Object
459 private Xcls_DialogNewComponent _this;
465 public Xcls_permname(Xcls_DialogNewComponent _owner )
468 _this.permname = this;
469 this.el = new Gtk.Entry();
473 // set gobject values
474 this.el.visible = true;
477 // user defined functions
480 public class Xcls_Label14 : Object
483 private Xcls_DialogNewComponent _this;
489 public Xcls_Label14(Xcls_DialogNewComponent _owner )
492 this.el = new Gtk.Label( "Order (for tabs)" );
496 // set gobject values
497 this.el.justify = Gtk.Justification.RIGHT;
498 this.el.xalign = 0.900000f;
499 this.el.visible = true;
502 // user defined functions
505 public class Xcls_modOrder : Object
508 private Xcls_DialogNewComponent _this;
514 public Xcls_modOrder(Xcls_DialogNewComponent _owner )
517 _this.modOrder = this;
518 this.el = new Gtk.Entry();
522 // set gobject values
523 this.el.visible = true;
526 // user defined functions
529 public class Xcls_Label16 : Object
532 private Xcls_DialogNewComponent _this;
538 public Xcls_Label16(Xcls_DialogNewComponent _owner )
541 this.el = new Gtk.Label( "Module to build (Vala only)" );
545 // set gobject values
546 this.el.justify = Gtk.Justification.RIGHT;
547 this.el.xalign = 0.900000f;
548 this.el.visible = true;
551 // user defined functions
554 public class Xcls_build_module : Object
556 public Gtk.ComboBox el;
557 private Xcls_DialogNewComponent _this;
563 public Xcls_build_module(Xcls_DialogNewComponent _owner )
566 _this.build_module = this;
567 this.el = new Gtk.ComboBox();
571 // set gobject values
572 var child_0 = new Xcls_dbcellrenderer( _this );
574 this.el.pack_start ( child_0.el , true );
575 var child_1 = new Xcls_dbmodel( _this );
577 this.el.set_model ( child_1.el );
581 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
584 // user defined functions
586 public class Xcls_dbcellrenderer : Object
588 public Gtk.CellRendererText el;
589 private Xcls_DialogNewComponent _this;
595 public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
598 _this.dbcellrenderer = this;
599 this.el = new Gtk.CellRendererText();
603 // set gobject values
606 // user defined functions
609 public class Xcls_dbmodel : Object
611 public Gtk.ListStore el;
612 private Xcls_DialogNewComponent _this;
618 public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
621 _this.dbmodel = this;
622 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
626 // set gobject values
629 // user defined functions
630 public void loadData (Gee.ArrayList<string> data, string cur) {
635 /// el.append(out iter);
638 // el.set_value(iter, 0, "");
639 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
644 el.set_value(iter, 0, "");
645 el.set_value(iter, 1, "-- select a module --");
646 _this.build_module.el.set_active_iter(iter);
648 for (var i = 0; i < data.size;i++) {
653 el.set_value(iter, 0, data.get(i));
654 el.set_value(iter, 1, data.get(i));
656 if (data.get(i) == cur) {
657 _this.build_module.el.set_active_iter(iter);
661 this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
669 public class Xcls_Button20 : Object
671 public Gtk.Button el;
672 private Xcls_DialogNewComponent _this;
678 public Xcls_Button20(Xcls_DialogNewComponent _owner )
681 this.el = new Gtk.Button();
685 // set gobject values
686 this.el.label = "Cancel";
689 // user defined functions
692 public class Xcls_Button21 : Object
694 public Gtk.Button el;
695 private Xcls_DialogNewComponent _this;
701 public Xcls_Button21(Xcls_DialogNewComponent _owner )
704 this.el = new Gtk.Button();
708 // set gobject values
709 this.el.label = "OK";
712 // user defined functions