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