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