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 - 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 = "";
121 // skip |xns - could not find seperator
123 // skip items - not pipe
125 // skip xvala_cls - not pipe
127 // skip xvala_xcls - not pipe
129 // skip xvala_id - not pipe
130 public class Xcls_VBox2
139 this.el = new Gtk.VBox();
143 // set gobject values
144 var child_0 = new Xcls_Toolbar3();
145 this.el.pack_start ( child_0.el , false,true );
146 var child_1 = new Xcls_RightEditor();
147 this.el.add ( child_1.el );
150 // userdefined functions
152 // skip pack - not pipe
154 // skip xtype - not pipe
156 // skip |xns - could not find seperator
158 // skip items - not pipe
160 // skip xvala_cls - not pipe
162 // skip xvala_xcls - not pipe
164 // skip xvala_id - not pipe
166 public class Xcls_Toolbar3
168 public Gtk.Toolbar el;
173 public Xcls_Toolbar3()
175 this.el = new Gtk.Toolbar();
179 // set gobject values
180 var child_0 = new Xcls_save_button();
181 this.el.add ( child_0.el );
184 // userdefined functions
186 // skip pack - not pipe
188 // skip xtype - not pipe
190 // skip |xns - could not find seperator
192 // skip items - not pipe
194 // skip xvala_cls - not pipe
196 // skip xvala_xcls - not pipe
198 // skip xvala_id - not pipe
200 public class Xcls_save_button
202 public Gtk.ToolButton el;
207 public Xcls_save_button()
209 this.el = new Gtk.ToolButton();
210 _this.save_button = this;
214 // set gobject values
215 this.el.label = "Save";
218 this.el.clicked.connect( () => {
219 Editor.RightEditor.save();
223 // userdefined functions
225 // skip listeners - not pipe
227 // skip id - not pipe
229 // skip label - already used
231 // skip xtype - not pipe
233 // skip |xns - could not find seperator
235 // skip xvala_cls - not pipe
237 // skip xvala_xcls - not pipe
239 // skip xvala_id - not pipe
241 public class Xcls_RightEditor
243 public Gtk.ScrolledWindow el;
248 public Xcls_RightEditor()
250 this.el = new Gtk.ScrolledWindow();
251 _this.RightEditor = this;
255 // set gobject values
256 var child_0 = new Xcls_view();
257 this.el.add ( child_0.el );
260 // userdefined functions
262 // skip id - not pipe
264 // skip pack - not pipe
266 // skip xtype - not pipe
268 print("editor.rightbutton.save");
269 if (_this.active_path.length < 1 ) {
270 print("skip - no active path");
274 var str = Editor.buffer.toString();
276 if (!Editor.buffer.checkSyntax()) {
277 print("check syntax failed");
278 //this.get('/StandardErrorDialog').show("Fix errors in code and save..");
282 // LeftPanel.model.changed( str , false);
284 _this.save_button.sensitive = false;
285 print("set save button grey");
289 // skip |xns - could not find seperator
291 // skip items - not pipe
293 // skip xvala_cls - not pipe
295 // skip xvala_xcls - not pipe
297 // skip xvala_id - not pipe
299 public class Xcls_view
301 public Gtk.SourceView el;
308 this.el = new Gtk.SourceView();
313 // set gobject values
314 this.el.auto_indent = true;
315 this.el.indent_width = 4;
316 this.el.insert_spaces_instead_of_tabs = true;
317 this.el.show_line_numbers = true;
318 var child_0 = new Xcls_buffer();
319 this.el.set_buffer ( child_0.el );
322 var description = Pango.FontDescription.from_string("monospace");
323 description.set_size(8000);
324 this.override_font(description);
327 this.el.key_release_event.connect( (event) => {
329 if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
330 print("SAVE: ctrl-S pressed");
334 // print(event.key.keyval)
341 // userdefined functions
343 // skip listeners - not pipe
345 // skip id - not pipe
347 // skip indent_width - already used
349 // skip pack - not pipe
351 // skip xtype - not pipe
353 // skip |auto_indent - already used
355 // skip |init - already used
357 // skip |insert_spaces_instead_of_tabs - already used
359 // skip |load - could not find seperator
362 Editor.RightEditor.save();
365 // skip |show_line_numbers - already used
367 // skip |xns - could not find seperator
369 // skip items - not pipe
371 // skip xvala_cls - not pipe
373 // skip xvala_xcls - not pipe
375 // skip xvala_id - not pipe
377 public class Xcls_buffer
379 public Gtk.SourceBuffer el;
386 this.el = new Gtk.SourceBuffer();
391 // set gobject values
394 this.el.changed.connect( () => {
396 if(this.checkSyntax()) {
397 Editor.save_button.sensitive = true;
399 // print("EDITOR CHANGED");
402 // this.get('/LeftPanel.model').changed( str , false);
407 // userdefined functions
409 // skip listeners - not pipe
411 // skip id - not pipe
413 // skip pack - not pipe
415 // skip xtype - not pipe
416 public bool checkSyntax() {
417 // we could try running valac... ?? but it's a bit confusing..
421 public string toString() {
425 this.get_start_iter(out s);
426 this.get_end_iter(out e);
427 var ret = this.get_text(s,e,true);
428 //print("TO STRING? " + ret);
432 // skip |xns - could not find seperator
434 // skip xvala_cls - not pipe
436 // skip xvala_xcls - not pipe
438 // skip xvala_id - not pipe