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