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