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