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