2 valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
3 /tmp/test.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 : Gtk.Window
24 public Xcls_save_button save_button;
25 public Xcls_RightEditor RightEditor;
26 public Xcls_view view;
27 public Xcls_buffer buffer;
30 public string active_path;
31 public string activeEditor;
34 public int pos_root_x;
35 public int pos_root_y;
44 this.active_path = "";
45 this.activeEditor = "";
50 this.height_request = 300;
51 this.title = "Application Builder - Editor";
52 this.width_request = 500;
53 this.add ( new Xcls_VBox2() );
56 this.delete_event.connect( (event) => {
57 if (!Editor.RightEditor.save()) {
58 // no hiding with errors.
62 _this.active_path = "";
65 this.configure_event.connect( (object) => {
67 this.get_position(out _this.pos_root_x, out _this.pos_root_y);
72 this.show.connect( () => {
74 _this.set_uposition(this.pos_root_x,this.pos_root_y);
79 // userdefined functions
82 if (!Editor.RightEditor.save()) {
83 // no hiding with errors.
86 _this.active_path = "";
91 public class Xcls_VBox2 : Gtk.VBox
102 // set gobject values
103 this.pack_start ( new Xcls_Toolbar3(), false,true );
104 this.add ( new Xcls_RightEditor() );
107 // userdefined functions
109 public class Xcls_Toolbar3 : Gtk.Toolbar
115 public Xcls_Toolbar3()
120 // set gobject values
121 this.add ( new Xcls_save_button() );
124 // userdefined functions
126 public class Xcls_save_button : Gtk.ToolButton
132 public Xcls_save_button()
134 _this.save_button = this;
138 // set gobject values
142 this.clicked.connect( () => {
143 Editor.RightEditor.save();
147 // userdefined functions
149 public class Xcls_RightEditor : Gtk.ScrolledWindow
155 public Xcls_RightEditor()
157 _this.RightEditor = this;
161 // set gobject values
162 this.add ( new Xcls_view() );
165 // userdefined functions
168 if (_this.active_path.length < 1 ) {
172 var str = Editor.buffer.toString();
174 if (!Editor.buffer.checkSyntax()) {
175 print("check syntax failed");
176 //this.get('/StandardErrorDialog').show("Fix errors in code and save..");
180 // LeftPanel.model.changed( str , false);
182 _this.save_button.sensitive = false;
186 public class Xcls_view : Gtk.SourceView
198 // set gobject values
199 this.auto_indent = true;
200 this.indent_width = 4;
201 this.insert_spaces_instead_of_tabs = true;
202 this.show_line_numbers = true;
203 this.set_buffer ( new Xcls_buffer() );
206 var description = Pango.FontDescription.from_string("monospace");
207 description.set_size(8000);
208 this.override_font(description);
211 this.key_release_event.connect( (event) => {
213 if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
214 print("SAVE: ctrl-S pressed");
218 // print(event.key.keyval)
225 // userdefined functions
228 Editor.RightEditor.save();
231 public class Xcls_buffer : Gtk.SourceBuffer
243 // set gobject values
248 // userdefined functions