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