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