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