/* -- to compile
valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
- /tmp/test.vala -o /tmp/Editor
+ /tmp/Editor.vala -o /tmp/Editor
*/
public static Xcls_Editor Editor;
-private static Xcls_Editor _this;
-
-public class Xcls_Editor : Gtk.Window
+public class Xcls_Editor
{
+ public Gtk.Window el;
+ private static Xcls_Editor _this;
+
public Xcls_save_button save_button;
public Xcls_RightEditor RightEditor;
public Xcls_view view;
public Xcls_buffer buffer;
// my vars
- public string active_path;
- public string activeEditor;
public bool dirty;
public bool pos;
public int pos_root_x;
public int pos_root_y;
+ public string activeEditor;
+ public string active_path;
// ctor
public Xcls_Editor()
{
+ this.el = new Gtk.Window();
_this = this;
Editor = this;
// my vars
- this.active_path = "";
- this.activeEditor = "";
this.dirty = false;
this.pos = false;
+ this.activeEditor = "";
+ this.active_path = "";
// set gobject values
- this.height_request = 300;
- this.title = "Application Builder - Editor";
- this.width_request = 500;
- this.add ( new Xcls_VBox2() );
+ this.el.height_request = 300;
+ this.el.title = "Application Builder - Code Editor";
+ this.el.width_request = 500;
+ var child_0 = new Xcls_VBox2();
+ this.el.add ( child_0.el );
// listeners
- this.delete_event.connect( (event) => {
- if (!Editor.RightEditor.save()) {
- // no hiding with errors.
- return true;
- }
- _this.hide();
- _this.active_path = "";
- return true;
- } );
- this.configure_event.connect( (object) => {
+ this.el.configure_event.connect( (object) => {
_this.pos = true;
- this.get_position(out _this.pos_root_x, out _this.pos_root_y);
+ this.el.get_position(out _this.pos_root_x, out _this.pos_root_y);
return false;
- } );
- this.show.connect( () => {
+ }
+
+ );
+ this.el.show.connect( () => {
if (this.pos) {
- _this.set_uposition(this.pos_root_x,this.pos_root_y);
+ _this.el.move(this.pos_root_x,this.pos_root_y);
}
- } );
+ }
+ );
}
// userdefined functions
- public bool save() {
+
+ // skip listeners - not pipe
+
+ // skip .bool:dirty - already used
+
+ // skip .bool:pos - already used
+
+ // skip .int:pos_root_x - already used
+
+ // skip .int:pos_root_y - already used
+
+ // skip .string:activeEditor - already used
+
+ // skip .string:active_path - already used
+
+ // skip height_request - already used
+
+ // skip id - not pipe
+
+ // skip title - already used
+
+ // skip width_request - already used
+
+ // skip xtype - not pipe
+ public bool save () {
if (!Editor.RightEditor.save()) {
// no hiding with errors.
return true;
}
_this.active_path = "";
- _this.hide();
+ _this.el.hide();
return true;
+ }
+
+ // skip |init - already used
+
+ // skip |show_all - no return type
+ public void show_all () {
+ this.el.show_all();
+
}
- public class Xcls_VBox2 : Gtk.VBox
+
+
+ // skip |xns - no return type
+
+ // skip items - not pipe
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
+ public class Xcls_VBox2
{
+ public Gtk.VBox el;
// my vars
// ctor
public Xcls_VBox2()
{
+ this.el = new Gtk.VBox( true, 0 );
// my vars
// set gobject values
- this.pack_start ( new Xcls_Toolbar3(), false,true );
- this.add ( new Xcls_RightEditor() );
+ var child_0 = new Xcls_Toolbar3();
+ this.el.pack_start ( child_0.el , false,true );
+ var child_1 = new Xcls_RightEditor();
+ this.el.add ( child_1.el );
}
// userdefined functions
+
+ // skip |homogeneous - already used
+
+ // skip pack - not pipe
+
+ // skip xtype - not pipe
+
+ // skip |xns - no return type
+
+ // skip items - not pipe
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
- public class Xcls_Toolbar3 : Gtk.Toolbar
+ public class Xcls_Toolbar3
{
+ public Gtk.Toolbar el;
// my vars
// ctor
public Xcls_Toolbar3()
{
+ this.el = new Gtk.Toolbar();
// my vars
// set gobject values
- this.add ( new Xcls_save_button() );
+ var child_0 = new Xcls_save_button();
+ this.el.add ( child_0.el );
}
// userdefined functions
+
+ // skip pack - not pipe
+
+ // skip xtype - not pipe
+
+ // skip |xns - no return type
+
+ // skip items - not pipe
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
- public class Xcls_save_button : Gtk.ToolButton
+ public class Xcls_save_button
{
+ public Gtk.ToolButton el;
// my vars
// ctor
public Xcls_save_button()
{
+ this.el = new Gtk.ToolButton( null, "Save" );
_this.save_button = this;
// my vars
// set gobject values
- this.label = "Save";
// listeners
- this.clicked.connect( () => {
+ this.el.clicked.connect( () => {
Editor.RightEditor.save();
- } );
+ }
+
+ );
}
// userdefined functions
+
+ // skip listeners - not pipe
+
+ // skip id - not pipe
+
+ // skip label - already used
+
+ // skip xtype - not pipe
+
+ // skip |xns - no return type
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
- public class Xcls_RightEditor : Gtk.ScrolledWindow
+ public class Xcls_RightEditor
{
+ public Gtk.ScrolledWindow el;
// my vars
// ctor
public Xcls_RightEditor()
{
+ this.el = new Gtk.ScrolledWindow( null, null );
_this.RightEditor = this;
// my vars
// set gobject values
- this.add ( new Xcls_view() );
+ var child_0 = new Xcls_view();
+ this.el.add ( child_0.el );
}
// userdefined functions
- public bool save() {
-
+
+ // skip id - not pipe
+
+ // skip pack - not pipe
+
+ // skip xtype - not pipe
+ public bool save () {
+ print("editor.rightbutton.save");
if (_this.active_path.length < 1 ) {
+ print("skip - no active path");
return true;
}
// LeftPanel.model.changed( str , false);
_this.dirty = false;
- _this.save_button.sensitive = false;
+ _this.save_button.el.sensitive = false;
+ print("set save button grey");
return true;
}
+
+
+ // skip |xns - no return type
+
+ // skip items - not pipe
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
- public class Xcls_view : Gtk.SourceView
+ public class Xcls_view
{
+ public Gtk.SourceView el;
// my vars
// ctor
public Xcls_view()
{
+ this.el = new Gtk.SourceView();
_this.view = this;
// my vars
// set gobject values
- this.auto_indent = true;
- this.indent_width = 4;
- this.insert_spaces_instead_of_tabs = true;
- this.show_line_numbers = true;
- this.set_buffer ( new Xcls_buffer() );
-
- // init method
- var description = Pango.FontDescription.from_string("monospace");
- description.set_size(8000);
- this.override_font(description);
+ this.el.auto_indent = true;
+ this.el.indent_width = 4;
+ this.el.insert_spaces_instead_of_tabs = true;
+ this.el.show_line_numbers = true;
+ var child_0 = new Xcls_buffer();
+ this.el.set_buffer ( child_0.el );
// listeners
- this.key_release_event.connect( (event) => {
+ this.el.key_release_event.connect( (event) => {
- if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
print("SAVE: ctrl-S pressed");
this.save();
return false;
return false;
- } );
+ }
+
+ );
}
// userdefined functions
- public void save() {
+
+ // skip listeners - not pipe
+
+ // skip id - not pipe
+
+ // skip indent_width - already used
+
+ // skip pack - not pipe
+
+ // skip xtype - not pipe
+
+ // skip |auto_indent - already used
+
+ // skip |init - already used
+
+ // skip |insert_spaces_instead_of_tabs - already used
+
+ // skip |show_line_numbers - already used
+ public void load (string str) {
+
+ // show the help page for the active node..
+ //this.get('/Help').show();
+
+
+ // this.get('/BottomPane').el.set_current_page(0);
+ this.el.get_buffer().set_text(str, str.length);
+ var lm = Gtk.SourceLanguageManager.get_default();
+
+ ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language("js"));
+ var buf = this.el.get_buffer();
+ var cursor = buf.get_mark("insert");
+ Gtk.TextIter iter;
+ buf.get_iter_at_mark(out iter, cursor);
+ iter.set_line(1);
+ iter.set_line_offset(4);
+ buf.move_mark(cursor, iter);
+
+
+ cursor = buf.get_mark("selection_bound");
+ //iter= new Gtk.TextIter;
+ buf.get_iter_at_mark(out iter, cursor);
+ iter.set_line(1);
+ iter.set_line_offset(4);
+ buf.move_mark(cursor, iter);
+ Editor.dirty = false;
+ this.el.grab_focus();
+ _this.save_button.el.sensitive = false;
+ }
+ public void save () {
Editor.RightEditor.save();
}
+
+
+ // skip |xns - no return type
+
+ // skip items - not pipe
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
- public class Xcls_buffer : Gtk.SourceBuffer
+ public class Xcls_buffer
{
+ public Gtk.SourceBuffer el;
// my vars
// ctor
public Xcls_buffer()
{
+ this.el = new Gtk.SourceBuffer( null );
_this.buffer = this;
// my vars
// set gobject values
// listeners
+ this.el.changed.connect( () => {
+ // check syntax??
+ if(this.checkSyntax()) {
+ Editor.save_button.el.sensitive = true;
+ }
+ // print("EDITOR CHANGED");
+ Editor.dirty = true;
+
+ // this.get('/LeftPanel.model').changed( str , false);
+ return ;
+ }
+
+
+ );
}
// userdefined functions
+
+ // skip listeners - not pipe
+
+ // skip id - not pipe
+
+ // skip pack - not pipe
+
+ // skip xtype - not pipe
+ public bool checkSyntax () {
+ /*
+ var str = this.toString();
+ var res = "";
+ /*
+ try {
+ // print('var res = ' + str);
+ Seed.check_syntax('var res = ' + str);
+
+
+ } catch (e) {
+
+ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+ red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
+ }));
+ print("SYNTAX ERROR IN EDITOR");
+ print(e);
+ // print(str);
+ //console.dump(e);
+ return false;
+ }
+ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+ red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+ }));
+ */
+ return true;
+ }
+ public string toString () {
+
+ Gtk.TextIter s;
+ Gtk.TextIter e;
+ this.el.get_start_iter(out s);
+ this.el.get_end_iter(out e);
+ var ret = this.el.get_text(s,e,true);
+ //print("TO STRING? " + ret);
+ return ret;
+ }
+
+
+ // skip |xns - no return type
+
+ // skip xvala_cls - not pipe
+
+ // skip xvala_xcls - not pipe
+
+ // skip xvala_id - not pipe
}
}