src/Builder4/ProjectSettings.bjs
[app.Builder.js] / src / Builder4 / ProjectSettings.vala
1 static Xcls_ProjectSettings  _ProjectSettings;
2
3 public class Xcls_ProjectSettings : Object 
4 {
5     public Gtk.VBox 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_DBTYPE database_DBTYPE;
23     public Xcls_database_DBUSERNAME database_DBUSERNAME;
24
25         // my vars (def)
26     public signal void buttonPressed (string btn);
27     public Project.Project project;
28
29     // ctor 
30     public Xcls_ProjectSettings()
31     {
32         _this = this;
33         this.el = new Gtk.VBox( false, 0 );
34
35         // my vars (dec)
36
37         // set gobject values
38         this.el.border_width = 5;
39         var child_0 = new Xcls_HBox2( _this );
40         child_0.ref();
41         this.el.pack_start (  child_0.el , false,false,0 );
42         var child_1 = new Xcls_Notebook5( _this );
43         child_1.ref();
44         this.el.pack_end (  child_1.el , true,true,0 );
45     }
46
47     // user defined functions 
48     public void show (Project.Project project) {
49         _this.project = project;
50         _this.path.el.label = project.firstPath();
51         // get the active project.
52          var lm = Gtk.SourceLanguageManager.get_default();
53                     
54         ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
55         
56             lm.get_language("html"));
57       
58         //print (project.fn);
59         //project.runhtml = project.runhtml || '';
60         _this.view.el.get_buffer().set_text(project.runhtml);
61         
62            
63         _this.rootURL.el.set_text( _this.project.rootURL );
64         _this.base_template.el.set_text(_this.project.base_template);    
65        
66         
67         //this.el.show_all();
68     }
69     public void save ()
70     {
71        var buf =    _this.view.el.get_buffer();
72        Gtk.TextIter s;
73          Gtk.TextIter e;
74         buf.get_start_iter(out s);
75         buf.get_end_iter(out e);
76           _this.project.runhtml = buf.get_text(s,e,true);
77           
78         _this.project.rootURL = _this.rootURL.el.get_text();
79         _this.project.base_template = _this.base_template.el.get_text();    
80         
81         
82     }
83     public class Xcls_HBox2 : Object 
84     {
85         public Gtk.HBox el;
86         private Xcls_ProjectSettings  _this;
87
88
89             // my vars (def)
90
91         // ctor 
92         public Xcls_HBox2(Xcls_ProjectSettings _owner )
93         {
94             _this = _owner;
95             this.el = new Gtk.HBox( true, 0 );
96
97             // my vars (dec)
98
99             // set gobject values
100             this.el.expand = false;
101             this.el.vexpand = false;
102             var child_0 = new Xcls_Button3( _this );
103             child_0.ref();
104             this.el.add (  child_0.el  );
105             var child_1 = new Xcls_Button4( _this );
106             child_1.ref();
107             this.el.add (  child_1.el  );
108         }
109
110         // user defined functions 
111     }
112     public class Xcls_Button3 : Object 
113     {
114         public Gtk.Button el;
115         private Xcls_ProjectSettings  _this;
116
117
118             // my vars (def)
119
120         // ctor 
121         public Xcls_Button3(Xcls_ProjectSettings _owner )
122         {
123             _this = _owner;
124             this.el = new Gtk.Button();
125
126             // my vars (dec)
127
128             // set gobject values
129             this.el.label = "Apply";
130
131             // listeners 
132             this.el.button_press_event.connect( () => {
133                 _this.save();
134                       
135                 _this.buttonPressed("apply");
136                     return false;
137             });
138         }
139
140         // user defined functions 
141     }
142     public class Xcls_Button4 : Object 
143     {
144         public Gtk.Button el;
145         private Xcls_ProjectSettings  _this;
146
147
148             // my vars (def)
149
150         // ctor 
151         public Xcls_Button4(Xcls_ProjectSettings _owner )
152         {
153             _this = _owner;
154             this.el = new Gtk.Button();
155
156             // my vars (dec)
157
158             // set gobject values
159             this.el.label = "Save";
160
161             // listeners 
162             this.el.button_press_event.connect( () => {
163                    _this.save();
164                       
165                 _this.buttonPressed("save");
166                     return false;
167             });
168         }
169
170         // user defined functions 
171     }
172     public class Xcls_Notebook5 : Object 
173     {
174         public Gtk.Notebook el;
175         private Xcls_ProjectSettings  _this;
176
177
178             // my vars (def)
179
180         // ctor 
181         public Xcls_Notebook5(Xcls_ProjectSettings _owner )
182         {
183             _this = _owner;
184             this.el = new Gtk.Notebook();
185
186             // my vars (dec)
187
188             // set gobject values
189             var child_0 = new Xcls_label_global( _this );
190             child_0.ref();
191             var child_1 = new Xcls_label_database( _this );
192             child_1.ref();
193             var child_2 = new Xcls_VBox8( _this );
194             child_2.ref();
195             this.el.append_page (  child_2.el , _this.label_global.el );
196             var child_3 = new Xcls_VBox19( _this );
197             child_3.ref();
198             this.el.append_page (  child_3.el , _this.label_database.el );
199         }
200
201         // user defined functions 
202     }
203     public class Xcls_label_global : Object 
204     {
205         public Gtk.Label el;
206         private Xcls_ProjectSettings  _this;
207
208
209             // my vars (def)
210
211         // ctor 
212         public Xcls_label_global(Xcls_ProjectSettings _owner )
213         {
214             _this = _owner;
215             _this.label_global = this;
216             this.el = new Gtk.Label( "Global" );
217
218             // my vars (dec)
219
220             // set gobject values
221         }
222
223         // user defined functions 
224     }
225     public class Xcls_label_database : Object 
226     {
227         public Gtk.Label el;
228         private Xcls_ProjectSettings  _this;
229
230
231             // my vars (def)
232
233         // ctor 
234         public Xcls_label_database(Xcls_ProjectSettings _owner )
235         {
236             _this = _owner;
237             _this.label_database = this;
238             this.el = new Gtk.Label( "Database" );
239
240             // my vars (dec)
241
242             // set gobject values
243         }
244
245         // user defined functions 
246     }
247     public class Xcls_VBox8 : Object 
248     {
249         public Gtk.VBox el;
250         private Xcls_ProjectSettings  _this;
251
252
253             // my vars (def)
254
255         // ctor 
256         public Xcls_VBox8(Xcls_ProjectSettings _owner )
257         {
258             _this = _owner;
259             this.el = new Gtk.VBox( false, 0 );
260
261             // my vars (dec)
262
263             // set gobject values
264             var child_0 = new Xcls_path( _this );
265             child_0.ref();
266             this.el.pack_start (  child_0.el , false,false,0 );
267             var child_1 = new Xcls_Label10( _this );
268             child_1.ref();
269             this.el.pack_start (  child_1.el , false,false,0 );
270             var child_2 = new Xcls_HBox11( _this );
271             child_2.ref();
272             this.el.pack_start (  child_2.el , false,false,0 );
273             var child_3 = new Xcls_HBox14( _this );
274             child_3.ref();
275             this.el.pack_start (  child_3.el , false,false,0 );
276             var child_4 = new Xcls_ScrolledWindow17( _this );
277             child_4.ref();
278             this.el.pack_start (  child_4.el , true,true,0 );
279         }
280
281         // user defined functions 
282     }
283     public class Xcls_path : Object 
284     {
285         public Gtk.Label el;
286         private Xcls_ProjectSettings  _this;
287
288
289             // my vars (def)
290
291         // ctor 
292         public Xcls_path(Xcls_ProjectSettings _owner )
293         {
294             _this = _owner;
295             _this.path = this;
296             this.el = new Gtk.Label( "filename" );
297
298             // my vars (dec)
299
300             // set gobject values
301             this.el.xalign = 0f;
302         }
303
304         // user defined functions 
305     }
306     public class Xcls_Label10 : Object 
307     {
308         public Gtk.Label el;
309         private Xcls_ProjectSettings  _this;
310
311
312             // my vars (def)
313
314         // ctor 
315         public Xcls_Label10(Xcls_ProjectSettings _owner )
316         {
317             _this = _owner;
318             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
319
320             // my vars (dec)
321
322             // set gobject values
323         }
324
325         // user defined functions 
326     }
327     public class Xcls_HBox11 : Object 
328     {
329         public Gtk.HBox el;
330         private Xcls_ProjectSettings  _this;
331
332
333             // my vars (def)
334
335         // ctor 
336         public Xcls_HBox11(Xcls_ProjectSettings _owner )
337         {
338             _this = _owner;
339             this.el = new Gtk.HBox( false, 0 );
340
341             // my vars (dec)
342
343             // set gobject values
344             this.el.expand = false;
345             var child_0 = new Xcls_Label12( _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_Label12 : Object 
356     {
357         public Gtk.Label el;
358         private Xcls_ProjectSettings  _this;
359
360
361             // my vars (def)
362
363         // ctor 
364         public Xcls_Label12(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         }
373
374         // user defined functions 
375     }
376     public class Xcls_base_template : Object 
377     {
378         public Gtk.Entry el;
379         private Xcls_ProjectSettings  _this;
380
381
382             // my vars (def)
383
384         // ctor 
385         public Xcls_base_template(Xcls_ProjectSettings _owner )
386         {
387             _this = _owner;
388             _this.base_template = this;
389             this.el = new Gtk.Entry();
390
391             // my vars (dec)
392
393             // set gobject values
394         }
395
396         // user defined functions 
397     }
398     public class Xcls_HBox14 : Object 
399     {
400         public Gtk.HBox el;
401         private Xcls_ProjectSettings  _this;
402
403
404             // my vars (def)
405
406         // ctor 
407         public Xcls_HBox14(Xcls_ProjectSettings _owner )
408         {
409             _this = _owner;
410             this.el = new Gtk.HBox( false, 0 );
411
412             // my vars (dec)
413
414             // set gobject values
415             this.el.expand = false;
416             var child_0 = new Xcls_Label15( _this );
417             child_0.ref();
418             this.el.pack_start (  child_0.el , false,false,0 );
419             var child_1 = new Xcls_rootURL( _this );
420             child_1.ref();
421             this.el.add (  child_1.el  );
422         }
423
424         // user defined functions 
425     }
426     public class Xcls_Label15 : Object 
427     {
428         public Gtk.Label el;
429         private Xcls_ProjectSettings  _this;
430
431
432             // my vars (def)
433
434         // ctor 
435         public Xcls_Label15(Xcls_ProjectSettings _owner )
436         {
437             _this = _owner;
438             this.el = new Gtk.Label( "root URL" );
439
440             // my vars (dec)
441
442             // set gobject values
443         }
444
445         // user defined functions 
446     }
447     public class Xcls_rootURL : Object 
448     {
449         public Gtk.Entry el;
450         private Xcls_ProjectSettings  _this;
451
452
453             // my vars (def)
454
455         // ctor 
456         public Xcls_rootURL(Xcls_ProjectSettings _owner )
457         {
458             _this = _owner;
459             _this.rootURL = this;
460             this.el = new Gtk.Entry();
461
462             // my vars (dec)
463
464             // set gobject values
465         }
466
467         // user defined functions 
468     }
469     public class Xcls_ScrolledWindow17 : Object 
470     {
471         public Gtk.ScrolledWindow el;
472         private Xcls_ProjectSettings  _this;
473
474
475             // my vars (def)
476
477         // ctor 
478         public Xcls_ScrolledWindow17(Xcls_ProjectSettings _owner )
479         {
480             _this = _owner;
481             this.el = new Gtk.ScrolledWindow( null, null );
482
483             // my vars (dec)
484
485             // set gobject values
486             var child_0 = new Xcls_view( _this );
487             child_0.ref();
488             this.el.add (  child_0.el  );
489         }
490
491         // user defined functions 
492     }
493     public class Xcls_view : Object 
494     {
495         public Gtk.SourceView el;
496         private Xcls_ProjectSettings  _this;
497
498
499             // my vars (def)
500
501         // ctor 
502         public Xcls_view(Xcls_ProjectSettings _owner )
503         {
504             _this = _owner;
505             _this.view = this;
506             this.el = new Gtk.SourceView();
507
508             // my vars (dec)
509
510             // set gobject values
511
512             // init method 
513
514             var description =   Pango.FontDescription.from_string("monospace");
515                 description.set_size(9000);
516                 this.el.override_font(description);
517
518             // listeners 
519             this.el.key_release_event.connect( ( event) =>{
520                 if (event.keyval != 115) {
521                     return false;
522                      
523                 }
524                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
525                     return false;
526                 }
527                  var buf =    this.el.get_buffer();
528                 Gtk.TextIter s;
529                 Gtk.TextIter e;
530                 buf.get_start_iter(out s);
531                 buf.get_end_iter(out e);
532                 _this.project.runhtml = buf.get_text(s,e,true);
533                 
534                       
535                 _this.buttonPressed("save");
536                  
537                 return false;
538                      
539             });
540         }
541
542         // user defined functions 
543     }
544     public class Xcls_VBox19 : Object 
545     {
546         public Gtk.VBox el;
547         private Xcls_ProjectSettings  _this;
548
549
550             // my vars (def)
551
552         // ctor 
553         public Xcls_VBox19(Xcls_ProjectSettings _owner )
554         {
555             _this = _owner;
556             this.el = new Gtk.VBox( false, 0 );
557
558             // my vars (dec)
559
560             // set gobject values
561             var child_0 = new Xcls_Label20( _this );
562             child_0.ref();
563             this.el.pack_start (  child_0.el , false,false,0 );
564             var child_1 = new Xcls_database_DBTYPE( _this );
565             child_1.ref();
566             this.el.pack_start (  child_1.el , false,false,0 );
567             var child_2 = new Xcls_Label22( _this );
568             child_2.ref();
569             this.el.pack_start (  child_2.el , false,false,0 );
570             var child_3 = new Xcls_database_DBTYPE( _this );
571             child_3.ref();
572             this.el.pack_start (  child_3.el , false,false,0 );
573             var child_4 = new Xcls_Label24( _this );
574             child_4.ref();
575             this.el.pack_start (  child_4.el , false,false,0 );
576             var child_5 = new Xcls_database_DBUSERNAME( _this );
577             child_5.ref();
578             this.el.pack_start (  child_5.el , false,false,0 );
579             var child_6 = new Xcls_Label26( _this );
580             child_6.ref();
581             this.el.pack_start (  child_6.el , false,false,0 );
582         }
583
584         // user defined functions 
585     }
586     public class Xcls_Label20 : Object 
587     {
588         public Gtk.Label el;
589         private Xcls_ProjectSettings  _this;
590
591
592             // my vars (def)
593
594         // ctor 
595         public Xcls_Label20(Xcls_ProjectSettings _owner )
596         {
597             _this = _owner;
598             this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
599
600             // my vars (dec)
601
602             // set gobject values
603             this.el.xalign = 0f;
604         }
605
606         // user defined functions 
607     }
608     public class Xcls_database_DBTYPE : Object 
609     {
610         public Gtk.Entry el;
611         private Xcls_ProjectSettings  _this;
612
613
614             // my vars (def)
615
616         // ctor 
617         public Xcls_database_DBTYPE(Xcls_ProjectSettings _owner )
618         {
619             _this = _owner;
620             _this.database_DBTYPE = this;
621             this.el = new Gtk.Entry();
622
623             // my vars (dec)
624
625             // set gobject values
626         }
627
628         // user defined functions 
629     }
630     public class Xcls_Label22 : Object 
631     {
632         public Gtk.Label el;
633         private Xcls_ProjectSettings  _this;
634
635
636             // my vars (def)
637
638         // ctor 
639         public Xcls_Label22(Xcls_ProjectSettings _owner )
640         {
641             _this = _owner;
642             this.el = new Gtk.Label( "Name" );
643
644             // my vars (dec)
645
646             // set gobject values
647             this.el.xalign = 0f;
648         }
649
650         // user defined functions 
651     }
652     public class Xcls_database_DBTYPE : Object 
653     {
654         public Gtk.Entry el;
655         private Xcls_ProjectSettings  _this;
656
657
658             // my vars (def)
659
660         // ctor 
661         public Xcls_database_DBTYPE(Xcls_ProjectSettings _owner )
662         {
663             _this = _owner;
664             _this.database_DBTYPE = this;
665             this.el = new Gtk.Entry();
666
667             // my vars (dec)
668
669             // set gobject values
670         }
671
672         // user defined functions 
673     }
674     public class Xcls_Label24 : Object 
675     {
676         public Gtk.Label el;
677         private Xcls_ProjectSettings  _this;
678
679
680             // my vars (def)
681
682         // ctor 
683         public Xcls_Label24(Xcls_ProjectSettings _owner )
684         {
685             _this = _owner;
686             this.el = new Gtk.Label( "Username" );
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_DBUSERNAME : 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_DBUSERNAME(Xcls_ProjectSettings _owner )
706         {
707             _this = _owner;
708             _this.database_DBUSERNAME = this;
709             this.el = new Gtk.Entry();
710
711             // my vars (dec)
712
713             // set gobject values
714         }
715
716         // user defined functions 
717     }
718     public class Xcls_Label26 : Object 
719     {
720         public Gtk.Label el;
721         private Xcls_ProjectSettings  _this;
722
723
724             // my vars (def)
725
726         // ctor 
727         public Xcls_Label26(Xcls_ProjectSettings _owner )
728         {
729             _this = _owner;
730             this.el = new Gtk.Label( "Username" );
731
732             // my vars (dec)
733
734             // set gobject values
735             this.el.xalign = 0f;
736         }
737
738         // user defined functions 
739     }
740 }