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