resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / ProjectSettings.vala
1 static Xcls_ProjectSettings  _ProjectSettings;
2
3 public class Xcls_ProjectSettings : Object 
4 {
5     public Gtk.Box el;
6     private Xcls_ProjectSettings  _this;
7
8     public static Xcls_ProjectSettings singleton()
9     {
10         if (_ProjectSettings == null) {
11             _ProjectSettings= new Xcls_ProjectSettings();
12         }
13         return _ProjectSettings;
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_rootURL rootURL;
20     public Xcls_view view;
21     public Xcls_database_DBTYPE database_DBTYPE;
22     public Xcls_database_DBNAME database_DBNAME;
23     public Xcls_database_DBUSERNAME database_DBUSERNAME;
24     public Xcls_database_DBPASSWORD database_DBPASSWORD;
25     public Xcls_database_ERROR database_ERROR;
26
27         // my vars (def)
28     public signal void buttonPressed (string btn);
29     public Project.Project project;
30
31     // ctor 
32     public Xcls_ProjectSettings()
33     {
34         _this = this;
35         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
36
37         // my vars (dec)
38
39         // set gobject values
40         this.el.homogeneous = false;
41         this.el.border_width = 5;
42         var child_0 = new Xcls_Box2( _this );
43         child_0.ref();
44         this.el.pack_start (  child_0.el , false,false,0 );
45         var child_1 = new Xcls_Notebook5( _this );
46         child_1.ref();
47         this.el.pack_end (  child_1.el , true,true,0 );
48     }
49
50     // user defined functions 
51     public void show (Project.Project project) {
52         _this.project = project;
53         _this.path.el.label = project.firstPath();
54         // get the active project.
55          var lm = Gtk.SourceLanguageManager.get_default();
56                     
57         ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
58         
59             lm.get_language("html"));
60       
61         //print (project.fn);
62         //project.runhtml = project.runhtml || '';
63         _this.view.el.get_buffer().set_text(project.runhtml);
64         
65            
66         _this.rootURL.el.set_text( _this.project.rootURL );
67         _this.base_template.el.set_text(_this.project.base_template);    
68          var js = _this.project;
69         _this.database_DBTYPE.el.set_text(     js.get_string_member("DBTYPE") );
70         _this.database_DBNAME.el.set_text(    js.get_string_member("DBNAME") );
71         _this.database_DBUSERNAME.el.set_text(    js.get_string_member("DBUSERNAME") );
72         _this.database_DBPASSWORD.el.set_text(    js.get_string_member("DBPASSWORD") );
73         //this.el.show_all();
74     }
75     public void save ()
76     {
77        var buf =    _this.view.el.get_buffer();
78        Gtk.TextIter s;
79          Gtk.TextIter e;
80         buf.get_start_iter(out s);
81         buf.get_end_iter(out e);
82           _this.project.runhtml = buf.get_text(s,e,true);
83           
84         _this.project.rootURL = _this.rootURL.el.get_text();
85         _this.project.base_template = _this.base_template.el.get_text();    
86         
87         var js = _this.project.json_project_data;
88         js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
89        js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
90         js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
91         js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
92     //    _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());    
93         
94         // need to re-init the database 
95         
96         _this.project.initRooDatabase();
97          
98         
99     }
100     public class Xcls_Box2 : Object 
101     {
102         public Gtk.Box el;
103         private Xcls_ProjectSettings  _this;
104
105
106             // my vars (def)
107
108         // ctor 
109         public Xcls_Box2(Xcls_ProjectSettings _owner )
110         {
111             _this = _owner;
112             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
113
114             // my vars (dec)
115
116             // set gobject values
117             this.el.homogeneous = true;
118             this.el.expand = false;
119             this.el.vexpand = false;
120             var child_0 = new Xcls_Button3( _this );
121             child_0.ref();
122             this.el.add (  child_0.el  );
123             var child_1 = new Xcls_Button4( _this );
124             child_1.ref();
125             this.el.add (  child_1.el  );
126         }
127
128         // user defined functions 
129     }
130     public class Xcls_Button3 : Object 
131     {
132         public Gtk.Button el;
133         private Xcls_ProjectSettings  _this;
134
135
136             // my vars (def)
137
138         // ctor 
139         public Xcls_Button3(Xcls_ProjectSettings _owner )
140         {
141             _this = _owner;
142             this.el = new Gtk.Button();
143
144             // my vars (dec)
145
146             // set gobject values
147             this.el.label = "Apply";
148
149             // listeners 
150             this.el.button_press_event.connect( () => {
151                 _this.save();
152                       
153                 _this.buttonPressed("apply");
154                     return false;
155             });
156         }
157
158         // user defined functions 
159     }
160     public class Xcls_Button4 : Object 
161     {
162         public Gtk.Button el;
163         private Xcls_ProjectSettings  _this;
164
165
166             // my vars (def)
167
168         // ctor 
169         public Xcls_Button4(Xcls_ProjectSettings _owner )
170         {
171             _this = _owner;
172             this.el = new Gtk.Button();
173
174             // my vars (dec)
175
176             // set gobject values
177             this.el.label = "Save";
178
179             // listeners 
180             this.el.button_press_event.connect( () => {
181                    _this.save();
182                       
183                 _this.buttonPressed("save");
184                     return false;
185             });
186         }
187
188         // user defined functions 
189     }
190     public class Xcls_Notebook5 : Object 
191     {
192         public Gtk.Notebook el;
193         private Xcls_ProjectSettings  _this;
194
195
196             // my vars (def)
197
198         // ctor 
199         public Xcls_Notebook5(Xcls_ProjectSettings _owner )
200         {
201             _this = _owner;
202             this.el = new Gtk.Notebook();
203
204             // my vars (dec)
205
206             // set gobject values
207             var child_0 = new Xcls_label_global( _this );
208             child_0.ref();
209             var child_1 = new Xcls_label_database( _this );
210             child_1.ref();
211             var child_2 = new Xcls_Box8( _this );
212             child_2.ref();
213             this.el.append_page (  child_2.el , _this.label_global.el );
214             var child_3 = new Xcls_Box19( _this );
215             child_3.ref();
216             this.el.append_page (  child_3.el , _this.label_database.el );
217         }
218
219         // user defined functions 
220     }
221     public class Xcls_label_global : Object 
222     {
223         public Gtk.Label el;
224         private Xcls_ProjectSettings  _this;
225
226
227             // my vars (def)
228
229         // ctor 
230         public Xcls_label_global(Xcls_ProjectSettings _owner )
231         {
232             _this = _owner;
233             _this.label_global = this;
234             this.el = new Gtk.Label( "Global" );
235
236             // my vars (dec)
237
238             // set gobject values
239         }
240
241         // user defined functions 
242     }
243     public class Xcls_label_database : Object 
244     {
245         public Gtk.Label el;
246         private Xcls_ProjectSettings  _this;
247
248
249             // my vars (def)
250
251         // ctor 
252         public Xcls_label_database(Xcls_ProjectSettings _owner )
253         {
254             _this = _owner;
255             _this.label_database = this;
256             this.el = new Gtk.Label( "Database" );
257
258             // my vars (dec)
259
260             // set gobject values
261         }
262
263         // user defined functions 
264     }
265     public class Xcls_Box8 : Object 
266     {
267         public Gtk.Box el;
268         private Xcls_ProjectSettings  _this;
269
270
271             // my vars (def)
272
273         // ctor 
274         public Xcls_Box8(Xcls_ProjectSettings _owner )
275         {
276             _this = _owner;
277             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
278
279             // my vars (dec)
280
281             // set gobject values
282             this.el.homogeneous = false;
283             var child_0 = new Xcls_path( _this );
284             child_0.ref();
285             this.el.pack_start (  child_0.el , false,false,0 );
286             var child_1 = new Xcls_Box10( _this );
287             child_1.ref();
288             this.el.pack_start (  child_1.el , false,false,0 );
289             var child_2 = new Xcls_Box13( _this );
290             child_2.ref();
291             this.el.pack_start (  child_2.el , false,false,0 );
292             var child_3 = new Xcls_Label16( _this );
293             child_3.ref();
294             this.el.pack_start (  child_3.el , false,false,0 );
295             var child_4 = new Xcls_ScrolledWindow17( _this );
296             child_4.ref();
297             this.el.pack_start (  child_4.el , true,true,0 );
298         }
299
300         // user defined functions 
301     }
302     public class Xcls_path : Object 
303     {
304         public Gtk.Label el;
305         private Xcls_ProjectSettings  _this;
306
307
308             // my vars (def)
309
310         // ctor 
311         public Xcls_path(Xcls_ProjectSettings _owner )
312         {
313             _this = _owner;
314             _this.path = this;
315             this.el = new Gtk.Label( "filename" );
316
317             // my vars (dec)
318
319             // set gobject values
320             this.el.margin = 3;
321             this.el.xalign = 0f;
322         }
323
324         // user defined functions 
325     }
326     public class Xcls_Box10 : Object 
327     {
328         public Gtk.Box el;
329         private Xcls_ProjectSettings  _this;
330
331
332             // my vars (def)
333
334         // ctor 
335         public Xcls_Box10(Xcls_ProjectSettings _owner )
336         {
337             _this = _owner;
338             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
339
340             // my vars (dec)
341
342             // set gobject values
343             this.el.homogeneous = false;
344             this.el.expand = false;
345             var child_0 = new Xcls_Label11( _this );
346             child_0.ref();
347             this.el.pack_start (  child_0.el , false,false,0 );
348             var child_1 = new Xcls_base_template( _this );
349             child_1.ref();
350             this.el.add (  child_1.el  );
351         }
352
353         // user defined functions 
354     }
355     public class Xcls_Label11 : Object 
356     {
357         public Gtk.Label el;
358         private Xcls_ProjectSettings  _this;
359
360
361             // my vars (def)
362
363         // ctor 
364         public Xcls_Label11(Xcls_ProjectSettings _owner )
365         {
366             _this = _owner;
367             this.el = new Gtk.Label( "HTML template file" );
368
369             // my vars (dec)
370
371             // set gobject values
372             this.el.margin = 3;
373         }
374
375         // user defined functions 
376     }
377     public class Xcls_base_template : Object 
378     {
379         public Gtk.Entry el;
380         private Xcls_ProjectSettings  _this;
381
382
383             // my vars (def)
384
385         // ctor 
386         public Xcls_base_template(Xcls_ProjectSettings _owner )
387         {
388             _this = _owner;
389             _this.base_template = this;
390             this.el = new Gtk.Entry();
391
392             // my vars (dec)
393
394             // set gobject values
395         }
396
397         // user defined functions 
398     }
399     public class Xcls_Box13 : Object 
400     {
401         public Gtk.Box el;
402         private Xcls_ProjectSettings  _this;
403
404
405             // my vars (def)
406
407         // ctor 
408         public Xcls_Box13(Xcls_ProjectSettings _owner )
409         {
410             _this = _owner;
411             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
412
413             // my vars (dec)
414
415             // set gobject values
416             this.el.homogeneous = false;
417             this.el.expand = false;
418             var child_0 = new Xcls_Label14( _this );
419             child_0.ref();
420             this.el.pack_start (  child_0.el , false,false,0 );
421             var child_1 = new Xcls_rootURL( _this );
422             child_1.ref();
423             this.el.add (  child_1.el  );
424         }
425
426         // user defined functions 
427     }
428     public class Xcls_Label14 : Object 
429     {
430         public Gtk.Label el;
431         private Xcls_ProjectSettings  _this;
432
433
434             // my vars (def)
435
436         // ctor 
437         public Xcls_Label14(Xcls_ProjectSettings _owner )
438         {
439             _this = _owner;
440             this.el = new Gtk.Label( "root URL" );
441
442             // my vars (dec)
443
444             // set gobject values
445             this.el.margin = 3;
446         }
447
448         // user defined functions 
449     }
450     public class Xcls_rootURL : Object 
451     {
452         public Gtk.Entry el;
453         private Xcls_ProjectSettings  _this;
454
455
456             // my vars (def)
457
458         // ctor 
459         public Xcls_rootURL(Xcls_ProjectSettings _owner )
460         {
461             _this = _owner;
462             _this.rootURL = this;
463             this.el = new Gtk.Entry();
464
465             // my vars (dec)
466
467             // set gobject values
468         }
469
470         // user defined functions 
471     }
472     public class Xcls_Label16 : Object 
473     {
474         public Gtk.Label el;
475         private Xcls_ProjectSettings  _this;
476
477
478             // my vars (def)
479
480         // ctor 
481         public Xcls_Label16(Xcls_ProjectSettings _owner )
482         {
483             _this = _owner;
484             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
485
486             // my vars (dec)
487
488             // set gobject values
489         }
490
491         // user defined functions 
492     }
493     public class Xcls_ScrolledWindow17 : Object 
494     {
495         public Gtk.ScrolledWindow el;
496         private Xcls_ProjectSettings  _this;
497
498
499             // my vars (def)
500
501         // ctor 
502         public Xcls_ScrolledWindow17(Xcls_ProjectSettings _owner )
503         {
504             _this = _owner;
505             this.el = new Gtk.ScrolledWindow( null, null );
506
507             // my vars (dec)
508
509             // set gobject values
510             var child_0 = new Xcls_view( _this );
511             child_0.ref();
512             this.el.add (  child_0.el  );
513         }
514
515         // user defined functions 
516     }
517     public class Xcls_view : Object 
518     {
519         public Gtk.SourceView el;
520         private Xcls_ProjectSettings  _this;
521
522
523             // my vars (def)
524
525         // ctor 
526         public Xcls_view(Xcls_ProjectSettings _owner )
527         {
528             _this = _owner;
529             _this.view = this;
530             this.el = new Gtk.SourceView();
531
532             // my vars (dec)
533
534             // init method 
535
536             var description =   Pango.FontDescription.from_string("monospace");
537                 description.set_size(9000);
538                 this.el.override_font(description);
539
540             // listeners 
541             this.el.key_release_event.connect( ( event) =>{
542                 if (event.keyval != 115) {
543                     return false;
544                      
545                 }
546                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
547                     return false;
548                 }
549                  var buf =    this.el.get_buffer();
550                 Gtk.TextIter s;
551                 Gtk.TextIter e;
552                 buf.get_start_iter(out s);
553                 buf.get_end_iter(out e);
554                 _this.project.runhtml = buf.get_text(s,e,true);
555                 
556                       
557                 _this.buttonPressed("save");
558                  
559                 return false;
560                      
561             });
562         }
563
564         // user defined functions 
565     }
566     public class Xcls_Box19 : Object 
567     {
568         public Gtk.Box el;
569         private Xcls_ProjectSettings  _this;
570
571
572             // my vars (def)
573
574         // ctor 
575         public Xcls_Box19(Xcls_ProjectSettings _owner )
576         {
577             _this = _owner;
578             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
579
580             // my vars (dec)
581
582             // set gobject values
583             this.el.homogeneous = false;
584             var child_0 = new Xcls_Label20( _this );
585             child_0.ref();
586             this.el.pack_start (  child_0.el , false,false,0 );
587             var child_1 = new Xcls_database_DBTYPE( _this );
588             child_1.ref();
589             this.el.pack_start (  child_1.el , false,false,0 );
590             var child_2 = new Xcls_Label22( _this );
591             child_2.ref();
592             this.el.pack_start (  child_2.el , false,false,0 );
593             var child_3 = new Xcls_database_DBNAME( _this );
594             child_3.ref();
595             this.el.pack_start (  child_3.el , false,false,0 );
596             var child_4 = new Xcls_Label24( _this );
597             child_4.ref();
598             this.el.pack_start (  child_4.el , false,false,0 );
599             var child_5 = new Xcls_database_DBUSERNAME( _this );
600             child_5.ref();
601             this.el.pack_start (  child_5.el , false,false,0 );
602             var child_6 = new Xcls_Label26( _this );
603             child_6.ref();
604             this.el.pack_start (  child_6.el , false,false,0 );
605             var child_7 = new Xcls_database_DBPASSWORD( _this );
606             child_7.ref();
607             this.el.pack_start (  child_7.el , false,false,0 );
608             var child_8 = new Xcls_Button28( _this );
609             child_8.ref();
610             this.el.pack_start (  child_8.el , false,false,0 );
611             var child_9 = new Xcls_database_ERROR( _this );
612             child_9.ref();
613             this.el.pack_start (  child_9.el , false,false,0 );
614         }
615
616         // user defined functions 
617     }
618     public class Xcls_Label20 : Object 
619     {
620         public Gtk.Label el;
621         private Xcls_ProjectSettings  _this;
622
623
624             // my vars (def)
625
626         // ctor 
627         public Xcls_Label20(Xcls_ProjectSettings _owner )
628         {
629             _this = _owner;
630             this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
631
632             // my vars (dec)
633
634             // set gobject values
635             this.el.xalign = 0f;
636         }
637
638         // user defined functions 
639     }
640     public class Xcls_database_DBTYPE : Object 
641     {
642         public Gtk.Entry el;
643         private Xcls_ProjectSettings  _this;
644
645
646             // my vars (def)
647
648         // ctor 
649         public Xcls_database_DBTYPE(Xcls_ProjectSettings _owner )
650         {
651             _this = _owner;
652             _this.database_DBTYPE = this;
653             this.el = new Gtk.Entry();
654
655             // my vars (dec)
656
657             // set gobject values
658
659             // listeners 
660             this.el.key_press_event.connect( (ev) => {
661             
662                 if (ev.keyval == Gdk.Key.Tab) {
663                     _this.database_DBNAME.el.grab_focus();
664                     return true;
665                 }
666             
667             
668                 return false;
669             });
670         }
671
672         // user defined functions 
673     }
674     public class Xcls_Label22 : Object 
675     {
676         public Gtk.Label el;
677         private Xcls_ProjectSettings  _this;
678
679
680             // my vars (def)
681
682         // ctor 
683         public Xcls_Label22(Xcls_ProjectSettings _owner )
684         {
685             _this = _owner;
686             this.el = new Gtk.Label( "Name" );
687
688             // my vars (dec)
689
690             // set gobject values
691             this.el.xalign = 0f;
692         }
693
694         // user defined functions 
695     }
696     public class Xcls_database_DBNAME : Object 
697     {
698         public Gtk.Entry el;
699         private Xcls_ProjectSettings  _this;
700
701
702             // my vars (def)
703
704         // ctor 
705         public Xcls_database_DBNAME(Xcls_ProjectSettings _owner )
706         {
707             _this = _owner;
708             _this.database_DBNAME = this;
709             this.el = new Gtk.Entry();
710
711             // my vars (dec)
712
713             // set gobject values
714
715             // listeners 
716             this.el.key_press_event.connect( (ev) => {
717             
718                 if (ev.keyval == Gdk.Key.Tab) {
719                     _this.database_DBUSERNAME.el.grab_focus();
720                     return true;
721                 }
722             
723             
724                 return false;
725             });
726         }
727
728         // user defined functions 
729     }
730     public class Xcls_Label24 : Object 
731     {
732         public Gtk.Label el;
733         private Xcls_ProjectSettings  _this;
734
735
736             // my vars (def)
737
738         // ctor 
739         public Xcls_Label24(Xcls_ProjectSettings _owner )
740         {
741             _this = _owner;
742             this.el = new Gtk.Label( "Username" );
743
744             // my vars (dec)
745
746             // set gobject values
747             this.el.xalign = 0f;
748         }
749
750         // user defined functions 
751     }
752     public class Xcls_database_DBUSERNAME : Object 
753     {
754         public Gtk.Entry el;
755         private Xcls_ProjectSettings  _this;
756
757
758             // my vars (def)
759
760         // ctor 
761         public Xcls_database_DBUSERNAME(Xcls_ProjectSettings _owner )
762         {
763             _this = _owner;
764             _this.database_DBUSERNAME = this;
765             this.el = new Gtk.Entry();
766
767             // my vars (dec)
768
769             // set gobject values
770
771             // listeners 
772             this.el.key_press_event.connect( (ev) => {
773             
774                 if (ev.keyval == Gdk.Key.Tab) {
775                     _this.database_DBPASSWORD.el.grab_focus();
776                     return true;
777                 }
778             
779             
780                 return false;
781             });
782         }
783
784         // user defined functions 
785     }
786     public class Xcls_Label26 : Object 
787     {
788         public Gtk.Label el;
789         private Xcls_ProjectSettings  _this;
790
791
792             // my vars (def)
793
794         // ctor 
795         public Xcls_Label26(Xcls_ProjectSettings _owner )
796         {
797             _this = _owner;
798             this.el = new Gtk.Label( "Password" );
799
800             // my vars (dec)
801
802             // set gobject values
803             this.el.xalign = 0f;
804         }
805
806         // user defined functions 
807     }
808     public class Xcls_database_DBPASSWORD : Object 
809     {
810         public Gtk.Entry el;
811         private Xcls_ProjectSettings  _this;
812
813
814             // my vars (def)
815
816         // ctor 
817         public Xcls_database_DBPASSWORD(Xcls_ProjectSettings _owner )
818         {
819             _this = _owner;
820             _this.database_DBPASSWORD = this;
821             this.el = new Gtk.Entry();
822
823             // my vars (dec)
824
825             // set gobject values
826         }
827
828         // user defined functions 
829     }
830     public class Xcls_Button28 : Object 
831     {
832         public Gtk.Button el;
833         private Xcls_ProjectSettings  _this;
834
835
836             // my vars (def)
837
838         // ctor 
839         public Xcls_Button28(Xcls_ProjectSettings _owner )
840         {
841             _this = _owner;
842             this.el = new Gtk.Button();
843
844             // my vars (dec)
845
846             // set gobject values
847             this.el.label = "Check Connection";
848
849             // listeners 
850             this.el.clicked.connect( () => {
851             
852             
853               _this.database_ERROR.el.label    = "";
854                 Gda.Connection cnc;
855                 try {
856                     // assumes localhost...
857                      cnc = Gda.Connection.open_from_string (
858                                 _this.database_DBTYPE.el.get_text(),
859                                 "DB_NAME=" + _this.database_DBNAME.el.get_text(), 
860                                 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() + 
861                                 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
862                                 Gda.ConnectionOptions.NONE
863                         );
864                //} catch (Gda.ConnectionError ce) { 
865                //   _this.database_ERROR.el.label = ce.message;        
866                } catch(Gda.ConnectionError ue) {
867                   _this.database_ERROR.el.label = ue.message;
868                     return;
869                }  catch(Gda.ConfigError ue) {
870                   _this.database_ERROR.el.label = ue.message;
871                     return;
872                }
873               _this.database_ERROR.el.label = "Connection Succeeded";
874                cnc.close();
875             });
876         }
877
878         // user defined functions 
879     }
880     public class Xcls_database_ERROR : Object 
881     {
882         public Gtk.Label el;
883         private Xcls_ProjectSettings  _this;
884
885
886             // my vars (def)
887
888         // ctor 
889         public Xcls_database_ERROR(Xcls_ProjectSettings _owner )
890         {
891             _this = _owner;
892             _this.database_ERROR = this;
893             this.el = new Gtk.Label( " " );
894
895             // my vars (dec)
896
897             // set gobject values
898             this.el.margin = 3;
899             this.el.xalign = 0f;
900         }
901
902         // user defined functions 
903     }
904 }