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