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 = "";
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 this.el.homogeneous = "true";
145 var child_0 = new Xcls_Toolbar3();
146 this.el.pack_start ( child_0.el , false,true );
147 var child_1 = new Xcls_RightEditor();
148 this.el.add ( child_1.el );
151 // userdefined functions
153 // skip homogeneous - already used
155 // skip pack - not pipe
157 // skip xtype - not pipe
159 // skip |xns - could not find seperator
161 // skip items - not pipe
163 // skip xvala_cls - not pipe
165 // skip xvala_xcls - not pipe
167 // skip xvala_id - not pipe
169 public class Xcls_Toolbar3
171 public Gtk.Toolbar el;
176 public Xcls_Toolbar3()
178 this.el = new Gtk.Toolbar();
182 // set gobject values
183 var child_0 = new Xcls_save_button();
184 this.el.add ( child_0.el );
187 // userdefined functions
189 // skip pack - not pipe
191 // skip xtype - not pipe
193 // skip |xns - could not find seperator
195 // skip items - not pipe
197 // skip xvala_cls - not pipe
199 // skip xvala_xcls - not pipe
201 // skip xvala_id - not pipe
203 public class Xcls_save_button
205 public Gtk.ToolButton el;
210 public Xcls_save_button()
212 this.el = new Gtk.ToolButton( null, "Save" );
213 _this.save_button = this;
217 // set gobject values
220 this.el.clicked.connect( () => {
221 Editor.RightEditor.save();
225 // userdefined functions
227 // skip listeners - not pipe
229 // skip id - not pipe
231 // skip label - already used
233 // skip xtype - not pipe
235 // skip |xns - could not find seperator
237 // skip xvala_cls - not pipe
239 // skip xvala_xcls - not pipe
241 // skip xvala_id - not pipe
243 public class Xcls_RightEditor
245 public Gtk.ScrolledWindow el;
250 public Xcls_RightEditor()
252 this.el = new Gtk.ScrolledWindow( null, null );
253 _this.RightEditor = this;
257 // set gobject values
258 var child_0 = new Xcls_view();
259 this.el.add ( child_0.el );
262 // userdefined functions
264 // skip id - not pipe
266 // skip pack - not pipe
268 // skip xtype - not pipe
270 print("editor.rightbutton.save");
271 if (_this.active_path.length < 1 ) {
272 print("skip - no active path");
276 var str = Editor.buffer.toString();
278 if (!Editor.buffer.checkSyntax()) {
279 print("check syntax failed");
280 //this.get('/StandardErrorDialog').show("Fix errors in code and save..");
284 // LeftPanel.model.changed( str , false);
286 _this.save_button.el.sensitive = false;
287 print("set save button grey");
291 // skip |xns - could not find seperator
293 // skip items - not pipe
295 // skip xvala_cls - not pipe
297 // skip xvala_xcls - not pipe
299 // skip xvala_id - not pipe
301 public class Xcls_view
303 public Gtk.SourceView el;
310 this.el = new Gtk.SourceView();
315 // set gobject values
316 this.el.auto_indent = true;
317 this.el.indent_width = 4;
318 this.el.insert_spaces_instead_of_tabs = true;
319 this.el.show_line_numbers = true;
320 var child_0 = new Xcls_buffer();
321 this.el.set_buffer ( child_0.el );
324 var description = Pango.FontDescription.from_string("monospace");
325 description.set_size(8000);
326 this.el.override_font(description);
329 this.el.key_release_event.connect( (event) => {
331 if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
332 print("SAVE: ctrl-S pressed");
336 // print(event.key.keyval)
343 // userdefined functions
345 // skip listeners - not pipe
347 // skip id - not pipe
349 // skip indent_width - already used
351 // skip pack - not pipe
353 // skip xtype - not pipe
355 // skip |auto_indent - already used
357 // skip |init - already used
359 // skip |insert_spaces_instead_of_tabs - already used
361 // skip |load - could not find seperator
364 Editor.RightEditor.save();
367 // skip |show_line_numbers - already used
369 // skip |xns - could not find seperator
371 // skip items - not pipe
373 // skip xvala_cls - not pipe
375 // skip xvala_xcls - not pipe
377 // skip xvala_id - not pipe
379 public class Xcls_buffer
381 public Gtk.SourceBuffer el;
388 this.el = new Gtk.SourceBuffer( null );
393 // set gobject values
396 this.el.changed.connect( () => {
398 if(this.checkSyntax()) {
399 Editor.save_button.el.sensitive = true;
401 // print("EDITOR CHANGED");
404 // this.get('/LeftPanel.model').changed( str , false);
409 // userdefined functions
411 // skip listeners - not pipe
413 // skip id - not pipe
415 // skip pack - not pipe
417 // skip xtype - not pipe
418 public bool checkSyntax() {
419 // we could try running valac... ?? but it's a bit confusing..
423 public string toString() {
427 this.el.get_start_iter(out s);
428 this.el.get_end_iter(out e);
429 var ret = this.el.get_text(s,e,true);
430 //print("TO STRING? " + ret);
434 // skip |xns - could not find seperator
436 // skip xvala_cls - not pipe
438 // skip xvala_xcls - not pipe
440 // skip xvala_id - not pipe