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.DOUBLE_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                         return;
1138                     }
1139             
1140                         
1141                    // add the directory..
1142                    
1143                    
1144                    GLib.Value val;
1145                     mod.get_value(iter,0, out val);
1146                    var fn =  (string) val;
1147                    
1148                    this.cursor = fn;
1149                    var cg = _this.project.compilegroups.get(fn);
1150                    _this.build_pack_target.el.set_text(cg.target_bin);
1151                    _this.build_compile_flags.el.set_text(cg.compile_flags);
1152                    // load the srouces
1153             
1154             
1155               });
1156         }
1157
1158         // user defined functions 
1159     }
1160     public class Xcls_targets_tree_store : Object 
1161     {
1162         public Gtk.ListStore el;
1163         private ValaProjectSettings  _this;
1164
1165
1166             // my vars (def)
1167
1168         // ctor 
1169         public Xcls_targets_tree_store(ValaProjectSettings _owner )
1170         {
1171             _this = _owner;
1172             _this.targets_tree_store = this;
1173             this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
1174      typeof(string) // ??
1175       );
1176
1177             // my vars (dec)
1178
1179             // set gobject values
1180         }
1181
1182         // user defined functions 
1183         public void load () {
1184          
1185           this.el.clear();
1186           
1187             
1188              var cg = _this.project.compilegroups;
1189              
1190            _this.targets_tree.cursor = "";
1191             Gtk.TreeIter citer;
1192             var iter = cg.map_iterator();
1193            while(iter.next()) {
1194                 var key = iter.get_key();
1195                 if (key == "_default_") {
1196                     continue;
1197                 }
1198             
1199                  this.el.append(out citer);   
1200                  
1201                 this.el.set_value(citer, 0,   key ); // title 
1202                 //this.el.set_value(citer, 1,   items.get(i) );
1203             };
1204             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1205             
1206         }
1207     }
1208     public class Xcls_TreeViewColumn35 : Object 
1209     {
1210         public Gtk.TreeViewColumn el;
1211         private ValaProjectSettings  _this;
1212
1213
1214             // my vars (def)
1215
1216         // ctor 
1217         public Xcls_TreeViewColumn35(ValaProjectSettings _owner )
1218         {
1219             _this = _owner;
1220             this.el = new Gtk.TreeViewColumn();
1221
1222             // my vars (dec)
1223
1224             // set gobject values
1225             this.el.title = "name";
1226             this.el.resizable = true;
1227             var child_0 = new Xcls_targets_render( _this );
1228             child_0.ref();
1229             this.el.pack_start (  child_0.el , false );
1230
1231             // init method 
1232
1233             {
1234                  this.el.add_attribute(_this.targets_render.el , "text", 0 );
1235              }        }
1236
1237         // user defined functions 
1238     }
1239     public class Xcls_targets_render : Object 
1240     {
1241         public Gtk.CellRendererText el;
1242         private ValaProjectSettings  _this;
1243
1244
1245             // my vars (def)
1246
1247         // ctor 
1248         public Xcls_targets_render(ValaProjectSettings _owner )
1249         {
1250             _this = _owner;
1251             _this.targets_render = this;
1252             this.el = new Gtk.CellRendererText();
1253
1254             // my vars (dec)
1255
1256             // set gobject values
1257             this.el.editable = true;
1258
1259             // listeners 
1260             this.el.edited.connect( (path, newtext) => {
1261                  
1262                  Gtk.TreeIter  iter;
1263                     _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1264                    GLib.Value gval;
1265                     _this.targets_tree_store.el.get_value(iter,0, out gval);
1266                     var oldval = (string)gval;
1267                    if (oldval == newtext) {
1268                       return;
1269                     }
1270                      var cg = _this.project.compilegroups.get(oldval);
1271                     cg.name = newtext;
1272                     _this.project.compilegroups.unset(oldval);
1273                     _this.project.compilegroups.set(newtext, cg);
1274                 _this.targets_tree_store.load();
1275               });
1276         }
1277
1278         // user defined functions 
1279     }
1280     public class Xcls_set_vbox : Object 
1281     {
1282         public Gtk.VBox el;
1283         private ValaProjectSettings  _this;
1284
1285
1286             // my vars (def)
1287
1288         // ctor 
1289         public Xcls_set_vbox(ValaProjectSettings _owner )
1290         {
1291             _this = _owner;
1292             this.el = new Gtk.VBox( false, 0 );
1293
1294             // my vars (dec)
1295
1296             // set gobject values
1297             var child_0 = new Xcls_Label38( _this );
1298             child_0.ref();
1299             this.el.pack_start (  child_0.el , false,false,0 );
1300             var child_1 = new Xcls_build_pack_target( _this );
1301             child_1.ref();
1302             this.el.pack_start (  child_1.el , false,false,0 );
1303             var child_2 = new Xcls_Label40( _this );
1304             child_2.ref();
1305             this.el.pack_start (  child_2.el , false,false,0 );
1306             var child_3 = new Xcls_build_compile_flags( _this );
1307             child_3.ref();
1308             this.el.pack_start (  child_3.el , false,false,0 );
1309             var child_4 = new Xcls_Label42( _this );
1310             child_4.ref();
1311             this.el.pack_start (  child_4.el , false,false,0 );
1312             var child_5 = new Xcls_ScrolledWindow43( _this );
1313             child_5.ref();
1314             this.el.pack_start (  child_5.el , true,true,0 );
1315         }
1316
1317         // user defined functions 
1318     }
1319     public class Xcls_Label38 : Object 
1320     {
1321         public Gtk.Label el;
1322         private ValaProjectSettings  _this;
1323
1324
1325             // my vars (def)
1326
1327         // ctor 
1328         public Xcls_Label38(ValaProjectSettings _owner )
1329         {
1330             _this = _owner;
1331             this.el = new Gtk.Label( "target filename" );
1332
1333             // my vars (dec)
1334
1335             // set gobject values
1336         }
1337
1338         // user defined functions 
1339     }
1340     public class Xcls_build_pack_target : Object 
1341     {
1342         public Gtk.Entry el;
1343         private ValaProjectSettings  _this;
1344
1345
1346             // my vars (def)
1347
1348         // ctor 
1349         public Xcls_build_pack_target(ValaProjectSettings _owner )
1350         {
1351             _this = _owner;
1352             _this.build_pack_target = this;
1353             this.el = new Gtk.Entry();
1354
1355             // my vars (dec)
1356
1357             // set gobject values
1358
1359             // listeners 
1360             this.el.changed.connect( ()  => {
1361                     if (_this.targets_tree.cursor.length < 1) {
1362                     return;
1363                 }
1364                 _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
1365             });
1366         }
1367
1368         // user defined functions 
1369     }
1370     public class Xcls_Label40 : Object 
1371     {
1372         public Gtk.Label el;
1373         private ValaProjectSettings  _this;
1374
1375
1376             // my vars (def)
1377
1378         // ctor 
1379         public Xcls_Label40(ValaProjectSettings _owner )
1380         {
1381             _this = _owner;
1382             this.el = new Gtk.Label( "compile flags" );
1383
1384             // my vars (dec)
1385
1386             // set gobject values
1387         }
1388
1389         // user defined functions 
1390     }
1391     public class Xcls_build_compile_flags : Object 
1392     {
1393         public Gtk.Entry el;
1394         private ValaProjectSettings  _this;
1395
1396
1397             // my vars (def)
1398
1399         // ctor 
1400         public Xcls_build_compile_flags(ValaProjectSettings _owner )
1401         {
1402             _this = _owner;
1403             _this.build_compile_flags = this;
1404             this.el = new Gtk.Entry();
1405
1406             // my vars (dec)
1407
1408             // set gobject values
1409
1410             // listeners 
1411             this.el.changed.connect( () => {
1412                 if (_this.targets_tree.cursor.length < 1) {
1413                     return;
1414                 }
1415                 _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
1416             });
1417         }
1418
1419         // user defined functions 
1420     }
1421     public class Xcls_Label42 : Object 
1422     {
1423         public Gtk.Label el;
1424         private ValaProjectSettings  _this;
1425
1426
1427             // my vars (def)
1428
1429         // ctor 
1430         public Xcls_Label42(ValaProjectSettings _owner )
1431         {
1432             _this = _owner;
1433             this.el = new Gtk.Label( "Files to compile" );
1434
1435             // my vars (dec)
1436
1437             // set gobject values
1438         }
1439
1440         // user defined functions 
1441     }
1442     public class Xcls_ScrolledWindow43 : Object 
1443     {
1444         public Gtk.ScrolledWindow el;
1445         private ValaProjectSettings  _this;
1446
1447
1448             // my vars (def)
1449
1450         // ctor 
1451         public Xcls_ScrolledWindow43(ValaProjectSettings _owner )
1452         {
1453             _this = _owner;
1454             this.el = new Gtk.ScrolledWindow( null, null );
1455
1456             // my vars (dec)
1457
1458             // set gobject values
1459             var child_0 = new Xcls_files_tree( _this );
1460             child_0.ref();
1461         }
1462
1463         // user defined functions 
1464     }
1465     public class Xcls_files_tree : Object 
1466     {
1467         public Gtk.TreeView el;
1468         private ValaProjectSettings  _this;
1469
1470
1471             // my vars (def)
1472
1473         // ctor 
1474         public Xcls_files_tree(ValaProjectSettings _owner )
1475         {
1476             _this = _owner;
1477             this.el = new Gtk.TreeView();
1478
1479             // my vars (dec)
1480
1481             // set gobject values
1482             var child_0 = new Xcls_files_tree_store( _this );
1483             child_0.ref();
1484             this.el.set_model (  child_0.el  );
1485             var child_1 = new Xcls_TreeViewColumn46( _this );
1486             child_1.ref();
1487             this.el.append_column (  child_1.el  );
1488             var child_2 = new Xcls_TreeViewColumn48( _this );
1489             child_2.ref();
1490             this.el.append_column (  child_2.el  );
1491         }
1492
1493         // user defined functions 
1494     }
1495     public class Xcls_files_tree_store : Object 
1496     {
1497         public Gtk.ListStore el;
1498         private ValaProjectSettings  _this;
1499
1500
1501             // my vars (def)
1502
1503         // ctor 
1504         public Xcls_files_tree_store(ValaProjectSettings _owner )
1505         {
1506             _this = _owner;
1507             _this.files_tree_store = this;
1508             this.el = new Gtk.ListStore( 3,     typeof(string),  // 0 file name
1509      typeof(string), // type (dir orfile)
1510      typeof(bool)  // is checked.
1511       );
1512
1513             // my vars (dec)
1514
1515             // set gobject values
1516         }
1517
1518         // user defined functions 
1519         public void load () {
1520          
1521           this.el.clear();
1522           
1523             
1524              var def = _this.project.compilegroups.get("_default_");
1525              var items  = def.sources;
1526              
1527          
1528             Gtk.TreeIter citer;
1529         
1530             for(var i =0 ; i < items.size; i++) {
1531                  this.el.append(out citer);   
1532                  
1533                 this.el.set_value(citer, 0,   items.get(i) ); // title 
1534                 this.el.set_value(citer, 1,   "dir"); // type         
1535                 this.el.set_value(citer, 2,   false ); // checked 
1536                 /*
1537                 var files = def.files(items.get(i));
1538                 
1539                  for(var j =0 ; j < files.size; j++) {
1540                     this.el.append(out citer);   
1541                  
1542                     this.el.set_value(citer, 0,   files.get(j) ); // title 
1543                     this.el.set_value(citer, 1,   "file"); // type         
1544                     this.el.set_value(citer, 2,   false ); // checked 
1545         
1546                 }
1547                 */
1548                 
1549                 //this.el.set_value(citer, 1,   items.get(i) );
1550             }
1551             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1552             
1553         }
1554     }
1555     public class Xcls_TreeViewColumn46 : Object 
1556     {
1557         public Gtk.TreeViewColumn el;
1558         private ValaProjectSettings  _this;
1559
1560
1561             // my vars (def)
1562
1563         // ctor 
1564         public Xcls_TreeViewColumn46(ValaProjectSettings _owner )
1565         {
1566             _this = _owner;
1567             this.el = new Gtk.TreeViewColumn();
1568
1569             // my vars (dec)
1570
1571             // set gobject values
1572             this.el.title = "name";
1573             this.el.resizable = true;
1574             var child_0 = new Xcls_files_render( _this );
1575             child_0.ref();
1576             this.el.pack_start (  child_0.el , false );
1577
1578             // init method 
1579
1580             /* this.el.add_attribute(_this.files_render.el , "markup", 2 );
1581             // this.el.add_attribute(_this.files_render.el , "text", 1 ); */        }
1582
1583         // user defined functions 
1584     }
1585     public class Xcls_files_render : Object 
1586     {
1587         public Gtk.CellRendererText el;
1588         private ValaProjectSettings  _this;
1589
1590
1591             // my vars (def)
1592
1593         // ctor 
1594         public Xcls_files_render(ValaProjectSettings _owner )
1595         {
1596             _this = _owner;
1597             _this.files_render = this;
1598             this.el = new Gtk.CellRendererText();
1599
1600             // my vars (dec)
1601
1602             // set gobject values
1603         }
1604
1605         // user defined functions 
1606     }
1607     public class Xcls_TreeViewColumn48 : Object 
1608     {
1609         public Gtk.TreeViewColumn el;
1610         private ValaProjectSettings  _this;
1611
1612
1613             // my vars (def)
1614
1615         // ctor 
1616         public Xcls_TreeViewColumn48(ValaProjectSettings _owner )
1617         {
1618             _this = _owner;
1619             this.el = new Gtk.TreeViewColumn();
1620
1621             // my vars (dec)
1622
1623             // set gobject values
1624             this.el.title = "use";
1625             this.el.resizable = false;
1626             this.el.fixed_width = 50;
1627             var child_0 = new Xcls_files_render_use( _this );
1628             child_0.ref();
1629             this.el.pack_start (  child_0.el , false );
1630
1631             // init method 
1632
1633             /*
1634             
1635              this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
1636              
1637              */        }
1638
1639         // user defined functions 
1640     }
1641     public class Xcls_files_render_use : Object 
1642     {
1643         public Gtk.CellRendererToggle el;
1644         private ValaProjectSettings  _this;
1645
1646
1647             // my vars (def)
1648
1649         // ctor 
1650         public Xcls_files_render_use(ValaProjectSettings _owner )
1651         {
1652             _this = _owner;
1653             _this.files_render_use = this;
1654             this.el = new Gtk.CellRendererToggle();
1655
1656             // my vars (dec)
1657
1658             // set gobject values
1659             this.el.activatable = true;
1660
1661             // listeners 
1662             this.el.toggled.connect( (  path_string) =>  { 
1663                 var m = _this.default_packages_tree_store.el;
1664                Gtk.TreeIter iter;
1665                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
1666                m.get_iter (out iter, path);
1667                GLib.Value val;
1668                m.get_value(iter, 1, out val);
1669                m.set_value(iter, 1,  ((bool) val) ? false :true); 
1670                  GLib.Value fval;  
1671                m.get_value(iter, 0, out fval);
1672                var fn = (string)fval;
1673                 
1674                 var def = _this.project.compilegroups.get("_default_");
1675                 var items  = def.packages;
1676                 if ((bool)val) {
1677                     // renive
1678                     items.remove(fn);
1679                 } else {
1680                     items.add(fn);
1681                 }
1682                 
1683             });
1684         }
1685
1686         // user defined functions 
1687     }
1688 }