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
391         // user defined functions 
392     }
393     public class Xcls_packages_render : Object 
394     {
395         public Gtk.CellRendererText el;
396         private ValaProjectSettings  _this;
397
398
399             // my vars (def)
400
401         // ctor 
402         public Xcls_packages_render(ValaProjectSettings _owner )
403         {
404             _this = _owner;
405             _this.packages_render = this;
406             this.el = new Gtk.CellRendererText();
407
408             // my vars (dec)
409
410             // set gobject values
411         }
412
413         // user defined functions 
414     }
415     public class Xcls_TreeViewColumn14 : Object 
416     {
417         public Gtk.TreeViewColumn el;
418         private ValaProjectSettings  _this;
419
420
421             // my vars (def)
422
423         // ctor 
424         public Xcls_TreeViewColumn14(ValaProjectSettings _owner )
425         {
426             _this = _owner;
427             this.el = new Gtk.TreeViewColumn();
428
429             // my vars (dec)
430
431             // set gobject values
432             this.el.title = "use";
433             this.el.resizable = false;
434             this.el.fixed_width = 50;
435             var child_0 = new Xcls_packages_render_use( _this );
436             child_0.ref();
437             this.el.pack_start (  child_0.el , false );
438
439             // init method 
440
441             {
442              this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
443              }
444         }
445
446         // user defined functions 
447     }
448     public class Xcls_packages_render_use : Object 
449     {
450         public Gtk.CellRendererToggle el;
451         private ValaProjectSettings  _this;
452
453
454             // my vars (def)
455
456         // ctor 
457         public Xcls_packages_render_use(ValaProjectSettings _owner )
458         {
459             _this = _owner;
460             _this.packages_render_use = this;
461             this.el = new Gtk.CellRendererToggle();
462
463             // my vars (dec)
464
465             // set gobject values
466             this.el.activatable = true;
467
468             // listeners 
469             this.el.toggled.connect( (  path_string) =>  { 
470                 var m = _this.default_packages_tree_store.el;
471                Gtk.TreeIter iter;
472                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
473                m.get_iter (out iter, path);
474                GLib.Value val;
475                m.get_value(iter, 1, out val);
476                m.set_value(iter, 1,  ((bool) val) ? false :true); 
477                  GLib.Value fval;  
478                m.get_value(iter, 0, out fval);
479                var fn = (string)fval;
480                 
481                 var def = _this.project.compilegroups.get("_default_");
482                 var items  = def.packages;
483                 if ((bool)val) {
484                     // renive
485                     items.remove(fn);
486                 } else {
487                     items.add(fn);
488                 }
489                 
490             });
491         }
492
493         // user defined functions 
494     }
495     public class Xcls_Label16 : Object 
496     {
497         public Gtk.Label el;
498         private ValaProjectSettings  _this;
499
500
501             // my vars (def)
502
503         // ctor 
504         public Xcls_Label16(ValaProjectSettings _owner )
505         {
506             _this = _owner;
507             this.el = new Gtk.Label( "Available Directories" );
508
509             // my vars (dec)
510
511             // set gobject values
512         }
513
514         // user defined functions 
515     }
516     public class Xcls_ScrolledWindow17 : Object 
517     {
518         public Gtk.ScrolledWindow el;
519         private ValaProjectSettings  _this;
520
521
522             // my vars (def)
523
524         // ctor 
525         public Xcls_ScrolledWindow17(ValaProjectSettings _owner )
526         {
527             _this = _owner;
528             this.el = new Gtk.ScrolledWindow( null, null );
529
530             // my vars (dec)
531
532             // set gobject values
533             var child_0 = new Xcls_default_directory_tree( _this );
534             child_0.ref();
535             this.el.add (  child_0.el  );
536             var child_1 = new Xcls_default_directory_menu( _this );
537             child_1.ref();
538         }
539
540         // user defined functions 
541     }
542     public class Xcls_default_directory_tree : Object 
543     {
544         public Gtk.TreeView el;
545         private ValaProjectSettings  _this;
546
547
548             // my vars (def)
549
550         // ctor 
551         public Xcls_default_directory_tree(ValaProjectSettings _owner )
552         {
553             _this = _owner;
554             _this.default_directory_tree = this;
555             this.el = new Gtk.TreeView();
556
557             // my vars (dec)
558
559             // set gobject values
560             this.el.headers_visible = false;
561             var child_0 = new Xcls_default_directory_tree_store( _this );
562             child_0.ref();
563             this.el.set_model (  child_0.el  );
564             var child_1 = new Xcls_TreeViewColumn20( _this );
565             child_1.ref();
566             this.el.append_column (  child_1.el  );
567
568             // listeners 
569             this.el.button_press_event.connect( ( ev) => {
570                 //console.log("button press?");
571                
572                 
573                 if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
574                     //print("click" + ev.type);
575                     return false;
576                 }
577                 //Gtk.TreePath res;
578                 //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
579                 //    return true;
580                 //}
581                  
582               //  this.el.get_selection().select_path(res);
583                  
584                   //if (!this.get('/LeftTreeMenu').el)  { 
585                   //      this.get('/LeftTreeMenu').init(); 
586                   //  }
587                     
588                  _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());
589                  _this.default_directory_menu.el.show_all();
590                   _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);
591                  //   print("click:" + res.path.to_string());
592                   return true;
593             });
594         }
595
596         // user defined functions 
597     }
598     public class Xcls_default_directory_tree_store : Object 
599     {
600         public Gtk.ListStore el;
601         private ValaProjectSettings  _this;
602
603
604             // my vars (def)
605
606         // ctor 
607         public Xcls_default_directory_tree_store(ValaProjectSettings _owner )
608         {
609             _this = _owner;
610             _this.default_directory_tree_store = this;
611             this.el = new Gtk.ListStore( 1,     typeof(string)
612       );
613
614             // my vars (dec)
615
616             // set gobject values
617         }
618
619         // user defined functions 
620         public void load () {
621          
622           this.el.clear();
623           
624             
625              var def = _this.project.compilegroups.get("_default_");
626              var items  = def.sources;
627              
628          
629             Gtk.TreeIter citer;
630         
631             for(var i =0 ; i < items.size; i++) {
632                  this.el.append(out citer);   
633                  
634                 this.el.set_value(citer, 0,   items.get(i) ); // title 
635                 //this.el.set_value(citer, 1,   items.get(i) );
636             }
637             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
638             
639         }
640     }
641     public class Xcls_TreeViewColumn20 : Object 
642     {
643         public Gtk.TreeViewColumn el;
644         private ValaProjectSettings  _this;
645
646
647             // my vars (def)
648
649         // ctor 
650         public Xcls_TreeViewColumn20(ValaProjectSettings _owner )
651         {
652             _this = _owner;
653             this.el = new Gtk.TreeViewColumn();
654
655             // my vars (dec)
656
657             // set gobject values
658             this.el.title = "name";
659             this.el.resizable = true;
660             var child_0 = new Xcls_directory_render( _this );
661             child_0.ref();
662             this.el.pack_start (  child_0.el , false );
663
664             // init method 
665
666             this.el.add_attribute(_this.directory_render.el , "text", 0 );
667         }
668
669         // user defined functions 
670     }
671     public class Xcls_directory_render : Object 
672     {
673         public Gtk.CellRendererText el;
674         private ValaProjectSettings  _this;
675
676
677             // my vars (def)
678
679         // ctor 
680         public Xcls_directory_render(ValaProjectSettings _owner )
681         {
682             _this = _owner;
683             _this.directory_render = this;
684             this.el = new Gtk.CellRendererText();
685
686             // my vars (dec)
687
688             // set gobject values
689         }
690
691         // user defined functions 
692     }
693     public class Xcls_default_directory_menu : Object 
694     {
695         public Gtk.Menu el;
696         private ValaProjectSettings  _this;
697
698
699             // my vars (def)
700
701         // ctor 
702         public Xcls_default_directory_menu(ValaProjectSettings _owner )
703         {
704             _this = _owner;
705             _this.default_directory_menu = this;
706             this.el = new Gtk.Menu();
707
708             // my vars (dec)
709
710             // set gobject values
711             var child_0 = new Xcls_MenuItem23( _this );
712             child_0.ref();
713             this.el.add (  child_0.el  );
714             var child_1 = new Xcls_MenuItem24( _this );
715             child_1.ref();
716             this.el.add (  child_1.el  );
717             var child_2 = new Xcls_SeparatorMenuItem25( _this );
718             child_2.ref();
719             this.el.add (  child_2.el  );
720             var child_3 = new Xcls_MenuItem26( _this );
721             child_3.ref();
722             this.el.add (  child_3.el  );
723         }
724
725         // user defined functions 
726     }
727     public class Xcls_MenuItem23 : Object 
728     {
729         public Gtk.MenuItem el;
730         private ValaProjectSettings  _this;
731
732
733             // my vars (def)
734
735         // ctor 
736         public Xcls_MenuItem23(ValaProjectSettings _owner )
737         {
738             _this = _owner;
739             this.el = new Gtk.MenuItem();
740
741             // my vars (dec)
742
743             // set gobject values
744             this.el.label = "Add Directory";
745
746             // listeners 
747             this.el.activate.connect( ()  => {
748                 
749                 var  chooser = new Gtk.FileChooserDialog (
750                 "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
751                 "_Cancel",
752                 Gtk.ResponseType.CANCEL,
753                 "_Add",
754                 Gtk.ResponseType.ACCEPT);
755                 if (chooser.run () != Gtk.ResponseType.ACCEPT) {
756                     chooser.close ();
757                        return;
758                    }
759                    chooser.close ();
760                    // add the directory..
761                    var fn = _this.project.relPath(chooser.get_filename());
762                    _this.project.compilegroups.get("_default_").sources.add(fn);
763                    _this.default_directory_tree_store.load();
764             });
765         }
766
767         // user defined functions 
768     }
769     public class Xcls_MenuItem24 : Object 
770     {
771         public Gtk.MenuItem el;
772         private ValaProjectSettings  _this;
773
774
775             // my vars (def)
776
777         // ctor 
778         public Xcls_MenuItem24(ValaProjectSettings _owner )
779         {
780             _this = _owner;
781             this.el = new Gtk.MenuItem();
782
783             // my vars (dec)
784
785             // set gobject values
786             this.el.label = "Add File";
787
788             // listeners 
789             this.el.activate.connect( ()  => {
790                 
791                 var  chooser = new Gtk.FileChooserDialog (
792                 "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
793                 "_Cancel",
794                 Gtk.ResponseType.CANCEL,
795                 "_Add",
796                 Gtk.ResponseType.ACCEPT);
797                 if (chooser.run () != Gtk.ResponseType.ACCEPT) {
798                     chooser.close ();
799                        return;
800                    }
801                    chooser.close ();
802                    // add the directory..
803                    var fn = _this.project.relPath(chooser.get_filename());
804                    _this.project.compilegroups.get("_default_").sources.add(fn);
805                    _this.default_directory_tree_store.load();
806             });
807         }
808
809         // user defined functions 
810     }
811     public class Xcls_SeparatorMenuItem25 : Object 
812     {
813         public Gtk.SeparatorMenuItem el;
814         private ValaProjectSettings  _this;
815
816
817             // my vars (def)
818
819         // ctor 
820         public Xcls_SeparatorMenuItem25(ValaProjectSettings _owner )
821         {
822             _this = _owner;
823             this.el = new Gtk.SeparatorMenuItem();
824
825             // my vars (dec)
826
827             // set gobject values
828         }
829
830         // user defined functions 
831     }
832     public class Xcls_MenuItem26 : Object 
833     {
834         public Gtk.MenuItem el;
835         private ValaProjectSettings  _this;
836
837
838             // my vars (def)
839
840         // ctor 
841         public Xcls_MenuItem26(ValaProjectSettings _owner )
842         {
843             _this = _owner;
844             this.el = new Gtk.MenuItem();
845
846             // my vars (dec)
847
848             // set gobject values
849             this.el.label = "Remove File/Directory";
850
851             // listeners 
852             this.el.activate.connect( ()  => {
853                 
854                  //
855                     Gtk.TreeModel mod;
856                     Gtk.TreeIter iter;
857                     if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
858                            print("nothing selected\n");
859                         return;
860                     }
861             
862                         
863                    // add the directory..
864                    
865                    
866                    GLib.Value val;
867                     mod.get_value(iter,0, out val);
868                    var fn =  (string) val;
869                    
870                    print("remove: %s\n", fn);
871                    if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
872                               print("remove failed");
873                           }
874                    _this.default_directory_tree_store.load();
875             });
876         }
877
878         // user defined functions 
879     }
880     public class Xcls_HPaned27 : Object 
881     {
882         public Gtk.HPaned el;
883         private ValaProjectSettings  _this;
884
885
886             // my vars (def)
887
888         // ctor 
889         public Xcls_HPaned27(ValaProjectSettings _owner )
890         {
891             _this = _owner;
892             this.el = new Gtk.HPaned();
893
894             // my vars (dec)
895
896             // set gobject values
897             this.el.position = 300;
898             var child_0 = new Xcls_ScrolledWindow28( _this );
899             child_0.ref();
900             this.el.add1 (  child_0.el  );
901             var child_1 = new Xcls_set_vbox( _this );
902             child_1.ref();
903             this.el.add2 (  child_1.el  );
904         }
905
906         // user defined functions 
907     }
908     public class Xcls_ScrolledWindow28 : Object 
909     {
910         public Gtk.ScrolledWindow el;
911         private ValaProjectSettings  _this;
912
913
914             // my vars (def)
915
916         // ctor 
917         public Xcls_ScrolledWindow28(ValaProjectSettings _owner )
918         {
919             _this = _owner;
920             this.el = new Gtk.ScrolledWindow( null, null );
921
922             // my vars (dec)
923
924             // set gobject values
925             var child_0 = new Xcls_targets_tree_menu( _this );
926             child_0.ref();
927             this.el.add (  child_0.el  );
928             var child_1 = new Xcls_targets_tree( _this );
929             child_1.ref();
930             this.el.add (  child_1.el  );
931
932             // init method 
933
934             {  
935             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
936             
937             }
938         }
939
940         // user defined functions 
941     }
942     public class Xcls_targets_tree_menu : Object 
943     {
944         public Gtk.Menu el;
945         private ValaProjectSettings  _this;
946
947
948             // my vars (def)
949
950         // ctor 
951         public Xcls_targets_tree_menu(ValaProjectSettings _owner )
952         {
953             _this = _owner;
954             _this.targets_tree_menu = this;
955             this.el = new Gtk.Menu();
956
957             // my vars (dec)
958
959             // set gobject values
960             var child_0 = new Xcls_MenuItem30( _this );
961             child_0.ref();
962             this.el.add (  child_0.el  );
963             var child_1 = new Xcls_SeparatorMenuItem31( _this );
964             child_1.ref();
965             this.el.add (  child_1.el  );
966             var child_2 = new Xcls_MenuItem32( _this );
967             child_2.ref();
968             this.el.add (  child_2.el  );
969         }
970
971         // user defined functions 
972     }
973     public class Xcls_MenuItem30 : Object 
974     {
975         public Gtk.MenuItem el;
976         private ValaProjectSettings  _this;
977
978
979             // my vars (def)
980
981         // ctor 
982         public Xcls_MenuItem30(ValaProjectSettings _owner )
983         {
984             _this = _owner;
985             this.el = new Gtk.MenuItem();
986
987             // my vars (dec)
988
989             // set gobject values
990             this.el.label = "Add Compile Target";
991
992             // listeners 
993             this.el.activate.connect( ()  => {
994                 
995                    if (_this.project.compilegroups.has_key("NEW GROUP")) {
996                     return;
997                 }
998                   
999                    // add the directory..
1000                    
1001                    _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
1002                    _this.targets_tree_store.load();
1003             });
1004         }
1005
1006         // user defined functions 
1007     }
1008     public class Xcls_SeparatorMenuItem31 : Object 
1009     {
1010         public Gtk.SeparatorMenuItem el;
1011         private ValaProjectSettings  _this;
1012
1013
1014             // my vars (def)
1015
1016         // ctor 
1017         public Xcls_SeparatorMenuItem31(ValaProjectSettings _owner )
1018         {
1019             _this = _owner;
1020             this.el = new Gtk.SeparatorMenuItem();
1021
1022             // my vars (dec)
1023
1024             // set gobject values
1025         }
1026
1027         // user defined functions 
1028     }
1029     public class Xcls_MenuItem32 : Object 
1030     {
1031         public Gtk.MenuItem el;
1032         private ValaProjectSettings  _this;
1033
1034
1035             // my vars (def)
1036
1037         // ctor 
1038         public Xcls_MenuItem32(ValaProjectSettings _owner )
1039         {
1040             _this = _owner;
1041             this.el = new Gtk.MenuItem();
1042
1043             // my vars (dec)
1044
1045             // set gobject values
1046             this.el.label = "Remove Target";
1047
1048             // listeners 
1049             this.el.activate.connect( ()  => {
1050                 
1051                  //
1052                     Gtk.TreeModel mod;
1053                     Gtk.TreeIter iter;
1054                     if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {
1055                            print("nothing selected\n");
1056                         return;
1057                     }
1058             
1059                         
1060                    // add the directory..
1061                    
1062                    
1063                    GLib.Value val;
1064                     mod.get_value(iter,0, out val);
1065                    var fn =  (string) val;
1066                    
1067                    print("remove: %s\n", fn);
1068                    if (!_this.project.compilegroups.unset(fn)) {
1069                               print("remove failed");
1070                   }
1071                    _this.targets_tree_store.load();
1072             });
1073         }
1074
1075         // user defined functions 
1076     }
1077     public class Xcls_targets_tree : Object 
1078     {
1079         public Gtk.TreeView el;
1080         private ValaProjectSettings  _this;
1081
1082
1083             // my vars (def)
1084         public string cursor;
1085
1086         // ctor 
1087         public Xcls_targets_tree(ValaProjectSettings _owner )
1088         {
1089             _this = _owner;
1090             _this.targets_tree = this;
1091             this.el = new Gtk.TreeView();
1092
1093             // my vars (dec)
1094
1095             // set gobject values
1096             var child_0 = new Xcls_targets_tree_store( _this );
1097             child_0.ref();
1098             this.el.set_model (  child_0.el  );
1099             var child_1 = new Xcls_TreeViewColumn35( _this );
1100             child_1.ref();
1101             this.el.append_column (  child_1.el  );
1102
1103             // listeners 
1104             this.el.button_press_event.connect( ( ev) => {
1105                 //console.log("button press?");
1106                
1107                 
1108                 if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
1109                     //print("click" + ev.type);
1110                     return false;
1111                 }
1112                 //Gtk.TreePath res;
1113                 //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
1114                 //    return true;
1115                 //}
1116                  
1117               //  this.el.get_selection().select_path(res);
1118                  
1119                   //if (!this.get('/LeftTreeMenu').el)  { 
1120                   //      this.get('/LeftTreeMenu').init(); 
1121                   //  }
1122                     
1123                  _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());
1124                  _this.targets_tree_menu.el.show_all();
1125                   _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);
1126                  //   print("click:" + res.path.to_string());
1127                   return true;
1128             });
1129             this.el.cursor_changed.connect( ( ) => {
1130             
1131                 if (this.cursor != "") {
1132                      // save the values..
1133                  }
1134                  
1135                  // load the new values.
1136                  
1137             
1138                      Gtk.TreeModel mod;
1139                     Gtk.TreeIter iter;
1140                     if (!this.el.get_selection().get_selected(out mod, out iter)) {
1141                         print("nothing selected\n");
1142                         // should disable the right hand side..
1143                         _this.set_vbox.el.hide();
1144                         return;
1145                     }
1146                     _this.set_vbox.el.show();
1147                         
1148                    // add the directory..
1149                    
1150                    
1151                    GLib.Value val;
1152                     mod.get_value(iter,0, out val);
1153                    var fn =  (string) val;
1154                    
1155                    this.cursor = fn;
1156                    var cg = _this.project.compilegroups.get(fn);
1157                    
1158                    _this.build_pack_target.el.set_text(cg.target_bin);
1159                    _this.build_compile_flags.el.set_text(cg.compile_flags);
1160                    _this.set_vbox.cgroup = cg;
1161                    _this.files_tree_store.update();
1162                    
1163                    // load the srouces
1164                    
1165             
1166               });
1167         }
1168
1169         // user defined functions 
1170     }
1171     public class Xcls_targets_tree_store : Object 
1172     {
1173         public Gtk.ListStore el;
1174         private ValaProjectSettings  _this;
1175
1176
1177             // my vars (def)
1178
1179         // ctor 
1180         public Xcls_targets_tree_store(ValaProjectSettings _owner )
1181         {
1182             _this = _owner;
1183             _this.targets_tree_store = this;
1184             this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
1185      typeof(string) // ??
1186       );
1187
1188             // my vars (dec)
1189
1190             // set gobject values
1191         }
1192
1193         // user defined functions 
1194         public void load () {
1195          
1196           this.el.clear();
1197           
1198             
1199              var cg = _this.project.compilegroups;
1200              
1201            _this.targets_tree.cursor = "";
1202             Gtk.TreeIter citer;
1203             var iter = cg.map_iterator();
1204            while(iter.next()) {
1205                 var key = iter.get_key();
1206                 if (key == "_default_") {
1207                     continue;
1208                 }
1209             
1210                  this.el.append(out citer);   
1211                  
1212                 this.el.set_value(citer, 0,   key ); // title 
1213                 //this.el.set_value(citer, 1,   items.get(i) );
1214             };
1215             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1216             _this.set_vbox.el.hide();
1217         }
1218     }
1219     public class Xcls_TreeViewColumn35 : Object 
1220     {
1221         public Gtk.TreeViewColumn el;
1222         private ValaProjectSettings  _this;
1223
1224
1225             // my vars (def)
1226
1227         // ctor 
1228         public Xcls_TreeViewColumn35(ValaProjectSettings _owner )
1229         {
1230             _this = _owner;
1231             this.el = new Gtk.TreeViewColumn();
1232
1233             // my vars (dec)
1234
1235             // set gobject values
1236             this.el.title = "name";
1237             this.el.resizable = true;
1238             var child_0 = new Xcls_targets_render( _this );
1239             child_0.ref();
1240             this.el.pack_start (  child_0.el , false );
1241
1242             // init method 
1243
1244             {
1245                  this.el.add_attribute(_this.targets_render.el , "text", 0 );
1246              }
1247         }
1248
1249         // user defined functions 
1250     }
1251     public class Xcls_targets_render : Object 
1252     {
1253         public Gtk.CellRendererText el;
1254         private ValaProjectSettings  _this;
1255
1256
1257             // my vars (def)
1258
1259         // ctor 
1260         public Xcls_targets_render(ValaProjectSettings _owner )
1261         {
1262             _this = _owner;
1263             _this.targets_render = this;
1264             this.el = new Gtk.CellRendererText();
1265
1266             // my vars (dec)
1267
1268             // set gobject values
1269             this.el.editable = true;
1270
1271             // listeners 
1272             this.el.edited.connect( (path, newtext) => {
1273                  
1274                  Gtk.TreeIter  iter;
1275                     _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
1276                    GLib.Value gval;
1277                     _this.targets_tree_store.el.get_value(iter,0, out gval);
1278                     var oldval = (string)gval;
1279                    if (oldval == newtext) {
1280                       return;
1281                     }
1282                      var cg = _this.project.compilegroups.get(oldval);
1283                     cg.name = newtext;
1284                     _this.project.compilegroups.unset(oldval);
1285                     _this.project.compilegroups.set(newtext, cg);
1286                    _this.targets_tree_store.load();
1287               });
1288         }
1289
1290         // user defined functions 
1291     }
1292     public class Xcls_set_vbox : Object 
1293     {
1294         public Gtk.VBox el;
1295         private ValaProjectSettings  _this;
1296
1297
1298             // my vars (def)
1299         public Project.GtkValaSettings cgroup;
1300
1301         // ctor 
1302         public Xcls_set_vbox(ValaProjectSettings _owner )
1303         {
1304             _this = _owner;
1305             _this.set_vbox = this;
1306             this.el = new Gtk.VBox( false, 0 );
1307
1308             // my vars (dec)
1309             this.cgroup = null;
1310
1311             // set gobject values
1312             var child_0 = new Xcls_Label38( _this );
1313             child_0.ref();
1314             this.el.pack_start (  child_0.el , false,false,0 );
1315             var child_1 = new Xcls_build_pack_target( _this );
1316             child_1.ref();
1317             this.el.pack_start (  child_1.el , false,false,0 );
1318             var child_2 = new Xcls_Label40( _this );
1319             child_2.ref();
1320             this.el.pack_start (  child_2.el , false,false,0 );
1321             var child_3 = new Xcls_build_compile_flags( _this );
1322             child_3.ref();
1323             this.el.pack_start (  child_3.el , false,false,0 );
1324             var child_4 = new Xcls_Label42( _this );
1325             child_4.ref();
1326             this.el.pack_start (  child_4.el , false,false,0 );
1327             var child_5 = new Xcls_ScrolledWindow43( _this );
1328             child_5.ref();
1329             this.el.pack_start (  child_5.el , true,true,0 );
1330         }
1331
1332         // user defined functions 
1333     }
1334     public class Xcls_Label38 : Object 
1335     {
1336         public Gtk.Label el;
1337         private ValaProjectSettings  _this;
1338
1339
1340             // my vars (def)
1341
1342         // ctor 
1343         public Xcls_Label38(ValaProjectSettings _owner )
1344         {
1345             _this = _owner;
1346             this.el = new Gtk.Label( "target filename" );
1347
1348             // my vars (dec)
1349
1350             // set gobject values
1351         }
1352
1353         // user defined functions 
1354     }
1355     public class Xcls_build_pack_target : Object 
1356     {
1357         public Gtk.Entry el;
1358         private ValaProjectSettings  _this;
1359
1360
1361             // my vars (def)
1362
1363         // ctor 
1364         public Xcls_build_pack_target(ValaProjectSettings _owner )
1365         {
1366             _this = _owner;
1367             _this.build_pack_target = this;
1368             this.el = new Gtk.Entry();
1369
1370             // my vars (dec)
1371
1372             // set gobject values
1373
1374             // listeners 
1375             this.el.changed.connect( ()  => {
1376                     if (_this.targets_tree.cursor.length < 1) {
1377                     return;
1378                 }
1379                 _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
1380             });
1381         }
1382
1383         // user defined functions 
1384     }
1385     public class Xcls_Label40 : Object 
1386     {
1387         public Gtk.Label el;
1388         private ValaProjectSettings  _this;
1389
1390
1391             // my vars (def)
1392
1393         // ctor 
1394         public Xcls_Label40(ValaProjectSettings _owner )
1395         {
1396             _this = _owner;
1397             this.el = new Gtk.Label( "compile flags" );
1398
1399             // my vars (dec)
1400
1401             // set gobject values
1402         }
1403
1404         // user defined functions 
1405     }
1406     public class Xcls_build_compile_flags : Object 
1407     {
1408         public Gtk.Entry el;
1409         private ValaProjectSettings  _this;
1410
1411
1412             // my vars (def)
1413
1414         // ctor 
1415         public Xcls_build_compile_flags(ValaProjectSettings _owner )
1416         {
1417             _this = _owner;
1418             _this.build_compile_flags = this;
1419             this.el = new Gtk.Entry();
1420
1421             // my vars (dec)
1422
1423             // set gobject values
1424
1425             // listeners 
1426             this.el.changed.connect( () => {
1427                 if (_this.targets_tree.cursor.length < 1) {
1428                     return;
1429                 }
1430                 _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
1431             });
1432         }
1433
1434         // user defined functions 
1435     }
1436     public class Xcls_Label42 : Object 
1437     {
1438         public Gtk.Label el;
1439         private ValaProjectSettings  _this;
1440
1441
1442             // my vars (def)
1443
1444         // ctor 
1445         public Xcls_Label42(ValaProjectSettings _owner )
1446         {
1447             _this = _owner;
1448             this.el = new Gtk.Label( "Files to compile" );
1449
1450             // my vars (dec)
1451
1452             // set gobject values
1453         }
1454
1455         // user defined functions 
1456     }
1457     public class Xcls_ScrolledWindow43 : Object 
1458     {
1459         public Gtk.ScrolledWindow el;
1460         private ValaProjectSettings  _this;
1461
1462
1463             // my vars (def)
1464
1465         // ctor 
1466         public Xcls_ScrolledWindow43(ValaProjectSettings _owner )
1467         {
1468             _this = _owner;
1469             this.el = new Gtk.ScrolledWindow( null, null );
1470
1471             // my vars (dec)
1472
1473             // set gobject values
1474             var child_0 = new Xcls_files_tree( _this );
1475             child_0.ref();
1476             this.el.add (  child_0.el  );
1477         }
1478
1479         // user defined functions 
1480     }
1481     public class Xcls_files_tree : Object 
1482     {
1483         public Gtk.TreeView el;
1484         private ValaProjectSettings  _this;
1485
1486
1487             // my vars (def)
1488
1489         // ctor 
1490         public Xcls_files_tree(ValaProjectSettings _owner )
1491         {
1492             _this = _owner;
1493             this.el = new Gtk.TreeView();
1494
1495             // my vars (dec)
1496
1497             // set gobject values
1498             var child_0 = new Xcls_files_tree_store( _this );
1499             child_0.ref();
1500             this.el.set_model (  child_0.el  );
1501             var child_1 = new Xcls_TreeViewColumn46( _this );
1502             child_1.ref();
1503             this.el.append_column (  child_1.el  );
1504             var child_2 = new Xcls_TreeViewColumn48( _this );
1505             child_2.ref();
1506             this.el.append_column (  child_2.el  );
1507         }
1508
1509         // user defined functions 
1510     }
1511     public class Xcls_files_tree_store : Object 
1512     {
1513         public Gtk.ListStore el;
1514         private ValaProjectSettings  _this;
1515
1516
1517             // my vars (def)
1518
1519         // ctor 
1520         public Xcls_files_tree_store(ValaProjectSettings _owner )
1521         {
1522             _this = _owner;
1523             _this.files_tree_store = this;
1524             this.el = new Gtk.ListStore( 4,     typeof(string),  // 0 file name
1525         typeof(string),  // 0 basename
1526      typeof(string), // type (dir orfile)
1527      typeof(bool)  // is checked.
1528       );
1529
1530             // my vars (dec)
1531
1532             // set gobject values
1533         }
1534
1535         // user defined functions 
1536         public void load () {
1537          
1538               this.el.clear();
1539           
1540             
1541              var def = _this.project.compilegroups.get("_default_");
1542              var items  = def.sources;
1543              
1544              
1545              
1546              
1547          
1548             Gtk.TreeIter citer;
1549         
1550             for(var i =0 ; i < items.size; i++) {
1551                  this.el.append(out citer);   
1552                  
1553                 this.el.set_value(citer, 0,   items.get(i) ); // title 
1554                 this.el.set_value(citer, 1,   "<span foreground=\"green\" font_weight=\"bold\">" + 
1555                             GLib.Markup.escape_text(items.get(i)) + "</span>"
1556                     ); // title 
1557                 print("ADD item %s", items.get(i));
1558                 this.el.set_value(citer, 2,   "dir"); // type         
1559                 this.el.set_value(citer, 3,   false ); // checked 
1560         
1561                 var files = _this.project.files(items.get(i));
1562                 
1563                  for(var j =0 ; j < files.size; j++) {
1564                     this.el.append(out citer);   
1565                          print("ADD item %s", files.get(j));
1566                     this.el.set_value(citer, 0,   files.get(j) ); // title 
1567                     this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             
1568                     this.el.set_value(citer, 2,   "file"); // type         
1569                     this.el.set_value(citer, 3,   false ); // checked 
1570         
1571                 }
1572                 
1573                 
1574                 //this.el.set_value(citer, 1,   items.get(i) );
1575             }
1576             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
1577             
1578         }
1579         public void update () {
1580         
1581         
1582             Gtk.TreeIter citer;
1583         
1584             for(var i =0 ; i < this.el.iter_n_children(null); i++) {
1585                 this.el.iter_nth_child(citer,null,i);
1586         
1587                 GLib.Value val;
1588                 this.el.get_value(iter,0, out val);
1589                 var fn = (string) val;
1590                 
1591                 var active = false;
1592                 if (_this.set_vbox.cgroup.sources.contains(fn)) {
1593                     active = true;
1594                 }
1595                 
1596                 this.el.set_value(citer, 3,   active ); // checked 
1597             }
1598         
1599         
1600         }
1601     }
1602     public class Xcls_TreeViewColumn46 : Object 
1603     {
1604         public Gtk.TreeViewColumn el;
1605         private ValaProjectSettings  _this;
1606
1607
1608             // my vars (def)
1609
1610         // ctor 
1611         public Xcls_TreeViewColumn46(ValaProjectSettings _owner )
1612         {
1613             _this = _owner;
1614             this.el = new Gtk.TreeViewColumn();
1615
1616             // my vars (dec)
1617
1618             // set gobject values
1619             this.el.title = "name";
1620             this.el.resizable = true;
1621             var child_0 = new Xcls_files_render( _this );
1622             child_0.ref();
1623             this.el.pack_start (  child_0.el , false );
1624
1625             // init method 
1626
1627             this.el.add_attribute(_this.files_render.el , "markup", 1 ); // basnemae
1628              
1629             /*  this.el.add_attribute(_this.files_render.el , "markup", 2 );
1630             */
1631         }
1632
1633         // user defined functions 
1634     }
1635     public class Xcls_files_render : Object 
1636     {
1637         public Gtk.CellRendererText el;
1638         private ValaProjectSettings  _this;
1639
1640
1641             // my vars (def)
1642
1643         // ctor 
1644         public Xcls_files_render(ValaProjectSettings _owner )
1645         {
1646             _this = _owner;
1647             _this.files_render = this;
1648             this.el = new Gtk.CellRendererText();
1649
1650             // my vars (dec)
1651
1652             // set gobject values
1653         }
1654
1655         // user defined functions 
1656     }
1657     public class Xcls_TreeViewColumn48 : Object 
1658     {
1659         public Gtk.TreeViewColumn el;
1660         private ValaProjectSettings  _this;
1661
1662
1663             // my vars (def)
1664
1665         // ctor 
1666         public Xcls_TreeViewColumn48(ValaProjectSettings _owner )
1667         {
1668             _this = _owner;
1669             this.el = new Gtk.TreeViewColumn();
1670
1671             // my vars (dec)
1672
1673             // set gobject values
1674             this.el.title = "use";
1675             this.el.resizable = false;
1676             this.el.fixed_width = 50;
1677             var child_0 = new Xcls_files_render_use( _this );
1678             child_0.ref();
1679             this.el.pack_start (  child_0.el , false );
1680
1681             // init method 
1682
1683             {
1684              this.el.add_attribute(_this.files_render_use.el , "active", 3 );
1685              }
1686         }
1687
1688         // user defined functions 
1689     }
1690     public class Xcls_files_render_use : Object 
1691     {
1692         public Gtk.CellRendererToggle el;
1693         private ValaProjectSettings  _this;
1694
1695
1696             // my vars (def)
1697
1698         // ctor 
1699         public Xcls_files_render_use(ValaProjectSettings _owner )
1700         {
1701             _this = _owner;
1702             _this.files_render_use = this;
1703             this.el = new Gtk.CellRendererToggle();
1704
1705             // my vars (dec)
1706
1707             // set gobject values
1708             this.el.activatable = true;
1709
1710             // listeners 
1711             this.el.toggled.connect( (  path_string) =>  { 
1712             
1713             
1714             
1715                 var m = _this.files_tree_store.el;
1716                Gtk.TreeIter iter;
1717                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
1718                m.get_iter (out iter, path);
1719                GLib.Value val;
1720                m.get_value(iter, 3, out val);
1721                m.set_value(iter, 3,  ((bool) val) ? false :true); 
1722                
1723                // type.
1724                GLib.Value ftval;  
1725                m.get_value(iter, 2, out ftval);
1726                var ftype = (string)ftval;   
1727                
1728                // full name...  
1729                GLib.Value fval;     
1730                m.get_value(iter, 0, out fval);
1731                var fn = (string)fval;
1732                 
1733                 
1734                 var cg =   _this.set_vbox.cgroup;
1735                 // what's the sleected target?
1736                 // update the list..
1737                 // if ftype is a dir == then toggle all the bellow.
1738                 // if ftype is a file .. see if all the files in that directory are check and check the dir.
1739             
1740                  
1741                 if ((bool)val) {
1742                     // renive
1743                     cg.sources.remove(fn);
1744                 } else {
1745                     cg.sources.add(fn);
1746                 }
1747                 
1748             });
1749         }
1750
1751         // user defined functions 
1752     }
1753 }