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