src/Builder4/RooProjectSettings.bjs
[roobuilder] / src / Builder4 / RooProjectSettings.vala
1 static Xcls_RooProjectSettings  _RooProjectSettings;
2
3 public class Xcls_RooProjectSettings : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_RooProjectSettings  _this;
7
8     public static Xcls_RooProjectSettings singleton()
9     {
10         if (_RooProjectSettings == null) {
11             _RooProjectSettings= new Xcls_RooProjectSettings();
12         }
13         return _RooProjectSettings;
14     }
15     public Xcls_label_global label_global;
16     public Xcls_label_database label_database;
17     public Xcls_path path;
18     public Xcls_base_template base_template;
19     public Xcls_base_template_cellrenderer base_template_cellrenderer;
20     public Xcls_base_template_model base_template_model;
21     public Xcls_rootURL rootURL;
22     public Xcls_grid grid;
23     public Xcls_filetypelbl filetypelbl;
24     public Xcls_filetype filetype;
25     public Xcls_ftdbcellrenderer ftdbcellrenderer;
26     public Xcls_ftdbmodel ftdbmodel;
27     public Xcls_dir dir;
28     public Xcls_dircellrenderer dircellrenderer;
29     public Xcls_dirmodel dirmodel;
30     public Xcls_path path;
31     public Xcls_base_template base_template;
32     public Xcls_base_template_cellrenderer base_template_cellrenderer;
33     public Xcls_base_template_model base_template_model;
34     public Xcls_view view;
35     public Xcls_database_DBTYPE database_DBTYPE;
36     public Xcls_database_DBNAME database_DBNAME;
37     public Xcls_database_DBUSERNAME database_DBUSERNAME;
38     public Xcls_database_DBPASSWORD database_DBPASSWORD;
39     public Xcls_database_ERROR database_ERROR;
40
41         // my vars (def)
42     public signal void buttonPressed (string btn);
43     public Project.Project project;
44
45     // ctor
46     public Xcls_RooProjectSettings()
47     {
48         _this = this;
49         this.el = new Gtk.Popover( null );
50
51         // my vars (dec)
52
53         // set gobject values
54         this.el.border_width = 0;
55         this.el.modal = true;
56         this.el.position = Gtk.PositionType.RIGHT;
57         var child_0 = new Xcls_Box2( _this );
58         child_0.ref();
59         this.el.add (  child_0.el  );
60     }
61
62     // user defined functions
63     public void show (Gtk.Widget btn, Project.Project project) {
64         _this.project = project;
65         _this.path.el.label = project.firstPath();
66         // get the active project.
67          var lm = Gtk.SourceLanguageManager.get_default();
68                     
69         ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
70             lm.get_language("html")
71         );
72       
73         //print (project.fn);
74         //project.runhtml = project.runhtml || '';
75         _this.view.el.get_buffer().set_text(project.runhtml);
76         
77            
78         _this.rootURL.el.set_text( _this.project.rootURL );
79         
80     
81         _this.base_template_model.loadData();
82         
83          var js = _this.project;
84         _this.database_DBTYPE.el.set_text(     js.get_string_member("DBTYPE") );
85         _this.database_DBNAME.el.set_text(    js.get_string_member("DBNAME") );
86         _this.database_DBUSERNAME.el.set_text(    js.get_string_member("DBUSERNAME") );
87         _this.database_DBPASSWORD.el.set_text(    js.get_string_member("DBPASSWORD") );
88         
89                 //console.log('show all');
90         this.el.set_modal(true);
91         this.el.set_relative_to(btn);
92     
93         this.el.set_position(Gtk.PositionType.RIGHT);
94     
95         // window + header?
96          print("SHOWALL - POPIP\n");
97         this.el.show_all();
98         this.el.set_size_request(800,500);
99         this.view.el.grab_focus();
100         
101         
102         //this.el.show_all();
103     }
104     public void save () {
105        var buf =    _this.view.el.get_buffer();
106        Gtk.TextIter s;
107          Gtk.TextIter e;
108         buf.get_start_iter(out s);
109         buf.get_end_iter(out e);
110           _this.project.runhtml = buf.get_text(s,e,true);
111           
112         _this.project.rootURL = _this.rootURL.el.get_text();
113         // set by event changed...
114         //_this.project.base_template = _this.base_template.el.get_text();    
115         
116         var js = _this.project.json_project_data;
117         js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
118        js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
119         js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
120         js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
121     //    _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());    
122         
123         // need to re-init the database 
124         
125         _this.project.initRooDatabase();
126          
127         
128     }
129     public class Xcls_Box2 : Object
130     {
131         public Gtk.Box el;
132         private Xcls_RooProjectSettings  _this;
133
134
135             // my vars (def)
136
137         // ctor
138         public Xcls_Box2(Xcls_RooProjectSettings _owner )
139         {
140             _this = _owner;
141             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
142
143             // my vars (dec)
144
145             // set gobject values
146             this.el.homogeneous = false;
147             this.el.border_width = 5;
148             var child_0 = new Xcls_Notebook3( _this );
149             child_0.ref();
150             this.el.pack_start (  child_0.el , true,true,0 );
151             var child_1 = new Xcls_Box45( _this );
152             child_1.ref();
153             this.el.pack_end (  child_1.el , false,false,0 );
154         }
155
156         // user defined functions
157     }
158     public class Xcls_Notebook3 : Object
159     {
160         public Gtk.Notebook el;
161         private Xcls_RooProjectSettings  _this;
162
163
164             // my vars (def)
165
166         // ctor
167         public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
168         {
169             _this = _owner;
170             this.el = new Gtk.Notebook();
171
172             // my vars (dec)
173
174             // set gobject values
175             var child_0 = new Xcls_label_global( _this );
176             child_0.ref();
177             var child_1 = new Xcls_label_database( _this );
178             child_1.ref();
179             var child_2 = new Xcls_Box6( _this );
180             child_2.ref();
181             this.el.append_page (  child_2.el , _this.label_global.el );
182             var child_3 = new Xcls_Box34( _this );
183             child_3.ref();
184             this.el.append_page (  child_3.el , _this.label_database.el );
185         }
186
187         // user defined functions
188     }
189     public class Xcls_label_global : Object
190     {
191         public Gtk.Label el;
192         private Xcls_RooProjectSettings  _this;
193
194
195             // my vars (def)
196
197         // ctor
198         public Xcls_label_global(Xcls_RooProjectSettings _owner )
199         {
200             _this = _owner;
201             _this.label_global = this;
202             this.el = new Gtk.Label( "Global" );
203
204             // my vars (dec)
205
206             // set gobject values
207         }
208
209         // user defined functions
210     }
211
212     public class Xcls_label_database : Object
213     {
214         public Gtk.Label el;
215         private Xcls_RooProjectSettings  _this;
216
217
218             // my vars (def)
219
220         // ctor
221         public Xcls_label_database(Xcls_RooProjectSettings _owner )
222         {
223             _this = _owner;
224             _this.label_database = this;
225             this.el = new Gtk.Label( "Database" );
226
227             // my vars (dec)
228
229             // set gobject values
230         }
231
232         // user defined functions
233     }
234
235     public class Xcls_Box6 : Object
236     {
237         public Gtk.Box el;
238         private Xcls_RooProjectSettings  _this;
239
240
241             // my vars (def)
242
243         // ctor
244         public Xcls_Box6(Xcls_RooProjectSettings _owner )
245         {
246             _this = _owner;
247             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
248
249             // my vars (dec)
250
251             // set gobject values
252             this.el.homogeneous = false;
253             var child_0 = new Xcls_path( _this );
254             child_0.ref();
255             this.el.pack_start (  child_0.el , false,false,0 );
256             var child_1 = new Xcls_Box8( _this );
257             child_1.ref();
258             this.el.pack_start (  child_1.el , false,false,0 );
259             var child_2 = new Xcls_Box13( _this );
260             child_2.ref();
261             this.el.pack_start (  child_2.el , false,false,0 );
262             var child_3 = new Xcls_Label16( _this );
263             child_3.ref();
264             this.el.pack_start (  child_3.el , false,false,0 );
265             var child_4 = new Xcls_grid( _this );
266             child_4.ref();
267             this.el.pack_start (  child_4.el , false,false,4 );
268             var child_5 = new Xcls_ScrolledWindow32( _this );
269             child_5.ref();
270             this.el.pack_start (  child_5.el , true,true,0 );
271         }
272
273         // user defined functions
274     }
275     public class Xcls_path : Object
276     {
277         public Gtk.Label el;
278         private Xcls_RooProjectSettings  _this;
279
280
281             // my vars (def)
282
283         // ctor
284         public Xcls_path(Xcls_RooProjectSettings _owner )
285         {
286             _this = _owner;
287             _this.path = this;
288             this.el = new Gtk.Label( "filename" );
289
290             // my vars (dec)
291
292             // set gobject values
293             this.el.margin = 3;
294             this.el.xalign = 0f;
295         }
296
297         // user defined functions
298     }
299
300     public class Xcls_Box8 : Object
301     {
302         public Gtk.Box el;
303         private Xcls_RooProjectSettings  _this;
304
305
306             // my vars (def)
307
308         // ctor
309         public Xcls_Box8(Xcls_RooProjectSettings _owner )
310         {
311             _this = _owner;
312             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
313
314             // my vars (dec)
315
316             // set gobject values
317             this.el.homogeneous = false;
318             this.el.expand = false;
319             var child_0 = new Xcls_Label9( _this );
320             child_0.ref();
321             this.el.pack_start (  child_0.el , false,false,0 );
322             var child_1 = new Xcls_base_template( _this );
323             child_1.ref();
324             this.el.add (  child_1.el  );
325         }
326
327         // user defined functions
328     }
329     public class Xcls_Label9 : Object
330     {
331         public Gtk.Label el;
332         private Xcls_RooProjectSettings  _this;
333
334
335             // my vars (def)
336
337         // ctor
338         public Xcls_Label9(Xcls_RooProjectSettings _owner )
339         {
340             _this = _owner;
341             this.el = new Gtk.Label( "HTML template file" );
342
343             // my vars (dec)
344
345             // set gobject values
346             this.el.margin = 3;
347         }
348
349         // user defined functions
350     }
351
352     public class Xcls_base_template : Object
353     {
354         public Gtk.ComboBox el;
355         private Xcls_RooProjectSettings  _this;
356
357
358             // my vars (def)
359         public bool loading;
360
361         // ctor
362         public Xcls_base_template(Xcls_RooProjectSettings _owner )
363         {
364             _this = _owner;
365             _this.base_template = this;
366             this.el = new Gtk.ComboBox();
367
368             // my vars (dec)
369             this.loading = false;
370
371             // set gobject values
372             var child_0 = new Xcls_base_template_cellrenderer( _this );
373             child_0.ref();
374             this.el.pack_start (  child_0.el , true );
375             var child_1 = new Xcls_base_template_model( _this );
376             child_1.ref();
377             this.el.set_model (  child_1.el  );
378
379             // init method
380
381             this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 0 );
382
383             //listeners
384             this.el.changed.connect( () => {
385                 Gtk.TreeIter iter;
386              
387                 // this get's called when we are filling in the data... ???
388                 if (this.loading) {
389                         return;
390                 }
391                 
392              
393                 if (this.el.get_active_iter(out iter)) {
394                         Value vfname;
395                         _this.base_template_model.el.get_value (iter, 0, out vfname);
396                         _this.project.base_template = ((string)vfname) ;
397                         
398                          print("\nSET base template to %s\n", _this.project.base_template );
399                         // is_bjs = ((string)vfname) == "bjs";
400                 }
401                 
402               
403                 // directory is only available for non-bjs 
404              
405             
406             
407             });
408         }
409
410         // user defined functions
411     }
412     public class Xcls_base_template_cellrenderer : Object
413     {
414         public Gtk.CellRendererText el;
415         private Xcls_RooProjectSettings  _this;
416
417
418             // my vars (def)
419
420         // ctor
421         public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
422         {
423             _this = _owner;
424             _this.base_template_cellrenderer = this;
425             this.el = new Gtk.CellRendererText();
426
427             // my vars (dec)
428
429             // set gobject values
430         }
431
432         // user defined functions
433     }
434
435     public class Xcls_base_template_model : Object
436     {
437         public Gtk.ListStore el;
438         private Xcls_RooProjectSettings  _this;
439
440
441             // my vars (def)
442
443         // ctor
444         public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
445         {
446             _this = _owner;
447             _this.base_template_model = this;
448             this.el = new Gtk.ListStore( 1, typeof(string) );
449
450             // my vars (dec)
451
452             // set gobject values
453         }
454
455         // user defined functions
456         public void loadData () {
457                 _this.base_template.loading = true;
458           
459             this.el.clear();                                    
460             Gtk.TreeIter iter;
461             var el = this.el;
462             
463            /// el.append(out iter);
464             
465            
466             el.append(out iter);
467             el.set_value(iter, 0, "roo.builder.html");
468             _this.base_template.el.set_active_iter(iter);
469                 if (_this.project.base_template == "roo.builder.html") {
470                    _this.base_template.el.set_active_iter(iter);
471             }
472         
473             el.append(out iter);
474             el.set_value(iter, 0, "bootstrap.builder.html");
475          
476                 print("\ncur template = %s\n", _this.project.base_template);
477          
478             if (_this.project.base_template == "bootstrap.builder.html") {
479                    _this.base_template.el.set_active_iter(iter);
480             }
481         
482                 el.append(out iter);
483             el.set_value(iter, 0, "mailer.builder.html");
484         
485                 if (_this.project.base_template == "mailer.builder.html") {
486                     _this.base_template.el.set_active_iter(iter);
487             }
488                 _this.base_template.loading = false;
489                                              
490         }
491     }
492
493
494
495     public class Xcls_Box13 : Object
496     {
497         public Gtk.Box el;
498         private Xcls_RooProjectSettings  _this;
499
500
501             // my vars (def)
502
503         // ctor
504         public Xcls_Box13(Xcls_RooProjectSettings _owner )
505         {
506             _this = _owner;
507             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
508
509             // my vars (dec)
510
511             // set gobject values
512             this.el.homogeneous = false;
513             this.el.expand = false;
514             var child_0 = new Xcls_Label14( _this );
515             child_0.ref();
516             this.el.pack_start (  child_0.el , false,false,0 );
517             var child_1 = new Xcls_rootURL( _this );
518             child_1.ref();
519             this.el.add (  child_1.el  );
520         }
521
522         // user defined functions
523     }
524     public class Xcls_Label14 : Object
525     {
526         public Gtk.Label el;
527         private Xcls_RooProjectSettings  _this;
528
529
530             // my vars (def)
531
532         // ctor
533         public Xcls_Label14(Xcls_RooProjectSettings _owner )
534         {
535             _this = _owner;
536             this.el = new Gtk.Label( "root URL" );
537
538             // my vars (dec)
539
540             // set gobject values
541             this.el.margin = 3;
542         }
543
544         // user defined functions
545     }
546
547     public class Xcls_rootURL : Object
548     {
549         public Gtk.Entry el;
550         private Xcls_RooProjectSettings  _this;
551
552
553             // my vars (def)
554
555         // ctor
556         public Xcls_rootURL(Xcls_RooProjectSettings _owner )
557         {
558             _this = _owner;
559             _this.rootURL = this;
560             this.el = new Gtk.Entry();
561
562             // my vars (dec)
563
564             // set gobject values
565         }
566
567         // user defined functions
568     }
569
570
571     public class Xcls_Label16 : Object
572     {
573         public Gtk.Label el;
574         private Xcls_RooProjectSettings  _this;
575
576
577             // my vars (def)
578
579         // ctor
580         public Xcls_Label16(Xcls_RooProjectSettings _owner )
581         {
582             _this = _owner;
583             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
584
585             // my vars (dec)
586
587             // set gobject values
588         }
589
590         // user defined functions
591     }
592
593     public class Xcls_grid : Object
594     {
595         public Gtk.Grid el;
596         private Xcls_RooProjectSettings  _this;
597
598
599             // my vars (def)
600
601         // ctor
602         public Xcls_grid(Xcls_RooProjectSettings _owner )
603         {
604             _this = _owner;
605             _this.grid = this;
606             this.el = new Gtk.Grid();
607
608             // my vars (dec)
609
610             // set gobject values
611             this.el.margin_right = 4;
612             this.el.margin_left = 4;
613             this.el.row_spacing = 2;
614             var child_0 = new Xcls_filetypelbl( _this );
615             child_0.ref();
616             this.el.attach (  child_0.el , 0,0,1,1 );
617             var child_1 = new Xcls_filetype( _this );
618             child_1.ref();
619             this.el.attach (  child_1.el , 1,0,1,1 );
620             var child_2 = new Xcls_Label22( _this );
621             child_2.ref();
622             this.el.attach (  child_2.el , 0,8,1,1 );
623             var child_3 = new Xcls_dir( _this );
624             child_3.ref();
625             this.el.attach (  child_3.el , 1,8,1,1 );
626             var child_4 = new Xcls_Label26( _this );
627             child_4.ref();
628             this.el.attach (  child_4.el , 0,0,1,1 );
629             var child_5 = new Xcls_path( _this );
630             child_5.ref();
631             this.el.attach (  child_5.el , 1,0,1,1 );
632             var child_6 = new Xcls_Label28( _this );
633             child_6.ref();
634             this.el.attach (  child_6.el , 0,1,1,1 );
635             var child_7 = new Xcls_base_template( _this );
636             child_7.ref();
637             this.el.attach (  child_7.el , 1,8,1,1 );
638         }
639
640         // user defined functions
641     }
642     public class Xcls_filetypelbl : Object
643     {
644         public Gtk.Label el;
645         private Xcls_RooProjectSettings  _this;
646
647
648             // my vars (def)
649
650         // ctor
651         public Xcls_filetypelbl(Xcls_RooProjectSettings _owner )
652         {
653             _this = _owner;
654             _this.filetypelbl = this;
655             this.el = new Gtk.Label( "File type" );
656
657             // my vars (dec)
658
659             // set gobject values
660             this.el.justify = Gtk.Justification.RIGHT;
661             this.el.xalign = 0.900000f;
662         }
663
664         // user defined functions
665     }
666
667     public class Xcls_filetype : Object
668     {
669         public Gtk.ComboBox el;
670         private Xcls_RooProjectSettings  _this;
671
672
673             // my vars (def)
674
675         // ctor
676         public Xcls_filetype(Xcls_RooProjectSettings _owner )
677         {
678             _this = _owner;
679             _this.filetype = this;
680             this.el = new Gtk.ComboBox();
681
682             // my vars (dec)
683
684             // set gobject values
685             var child_0 = new Xcls_ftdbcellrenderer( _this );
686             child_0.ref();
687             this.el.pack_start (  child_0.el , true );
688             var child_1 = new Xcls_ftdbmodel( _this );
689             child_1.ref();
690             this.el.set_model (  child_1.el  );
691
692             // init method
693
694             this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
695
696             //listeners
697             this.el.changed.connect( () => {
698                 Gtk.TreeIter iter;
699                 bool is_bjs = true;
700                 if (this.el.get_active_iter(out iter)) {
701                         Value vfname;
702                         _this.ftdbmodel.el.get_value (iter, 0, out vfname);
703                          is_bjs = ((string)vfname) == "bjs";
704                 }
705                 
706               
707                 // directory is only available for non-bjs 
708                 this.showhide(is_bjs);
709             
710             
711             });
712         }
713
714         // user defined functions
715         public void showhide (bool is_bjs) {
716                 for (var i = 2; i < 9;i++) {
717                         var el = _this.grid.el.get_child_at(0,i);
718                         
719                         var showhide= is_bjs;
720                         if (i> 7) {
721                                 showhide = !showhide;
722                         }
723                         
724                         if (showhide) {
725                            el.show();
726                         } else {
727                                 el.hide();
728                         }
729                          el = _this.grid.el.get_child_at(1,i);
730                         if (showhide) {
731                            el.show();
732                         } else {
733                                 el.hide();
734                         }     
735             }
736             // load up the directories
737             //??? why can we not create bjs files in other directories??
738                 if (!is_bjs && _this.file.path.length < 1) {
739                         _this.dirmodel.loadData();
740                         
741                         
742                 }
743            
744             
745         }
746     }
747     public class Xcls_ftdbcellrenderer : Object
748     {
749         public Gtk.CellRendererText el;
750         private Xcls_RooProjectSettings  _this;
751
752
753             // my vars (def)
754
755         // ctor
756         public Xcls_ftdbcellrenderer(Xcls_RooProjectSettings _owner )
757         {
758             _this = _owner;
759             _this.ftdbcellrenderer = this;
760             this.el = new Gtk.CellRendererText();
761
762             // my vars (dec)
763
764             // set gobject values
765         }
766
767         // user defined functions
768     }
769
770     public class Xcls_ftdbmodel : Object
771     {
772         public Gtk.ListStore el;
773         private Xcls_RooProjectSettings  _this;
774
775
776             // my vars (def)
777
778         // ctor
779         public Xcls_ftdbmodel(Xcls_RooProjectSettings _owner )
780         {
781             _this = _owner;
782             _this.ftdbmodel = this;
783             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
784
785             // my vars (dec)
786
787             // set gobject values
788         }
789
790         // user defined functions
791         public void loadData (string cur) {
792             this.el.clear();                                    
793             Gtk.TreeIter iter;
794             var el = this.el;
795             
796            /// el.append(out iter);
797             
798              
799            // el.set_value(iter, 0, "");
800            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
801         
802             el.append(out iter);
803         
804             
805             el.set_value(iter, 0, "bjs");
806             el.set_value(iter, 1, "User Interface File (bjs)");
807             _this.filetype.el.set_active_iter(iter);
808         
809             el.append(out iter);
810             
811             el.set_value(iter, 0, "vala");
812             el.set_value(iter, 1, "Vala");
813                 if (cur == "vala") {
814                     _this.filetype.el.set_active_iter(iter);
815             }
816         
817         
818         
819             el.append(out iter);
820             
821             el.set_value(iter, 0, "js");
822             el.set_value(iter, 1, "Javascript");
823         
824                 if (cur == "js") {
825                     _this.filetype.el.set_active_iter(iter);
826             }
827         
828             el.append(out iter);
829             
830             el.set_value(iter, 0, "css");
831             el.set_value(iter, 1, "CSS");
832         
833                 if (cur == "css") {
834                     _this.filetype.el.set_active_iter(iter);
835             }
836                                              
837         }
838     }
839
840
841     public class Xcls_Label22 : Object
842     {
843         public Gtk.Label el;
844         private Xcls_RooProjectSettings  _this;
845
846
847             // my vars (def)
848
849         // ctor
850         public Xcls_Label22(Xcls_RooProjectSettings _owner )
851         {
852             _this = _owner;
853             this.el = new Gtk.Label( "Directory" );
854
855             // my vars (dec)
856
857             // set gobject values
858             this.el.justify = Gtk.Justification.RIGHT;
859             this.el.xalign = 0.900000f;
860             this.el.visible = true;
861         }
862
863         // user defined functions
864     }
865
866     public class Xcls_dir : Object
867     {
868         public Gtk.ComboBox el;
869         private Xcls_RooProjectSettings  _this;
870
871
872             // my vars (def)
873
874         // ctor
875         public Xcls_dir(Xcls_RooProjectSettings _owner )
876         {
877             _this = _owner;
878             _this.dir = this;
879             this.el = new Gtk.ComboBox();
880
881             // my vars (dec)
882
883             // set gobject values
884             var child_0 = new Xcls_dircellrenderer( _this );
885             child_0.ref();
886             this.el.pack_start (  child_0.el , true );
887             var child_1 = new Xcls_dirmodel( _this );
888             child_1.ref();
889             this.el.set_model (  child_1.el  );
890
891             // init method
892
893             this.el.add_attribute(_this.dircellrenderer.el , "markup", 1 );
894         }
895
896         // user defined functions
897     }
898     public class Xcls_dircellrenderer : Object
899     {
900         public Gtk.CellRendererText el;
901         private Xcls_RooProjectSettings  _this;
902
903
904             // my vars (def)
905
906         // ctor
907         public Xcls_dircellrenderer(Xcls_RooProjectSettings _owner )
908         {
909             _this = _owner;
910             _this.dircellrenderer = this;
911             this.el = new Gtk.CellRendererText();
912
913             // my vars (dec)
914
915             // set gobject values
916         }
917
918         // user defined functions
919     }
920
921     public class Xcls_dirmodel : Object
922     {
923         public Gtk.ListStore el;
924         private Xcls_RooProjectSettings  _this;
925
926
927             // my vars (def)
928
929         // ctor
930         public Xcls_dirmodel(Xcls_RooProjectSettings _owner )
931         {
932             _this = _owner;
933             _this.dirmodel = this;
934             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
935
936             // my vars (dec)
937
938             // set gobject values
939         }
940
941         // user defined functions
942         public void loadData () {
943                 
944                 
945           
946             this.el.clear();                                    
947             
948             if (!(_this.project is Project.Gtk)) {
949                         return;
950                 }
951             var sd = ((Project.Gtk)_this.project).sourcedirs();
952             
953             Gtk.TreeIter iter;
954             var el = this.el;
955             
956            /// el.append(out iter);
957             
958              
959            // el.set_value(iter, 0, "");
960            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
961         
962         //    el.append(out iter);
963         
964             
965         //    el.set_value(iter, 0, "");
966           //  el.set_value(iter, 1, "-- select a directoyr --");
967             //_this.build_module.el.set_active_iter(iter);
968             
969             for (var i = 0; i < sd.length;i++) {
970             
971         
972                 el.append(out iter);
973                 
974                 el.set_value(iter, 0, sd[i]);
975                 el.set_value(iter, 1, sd[i]);
976                 
977                 //if (data.get(i) == cur) {
978                 //    _this.build_module.el.set_active_iter(iter);
979                // }
980                 
981             }
982           //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
983                                              
984         }
985     }
986
987
988     public class Xcls_Label26 : Object
989     {
990         public Gtk.Label el;
991         private Xcls_RooProjectSettings  _this;
992
993
994             // my vars (def)
995
996         // ctor
997         public Xcls_Label26(Xcls_RooProjectSettings _owner )
998         {
999             _this = _owner;
1000             this.el = new Gtk.Label( "Filename" );
1001
1002             // my vars (dec)
1003
1004             // set gobject values
1005             this.el.margin = 3;
1006             this.el.xalign = 0f;
1007         }
1008
1009         // user defined functions
1010     }
1011
1012     public class Xcls_path : Object
1013     {
1014         public Gtk.Label el;
1015         private Xcls_RooProjectSettings  _this;
1016
1017
1018             // my vars (def)
1019
1020         // ctor
1021         public Xcls_path(Xcls_RooProjectSettings _owner )
1022         {
1023             _this = _owner;
1024             _this.path = this;
1025             this.el = new Gtk.Label( "filename" );
1026
1027             // my vars (dec)
1028
1029             // set gobject values
1030             this.el.margin = 3;
1031             this.el.xalign = 0f;
1032         }
1033
1034         // user defined functions
1035     }
1036
1037     public class Xcls_Label28 : Object
1038     {
1039         public Gtk.Label el;
1040         private Xcls_RooProjectSettings  _this;
1041
1042
1043             // my vars (def)
1044
1045         // ctor
1046         public Xcls_Label28(Xcls_RooProjectSettings _owner )
1047         {
1048             _this = _owner;
1049             this.el = new Gtk.Label( "HTML template file" );
1050
1051             // my vars (dec)
1052
1053             // set gobject values
1054             this.el.margin = 3;
1055         }
1056
1057         // user defined functions
1058     }
1059
1060     public class Xcls_base_template : Object
1061     {
1062         public Gtk.ComboBox el;
1063         private Xcls_RooProjectSettings  _this;
1064
1065
1066             // my vars (def)
1067         public bool loading;
1068
1069         // ctor
1070         public Xcls_base_template(Xcls_RooProjectSettings _owner )
1071         {
1072             _this = _owner;
1073             _this.base_template = this;
1074             this.el = new Gtk.ComboBox();
1075
1076             // my vars (dec)
1077             this.loading = false;
1078
1079             // set gobject values
1080             var child_0 = new Xcls_base_template_cellrenderer( _this );
1081             child_0.ref();
1082             this.el.pack_start (  child_0.el , true );
1083             var child_1 = new Xcls_base_template_model( _this );
1084             child_1.ref();
1085             this.el.set_model (  child_1.el  );
1086
1087             // init method
1088
1089             this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 0 );
1090
1091             //listeners
1092             this.el.changed.connect( () => {
1093                 Gtk.TreeIter iter;
1094              
1095                 // this get's called when we are filling in the data... ???
1096                 if (this.loading) {
1097                         return;
1098                 }
1099                 
1100              
1101                 if (this.el.get_active_iter(out iter)) {
1102                         Value vfname;
1103                         _this.base_template_model.el.get_value (iter, 0, out vfname);
1104                         _this.project.base_template = ((string)vfname) ;
1105                         
1106                          print("\nSET base template to %s\n", _this.project.base_template );
1107                         // is_bjs = ((string)vfname) == "bjs";
1108                 }
1109                 
1110               
1111                 // directory is only available for non-bjs 
1112              
1113             
1114             
1115             });
1116         }
1117
1118         // user defined functions
1119     }
1120     public class Xcls_base_template_cellrenderer : Object
1121     {
1122         public Gtk.CellRendererText el;
1123         private Xcls_RooProjectSettings  _this;
1124
1125
1126             // my vars (def)
1127
1128         // ctor
1129         public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
1130         {
1131             _this = _owner;
1132             _this.base_template_cellrenderer = this;
1133             this.el = new Gtk.CellRendererText();
1134
1135             // my vars (dec)
1136
1137             // set gobject values
1138         }
1139
1140         // user defined functions
1141     }
1142
1143     public class Xcls_base_template_model : Object
1144     {
1145         public Gtk.ListStore el;
1146         private Xcls_RooProjectSettings  _this;
1147
1148
1149             // my vars (def)
1150
1151         // ctor
1152         public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
1153         {
1154             _this = _owner;
1155             _this.base_template_model = this;
1156             this.el = new Gtk.ListStore( 1, typeof(string) );
1157
1158             // my vars (dec)
1159
1160             // set gobject values
1161         }
1162
1163         // user defined functions
1164         public void loadData () {
1165                 _this.base_template.loading = true;
1166           
1167             this.el.clear();                                    
1168             Gtk.TreeIter iter;
1169             var el = this.el;
1170             
1171            /// el.append(out iter);
1172             
1173            
1174             el.append(out iter);
1175             el.set_value(iter, 0, "roo.builder.html");
1176             _this.base_template.el.set_active_iter(iter);
1177                 if (_this.project.base_template == "roo.builder.html") {
1178                    _this.base_template.el.set_active_iter(iter);
1179             }
1180         
1181             el.append(out iter);
1182             el.set_value(iter, 0, "bootstrap.builder.html");
1183          
1184                 print("\ncur template = %s\n", _this.project.base_template);
1185          
1186             if (_this.project.base_template == "bootstrap.builder.html") {
1187                    _this.base_template.el.set_active_iter(iter);
1188             }
1189         
1190                 el.append(out iter);
1191             el.set_value(iter, 0, "mailer.builder.html");
1192         
1193                 if (_this.project.base_template == "mailer.builder.html") {
1194                     _this.base_template.el.set_active_iter(iter);
1195             }
1196                 _this.base_template.loading = false;
1197                                              
1198         }
1199     }
1200
1201
1202
1203     public class Xcls_ScrolledWindow32 : Object
1204     {
1205         public Gtk.ScrolledWindow el;
1206         private Xcls_RooProjectSettings  _this;
1207
1208
1209             // my vars (def)
1210
1211         // ctor
1212         public Xcls_ScrolledWindow32(Xcls_RooProjectSettings _owner )
1213         {
1214             _this = _owner;
1215             this.el = new Gtk.ScrolledWindow( null, null );
1216
1217             // my vars (dec)
1218
1219             // set gobject values
1220             var child_0 = new Xcls_view( _this );
1221             child_0.ref();
1222             this.el.add (  child_0.el  );
1223         }
1224
1225         // user defined functions
1226     }
1227     public class Xcls_view : Object
1228     {
1229         public Gtk.SourceView el;
1230         private Xcls_RooProjectSettings  _this;
1231
1232
1233             // my vars (def)
1234
1235         // ctor
1236         public Xcls_view(Xcls_RooProjectSettings _owner )
1237         {
1238             _this = _owner;
1239             _this.view = this;
1240             this.el = new Gtk.SourceView();
1241
1242             // my vars (dec)
1243
1244             // init method
1245
1246             var description =   Pango.FontDescription.from_string("monospace");
1247                 description.set_size(9000);
1248                 this.el.override_font(description);
1249
1250             //listeners
1251             this.el.key_release_event.connect( ( event) =>{
1252                 if (event.keyval != 115) {
1253                     return false;
1254                      
1255                 }
1256                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
1257                     return false;
1258                 }
1259                  var buf =    this.el.get_buffer();
1260                 Gtk.TextIter s;
1261                 Gtk.TextIter e;
1262                 buf.get_start_iter(out s);
1263                 buf.get_end_iter(out e);
1264                 _this.project.runhtml = buf.get_text(s,e,true);
1265                 
1266                       
1267                 _this.buttonPressed("save");
1268                  
1269                 return false;
1270                      
1271             });
1272         }
1273
1274         // user defined functions
1275     }
1276
1277
1278
1279     public class Xcls_Box34 : Object
1280     {
1281         public Gtk.Box el;
1282         private Xcls_RooProjectSettings  _this;
1283
1284
1285             // my vars (def)
1286
1287         // ctor
1288         public Xcls_Box34(Xcls_RooProjectSettings _owner )
1289         {
1290             _this = _owner;
1291             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1292
1293             // my vars (dec)
1294
1295             // set gobject values
1296             this.el.homogeneous = false;
1297             var child_0 = new Xcls_Label35( _this );
1298             child_0.ref();
1299             this.el.pack_start (  child_0.el , false,false,0 );
1300             var child_1 = new Xcls_database_DBTYPE( _this );
1301             child_1.ref();
1302             this.el.pack_start (  child_1.el , false,false,0 );
1303             var child_2 = new Xcls_Label37( _this );
1304             child_2.ref();
1305             this.el.pack_start (  child_2.el , false,false,0 );
1306             var child_3 = new Xcls_database_DBNAME( _this );
1307             child_3.ref();
1308             this.el.pack_start (  child_3.el , false,false,0 );
1309             var child_4 = new Xcls_Label39( _this );
1310             child_4.ref();
1311             this.el.pack_start (  child_4.el , false,false,0 );
1312             var child_5 = new Xcls_database_DBUSERNAME( _this );
1313             child_5.ref();
1314             this.el.pack_start (  child_5.el , false,false,0 );
1315             var child_6 = new Xcls_Label41( _this );
1316             child_6.ref();
1317             this.el.pack_start (  child_6.el , false,false,0 );
1318             var child_7 = new Xcls_database_DBPASSWORD( _this );
1319             child_7.ref();
1320             this.el.pack_start (  child_7.el , false,false,0 );
1321             var child_8 = new Xcls_Button43( _this );
1322             child_8.ref();
1323             this.el.pack_start (  child_8.el , false,false,0 );
1324             var child_9 = new Xcls_database_ERROR( _this );
1325             child_9.ref();
1326             this.el.pack_start (  child_9.el , false,false,0 );
1327         }
1328
1329         // user defined functions
1330     }
1331     public class Xcls_Label35 : Object
1332     {
1333         public Gtk.Label el;
1334         private Xcls_RooProjectSettings  _this;
1335
1336
1337             // my vars (def)
1338
1339         // ctor
1340         public Xcls_Label35(Xcls_RooProjectSettings _owner )
1341         {
1342             _this = _owner;
1343             this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
1344
1345             // my vars (dec)
1346
1347             // set gobject values
1348             this.el.xalign = 0f;
1349         }
1350
1351         // user defined functions
1352     }
1353
1354     public class Xcls_database_DBTYPE : Object
1355     {
1356         public Gtk.Entry el;
1357         private Xcls_RooProjectSettings  _this;
1358
1359
1360             // my vars (def)
1361
1362         // ctor
1363         public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
1364         {
1365             _this = _owner;
1366             _this.database_DBTYPE = this;
1367             this.el = new Gtk.Entry();
1368
1369             // my vars (dec)
1370
1371             // set gobject values
1372
1373             //listeners
1374             this.el.key_press_event.connect( (ev) => {
1375             
1376                 if (ev.keyval == Gdk.Key.Tab) {
1377                     _this.database_DBNAME.el.grab_focus();
1378                     return true;
1379                 }
1380             
1381             
1382                 return false;
1383             });
1384         }
1385
1386         // user defined functions
1387     }
1388
1389     public class Xcls_Label37 : Object
1390     {
1391         public Gtk.Label el;
1392         private Xcls_RooProjectSettings  _this;
1393
1394
1395             // my vars (def)
1396
1397         // ctor
1398         public Xcls_Label37(Xcls_RooProjectSettings _owner )
1399         {
1400             _this = _owner;
1401             this.el = new Gtk.Label( "Name" );
1402
1403             // my vars (dec)
1404
1405             // set gobject values
1406             this.el.xalign = 0f;
1407         }
1408
1409         // user defined functions
1410     }
1411
1412     public class Xcls_database_DBNAME : Object
1413     {
1414         public Gtk.Entry el;
1415         private Xcls_RooProjectSettings  _this;
1416
1417
1418             // my vars (def)
1419
1420         // ctor
1421         public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
1422         {
1423             _this = _owner;
1424             _this.database_DBNAME = this;
1425             this.el = new Gtk.Entry();
1426
1427             // my vars (dec)
1428
1429             // set gobject values
1430
1431             //listeners
1432             this.el.key_press_event.connect( (ev) => {
1433             
1434                 if (ev.keyval == Gdk.Key.Tab) {
1435                     _this.database_DBUSERNAME.el.grab_focus();
1436                     return true;
1437                 }
1438             
1439             
1440                 return false;
1441             });
1442         }
1443
1444         // user defined functions
1445     }
1446
1447     public class Xcls_Label39 : Object
1448     {
1449         public Gtk.Label el;
1450         private Xcls_RooProjectSettings  _this;
1451
1452
1453             // my vars (def)
1454
1455         // ctor
1456         public Xcls_Label39(Xcls_RooProjectSettings _owner )
1457         {
1458             _this = _owner;
1459             this.el = new Gtk.Label( "Username" );
1460
1461             // my vars (dec)
1462
1463             // set gobject values
1464             this.el.xalign = 0f;
1465         }
1466
1467         // user defined functions
1468     }
1469
1470     public class Xcls_database_DBUSERNAME : Object
1471     {
1472         public Gtk.Entry el;
1473         private Xcls_RooProjectSettings  _this;
1474
1475
1476             // my vars (def)
1477
1478         // ctor
1479         public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
1480         {
1481             _this = _owner;
1482             _this.database_DBUSERNAME = this;
1483             this.el = new Gtk.Entry();
1484
1485             // my vars (dec)
1486
1487             // set gobject values
1488
1489             //listeners
1490             this.el.key_press_event.connect( (ev) => {
1491             
1492                 if (ev.keyval == Gdk.Key.Tab) {
1493                     _this.database_DBPASSWORD.el.grab_focus();
1494                     return true;
1495                 }
1496             
1497             
1498                 return false;
1499             });
1500         }
1501
1502         // user defined functions
1503     }
1504
1505     public class Xcls_Label41 : Object
1506     {
1507         public Gtk.Label el;
1508         private Xcls_RooProjectSettings  _this;
1509
1510
1511             // my vars (def)
1512
1513         // ctor
1514         public Xcls_Label41(Xcls_RooProjectSettings _owner )
1515         {
1516             _this = _owner;
1517             this.el = new Gtk.Label( "Password" );
1518
1519             // my vars (dec)
1520
1521             // set gobject values
1522             this.el.xalign = 0f;
1523         }
1524
1525         // user defined functions
1526     }
1527
1528     public class Xcls_database_DBPASSWORD : Object
1529     {
1530         public Gtk.Entry el;
1531         private Xcls_RooProjectSettings  _this;
1532
1533
1534             // my vars (def)
1535
1536         // ctor
1537         public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
1538         {
1539             _this = _owner;
1540             _this.database_DBPASSWORD = this;
1541             this.el = new Gtk.Entry();
1542
1543             // my vars (dec)
1544
1545             // set gobject values
1546         }
1547
1548         // user defined functions
1549     }
1550
1551     public class Xcls_Button43 : Object
1552     {
1553         public Gtk.Button el;
1554         private Xcls_RooProjectSettings  _this;
1555
1556
1557             // my vars (def)
1558
1559         // ctor
1560         public Xcls_Button43(Xcls_RooProjectSettings _owner )
1561         {
1562             _this = _owner;
1563             this.el = new Gtk.Button();
1564
1565             // my vars (dec)
1566
1567             // set gobject values
1568             this.el.label = "Check Connection";
1569
1570             //listeners
1571             this.el.clicked.connect( () => {
1572             
1573             
1574               _this.database_ERROR.el.label    = "";
1575                 Gda.Connection cnc;
1576                 try {
1577                     // assumes localhost...
1578                      cnc = Gda.Connection.open_from_string (
1579                                 _this.database_DBTYPE.el.get_text(),
1580                                 "DB_NAME=" + _this.database_DBNAME.el.get_text(), 
1581                                 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() + 
1582                                 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
1583                                 Gda.ConnectionOptions.NONE
1584                         );
1585                //} catch (Gda.ConnectionError ce) { 
1586                //   _this.database_ERROR.el.label = ce.message;        
1587                } catch(Gda.ConnectionError ue) {
1588                   _this.database_ERROR.el.label = ue.message;
1589                     return;
1590                }  catch(Gda.ConfigError ue) {
1591                   _this.database_ERROR.el.label = ue.message;
1592                     return;
1593                }
1594               _this.database_ERROR.el.label = "Connection Succeeded";
1595                cnc.close();
1596             });
1597         }
1598
1599         // user defined functions
1600     }
1601
1602     public class Xcls_database_ERROR : Object
1603     {
1604         public Gtk.Label el;
1605         private Xcls_RooProjectSettings  _this;
1606
1607
1608             // my vars (def)
1609
1610         // ctor
1611         public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
1612         {
1613             _this = _owner;
1614             _this.database_ERROR = this;
1615             this.el = new Gtk.Label( " " );
1616
1617             // my vars (dec)
1618
1619             // set gobject values
1620             this.el.margin = 3;
1621             this.el.xalign = 0f;
1622         }
1623
1624         // user defined functions
1625     }
1626
1627
1628
1629     public class Xcls_Box45 : Object
1630     {
1631         public Gtk.Box el;
1632         private Xcls_RooProjectSettings  _this;
1633
1634
1635             // my vars (def)
1636
1637         // ctor
1638         public Xcls_Box45(Xcls_RooProjectSettings _owner )
1639         {
1640             _this = _owner;
1641             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1642
1643             // my vars (dec)
1644
1645             // set gobject values
1646             this.el.homogeneous = true;
1647             this.el.expand = false;
1648             this.el.vexpand = false;
1649             var child_0 = new Xcls_Button46( _this );
1650             child_0.ref();
1651             this.el.add (  child_0.el  );
1652             var child_1 = new Xcls_Button47( _this );
1653             child_1.ref();
1654             this.el.add (  child_1.el  );
1655         }
1656
1657         // user defined functions
1658     }
1659     public class Xcls_Button46 : Object
1660     {
1661         public Gtk.Button el;
1662         private Xcls_RooProjectSettings  _this;
1663
1664
1665             // my vars (def)
1666
1667         // ctor
1668         public Xcls_Button46(Xcls_RooProjectSettings _owner )
1669         {
1670             _this = _owner;
1671             this.el = new Gtk.Button();
1672
1673             // my vars (dec)
1674
1675             // set gobject values
1676             this.el.label = "Apply";
1677
1678             //listeners
1679             this.el.button_press_event.connect( () => {
1680                 _this.save();
1681                       
1682                 _this.buttonPressed("apply");
1683                     return false;
1684             });
1685         }
1686
1687         // user defined functions
1688     }
1689
1690     public class Xcls_Button47 : Object
1691     {
1692         public Gtk.Button el;
1693         private Xcls_RooProjectSettings  _this;
1694
1695
1696             // my vars (def)
1697
1698         // ctor
1699         public Xcls_Button47(Xcls_RooProjectSettings _owner )
1700         {
1701             _this = _owner;
1702             this.el = new Gtk.Button();
1703
1704             // my vars (dec)
1705
1706             // set gobject values
1707             this.el.label = "Save";
1708
1709             //listeners
1710             this.el.button_press_event.connect( () => {
1711                    _this.save();
1712                       
1713                 _this.buttonPressed("save");
1714                     return false;
1715             });
1716         }
1717
1718         // user defined functions
1719     }
1720
1721
1722
1723 }