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