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                    _this.set_vbox.cgroup = cg;
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             _this.set_vbox.el.hide();
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         public Project.GtkValaSettings cgroup;
1294
1295         // ctor 
1296         public Xcls_set_vbox(ValaProjectSettings _owner )
1297         {
1298             _this = _owner;
1299             _this.set_vbox = this;
1300             this.el = new Gtk.VBox( false, 0 );
1301
1302             // my vars (dec)
1303             this.cgroup = null;
1304
1305             // set gobject values
1306             var child_0 = new Xcls_Label38( _this );
1307             child_0.ref();
1308             this.el.pack_start (  child_0.el , false,false,0 );
1309             var child_1 = new Xcls_build_pack_target( _this );
1310             child_1.ref();
1311             this.el.pack_start (  child_1.el , false,false,0 );
1312             var child_2 = new Xcls_Label40( _this );
1313             child_2.ref();
1314             this.el.pack_start (  child_2.el , false,false,0 );
1315             var child_3 = new Xcls_build_compile_flags( _this );
1316             child_3.ref();
1317             this.el.pack_start (  child_3.el , false,false,0 );
1318             var child_4 = new Xcls_Label42( _this );
1319             child_4.ref();
1320             this.el.pack_start (  child_4.el , false,false,0 );
1321             var child_5 = new Xcls_ScrolledWindow43( _this );
1322             child_5.ref();
1323             this.el.pack_start (  child_5.el , true,true,0 );
1324         }
1325
1326         // user defined functions 
1327     }
1328     public class Xcls_Label38 : Object 
1329     {
1330         public Gtk.Label el;
1331         private ValaProjectSettings  _this;
1332
1333
1334             // my vars (def)
1335
1336         // ctor 
1337         public Xcls_Label38(ValaProjectSettings _owner )
1338         {
1339             _this = _owner;
1340             this.el = new Gtk.Label( "target filename" );
1341
1342             // my vars (dec)
1343
1344             // set gobject values
1345         }
1346
1347         // user defined functions 
1348     }
1349     public class Xcls_build_pack_target : Object 
1350     {
1351         public Gtk.Entry el;
1352         private ValaProjectSettings  _this;
1353
1354
1355             // my vars (def)
1356
1357         // ctor 
1358         public Xcls_build_pack_target(ValaProjectSettings _owner )
1359         {
1360             _this = _owner;
1361             _this.build_pack_target = this;
1362             this.el = new Gtk.Entry();
1363
1364             // my vars (dec)
1365
1366             // set gobject values
1367
1368             // listeners 
1369             this.el.changed.connect( ()  => {
1370                     if (_this.targets_tree.cursor.length < 1) {
1371                     return;
1372                 }
1373                 _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
1374             });
1375         }
1376
1377         // user defined functions 
1378     }
1379     public class Xcls_Label40 : Object 
1380     {
1381         public Gtk.Label el;
1382         private ValaProjectSettings  _this;
1383
1384
1385             // my vars (def)
1386
1387         // ctor 
1388         public Xcls_Label40(ValaProjectSettings _owner )
1389         {
1390             _this = _owner;
1391             this.el = new Gtk.Label( "compile flags" );
1392
1393             // my vars (dec)
1394
1395             // set gobject values
1396         }
1397
1398         // user defined functions 
1399     }
1400     public class Xcls_build_compile_flags : Object 
1401     {
1402         public Gtk.Entry el;
1403         private ValaProjectSettings  _this;
1404
1405
1406             // my vars (def)
1407
1408         // ctor 
1409         public Xcls_build_compile_flags(ValaProjectSettings _owner )
1410         {
1411             _this = _owner;
1412             _this.build_compile_flags = this;
1413             this.el = new Gtk.Entry();
1414
1415             // my vars (dec)
1416
1417             // set gobject values
1418
1419             // listeners 
1420             this.el.changed.connect( () => {
1421                 if (_this.targets_tree.cursor.length < 1) {
1422                     return;
1423                 }
1424                 _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
1425             });
1426         }
1427
1428         // user defined functions 
1429     }
1430     public class Xcls_Label42 : Object 
1431     {
1432         public Gtk.Label el;
1433         private ValaProjectSettings  _this;
1434
1435
1436             // my vars (def)
1437
1438         // ctor 
1439         public Xcls_Label42(ValaProjectSettings _owner )
1440         {
1441             _this = _owner;
1442             this.el = new Gtk.Label( "Files to compile" );
1443
1444             // my vars (dec)
1445
1446             // set gobject values
1447         }
1448
1449         // user defined functions 
1450     }
1451     public class Xcls_ScrolledWindow43 : Object 
1452     {
1453         public Gtk.ScrolledWindow el;
1454         private ValaProjectSettings  _this;
1455
1456
1457             // my vars (def)
1458
1459         // ctor 
1460         public Xcls_ScrolledWindow43(ValaProjectSettings _owner )
1461         {
1462             _this = _owner;
1463             this.el = new Gtk.ScrolledWindow( null, null );
1464
1465             // my vars (dec)
1466
1467             // set gobject values
1468             var child_0 = new Xcls_files_tree( _this );
1469             child_0.ref();
1470             this.el.add (  child_0.el  );
1471         }
1472
1473         // user defined functions 
1474     }
1475     public class Xcls_files_tree : Object 
1476     {
1477         public Gtk.TreeView el;
1478         private ValaProjectSettings  _this;
1479
1480
1481             // my vars (def)
1482
1483         // ctor 
1484         public Xcls_files_tree(ValaProjectSettings _owner )
1485         {
1486             _this = _owner;
1487             this.el = new Gtk.TreeView();
1488
1489             // my vars (dec)
1490
1491             // set gobject values
1492             var child_0 = new Xcls_files_tree_store( _this );
1493             child_0.ref();
1494             this.el.set_model (  child_0.el  );
1495             var child_1 = new Xcls_TreeViewColumn46( _this );
1496             child_1.ref();
1497             this.el.append_column (  child_1.el  );
1498             var child_2 = new Xcls_TreeViewColumn48( _this );
1499             child_2.ref();
1500             this.el.append_column (  child_2.el  );
1501         }
1502
1503         // user defined functions 
1504     }
1505     public class Xcls_files_tree_store : Object 
1506     {
1507         public Gtk.ListStore el;
1508         private ValaProjectSettings  _this;
1509
1510
1511             // my vars (def)
1512
1513         // ctor 
1514         public Xcls_files_tree_store(ValaProjectSettings _owner )
1515         {
1516             _this = _owner;
1517             _this.files_tree_store = this;
1518             this.el = new Gtk.ListStore( 4,     typeof(string),  // 0 file name
1519         typeof(string),  // 0 basename
1520      typeof(string), // type (dir orfile)
1521      typeof(bool)  // is checked.
1522       );
1523
1524             // my vars (dec)
1525
1526             // set gobject values
1527         }
1528
1529         // user defined functions 
1530         public void load () {
1531          
1532               this.el.clear();
1533           
1534             
1535              var def = _this.project.compilegroups.get("_default_");
1536              var items  = def.sources;
1537              
1538              
1539              
1540              
1541          
1542             Gtk.TreeIter citer;
1543         
1544             for(var i =0 ; i < items.size; i++) {
1545                  this.el.append(out citer);   
1546                  
1547                 this.el.set_value(citer, 0,   items.get(i) ); // title 
1548                 this.el.set_value(citer, 1,   "<span foreground=\"green\" font_weight=\"bold\">" + 
1549                             GLib.Markup.escape_text(items.get(i)) + "</span>"
1550                     ); // title 
1551                 print("ADD item %s", items.get(i));
1552                 this.el.set_value(citer, 2,   "dir"); // type         
1553                 this.el.set_value(citer, 3,   false ); // checked 
1554         
1555                 var files = _this.project.files(items.get(i));
1556                 
1557                  for(var j =0 ; j < files.size; j++) {
1558                     this.el.append(out citer);   
1559                          print("ADD item %s", files.get(j));
1560                     this.el.set_value(citer, 0,   files.get(j) ); // title 
1561                     this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             
1562                     this.el.set_value(citer, 2,   "file"); // type         
1563                     this.el.set_value(citer, 3,   false ); // checked 
1564         
1565                 }
1566                 
1567                 
1568                 //this.el.set_value(citer, 1,   items.get(i) );
1569             }
1570             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1571             
1572         }
1573     }
1574     public class Xcls_TreeViewColumn46 : Object 
1575     {
1576         public Gtk.TreeViewColumn el;
1577         private ValaProjectSettings  _this;
1578
1579
1580             // my vars (def)
1581
1582         // ctor 
1583         public Xcls_TreeViewColumn46(ValaProjectSettings _owner )
1584         {
1585             _this = _owner;
1586             this.el = new Gtk.TreeViewColumn();
1587
1588             // my vars (dec)
1589
1590             // set gobject values
1591             this.el.title = "name";
1592             this.el.resizable = true;
1593             var child_0 = new Xcls_files_render( _this );
1594             child_0.ref();
1595             this.el.pack_start (  child_0.el , false );
1596
1597             // init method 
1598
1599             this.el.add_attribute(_this.files_render.el , "markup", 1 ); // basnemae
1600              
1601             /*  this.el.add_attribute(_this.files_render.el , "markup", 2 );
1602             */        }
1603
1604         // user defined functions 
1605     }
1606     public class Xcls_files_render : Object 
1607     {
1608         public Gtk.CellRendererText el;
1609         private ValaProjectSettings  _this;
1610
1611
1612             // my vars (def)
1613
1614         // ctor 
1615         public Xcls_files_render(ValaProjectSettings _owner )
1616         {
1617             _this = _owner;
1618             _this.files_render = this;
1619             this.el = new Gtk.CellRendererText();
1620
1621             // my vars (dec)
1622
1623             // set gobject values
1624         }
1625
1626         // user defined functions 
1627     }
1628     public class Xcls_TreeViewColumn48 : Object 
1629     {
1630         public Gtk.TreeViewColumn el;
1631         private ValaProjectSettings  _this;
1632
1633
1634             // my vars (def)
1635
1636         // ctor 
1637         public Xcls_TreeViewColumn48(ValaProjectSettings _owner )
1638         {
1639             _this = _owner;
1640             this.el = new Gtk.TreeViewColumn();
1641
1642             // my vars (dec)
1643
1644             // set gobject values
1645             this.el.title = "use";
1646             this.el.resizable = false;
1647             this.el.fixed_width = 50;
1648             var child_0 = new Xcls_files_render_use( _this );
1649             child_0.ref();
1650             this.el.pack_start (  child_0.el , false );
1651
1652             // init method 
1653
1654             {
1655              this.el.add_attribute(_this.files_render_use.el , "active", 3 );
1656              }        }
1657
1658         // user defined functions 
1659     }
1660     public class Xcls_files_render_use : Object 
1661     {
1662         public Gtk.CellRendererToggle el;
1663         private ValaProjectSettings  _this;
1664
1665
1666             // my vars (def)
1667
1668         // ctor 
1669         public Xcls_files_render_use(ValaProjectSettings _owner )
1670         {
1671             _this = _owner;
1672             _this.files_render_use = this;
1673             this.el = new Gtk.CellRendererToggle();
1674
1675             // my vars (dec)
1676
1677             // set gobject values
1678             this.el.activatable = true;
1679
1680             // listeners 
1681             this.el.toggled.connect( (  path_string) =>  { 
1682             
1683             
1684             
1685                 var m = _this.files_tree_store.el;
1686                Gtk.TreeIter iter;
1687                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
1688                m.get_iter (out iter, path);
1689                GLib.Value val;
1690                m.get_value(iter, 3, out val);
1691                m.set_value(iter, 3,  ((bool) val) ? false :true); 
1692                
1693                // type.
1694                GLib.Value ftval;  
1695                m.get_value(iter, 2, out ftval);
1696                var ftype = (string)ftval;   
1697                
1698                // full name...
1699                GLib.Value fval;     
1700                m.get_value(iter, 0, out fval);
1701                var fn = (string)fval;
1702                 
1703                 
1704                 var cg = = _this.set_vbox.cgroup;
1705                 // what's the sleected target?
1706                 // update the list..
1707                 // if ftype is a dir == then toggle all the bellow.
1708                 // if ftype is a file .. see if all the files in that directory are check and check the dir.
1709             
1710                 var items  = def.packages;
1711                 if ((bool)val) {
1712                     // renive
1713                     cg.sources.remove(fn);
1714                 } else {
1715                     cg.sources.add(fn);
1716                 }
1717                 
1718             });
1719         }
1720
1721         // user defined functions 
1722     }
1723 }