NewBranch.bjs
[gitlive] / NewBranch.vala
1 static Xcls_DialogNewComponent  _DialogNewComponent;
2
3 public class Xcls_DialogNewComponent : Object
4 {
5     public Gtk.Dialog el;
6     private Xcls_DialogNewComponent  _this;
7
8     public static Xcls_DialogNewComponent singleton()
9     {
10         if (_DialogNewComponent == null) {
11             _DialogNewComponent= new Xcls_DialogNewComponent();
12         }
13         return _DialogNewComponent;
14     }
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
25         // my vars (def)
26     public signal void success (Project.Project pr, JsRender.JsRender file);
27     public Project.Project project;
28     public JsRender.JsRender file;
29
30     // ctor
31     public Xcls_DialogNewComponent()
32     {
33         _this = this;
34         this.el = new Gtk.Dialog();
35
36         // my vars (dec)
37         this.file = null;
38
39         // set gobject values
40         this.el.title = "New Component";
41         this.el.default_height = 200;
42         this.el.default_width = 500;
43         this.el.deletable = true;
44         this.el.modal = true;
45         var child_0 = new Xcls_VBox2( _this );
46         child_0.ref();
47         this.el.get_content_area().add (  child_0.el  );
48         var child_1 = new Xcls_Button20( _this );
49         child_1.ref();
50         this.el.add_action_widget (  child_1.el , 0 );
51         var child_2 = new Xcls_Button21( _this );
52         child_2.ref();
53         this.el.add_action_widget (  child_2.el , 1 );
54
55         //listeners
56         this.el.delete_event.connect( (self, event) => {
57             this.el.hide();
58             return true; 
59             //test  
60         });
61         this.el.response.connect( (self, response_id) =>  { 
62           
63                  
64         });
65         this.el.show.connect( (self)  => {
66           this.el.show_all();
67           //test
68         });
69     }
70
71     // user defined functions
72     public   void updateFileFromEntry () {
73     
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();
79             
80             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
81                 _this.file.renameTo(_this.name.el.get_text());
82             }
83             // store the module...
84             _this.file.build_module = "";        
85              Gtk.TreeIter iter; 
86             if (_this.build_module.el.get_active_iter (out iter)) {
87                  Value vfname;
88                  this.dbmodel.el.get_value (iter, 0, out vfname);
89                  if (((string)vfname).length > 0) {
90                      _this.file.build_module = (string)vfname;
91                  }
92         
93             }
94             
95             
96     
97                                                         
98     }
99     public   void show (JsRender.JsRender c) 
100     {
101         this.project = c.project;
102         
103         //if (!this.el) {
104             //this.init();
105          //}
106         
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);
113         
114         if (c.path.length > 0) {
115             this.el.set_title("Edit File Details - " + c.name);
116         } else {
117             this.el.set_title("Create New File");
118         }
119         
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;
126     
127             var iter = cg.map_iterator();
128            while(iter.next()) {
129                 var key = iter.get_key();
130                 if (key == "_default_") {
131                     continue;
132                 }
133                 ar.add(key);
134             };
135             _this.dbmodel.loadData(ar, c.build_module);
136     
137         }
138         
139          
140         _this.file = c;
141         //console.log('show all');
142         this.el.show_all();
143         
144         //this.success = c.success;
145         
146         
147     }
148     public class Xcls_VBox2 : Object
149     {
150         public Gtk.VBox el;
151         private Xcls_DialogNewComponent  _this;
152
153
154             // my vars (def)
155
156         // ctor
157         public Xcls_VBox2(Xcls_DialogNewComponent _owner )
158         {
159             _this = _owner;
160             this.el = new Gtk.VBox( true, 0 );
161
162             // my vars (dec)
163
164             // set gobject values
165             var child_0 = new Xcls_Table3( _this );
166             child_0.ref();
167             this.el.pack_start (  child_0.el , false,false,0 );
168         }
169
170         // user defined functions
171     }
172     public class Xcls_Table3 : Object
173     {
174         public Gtk.Table el;
175         private Xcls_DialogNewComponent  _this;
176
177
178             // my vars (def)
179
180         // ctor
181         public Xcls_Table3(Xcls_DialogNewComponent _owner )
182         {
183             _this = _owner;
184             this.el = new Gtk.Table( 3, 2, true );
185
186             // my vars (dec)
187
188             // set gobject values
189             var child_0 = new Xcls_Label4( _this );
190             child_0.ref();
191             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
192             var child_1 = new Xcls_name( _this );
193             child_1.ref();
194             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
195             var child_2 = new Xcls_Label6( _this );
196             child_2.ref();
197             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
198             var child_3 = new Xcls_title( _this );
199             child_3.ref();
200             this.el.attach_defaults (  child_3.el , 1,2,1,2 );
201             var child_4 = new Xcls_Label8( _this );
202             child_4.ref();
203             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
204             var child_5 = new Xcls_region( _this );
205             child_5.ref();
206             this.el.attach_defaults (  child_5.el , 1,2,2,3 );
207             var child_6 = new Xcls_Label10( _this );
208             child_6.ref();
209             this.el.attach_defaults (  child_6.el , 0,1,3,4 );
210             var child_7 = new Xcls_parent( _this );
211             child_7.ref();
212             this.el.attach_defaults (  child_7.el , 1,2,3,4 );
213             var child_8 = new Xcls_Label12( _this );
214             child_8.ref();
215             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
216             var child_9 = new Xcls_permname( _this );
217             child_9.ref();
218             this.el.attach_defaults (  child_9.el , 1,2,4,5 );
219             var child_10 = new Xcls_Label14( _this );
220             child_10.ref();
221             this.el.attach_defaults (  child_10.el , 0,1,5,6 );
222             var child_11 = new Xcls_modOrder( _this );
223             child_11.ref();
224             this.el.attach_defaults (  child_11.el , 1,2,5,6 );
225             var child_12 = new Xcls_Label16( _this );
226             child_12.ref();
227             this.el.attach_defaults (  child_12.el , 0,1,6,7 );
228             var child_13 = new Xcls_build_module( _this );
229             child_13.ref();
230             this.el.attach_defaults (  child_13.el , 1,2,6,7 );
231         }
232
233         // user defined functions
234     }
235     public class Xcls_Label4 : Object
236     {
237         public Gtk.Label el;
238         private Xcls_DialogNewComponent  _this;
239
240
241             // my vars (def)
242
243         // ctor
244         public Xcls_Label4(Xcls_DialogNewComponent _owner )
245         {
246             _this = _owner;
247             this.el = new Gtk.Label( "Component Name" );
248
249             // my vars (dec)
250
251             // set gobject values
252             this.el.justify = Gtk.Justification.RIGHT;
253             this.el.xalign = 0.900000f;
254         }
255
256         // user defined functions
257     }
258
259     public class Xcls_name : Object
260     {
261         public Gtk.Entry el;
262         private Xcls_DialogNewComponent  _this;
263
264
265             // my vars (def)
266
267         // ctor
268         public Xcls_name(Xcls_DialogNewComponent _owner )
269         {
270             _this = _owner;
271             _this.name = this;
272             this.el = new Gtk.Entry();
273
274             // my vars (dec)
275
276             // set gobject values
277             this.el.visible = true;
278         }
279
280         // user defined functions
281     }
282
283     public class Xcls_Label6 : Object
284     {
285         public Gtk.Label el;
286         private Xcls_DialogNewComponent  _this;
287
288
289             // my vars (def)
290
291         // ctor
292         public Xcls_Label6(Xcls_DialogNewComponent _owner )
293         {
294             _this = _owner;
295             this.el = new Gtk.Label( "Title" );
296
297             // my vars (dec)
298
299             // set gobject values
300             this.el.justify = Gtk.Justification.RIGHT;
301             this.el.xalign = 0.900000f;
302             this.el.visible = true;
303         }
304
305         // user defined functions
306     }
307
308     public class Xcls_title : Object
309     {
310         public Gtk.Entry el;
311         private Xcls_DialogNewComponent  _this;
312
313
314             // my vars (def)
315
316         // ctor
317         public Xcls_title(Xcls_DialogNewComponent _owner )
318         {
319             _this = _owner;
320             _this.title = this;
321             this.el = new Gtk.Entry();
322
323             // my vars (dec)
324
325             // set gobject values
326             this.el.visible = true;
327         }
328
329         // user defined functions
330     }
331
332     public class Xcls_Label8 : Object
333     {
334         public Gtk.Label el;
335         private Xcls_DialogNewComponent  _this;
336
337
338             // my vars (def)
339
340         // ctor
341         public Xcls_Label8(Xcls_DialogNewComponent _owner )
342         {
343             _this = _owner;
344             this.el = new Gtk.Label( "Region" );
345
346             // my vars (dec)
347
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;
353         }
354
355         // user defined functions
356     }
357
358     public class Xcls_region : Object
359     {
360         public Gtk.Entry el;
361         private Xcls_DialogNewComponent  _this;
362
363
364             // my vars (def)
365
366         // ctor
367         public Xcls_region(Xcls_DialogNewComponent _owner )
368         {
369             _this = _owner;
370             _this.region = this;
371             this.el = new Gtk.Entry();
372
373             // my vars (dec)
374
375             // set gobject values
376             this.el.visible = true;
377         }
378
379         // user defined functions
380     }
381
382     public class Xcls_Label10 : Object
383     {
384         public Gtk.Label el;
385         private Xcls_DialogNewComponent  _this;
386
387
388             // my vars (def)
389
390         // ctor
391         public Xcls_Label10(Xcls_DialogNewComponent _owner )
392         {
393             _this = _owner;
394             this.el = new Gtk.Label( "Parent Name" );
395
396             // my vars (dec)
397
398             // set gobject values
399             this.el.justify = Gtk.Justification.RIGHT;
400             this.el.xalign = 0.900000f;
401             this.el.visible = true;
402         }
403
404         // user defined functions
405     }
406
407     public class Xcls_parent : Object
408     {
409         public Gtk.Entry el;
410         private Xcls_DialogNewComponent  _this;
411
412
413             // my vars (def)
414
415         // ctor
416         public Xcls_parent(Xcls_DialogNewComponent _owner )
417         {
418             _this = _owner;
419             _this.parent = this;
420             this.el = new Gtk.Entry();
421
422             // my vars (dec)
423
424             // set gobject values
425             this.el.visible = true;
426         }
427
428         // user defined functions
429     }
430
431     public class Xcls_Label12 : Object
432     {
433         public Gtk.Label el;
434         private Xcls_DialogNewComponent  _this;
435
436
437             // my vars (def)
438
439         // ctor
440         public Xcls_Label12(Xcls_DialogNewComponent _owner )
441         {
442             _this = _owner;
443             this.el = new Gtk.Label( "Permission Name" );
444
445             // my vars (dec)
446
447             // set gobject values
448             this.el.justify = Gtk.Justification.RIGHT;
449             this.el.xalign = 0.900000f;
450             this.el.visible = true;
451         }
452
453         // user defined functions
454     }
455
456     public class Xcls_permname : Object
457     {
458         public Gtk.Entry el;
459         private Xcls_DialogNewComponent  _this;
460
461
462             // my vars (def)
463
464         // ctor
465         public Xcls_permname(Xcls_DialogNewComponent _owner )
466         {
467             _this = _owner;
468             _this.permname = this;
469             this.el = new Gtk.Entry();
470
471             // my vars (dec)
472
473             // set gobject values
474             this.el.visible = true;
475         }
476
477         // user defined functions
478     }
479
480     public class Xcls_Label14 : Object
481     {
482         public Gtk.Label el;
483         private Xcls_DialogNewComponent  _this;
484
485
486             // my vars (def)
487
488         // ctor
489         public Xcls_Label14(Xcls_DialogNewComponent _owner )
490         {
491             _this = _owner;
492             this.el = new Gtk.Label( "Order (for tabs)" );
493
494             // my vars (dec)
495
496             // set gobject values
497             this.el.justify = Gtk.Justification.RIGHT;
498             this.el.xalign = 0.900000f;
499             this.el.visible = true;
500         }
501
502         // user defined functions
503     }
504
505     public class Xcls_modOrder : Object
506     {
507         public Gtk.Entry el;
508         private Xcls_DialogNewComponent  _this;
509
510
511             // my vars (def)
512
513         // ctor
514         public Xcls_modOrder(Xcls_DialogNewComponent _owner )
515         {
516             _this = _owner;
517             _this.modOrder = this;
518             this.el = new Gtk.Entry();
519
520             // my vars (dec)
521
522             // set gobject values
523             this.el.visible = true;
524         }
525
526         // user defined functions
527     }
528
529     public class Xcls_Label16 : Object
530     {
531         public Gtk.Label el;
532         private Xcls_DialogNewComponent  _this;
533
534
535             // my vars (def)
536
537         // ctor
538         public Xcls_Label16(Xcls_DialogNewComponent _owner )
539         {
540             _this = _owner;
541             this.el = new Gtk.Label( "Module to build (Vala only)" );
542
543             // my vars (dec)
544
545             // set gobject values
546             this.el.justify = Gtk.Justification.RIGHT;
547             this.el.xalign = 0.900000f;
548             this.el.visible = true;
549         }
550
551         // user defined functions
552     }
553
554     public class Xcls_build_module : Object
555     {
556         public Gtk.ComboBox el;
557         private Xcls_DialogNewComponent  _this;
558
559
560             // my vars (def)
561
562         // ctor
563         public Xcls_build_module(Xcls_DialogNewComponent _owner )
564         {
565             _this = _owner;
566             _this.build_module = this;
567             this.el = new Gtk.ComboBox();
568
569             // my vars (dec)
570
571             // set gobject values
572             var child_0 = new Xcls_dbcellrenderer( _this );
573             child_0.ref();
574             this.el.pack_start (  child_0.el , true );
575             var child_1 = new Xcls_dbmodel( _this );
576             child_1.ref();
577             this.el.set_model (  child_1.el  );
578
579             // init method
580
581             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
582         }
583
584         // user defined functions
585     }
586     public class Xcls_dbcellrenderer : Object
587     {
588         public Gtk.CellRendererText el;
589         private Xcls_DialogNewComponent  _this;
590
591
592             // my vars (def)
593
594         // ctor
595         public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
596         {
597             _this = _owner;
598             _this.dbcellrenderer = this;
599             this.el = new Gtk.CellRendererText();
600
601             // my vars (dec)
602
603             // set gobject values
604         }
605
606         // user defined functions
607     }
608
609     public class Xcls_dbmodel : Object
610     {
611         public Gtk.ListStore el;
612         private Xcls_DialogNewComponent  _this;
613
614
615             // my vars (def)
616
617         // ctor
618         public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
619         {
620             _this = _owner;
621             _this.dbmodel = this;
622             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
623
624             // my vars (dec)
625
626             // set gobject values
627         }
628
629         // user defined functions
630         public void loadData (Gee.ArrayList<string> data, string cur) {
631             this.el.clear();                                    
632             Gtk.TreeIter iter;
633             var el = this.el;
634             
635            /// el.append(out iter);
636             
637              
638            // el.set_value(iter, 0, "");
639            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
640         
641             el.append(out iter);
642         
643             
644             el.set_value(iter, 0, "");
645             el.set_value(iter, 1, "-- select a module --");
646             _this.build_module.el.set_active_iter(iter);
647             
648             for (var i = 0; i < data.size;i++) {
649             
650         
651                 el.append(out iter);
652                 
653                 el.set_value(iter, 0, data.get(i));
654                 el.set_value(iter, 1, data.get(i));
655                 
656                 if (data.get(i) == cur) {
657                     _this.build_module.el.set_active_iter(iter);
658                 }
659                 
660             }
661              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
662                                              
663         }
664     }
665
666
667
668
669     public class Xcls_Button20 : Object
670     {
671         public Gtk.Button el;
672         private Xcls_DialogNewComponent  _this;
673
674
675             // my vars (def)
676
677         // ctor
678         public Xcls_Button20(Xcls_DialogNewComponent _owner )
679         {
680             _this = _owner;
681             this.el = new Gtk.Button();
682
683             // my vars (dec)
684
685             // set gobject values
686             this.el.label = "Cancel";
687         }
688
689         // user defined functions
690     }
691
692     public class Xcls_Button21 : Object
693     {
694         public Gtk.Button el;
695         private Xcls_DialogNewComponent  _this;
696
697
698             // my vars (def)
699
700         // ctor
701         public Xcls_Button21(Xcls_DialogNewComponent _owner )
702         {
703             _this = _owner;
704             this.el = new Gtk.Button();
705
706             // my vars (dec)
707
708             // set gobject values
709             this.el.label = "OK";
710         }
711
712         // user defined functions
713     }
714
715 }