src/Builder4/ValaProjectSettings.bjs
[app.Builder.js] / src / Builder4 / ValaProjectSettings.vala
1 static ValaProjectSettings  _ValaProjectSettings;
2
3 public class ValaProjectSettings : Object 
4 {
5     public Gtk.VBox el;
6     private ValaProjectSettings  _this;
7
8     public static ValaProjectSettings singleton()
9     {
10         if (_ValaProjectSettings == null) {
11             _ValaProjectSettings= new ValaProjectSettings();
12         }
13         return _ValaProjectSettings;
14     }
15     public Xcls_label_global label_global;
16     public Xcls_label_targets label_targets;
17     public Xcls_compile_flags compile_flags;
18     public Xcls_default_packages_tree_store default_packages_tree_store;
19     public Xcls_packages_render packages_render;
20     public Xcls_packages_render_use packages_render_use;
21     public Xcls_default_directory_tree default_directory_tree;
22     public Xcls_default_directory_tree_store default_directory_tree_store;
23     public Xcls_directory_render directory_render;
24     public Xcls_default_directory_menu default_directory_menu;
25     public Xcls_targets_tree_menu targets_tree_menu;
26     public Xcls_targets_tree targets_tree;
27     public Xcls_targets_tree_store targets_tree_store;
28     public Xcls_targets_render targets_render;
29     public Xcls_build_pack_target build_pack_target;
30     public Xcls_build_compile_flags build_compile_flags;
31     public Xcls_files_tree_store files_tree_store;
32     public Xcls_files_render files_render;
33     public Xcls_files_render_use files_render_use;
34
35         // my vars (def)
36     public Project.Gtk project;
37     public Xcls_MainWindow window;
38
39     // ctor 
40     public ValaProjectSettings()
41     {
42         _this = this;
43         this.el = new Gtk.VBox( true, 0 );
44
45         // my vars (dec)
46         this.project = null;
47         this.window = null;
48
49         // set gobject values
50         var child_0 = new Xcls_Notebook2( _this );
51         child_0.ref();
52         this.el.pack_start (  child_0.el , true,true,0 );
53     }
54
55     // user defined functions 
56     public void show (Project.Gtk project) {
57         
58         
59         print("ValaProjectSettings show\n");
60         
61         this.project=  project;
62     
63         this.compile_flags.el.text = _this.project.compilegroups.get("_default_").compile_flags;
64         
65         this.default_directory_tree_store.load();    
66         this.default_packages_tree_store.load();            
67         this.targets_tree_store.load();
68         this.files_tree_store.load();
69     
70     }
71     public void save ()  {
72         this.project.writeConfig();
73     }
74     public class Xcls_Notebook2 : Object 
75     {
76         public Gtk.Notebook el;
77         private ValaProjectSettings  _this;
78
79
80             // my vars (def)
81
82         // ctor 
83         public Xcls_Notebook2(ValaProjectSettings _owner )
84         {
85             _this = _owner;
86             this.el = new Gtk.Notebook();
87
88             // my vars (dec)
89
90             // set gobject values
91             var child_0 = new Xcls_label_global( _this );
92             child_0.ref();
93             var child_1 = new Xcls_label_targets( _this );
94             child_1.ref();
95             var child_2 = new Xcls_VBox5( _this );
96             child_2.ref();
97             this.el.append_page (  child_2.el , _this.label_global.el );
98             var child_3 = new Xcls_HPaned27( _this );
99             child_3.ref();
100             this.el.append_page (  child_3.el , _this.label_targets.el );
101         }
102
103         // user defined functions 
104     }
105     public class Xcls_label_global : Object 
106     {
107         public Gtk.Label el;
108         private ValaProjectSettings  _this;
109
110
111             // my vars (def)
112
113         // ctor 
114         public Xcls_label_global(ValaProjectSettings _owner )
115         {
116             _this = _owner;
117             _this.label_global = this;
118             this.el = new Gtk.Label( "Global" );
119
120             // my vars (dec)
121
122             // set gobject values
123         }
124
125         // user defined functions 
126     }
127     public class Xcls_label_targets : Object 
128     {
129         public Gtk.Label el;
130         private ValaProjectSettings  _this;
131
132
133             // my vars (def)
134
135         // ctor 
136         public Xcls_label_targets(ValaProjectSettings _owner )
137         {
138             _this = _owner;
139             _this.label_targets = this;
140             this.el = new Gtk.Label( "Targets" );
141
142             // my vars (dec)
143
144             // set gobject values
145         }
146
147         // user defined functions 
148     }
149     public class Xcls_VBox5 : Object 
150     {
151         public Gtk.VBox el;
152         private ValaProjectSettings  _this;
153
154
155             // my vars (def)
156
157         // ctor 
158         public Xcls_VBox5(ValaProjectSettings _owner )
159         {
160             _this = _owner;
161             this.el = new Gtk.VBox( false, 0 );
162
163             // my vars (dec)
164
165             // set gobject values
166             var child_0 = new Xcls_Label6( _this );
167             child_0.ref();
168             this.el.pack_start (  child_0.el , false,false,0 );
169             var child_1 = new Xcls_compile_flags( _this );
170             child_1.ref();
171             this.el.pack_start (  child_1.el , false,false,0 );
172             var child_2 = new Xcls_Label8( _this );
173             child_2.ref();
174             this.el.pack_start (  child_2.el , false,false,0 );
175             var child_3 = new Xcls_ScrolledWindow9( _this );
176             child_3.ref();
177             this.el.pack_start (  child_3.el , true,true,0 );
178             var child_4 = new Xcls_Label16( _this );
179             child_4.ref();
180             this.el.pack_start (  child_4.el , false,false,0 );
181             var child_5 = new Xcls_ScrolledWindow17( _this );
182             child_5.ref();
183             this.el.pack_start (  child_5.el , true,true,0 );
184         }
185
186         // user defined functions 
187     }
188     public class Xcls_Label6 : Object 
189     {
190         public Gtk.Label el;
191         private ValaProjectSettings  _this;
192
193
194             // my vars (def)
195
196         // ctor 
197         public Xcls_Label6(ValaProjectSettings _owner )
198         {
199             _this = _owner;
200             this.el = new Gtk.Label( "compile flags" );
201
202             // my vars (dec)
203
204             // set gobject values
205         }
206
207         // user defined functions 
208     }
209     public class Xcls_compile_flags : Object 
210     {
211         public Gtk.Entry el;
212         private ValaProjectSettings  _this;
213
214
215             // my vars (def)
216
217         // ctor 
218         public Xcls_compile_flags(ValaProjectSettings _owner )
219         {
220             _this = _owner;
221             _this.compile_flags = this;
222             this.el = new Gtk.Entry();
223
224             // my vars (dec)
225
226             // set gobject values
227             this.el.placeholder_text = "eg. -g --valasrc $BASEDIR ";
228
229             // listeners 
230             this.el.changed.connect( () => {
231                 
232                _this.project.compilegroups.get("_default_").compile_flags = this.el.text;
233                _this.project.writeConfig();
234             //    _this.project.save();
235             
236             });
237         }
238
239         // user defined functions 
240     }
241     public class Xcls_Label8 : Object 
242     {
243         public Gtk.Label el;
244         private ValaProjectSettings  _this;
245
246
247             // my vars (def)
248
249         // ctor 
250         public Xcls_Label8(ValaProjectSettings _owner )
251         {
252             _this = _owner;
253             this.el = new Gtk.Label( "packages" );
254
255             // my vars (dec)
256
257             // set gobject values
258         }
259
260         // user defined functions 
261     }
262     public class Xcls_ScrolledWindow9 : Object 
263     {
264         public Gtk.ScrolledWindow el;
265         private ValaProjectSettings  _this;
266
267
268             // my vars (def)
269
270         // ctor 
271         public Xcls_ScrolledWindow9(ValaProjectSettings _owner )
272         {
273             _this = _owner;
274             this.el = new Gtk.ScrolledWindow( null, null );
275
276             // my vars (dec)
277
278             // set gobject values
279             var child_0 = new Xcls_default_packages_tree( _this );
280             child_0.ref();
281             this.el.add (  child_0.el  );
282         }
283
284         // user defined functions 
285     }
286     public class Xcls_default_packages_tree : Object 
287     {
288         public Gtk.TreeView el;
289         private ValaProjectSettings  _this;
290
291
292             // my vars (def)
293
294         // ctor 
295         public Xcls_default_packages_tree(ValaProjectSettings _owner )
296         {
297             _this = _owner;
298             this.el = new Gtk.TreeView();
299
300             // my vars (dec)
301
302             // set gobject values
303             this.el.headers_visible = false;
304             var child_0 = new Xcls_default_packages_tree_store( _this );
305             child_0.ref();
306             this.el.set_model (  child_0.el  );
307             var child_1 = new Xcls_TreeViewColumn12( _this );
308             child_1.ref();
309             this.el.append_column (  child_1.el  );
310             var child_2 = new Xcls_TreeViewColumn14( _this );
311             child_2.ref();
312             this.el.append_column (  child_2.el  );
313         }
314
315         // user defined functions 
316     }
317     public class Xcls_default_packages_tree_store : Object 
318     {
319         public Gtk.ListStore el;
320         private ValaProjectSettings  _this;
321
322
323             // my vars (def)
324
325         // ctor 
326         public Xcls_default_packages_tree_store(ValaProjectSettings _owner )
327         {
328             _this = _owner;
329             _this.default_packages_tree_store = this;
330             this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
331       typeof(bool) );
332
333             // my vars (dec)
334
335             // set gobject values
336         }
337
338         // user defined functions 
339         public void load () {
340          
341             var def = _this.project.compilegroups.get("_default_");
342             var items  = def.packages;
343             
344             this.el.clear();
345             var pal = (Palete.Gtk) Palete.factory("Gtk");
346             var pkgs = pal.packages();
347             print("ValaProjectSettings:packages load %d\n", pkgs.size);
348         
349             Gtk.TreeIter citer;
350         
351             for(var i =0 ; i < pkgs.size; i++) {
352                  this.el.append(out citer);   
353                  
354                 this.el.set_value(citer, 0,   pkgs.get(i) ); // title 
355                 this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );
356             }
357             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
358             
359         }
360     }
361     public class Xcls_TreeViewColumn12 : Object 
362     {
363         public Gtk.TreeViewColumn el;
364         private ValaProjectSettings  _this;
365
366
367             // my vars (def)
368
369         // ctor 
370         public Xcls_TreeViewColumn12(ValaProjectSettings _owner )
371         {
372             _this = _owner;
373             this.el = new Gtk.TreeViewColumn();
374
375             // my vars (dec)
376
377             // set gobject values
378             this.el.title = "name";
379             this.el.expand = true;
380             this.el.resizable = true;
381             var child_0 = new Xcls_packages_render( _this );
382             child_0.ref();
383             this.el.pack_start (  child_0.el , false );
384
385             // init method 
386
387             this.el.add_attribute(_this.packages_render.el , "text", 0 );        }
388
389         // user defined functions 
390     }
391     public class Xcls_packages_render : Object 
392     {
393         public Gtk.CellRendererText el;
394         private ValaProjectSettings  _this;
395
396
397             // my vars (def)
398
399         // ctor 
400         public Xcls_packages_render(ValaProjectSettings _owner )
401         {
402             _this = _owner;
403             _this.packages_render = this;
404             this.el = new Gtk.CellRendererText();
405
406             // my vars (dec)
407
408             // set gobject values
409         }
410
411         // user defined functions 
412     }
413     public class Xcls_TreeViewColumn14 : Object 
414     {
415         public Gtk.TreeViewColumn el;
416         private ValaProjectSettings  _this;
417
418
419             // my vars (def)
420
421         // ctor 
422         public Xcls_TreeViewColumn14(ValaProjectSettings _owner )
423         {
424             _this = _owner;
425             this.el = new Gtk.TreeViewColumn();
426
427             // my vars (dec)
428
429             // set gobject values
430             this.el.title = "use";
431             this.el.resizable = false;
432             this.el.fixed_width = 50;
433             var child_0 = new Xcls_packages_render_use( _this );
434             child_0.ref();
435             this.el.pack_start (  child_0.el , false );
436
437             // init method 
438
439             {
440              this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
441              }        }
442
443         // user defined functions 
444     }
445     public class Xcls_packages_render_use : Object 
446     {
447         public Gtk.CellRendererToggle el;
448         private ValaProjectSettings  _this;
449
450
451             // my vars (def)
452
453         // ctor 
454         public Xcls_packages_render_use(ValaProjectSettings _owner )
455         {
456             _this = _owner;
457             _this.packages_render_use = this;
458             this.el = new Gtk.CellRendererToggle();
459
460             // my vars (dec)
461
462             // set gobject values
463             this.el.activatable = true;
464
465             // listeners 
466             this.el.toggled.connect( (  path_string) =>  { 
467                 var m = _this.default_packages_tree_store.el;
468                Gtk.TreeIter iter;
469                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
470                m.get_iter (out iter, path);
471                GLib.Value val;
472                m.get_value(iter, 1, out val);
473                m.set_value(iter, 1,  ((bool) val) ? false :true); 
474                  GLib.Value fval;  
475                m.get_value(iter, 0, out fval);
476                var fn = (string)fval;
477                 
478                 var def = _this.project.compilegroups.get("_default_");
479                 var items  = def.packages;
480                 if ((bool)val) {
481                     // renive
482                     items.remove(fn);
483                 } else {
484                     items.add(fn);
485                 }
486                 
487             });
488         }
489
490         // user defined functions 
491     }
492     public class Xcls_Label16 : Object 
493     {
494         public Gtk.Label el;
495         private ValaProjectSettings  _this;
496
497
498             // my vars (def)
499
500         // ctor 
501         public Xcls_Label16(ValaProjectSettings _owner )
502         {
503             _this = _owner;
504             this.el = new Gtk.Label( "Available Directories" );
505
506             // my vars (dec)
507
508             // set gobject values
509         }
510
511         // user defined functions 
512     }
513     public class Xcls_ScrolledWindow17 : Object 
514     {
515         public Gtk.ScrolledWindow el;
516         private ValaProjectSettings  _this;
517
518
519             // my vars (def)
520
521         // ctor 
522         public Xcls_ScrolledWindow17(ValaProjectSettings _owner )
523         {
524             _this = _owner;
525             this.el = new Gtk.ScrolledWindow( null, null );
526
527             // my vars (dec)
528
529             // set gobject values
530             var child_0 = new Xcls_default_directory_tree( _this );
531             child_0.ref();
532             this.el.add (  child_0.el  );
533             var child_1 = new Xcls_default_directory_menu( _this );
534             child_1.ref();
535         }
536
537         // user defined functions 
538     }
539     public class Xcls_default_directory_tree : Object 
540     {
541         public Gtk.TreeView el;
542         private ValaProjectSettings  _this;
543
544
545             // my vars (def)
546
547         // ctor 
548         public Xcls_default_directory_tree(ValaProjectSettings _owner )
549         {
550             _this = _owner;
551             _this.default_directory_tree = this;
552             this.el = new Gtk.TreeView();
553
554             // my vars (dec)
555
556             // set gobject values
557             this.el.headers_visible = false;
558             var child_0 = new Xcls_default_directory_tree_store( _this );
559             child_0.ref();
560             this.el.set_model (  child_0.el  );
561             var child_1 = new Xcls_TreeViewColumn20( _this );
562             child_1.ref();
563             this.el.append_column (  child_1.el  );
564
565             // listeners 
566             this.el.button_press_event.connect( ( ev) => {
567                 //console.log("button press?");
568                
569                 
570                 if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
571                     //print("click" + ev.type);
572                     return false;
573                 }
574                 //Gtk.TreePath res;
575                 //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
576                 //    return true;
577                 //}
578                  
579               //  this.el.get_selection().select_path(res);
580                  
581                   //if (!this.get('/LeftTreeMenu').el)  { 
582                   //      this.get('/LeftTreeMenu').init(); 
583                   //  }
584                     
585                  _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());
586                  _this.default_directory_menu.el.show_all();
587                   _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);
588                  //   print("click:" + res.path.to_string());
589                   return true;
590             });
591         }
592
593         // user defined functions 
594     }
595     public class Xcls_default_directory_tree_store : Object 
596     {
597         public Gtk.ListStore el;
598         private ValaProjectSettings  _this;
599
600
601             // my vars (def)
602
603         // ctor 
604         public Xcls_default_directory_tree_store(ValaProjectSettings _owner )
605         {
606             _this = _owner;
607             _this.default_directory_tree_store = this;
608             this.el = new Gtk.ListStore( 1,     typeof(string)
609       );
610
611             // my vars (dec)
612
613             // set gobject values
614         }
615
616         // user defined functions 
617         public void load () {
618          
619           this.el.clear();
620           
621             
622              var def = _this.project.compilegroups.get("_default_");
623              var items  = def.sources;
624              
625          
626             Gtk.TreeIter citer;
627         
628             for(var i =0 ; i < items.size; i++) {
629                  this.el.append(out citer);   
630                  
631                 this.el.set_value(citer, 0,   items.get(i) ); // title 
632                 //this.el.set_value(citer, 1,   items.get(i) );
633             }
634             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
635             
636         }
637     }
638     public class Xcls_TreeViewColumn20 : Object 
639     {
640         public Gtk.TreeViewColumn el;
641         private ValaProjectSettings  _this;
642
643
644             // my vars (def)
645
646         // ctor 
647         public Xcls_TreeViewColumn20(ValaProjectSettings _owner )
648         {
649             _this = _owner;
650             this.el = new Gtk.TreeViewColumn();
651
652             // my vars (dec)
653
654             // set gobject values
655             this.el.title = "name";
656             this.el.resizable = true;
657             var child_0 = new Xcls_directory_render( _this );
658             child_0.ref();
659             this.el.pack_start (  child_0.el , false );
660
661             // init method 
662
663             this.el.add_attribute(_this.directory_render.el , "text", 0 );        }
664
665         // user defined functions 
666     }
667     public class Xcls_directory_render : Object 
668     {
669         public Gtk.CellRendererText el;
670         private ValaProjectSettings  _this;
671
672
673             // my vars (def)
674
675         // ctor 
676         public Xcls_directory_render(ValaProjectSettings _owner )
677         {
678             _this = _owner;
679             _this.directory_render = this;
680             this.el = new Gtk.CellRendererText();
681
682             // my vars (dec)
683
684             // set gobject values
685         }
686
687         // user defined functions 
688     }
689     public class Xcls_default_directory_menu : Object 
690     {
691         public Gtk.Menu el;
692         private ValaProjectSettings  _this;
693
694
695             // my vars (def)
696
697         // ctor 
698         public Xcls_default_directory_menu(ValaProjectSettings _owner )
699         {
700             _this = _owner;
701             _this.default_directory_menu = this;
702             this.el = new Gtk.Menu();
703
704             // my vars (dec)
705
706             // set gobject values
707             var child_0 = new Xcls_MenuItem23( _this );
708             child_0.ref();
709             this.el.add (  child_0.el  );
710             var child_1 = new Xcls_MenuItem24( _this );
711             child_1.ref();
712             this.el.add (  child_1.el  );
713             var child_2 = new Xcls_SeparatorMenuItem25( _this );
714             child_2.ref();
715             this.el.add (  child_2.el  );
716             var child_3 = new Xcls_MenuItem26( _this );
717             child_3.ref();
718             this.el.add (  child_3.el  );
719         }
720
721         // user defined functions 
722     }
723     public class Xcls_MenuItem23 : Object 
724     {
725         public Gtk.MenuItem el;
726         private ValaProjectSettings  _this;
727
728
729             // my vars (def)
730
731         // ctor 
732         public Xcls_MenuItem23(ValaProjectSettings _owner )
733         {
734             _this = _owner;
735             this.el = new Gtk.MenuItem();
736
737             // my vars (dec)
738
739             // set gobject values
740             this.el.label = "Add Directory";
741
742             // listeners 
743             this.el.activate.connect( ()  => {
744                 
745                 var  chooser = new Gtk.FileChooserDialog (
746                 "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
747                 "_Cancel",
748                 Gtk.ResponseType.CANCEL,
749                 "_Add",
750                 Gtk.ResponseType.ACCEPT);
751                 if (chooser.run () != Gtk.ResponseType.ACCEPT) {
752                     chooser.close ();
753                        return;
754                    }
755                    chooser.close ();
756                    // add the directory..
757                    var fn = _this.project.relPath(chooser.get_filename());
758                    _this.project.compilegroups.get("_default_").sources.add(fn);
759                    _this.default_directory_tree_store.load();
760             });
761         }
762
763         // user defined functions 
764     }
765     public class Xcls_MenuItem24 : Object 
766     {
767         public Gtk.MenuItem el;
768         private ValaProjectSettings  _this;
769
770
771             // my vars (def)
772
773         // ctor 
774         public Xcls_MenuItem24(ValaProjectSettings _owner )
775         {
776             _this = _owner;
777             this.el = new Gtk.MenuItem();
778
779             // my vars (dec)
780
781             // set gobject values
782             this.el.label = "Add File";
783
784             // listeners 
785             this.el.activate.connect( ()  => {
786                 
787                 var  chooser = new Gtk.FileChooserDialog (
788                 "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
789                 "_Cancel",
790                 Gtk.ResponseType.CANCEL,
791                 "_Add",
792                 Gtk.ResponseType.ACCEPT);
793                 if (chooser.run () != Gtk.ResponseType.ACCEPT) {
794                     chooser.close ();
795                        return;
796                    }
797                    chooser.close ();
798                    // add the directory..
799                    var fn = _this.project.relPath(chooser.get_filename());
800                    _this.project.compilegroups.get("_default_").sources.add(fn);
801                    _this.default_directory_tree_store.load();
802             });
803         }
804
805         // user defined functions 
806     }
807     public class Xcls_SeparatorMenuItem25 : Object 
808     {
809         public Gtk.SeparatorMenuItem el;
810         private ValaProjectSettings  _this;
811
812
813             // my vars (def)
814
815         // ctor 
816         public Xcls_SeparatorMenuItem25(ValaProjectSettings _owner )
817         {
818             _this = _owner;
819             this.el = new Gtk.SeparatorMenuItem();
820
821             // my vars (dec)
822
823             // set gobject values
824         }
825
826         // user defined functions 
827     }
828     public class Xcls_MenuItem26 : Object 
829     {
830         public Gtk.MenuItem el;
831         private ValaProjectSettings  _this;
832
833
834             // my vars (def)
835
836         // ctor 
837         public Xcls_MenuItem26(ValaProjectSettings _owner )
838         {
839             _this = _owner;
840             this.el = new Gtk.MenuItem();
841
842             // my vars (dec)
843
844             // set gobject values
845             this.el.label = "Remove File/Directory";
846
847             // listeners 
848             this.el.activate.connect( ()  => {
849                 
850                  //
851                     Gtk.TreeModel mod;
852                     Gtk.TreeIter iter;
853                     if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
854                            print("nothing selected\n");
855                         return;
856                     }
857             
858                         
859                    // add the directory..
860                    
861                    
862                    GLib.Value val;
863                     mod.get_value(iter,0, out val);
864                    var fn =  (string) val;
865                    
866                    print("remove: %s\n", fn);
867                    if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
868                               print("remove failed");
869                           }
870                    _this.default_directory_tree_store.load();
871             });
872         }
873
874         // user defined functions 
875     }
876     public class Xcls_HPaned27 : Object 
877     {
878         public Gtk.HPaned el;
879         private ValaProjectSettings  _this;
880
881
882             // my vars (def)
883
884         // ctor 
885         public Xcls_HPaned27(ValaProjectSettings _owner )
886         {
887             _this = _owner;
888             this.el = new Gtk.HPaned();
889
890             // my vars (dec)
891
892             // set gobject values
893             this.el.position = 300;
894             var child_0 = new Xcls_ScrolledWindow28( _this );
895             child_0.ref();
896             this.el.add1 (  child_0.el  );
897             var child_1 = new Xcls_set_vbox( _this );
898             child_1.ref();
899             this.el.add2 (  child_1.el  );
900         }
901
902         // user defined functions 
903     }
904     public class Xcls_ScrolledWindow28 : Object 
905     {
906         public Gtk.ScrolledWindow el;
907         private ValaProjectSettings  _this;
908
909
910             // my vars (def)
911
912         // ctor 
913         public Xcls_ScrolledWindow28(ValaProjectSettings _owner )
914         {
915             _this = _owner;
916             this.el = new Gtk.ScrolledWindow( null, null );
917
918             // my vars (dec)
919
920             // set gobject values
921             var child_0 = new Xcls_targets_tree_menu( _this );
922             child_0.ref();
923             this.el.add (  child_0.el  );
924             var child_1 = new Xcls_targets_tree( _this );
925             child_1.ref();
926             this.el.add (  child_1.el  );
927
928             // init method 
929
930             {  
931             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
932             
933             }        }
934
935         // user defined functions 
936     }
937     public class Xcls_targets_tree_menu : Object 
938     {
939         public Gtk.Menu el;
940         private ValaProjectSettings  _this;
941
942
943             // my vars (def)
944
945         // ctor 
946         public Xcls_targets_tree_menu(ValaProjectSettings _owner )
947         {
948             _this = _owner;
949             _this.targets_tree_menu = this;
950             this.el = new Gtk.Menu();
951
952             // my vars (dec)
953
954             // set gobject values
955             var child_0 = new Xcls_MenuItem30( _this );
956             child_0.ref();
957             this.el.add (  child_0.el  );
958             var child_1 = new Xcls_SeparatorMenuItem31( _this );
959             child_1.ref();
960             this.el.add (  child_1.el  );
961             var child_2 = new Xcls_MenuItem32( _this );
962             child_2.ref();
963             this.el.add (  child_2.el  );
964         }
965
966         // user defined functions 
967     }
968     public class Xcls_MenuItem30 : Object 
969     {
970         public Gtk.MenuItem el;
971         private ValaProjectSettings  _this;
972
973
974             // my vars (def)
975
976         // ctor 
977         public Xcls_MenuItem30(ValaProjectSettings _owner )
978         {
979             _this = _owner;
980             this.el = new Gtk.MenuItem();
981
982             // my vars (dec)
983
984             // set gobject values
985             this.el.label = "Add Compile Target";
986
987             // listeners 
988             this.el.activate.connect( ()  => {
989                 
990                    if (_this.project.compilegroups.has_key("NEW GROUP")) {
991                     return;
992                 }
993                   
994                    // add the directory..
995                    
996                    _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
997                    _this.targets_tree_store.load();
998             });
999         }
1000
1001         // user defined functions 
1002     }
1003     public class Xcls_SeparatorMenuItem31 : Object 
1004     {
1005         public Gtk.SeparatorMenuItem el;
1006         private ValaProjectSettings  _this;
1007
1008
1009             // my vars (def)
1010
1011         // ctor 
1012         public Xcls_SeparatorMenuItem31(ValaProjectSettings _owner )
1013         {
1014             _this = _owner;
1015             this.el = new Gtk.SeparatorMenuItem();
1016
1017             // my vars (dec)
1018
1019             // set gobject values
1020         }
1021
1022         // user defined functions 
1023     }
1024     public class Xcls_MenuItem32 : Object 
1025     {
1026         public Gtk.MenuItem el;
1027         private ValaProjectSettings  _this;
1028
1029
1030             // my vars (def)
1031
1032         // ctor 
1033         public Xcls_MenuItem32(ValaProjectSettings _owner )
1034         {
1035             _this = _owner;
1036             this.el = new Gtk.MenuItem();
1037
1038             // my vars (dec)
1039
1040             // set gobject values
1041             this.el.label = "Remove Target";
1042
1043             // listeners 
1044             this.el.activate.connect( ()  => {
1045                 
1046                  //
1047                     Gtk.TreeModel mod;
1048                     Gtk.TreeIter iter;
1049                     if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {
1050                            print("nothing selected\n");
1051                         return;
1052                     }
1053             
1054                         
1055                    // add the directory..
1056                    
1057                    
1058                    GLib.Value val;
1059                     mod.get_value(iter,0, out val);
1060                    var fn =  (string) val;
1061                    
1062                    print("remove: %s\n", fn);
1063                    if (!_this.project.compilegroups.unset(fn)) {
1064                               print("remove failed");
1065                   }
1066                    _this.targets_tree_store.load();
1067             });
1068         }
1069
1070         // user defined functions 
1071     }
1072     public class Xcls_targets_tree : Object 
1073     {
1074         public Gtk.TreeView el;
1075         private ValaProjectSettings  _this;
1076
1077
1078             // my vars (def)
1079         public string cursor;
1080
1081         // ctor 
1082         public Xcls_targets_tree(ValaProjectSettings _owner )
1083         {
1084             _this = _owner;
1085             _this.targets_tree = this;
1086             this.el = new Gtk.TreeView();
1087
1088             // my vars (dec)
1089
1090             // set gobject values
1091             var child_0 = new Xcls_targets_tree_store( _this );
1092             child_0.ref();
1093             this.el.set_model (  child_0.el  );
1094             var child_1 = new Xcls_TreeViewColumn35( _this );
1095             child_1.ref();
1096             this.el.append_column (  child_1.el  );
1097
1098             // listeners 
1099             this.el.button_press_event.connect( ( ev) => {
1100                 //console.log("button press?");
1101                
1102                 
1103                 if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
1104                     //print("click" + ev.type);
1105                     return false;
1106                 }
1107                 //Gtk.TreePath res;
1108                 //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
1109                 //    return true;
1110                 //}
1111                  
1112               //  this.el.get_selection().select_path(res);
1113                  
1114                   //if (!this.get('/LeftTreeMenu').el)  { 
1115                   //      this.get('/LeftTreeMenu').init(); 
1116                   //  }
1117                     
1118                  _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());
1119                  _this.targets_tree_menu.el.show_all();
1120                   _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);
1121                  //   print("click:" + res.path.to_string());
1122                   return true;
1123             });
1124             this.el.cursor_changed.connect( ( ) => {
1125             
1126                 if (this.cursor != "") {
1127                      // save the values..
1128                  }
1129                  
1130                  // load the new values.
1131                  
1132             
1133                      Gtk.TreeModel mod;
1134                     Gtk.TreeIter iter;
1135                     if (!this.el.get_selection().get_selected(out mod, out iter)) {
1136                         print("nothing selected\n");
1137                         // should disable the right hand side..
1138                         _this.set_vbox.el.hide();
1139                         return;
1140                     }
1141                     _this.set_vbox.el.show();
1142                         
1143                    // add the directory..
1144                    
1145                    
1146                    GLib.Value val;
1147                     mod.get_value(iter,0, out val);
1148                    var fn =  (string) val;
1149                    
1150                    this.cursor = fn;
1151                    var cg = _this.project.compilegroups.get(fn);
1152                    _this.build_pack_target.el.set_text(cg.target_bin);
1153                    _this.build_compile_flags.el.set_text(cg.compile_flags);
1154                    // load the srouces
1155                    
1156             
1157               });
1158         }
1159
1160         // user defined functions 
1161     }
1162     public class Xcls_targets_tree_store : Object 
1163     {
1164         public Gtk.ListStore el;
1165         private ValaProjectSettings  _this;
1166
1167
1168             // my vars (def)
1169
1170         // ctor 
1171         public Xcls_targets_tree_store(ValaProjectSettings _owner )
1172         {
1173             _this = _owner;
1174             _this.targets_tree_store = this;
1175             this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
1176      typeof(string) // ??
1177       );
1178
1179             // my vars (dec)
1180
1181             // set gobject values
1182         }
1183
1184         // user defined functions 
1185         public void load () {
1186          
1187           this.el.clear();
1188           
1189             
1190              var cg = _this.project.compilegroups;
1191              
1192            _this.targets_tree.cursor = "";
1193             Gtk.TreeIter citer;
1194             var iter = cg.map_iterator();
1195            while(iter.next()) {
1196                 var key = iter.get_key();
1197                 if (key == "_default_") {
1198                     continue;
1199                 }
1200             
1201                  this.el.append(out citer);   
1202                  
1203                 this.el.set_value(citer, 0,   key ); // title 
1204                 //this.el.set_value(citer, 1,   items.get(i) );
1205             };
1206             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1207             
1208         }
1209     }
1210     public class Xcls_TreeViewColumn35 : Object 
1211     {
1212         public Gtk.TreeViewColumn el;
1213         private ValaProjectSettings  _this;
1214
1215
1216             // my vars (def)
1217
1218         // ctor 
1219         public Xcls_TreeViewColumn35(ValaProjectSettings _owner )
1220         {
1221             _this = _owner;
1222             this.el = new Gtk.TreeViewColumn();
1223
1224             // my vars (dec)
1225
1226             // set gobject values
1227             this.el.title = "name";
1228             this.el.resizable = true;
1229             var child_0 = new Xcls_targets_render( _this );
1230             child_0.ref();
1231             this.el.pack_start (  child_0.el , false );
1232
1233             // init method 
1234
1235             {
1236                  this.el.add_attribute(_this.targets_render.el , "text", 0 );
1237              }        }
1238
1239         // user defined functions 
1240     }
1241     public class Xcls_targets_render : Object 
1242     {
1243         public Gtk.CellRendererText el;
1244         private ValaProjectSettings  _this;
1245
1246
1247             // my vars (def)
1248
1249         // ctor 
1250         public Xcls_targets_render(ValaProjectSettings _owner )
1251         {
1252             _this = _owner;
1253             _this.targets_render = this;
1254             this.el = new Gtk.CellRendererText();
1255
1256             // my vars (dec)
1257
1258             // set gobject values
1259             this.el.editable = true;
1260
1261             // listeners 
1262             this.el.edited.connect( (path, newtext) => {
1263                  
1264                  Gtk.TreeIter  iter;
1265                     _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1266                    GLib.Value gval;
1267                     _this.targets_tree_store.el.get_value(iter,0, out gval);
1268                     var oldval = (string)gval;
1269                    if (oldval == newtext) {
1270                       return;
1271                     }
1272                      var cg = _this.project.compilegroups.get(oldval);
1273                     cg.name = newtext;
1274                     _this.project.compilegroups.unset(oldval);
1275                     _this.project.compilegroups.set(newtext, cg);
1276                 _this.targets_tree_store.load();
1277               });
1278         }
1279
1280         // user defined functions 
1281     }
1282     public class Xcls_set_vbox : Object 
1283     {
1284         public Gtk.VBox el;
1285         private ValaProjectSettings  _this;
1286
1287
1288             // my vars (def)
1289
1290         // ctor 
1291         public Xcls_set_vbox(ValaProjectSettings _owner )
1292         {
1293             _this = _owner;
1294             this.el = new Gtk.VBox( false, 0 );
1295
1296             // my vars (dec)
1297
1298             // set gobject values
1299             var child_0 = new Xcls_Label38( _this );
1300             child_0.ref();
1301             this.el.pack_start (  child_0.el , false,false,0 );
1302             var child_1 = new Xcls_build_pack_target( _this );
1303             child_1.ref();
1304             this.el.pack_start (  child_1.el , false,false,0 );
1305             var child_2 = new Xcls_Label40( _this );
1306             child_2.ref();
1307             this.el.pack_start (  child_2.el , false,false,0 );
1308             var child_3 = new Xcls_build_compile_flags( _this );
1309             child_3.ref();
1310             this.el.pack_start (  child_3.el , false,false,0 );
1311             var child_4 = new Xcls_Label42( _this );
1312             child_4.ref();
1313             this.el.pack_start (  child_4.el , false,false,0 );
1314             var child_5 = new Xcls_ScrolledWindow43( _this );
1315             child_5.ref();
1316             this.el.pack_start (  child_5.el , true,true,0 );
1317         }
1318
1319         // user defined functions 
1320     }
1321     public class Xcls_Label38 : Object 
1322     {
1323         public Gtk.Label el;
1324         private ValaProjectSettings  _this;
1325
1326
1327             // my vars (def)
1328
1329         // ctor 
1330         public Xcls_Label38(ValaProjectSettings _owner )
1331         {
1332             _this = _owner;
1333             this.el = new Gtk.Label( "target filename" );
1334
1335             // my vars (dec)
1336
1337             // set gobject values
1338         }
1339
1340         // user defined functions 
1341     }
1342     public class Xcls_build_pack_target : Object 
1343     {
1344         public Gtk.Entry el;
1345         private ValaProjectSettings  _this;
1346
1347
1348             // my vars (def)
1349
1350         // ctor 
1351         public Xcls_build_pack_target(ValaProjectSettings _owner )
1352         {
1353             _this = _owner;
1354             _this.build_pack_target = this;
1355             this.el = new Gtk.Entry();
1356
1357             // my vars (dec)
1358
1359             // set gobject values
1360
1361             // listeners 
1362             this.el.changed.connect( ()  => {
1363                     if (_this.targets_tree.cursor.length < 1) {
1364                     return;
1365                 }
1366                 _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
1367             });
1368         }
1369
1370         // user defined functions 
1371     }
1372     public class Xcls_Label40 : Object 
1373     {
1374         public Gtk.Label el;
1375         private ValaProjectSettings  _this;
1376
1377
1378             // my vars (def)
1379
1380         // ctor 
1381         public Xcls_Label40(ValaProjectSettings _owner )
1382         {
1383             _this = _owner;
1384             this.el = new Gtk.Label( "compile flags" );
1385
1386             // my vars (dec)
1387
1388             // set gobject values
1389         }
1390
1391         // user defined functions 
1392     }
1393     public class Xcls_build_compile_flags : Object 
1394     {
1395         public Gtk.Entry el;
1396         private ValaProjectSettings  _this;
1397
1398
1399             // my vars (def)
1400
1401         // ctor 
1402         public Xcls_build_compile_flags(ValaProjectSettings _owner )
1403         {
1404             _this = _owner;
1405             _this.build_compile_flags = this;
1406             this.el = new Gtk.Entry();
1407
1408             // my vars (dec)
1409
1410             // set gobject values
1411
1412             // listeners 
1413             this.el.changed.connect( () => {
1414                 if (_this.targets_tree.cursor.length < 1) {
1415                     return;
1416                 }
1417                 _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
1418             });
1419         }
1420
1421         // user defined functions 
1422     }
1423     public class Xcls_Label42 : Object 
1424     {
1425         public Gtk.Label el;
1426         private ValaProjectSettings  _this;
1427
1428
1429             // my vars (def)
1430
1431         // ctor 
1432         public Xcls_Label42(ValaProjectSettings _owner )
1433         {
1434             _this = _owner;
1435             this.el = new Gtk.Label( "Files to compile" );
1436
1437             // my vars (dec)
1438
1439             // set gobject values
1440         }
1441
1442         // user defined functions 
1443     }
1444     public class Xcls_ScrolledWindow43 : Object 
1445     {
1446         public Gtk.ScrolledWindow el;
1447         private ValaProjectSettings  _this;
1448
1449
1450             // my vars (def)
1451
1452         // ctor 
1453         public Xcls_ScrolledWindow43(ValaProjectSettings _owner )
1454         {
1455             _this = _owner;
1456             this.el = new Gtk.ScrolledWindow( null, null );
1457
1458             // my vars (dec)
1459
1460             // set gobject values
1461             var child_0 = new Xcls_files_tree( _this );
1462             child_0.ref();
1463         }
1464
1465         // user defined functions 
1466     }
1467     public class Xcls_files_tree : Object 
1468     {
1469         public Gtk.TreeView el;
1470         private ValaProjectSettings  _this;
1471
1472
1473             // my vars (def)
1474
1475         // ctor 
1476         public Xcls_files_tree(ValaProjectSettings _owner )
1477         {
1478             _this = _owner;
1479             this.el = new Gtk.TreeView();
1480
1481             // my vars (dec)
1482
1483             // set gobject values
1484             var child_0 = new Xcls_files_tree_store( _this );
1485             child_0.ref();
1486             this.el.set_model (  child_0.el  );
1487             var child_1 = new Xcls_TreeViewColumn46( _this );
1488             child_1.ref();
1489             this.el.append_column (  child_1.el  );
1490             var child_2 = new Xcls_TreeViewColumn48( _this );
1491             child_2.ref();
1492             this.el.append_column (  child_2.el  );
1493         }
1494
1495         // user defined functions 
1496     }
1497     public class Xcls_files_tree_store : Object 
1498     {
1499         public Gtk.ListStore el;
1500         private ValaProjectSettings  _this;
1501
1502
1503             // my vars (def)
1504
1505         // ctor 
1506         public Xcls_files_tree_store(ValaProjectSettings _owner )
1507         {
1508             _this = _owner;
1509             _this.files_tree_store = this;
1510             this.el = new Gtk.ListStore( 3,     typeof(string),  // 0 file name
1511      typeof(string), // type (dir orfile)
1512      typeof(bool)  // is checked.
1513       );
1514
1515             // my vars (dec)
1516
1517             // set gobject values
1518         }
1519
1520         // user defined functions 
1521         public void load () {
1522          
1523           this.el.clear();
1524           
1525             
1526              var def = _this.project.compilegroups.get("_default_");
1527              var items  = def.sources;
1528              
1529              
1530              
1531              
1532          
1533             Gtk.TreeIter citer;
1534         
1535             for(var i =0 ; i < items.size; i++) {
1536                  this.el.append(out citer);   
1537                  
1538                 this.el.set_value(citer, 0,   items.get(i) ); // title 
1539                 this.el.set_value(citer, 1,   "dir"); // type         
1540                 this.el.set_value(citer, 2,   false ); // checked 
1541         
1542                 var files = _this.project.files(items.get(i));
1543                 
1544                  for(var j =0 ; j < files.size; j++) {
1545                     this.el.append(out citer);   
1546                  
1547                     this.el.set_value(citer, 0,   files.get(j) ); // title 
1548                     this.el.set_value(citer, 1,   "file"); // type         
1549                     this.el.set_value(citer, 2,   false ); // checked 
1550         
1551                 }
1552                 
1553                 
1554                 //this.el.set_value(citer, 1,   items.get(i) );
1555             }
1556             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1557             
1558         }
1559     }
1560     public class Xcls_TreeViewColumn46 : Object 
1561     {
1562         public Gtk.TreeViewColumn el;
1563         private ValaProjectSettings  _this;
1564
1565
1566             // my vars (def)
1567
1568         // ctor 
1569         public Xcls_TreeViewColumn46(ValaProjectSettings _owner )
1570         {
1571             _this = _owner;
1572             this.el = new Gtk.TreeViewColumn();
1573
1574             // my vars (dec)
1575
1576             // set gobject values
1577             this.el.title = "name";
1578             this.el.resizable = true;
1579             var child_0 = new Xcls_files_render( _this );
1580             child_0.ref();
1581             this.el.pack_start (  child_0.el , false );
1582
1583             // init method 
1584
1585             /* this.el.add_attribute(_this.files_render.el , "markup", 2 );
1586             // this.el.add_attribute(_this.files_render.el , "text", 1 ); */        }
1587
1588         // user defined functions 
1589     }
1590     public class Xcls_files_render : Object 
1591     {
1592         public Gtk.CellRendererText el;
1593         private ValaProjectSettings  _this;
1594
1595
1596             // my vars (def)
1597
1598         // ctor 
1599         public Xcls_files_render(ValaProjectSettings _owner )
1600         {
1601             _this = _owner;
1602             _this.files_render = this;
1603             this.el = new Gtk.CellRendererText();
1604
1605             // my vars (dec)
1606
1607             // set gobject values
1608         }
1609
1610         // user defined functions 
1611     }
1612     public class Xcls_TreeViewColumn48 : Object 
1613     {
1614         public Gtk.TreeViewColumn el;
1615         private ValaProjectSettings  _this;
1616
1617
1618             // my vars (def)
1619
1620         // ctor 
1621         public Xcls_TreeViewColumn48(ValaProjectSettings _owner )
1622         {
1623             _this = _owner;
1624             this.el = new Gtk.TreeViewColumn();
1625
1626             // my vars (dec)
1627
1628             // set gobject values
1629             this.el.title = "use";
1630             this.el.resizable = false;
1631             this.el.fixed_width = 50;
1632             var child_0 = new Xcls_files_render_use( _this );
1633             child_0.ref();
1634             this.el.pack_start (  child_0.el , false );
1635
1636             // init method 
1637
1638             /*
1639             
1640              this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
1641              
1642              */        }
1643
1644         // user defined functions 
1645     }
1646     public class Xcls_files_render_use : Object 
1647     {
1648         public Gtk.CellRendererToggle el;
1649         private ValaProjectSettings  _this;
1650
1651
1652             // my vars (def)
1653
1654         // ctor 
1655         public Xcls_files_render_use(ValaProjectSettings _owner )
1656         {
1657             _this = _owner;
1658             _this.files_render_use = this;
1659             this.el = new Gtk.CellRendererToggle();
1660
1661             // my vars (dec)
1662
1663             // set gobject values
1664             this.el.activatable = true;
1665
1666             // listeners 
1667             this.el.toggled.connect( (  path_string) =>  { 
1668                 var m = _this.default_packages_tree_store.el;
1669                Gtk.TreeIter iter;
1670                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
1671                m.get_iter (out iter, path);
1672                GLib.Value val;
1673                m.get_value(iter, 1, out val);
1674                m.set_value(iter, 1,  ((bool) val) ? false :true); 
1675                  GLib.Value fval;  
1676                m.get_value(iter, 0, out fval);
1677                var fn = (string)fval;
1678                 
1679                 var def = _this.project.compilegroups.get("_default_");
1680                 var items  = def.packages;
1681                 if ((bool)val) {
1682                     // renive
1683                     items.remove(fn);
1684                 } else {
1685                     items.add(fn);
1686                 }
1687                 
1688             });
1689         }
1690
1691         // user defined functions 
1692     }
1693 }