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