2 valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
3 /tmp/Editor.vala -o /tmp/Editor
8 static int main (string[] args) {
18 public static Xcls_Editor Editor;
20 private static Xcls_Editor _this;
22 public class Xcls_Editor
25 public Xcls_save_button save_button;
26 public Xcls_RightEditor RightEditor;
27 public Xcls_view view;
28 public Xcls_buffer buffer;
31 public string activeEditor;
32 public string active_path;
35 public int pos_root_x;
36 public int pos_root_y;
41 this.el = new Gtk.Window();
46 this.activeEditor = "";
47 this.active_path = "";
52 this.el.height_request = 300;
53 this.el.title = "Application Builder - Code Editor";
54 this.el.width_request = 500;
55 var child_0 = new Xcls_VBox2();
56 this.el.add ( child_0.el );
59 this.el.delete_event.connect( (event) => {
60 if (!Editor.RightEditor.save()) {
61 // no hiding with errors.
65 _this.active_path = "";
68 this.el.configure_event.connect( (object) => {
70 this.el.get_position(out _this.pos_root_x, out _this.pos_root_y);
75 this.el.show.connect( () => {
77 _this.el.move(this.pos_root_x,this.pos_root_y);
82 // userdefined functions
84 // skip listeners - not pipe
86 // skip .activeEditor - already used
88 // skip .active_path - already used
90 // skip .dirty - already used
92 // skip .pos - already used
94 // skip .pos_root_x - already used
96 // skip .pos_root_y - already used
98 // skip height_request - already used
100 // skip id - not pipe
102 // skip title - already used
104 // skip width_request - already used
106 // skip xtype - not pipe
108 // skip |init - already used
111 if (!Editor.RightEditor.save()) {
112 // no hiding with errors.
115 _this.active_path = "";
120 public void show_all() {
125 // skip |xns - could not find seperator
127 // skip items - not pipe
129 // skip xvala_cls - not pipe
131 // skip xvala_xcls - not pipe
133 // skip xvala_id - not pipe
134 public class Xcls_VBox2
143 this.el = new Gtk.VBox( true, 0 );
147 // set gobject values
148 var child_0 = new Xcls_Toolbar3();
149 this.el.pack_start ( child_0.el , false,true );
150 var child_1 = new Xcls_RightEditor();
151 this.el.add ( child_1.el );
154 // userdefined functions
156 // skip |homogeneous - already used
158 // skip pack - not pipe
160 // skip xtype - not pipe
162 // skip |xns - could not find seperator
164 // skip items - not pipe
166 // skip xvala_cls - not pipe
168 // skip xvala_xcls - not pipe
170 // skip xvala_id - not pipe
172 public class Xcls_Toolbar3
174 public Gtk.Toolbar el;
179 public Xcls_Toolbar3()
181 this.el = new Gtk.Toolbar();
185 // set gobject values
186 var child_0 = new Xcls_save_button();
187 this.el.add ( child_0.el );
190 // userdefined functions
192 // skip pack - not pipe
194 // skip xtype - not pipe
196 // skip |xns - could not find seperator
198 // skip items - not pipe
200 // skip xvala_cls - not pipe
202 // skip xvala_xcls - not pipe
204 // skip xvala_id - not pipe
206 public class Xcls_save_button
208 public Gtk.ToolButton el;
213 public Xcls_save_button()
215 this.el = new Gtk.ToolButton( null, "Save" );
216 _this.save_button = this;
220 // set gobject values
223 this.el.clicked.connect( () => {
224 Editor.RightEditor.save();
228 // userdefined functions
230 // skip listeners - not pipe
232 // skip id - not pipe
234 // skip label - already used
236 // skip xtype - not pipe
238 // skip |xns - could not find seperator
240 // skip xvala_cls - not pipe
242 // skip xvala_xcls - not pipe
244 // skip xvala_id - not pipe
246 public class Xcls_RightEditor
248 public Gtk.ScrolledWindow el;
253 public Xcls_RightEditor()
255 this.el = new Gtk.ScrolledWindow( null, null );
256 _this.RightEditor = this;
260 // set gobject values
261 var child_0 = new Xcls_view();
262 this.el.add ( child_0.el );
265 // userdefined functions
267 // skip id - not pipe
269 // skip pack - not pipe
271 // skip xtype - not pipe
273 print("editor.rightbutton.save");
274 if (_this.active_path.length < 1 ) {
275 print("skip - no active path");
279 var str = Editor.buffer.toString();
281 if (!Editor.buffer.checkSyntax()) {
282 print("check syntax failed");
283 //this.get('/StandardErrorDialog').show("Fix errors in code and save..");
287 // LeftPanel.model.changed( str , false);
289 _this.save_button.el.sensitive = false;
290 print("set save button grey");
294 // skip |xns - could not find seperator
296 // skip items - not pipe
298 // skip xvala_cls - not pipe
300 // skip xvala_xcls - not pipe
302 // skip xvala_id - not pipe
304 public class Xcls_view
306 public Gtk.SourceView el;
313 this.el = new Gtk.SourceView();
318 // set gobject values
319 this.el.auto_indent = true;
320 this.el.indent_width = 4;
321 this.el.insert_spaces_instead_of_tabs = true;
322 this.el.show_line_numbers = true;
323 var child_0 = new Xcls_buffer();
324 this.el.set_buffer ( child_0.el );
327 var description = Pango.FontDescription.from_string("monospace");
328 description.set_size(8000);
329 this.el.override_font(description);
332 this.el.key_release_event.connect( (event) => {
334 if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
335 print("SAVE: ctrl-S pressed");
339 // print(event.key.keyval)
346 // userdefined functions
348 // skip listeners - not pipe
350 // skip id - not pipe
352 // skip indent_width - already used
354 // skip pack - not pipe
356 // skip xtype - not pipe
358 // skip |auto_indent - already used
360 // skip |init - already used
362 // skip |insert_spaces_instead_of_tabs - already used
364 // skip |load - could not find seperator
367 Editor.RightEditor.save();
370 // skip |show_line_numbers - already used
372 // skip |xns - could not find seperator
374 // skip items - not pipe
376 // skip xvala_cls - not pipe
378 // skip xvala_xcls - not pipe
380 // skip xvala_id - not pipe
382 public class Xcls_buffer
384 public Gtk.SourceBuffer el;
391 this.el = new Gtk.SourceBuffer( null );
396 // set gobject values
399 this.el.changed.connect( () => {
401 if(this.checkSyntax()) {
402 Editor.save_button.el.sensitive = true;
404 // print("EDITOR CHANGED");
407 // this.get('/LeftPanel.model').changed( str , false);
412 // userdefined functions
414 // skip listeners - not pipe
416 // skip id - not pipe
418 // skip pack - not pipe
420 // skip xtype - not pipe
421 public bool checkSyntax() {
422 // we could try running valac... ?? but it's a bit confusing..
426 public string toString() {
430 this.el.get_start_iter(out s);
431 this.el.get_end_iter(out e);
432 var ret = this.el.get_text(s,e,true);
433 //print("TO STRING? " + ret);
437 // skip |xns - could not find seperator
439 // skip xvala_cls - not pipe
441 // skip xvala_xcls - not pipe
443 // skip xvala_id - not pipe