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_HBox5( _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_Label9( _this );
46         child_3.ref();
47         this.el.pack_start (  child_3.el , false,false,0 );
48         var child_4 = new Xcls_HBox10( _this );
49         child_4.ref();
50         this.el.pack_start (  child_4.el , false,false,0 );
51         var child_5 = new Xcls_HBox13( _this );
52         child_5.ref();
53         this.el.pack_start (  child_5.el , false,false,0 );
54         var child_6 = new Xcls_ScrolledWindow16( _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         }
117
118         // user defined functions 
119     }
120     public class Xcls_label_global : Object 
121     {
122         public Gtk.Label el;
123         private Xcls_ProjectSettings  _this;
124
125
126             // my vars (def)
127
128         // ctor 
129         public Xcls_label_global(Xcls_ProjectSettings _owner )
130         {
131             _this = _owner;
132             _this.label_global = this;
133             this.el = new Gtk.Label( "Global" );
134
135             // my vars (dec)
136
137             // set gobject values
138         }
139
140         // user defined functions 
141     }
142     public class Xcls_label_database : Object 
143     {
144         public Gtk.Label el;
145         private Xcls_ProjectSettings  _this;
146
147
148             // my vars (def)
149
150         // ctor 
151         public Xcls_label_database(Xcls_ProjectSettings _owner )
152         {
153             _this = _owner;
154             _this.label_database = this;
155             this.el = new Gtk.Label( "Database" );
156
157             // my vars (dec)
158
159             // set gobject values
160         }
161
162         // user defined functions 
163     }
164     public class Xcls_HBox5 : Object 
165     {
166         public Gtk.HBox el;
167         private Xcls_ProjectSettings  _this;
168
169
170             // my vars (def)
171
172         // ctor 
173         public Xcls_HBox5(Xcls_ProjectSettings _owner )
174         {
175             _this = _owner;
176             this.el = new Gtk.HBox( true, 0 );
177
178             // my vars (dec)
179
180             // set gobject values
181             this.el.expand = false;
182             this.el.vexpand = false;
183             var child_0 = new Xcls_Button6( _this );
184             child_0.ref();
185             this.el.add (  child_0.el  );
186             var child_1 = new Xcls_Button7( _this );
187             child_1.ref();
188             this.el.add (  child_1.el  );
189         }
190
191         // user defined functions 
192     }
193     public class Xcls_Button6 : Object 
194     {
195         public Gtk.Button el;
196         private Xcls_ProjectSettings  _this;
197
198
199             // my vars (def)
200
201         // ctor 
202         public Xcls_Button6(Xcls_ProjectSettings _owner )
203         {
204             _this = _owner;
205             this.el = new Gtk.Button();
206
207             // my vars (dec)
208
209             // set gobject values
210             this.el.label = "Apply";
211
212             // listeners 
213             this.el.button_press_event.connect( () => {
214                 _this.save();
215                       
216                 _this.buttonPressed("apply");
217                     return false;
218             });
219         }
220
221         // user defined functions 
222     }
223     public class Xcls_Button7 : Object 
224     {
225         public Gtk.Button el;
226         private Xcls_ProjectSettings  _this;
227
228
229             // my vars (def)
230
231         // ctor 
232         public Xcls_Button7(Xcls_ProjectSettings _owner )
233         {
234             _this = _owner;
235             this.el = new Gtk.Button();
236
237             // my vars (dec)
238
239             // set gobject values
240             this.el.label = "Save";
241
242             // listeners 
243             this.el.button_press_event.connect( () => {
244                    _this.save();
245                       
246                 _this.buttonPressed("save");
247                     return false;
248             });
249         }
250
251         // user defined functions 
252     }
253     public class Xcls_path : Object 
254     {
255         public Gtk.Label el;
256         private Xcls_ProjectSettings  _this;
257
258
259             // my vars (def)
260
261         // ctor 
262         public Xcls_path(Xcls_ProjectSettings _owner )
263         {
264             _this = _owner;
265             _this.path = this;
266             this.el = new Gtk.Label( "filename" );
267
268             // my vars (dec)
269
270             // set gobject values
271             this.el.xalign = 0f;
272         }
273
274         // user defined functions 
275     }
276     public class Xcls_Label9 : Object 
277     {
278         public Gtk.Label el;
279         private Xcls_ProjectSettings  _this;
280
281
282             // my vars (def)
283
284         // ctor 
285         public Xcls_Label9(Xcls_ProjectSettings _owner )
286         {
287             _this = _owner;
288             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
289
290             // my vars (dec)
291
292             // set gobject values
293         }
294
295         // user defined functions 
296     }
297     public class Xcls_HBox10 : Object 
298     {
299         public Gtk.HBox el;
300         private Xcls_ProjectSettings  _this;
301
302
303             // my vars (def)
304
305         // ctor 
306         public Xcls_HBox10(Xcls_ProjectSettings _owner )
307         {
308             _this = _owner;
309             this.el = new Gtk.HBox( false, 0 );
310
311             // my vars (dec)
312
313             // set gobject values
314             this.el.expand = false;
315             var child_0 = new Xcls_Label11( _this );
316             child_0.ref();
317             this.el.pack_start (  child_0.el , false,false,0 );
318             var child_1 = new Xcls_base_template( _this );
319             child_1.ref();
320             this.el.add (  child_1.el  );
321         }
322
323         // user defined functions 
324     }
325     public class Xcls_Label11 : Object 
326     {
327         public Gtk.Label el;
328         private Xcls_ProjectSettings  _this;
329
330
331             // my vars (def)
332
333         // ctor 
334         public Xcls_Label11(Xcls_ProjectSettings _owner )
335         {
336             _this = _owner;
337             this.el = new Gtk.Label( "HTML template file" );
338
339             // my vars (dec)
340
341             // set gobject values
342         }
343
344         // user defined functions 
345     }
346     public class Xcls_base_template : Object 
347     {
348         public Gtk.Entry el;
349         private Xcls_ProjectSettings  _this;
350
351
352             // my vars (def)
353
354         // ctor 
355         public Xcls_base_template(Xcls_ProjectSettings _owner )
356         {
357             _this = _owner;
358             _this.base_template = this;
359             this.el = new Gtk.Entry();
360
361             // my vars (dec)
362
363             // set gobject values
364         }
365
366         // user defined functions 
367     }
368     public class Xcls_HBox13 : Object 
369     {
370         public Gtk.HBox el;
371         private Xcls_ProjectSettings  _this;
372
373
374             // my vars (def)
375
376         // ctor 
377         public Xcls_HBox13(Xcls_ProjectSettings _owner )
378         {
379             _this = _owner;
380             this.el = new Gtk.HBox( false, 0 );
381
382             // my vars (dec)
383
384             // set gobject values
385             this.el.expand = false;
386             var child_0 = new Xcls_Label14( _this );
387             child_0.ref();
388             this.el.pack_start (  child_0.el , false,false,0 );
389             var child_1 = new Xcls_rootURL( _this );
390             child_1.ref();
391             this.el.add (  child_1.el  );
392         }
393
394         // user defined functions 
395     }
396     public class Xcls_Label14 : Object 
397     {
398         public Gtk.Label el;
399         private Xcls_ProjectSettings  _this;
400
401
402             // my vars (def)
403
404         // ctor 
405         public Xcls_Label14(Xcls_ProjectSettings _owner )
406         {
407             _this = _owner;
408             this.el = new Gtk.Label( "root URL" );
409
410             // my vars (dec)
411
412             // set gobject values
413         }
414
415         // user defined functions 
416     }
417     public class Xcls_rootURL : Object 
418     {
419         public Gtk.Entry el;
420         private Xcls_ProjectSettings  _this;
421
422
423             // my vars (def)
424
425         // ctor 
426         public Xcls_rootURL(Xcls_ProjectSettings _owner )
427         {
428             _this = _owner;
429             _this.rootURL = this;
430             this.el = new Gtk.Entry();
431
432             // my vars (dec)
433
434             // set gobject values
435         }
436
437         // user defined functions 
438     }
439     public class Xcls_ScrolledWindow16 : Object 
440     {
441         public Gtk.ScrolledWindow el;
442         private Xcls_ProjectSettings  _this;
443
444
445             // my vars (def)
446
447         // ctor 
448         public Xcls_ScrolledWindow16(Xcls_ProjectSettings _owner )
449         {
450             _this = _owner;
451             this.el = new Gtk.ScrolledWindow( null, null );
452
453             // my vars (dec)
454
455             // set gobject values
456             var child_0 = new Xcls_view( _this );
457             child_0.ref();
458             this.el.add (  child_0.el  );
459         }
460
461         // user defined functions 
462     }
463     public class Xcls_view : Object 
464     {
465         public Gtk.SourceView el;
466         private Xcls_ProjectSettings  _this;
467
468
469             // my vars (def)
470
471         // ctor 
472         public Xcls_view(Xcls_ProjectSettings _owner )
473         {
474             _this = _owner;
475             _this.view = this;
476             this.el = new Gtk.SourceView();
477
478             // my vars (dec)
479
480             // set gobject values
481
482             // init method 
483
484             var description =   Pango.FontDescription.from_string("monospace");
485                 description.set_size(9000);
486                 this.el.override_font(description);
487
488             // listeners 
489             this.el.key_release_event.connect( ( event) =>{
490                 if (event.keyval != 115) {
491                     return false;
492                      
493                 }
494                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
495                     return false;
496                 }
497                  var buf =    this.el.get_buffer();
498                 Gtk.TextIter s;
499                 Gtk.TextIter e;
500                 buf.get_start_iter(out s);
501                 buf.get_end_iter(out e);
502                 _this.project.runhtml = buf.get_text(s,e,true);
503                 
504                       
505                 _this.buttonPressed("save");
506                  
507                 return false;
508                      
509             });
510         }
511
512         // user defined functions 
513     }
514 }