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