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