* switch window now uses libadwadi panel
* switch window search shows full file list in panel - so you can jump to file
* control-o tiggers file open, after file serach up/down arrows select file, and enter / shift enter will open.
+ * undo and redo buttons - now work
+ * improved performance on node generation, and language server call performance (less uneccessary calls)
-- Alan Knowles <alan@touchbox> Sun, 28 Jan 2024 06:54:56 +0800
"\t}",
"\tvar ar = this.file.getErrors();",
"\tif (ar.size < 1) {",
- "\t\tbuf.remove_source_marks (start, end, null);",
+ "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
"\t\t}",
"\t",
"\t}",
- "\tbuf.remove_source_marks (start, end, null);",
+ "\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
}
var ar = this.file.getErrors();
if (ar.size < 1) {
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
}
}
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
"\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
- "\t\tbuf.remove_source_marks (start, end, null);",
+ "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\t\tthis.last_error_counter = file.error_counter ;",
"\t\tGLib.debug(\"higjlight has no errors\");",
"\t\treturn;",
"\t",
" ",
"\t ",
- "\tbuf.remove_source_marks (start, end, null);",
+ "\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
this.last_error_counter = file.error_counter ;
GLib.debug("higjlight has no errors");
return;
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
},
"string tooltip_text" : "Manage Windows (Ctrl-O)",
"xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool has_frame" : false,
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\t",
+ "\tGLib.debug(\"undo clicked\");",
+ "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
+ "\t\t_this.windowstate.code_editor_tab.buffer.el.undo();",
+ "\t}",
+ "\tif (!_this.windowstate.file.undoStep(-1)) {",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t ",
+ "\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
+ "\t// this triggers loadItems..",
+ "\t_this.windowstate.left_tree.model.loadFile(",
+ "\t\t_this.windowstate.file);",
+ "\t ",
+ "",
+ "\t",
+ " ",
+ "",
+ "\t// load it everywhere",
+ "}",
+ ""
+ ]
+ },
+ "string icon_name" : "edit-undo",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool has_frame" : false,
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\t",
+ "\tGLib.debug(\"undo clicked\");",
+ "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
+ "\t\t_this.windowstate.code_editor_tab.buffer.el.redo();",
+ "\t}",
+ "\tif (!_this.windowstate.file.undoStep(1)) {",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t ",
+ "\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
+ "\t// this triggers loadItems..",
+ "\t_this.windowstate.left_tree.model.loadFile(",
+ "\t\t_this.windowstate.file);",
+ "\t ",
+ "",
+ "\t",
+ " ",
+ "",
+ "\t// load it everywhere",
+ "}",
+ ""
+ ]
+ },
+ "string icon_name" : "edit-redo",
+ "xtype" : "Button"
}
],
"xtype" : "Box"
"items" : [
{
"$ xns" : "Gtk",
- "* prop" : "child",
"bool has_tooltip" : true,
"bool hexpand" : true,
"id" : "filesearch",
"listeners" : {
"clicked" : [
" ( ) => {",
+ " \t_this.splitview.el.show_sidebar = false;",
" \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
"}"
]
"\t",
"\t_this.treeview.el.set_model(_this.treeselmodel.el);",
"\t",
- " \t _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " \t_this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
"\t",
" ",
"}"
this.show_close_button = true;
// set gobject values
- var child_1 = new Xcls_Box3( _this );
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
this.el.pack_start ( child_1.el );
}
// user defined functions
}
- public class Xcls_Box3 : Object
+ public class Xcls_Box2 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Box3(Xcls_MainWindow _owner )
+ public Xcls_Box2(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// my vars (dec)
// set gobject values
- var child_1 = new Xcls_Button4( _this );
+ var child_1 = new Xcls_Button3( _this );
child_1.ref();
this.el.append ( child_1.el );
+ var child_2 = new Xcls_Button5( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button6( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
}
// user defined functions
}
- public class Xcls_Button4 : Object
+ public class Xcls_Button3 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Button4(Xcls_MainWindow _owner )
+ public Xcls_Button3(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
this.el.has_frame = false;
this.el.tooltip_text = "Manage Windows (Ctrl-O)";
this.el.has_tooltip = true;
- var child_1 = new Xcls_ButtonContent5( _this );
+ var child_1 = new Xcls_ButtonContent4( _this );
this.el.child = child_1.el;
//listeners
// user defined functions
}
- public class Xcls_ButtonContent5 : Object
+ public class Xcls_ButtonContent4 : Object
{
public Adw.ButtonContent el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_ButtonContent5(Xcls_MainWindow _owner )
+ public Xcls_ButtonContent4(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Adw.ButtonContent();
}
+ public class Xcls_Button5 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button5(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "edit-undo";
+ this.el.has_frame = false;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ GLib.debug("undo clicked");
+ if (_this.windowstate.file.xtype == "PlainFile") {
+ _this.windowstate.code_editor_tab.buffer.el.undo();
+ }
+ if (!_this.windowstate.file.undoStep(-1)) {
+ return;
+ }
+
+
+ _this.windowstate.switchState (WindowState.State.PREVIEW);
+ // this triggers loadItems..
+ _this.windowstate.left_tree.model.loadFile(
+ _this.windowstate.file);
+
+
+
+
+
+ // load it everywhere
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button6 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button6(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "edit-redo";
+ this.el.has_frame = false;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ GLib.debug("undo clicked");
+ if (_this.windowstate.file.xtype == "PlainFile") {
+ _this.windowstate.code_editor_tab.buffer.el.redo();
+ }
+ if (!_this.windowstate.file.undoStep(1)) {
+ return;
+ }
+
+
+ _this.windowstate.switchState (WindowState.State.PREVIEW);
+ // this triggers loadItems..
+ _this.windowstate.left_tree.model.loadFile(
+ _this.windowstate.file);
+
+
+
+
+
+ // load it everywhere
+ });
+ }
+
+ // user defined functions
+ }
+
public class Xcls_splitview : Object
this.el.vexpand = false;
new Xcls_mainpane( _this );
this.el.append( _this.mainpane.el );
- var child_2 = new Xcls_Box16( _this );
+ var child_2 = new Xcls_Box17( _this );
child_2.ref();
this.el.append( child_2.el );
}
this.el.position = 400;
new Xcls_leftpane( _this );
this.el.start_child = _this.leftpane.el;
- var child_2 = new Xcls_Box13( _this );
+ var child_2 = new Xcls_Box14( _this );
this.el.end_child = child_2.el;
//listeners
- public class Xcls_Box13 : Object
+ public class Xcls_Box14 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Box13(Xcls_MainWindow _owner )
+ public Xcls_Box14(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- public class Xcls_Box16 : Object
+ public class Xcls_Box17 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Box16(Xcls_MainWindow _owner )
+ public Xcls_Box17(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// set gobject values
this.el.homogeneous = false;
this.el.vexpand = false;
- var child_1 = new Xcls_Button17( _this );
+ var child_1 = new Xcls_Button18( _this );
child_1.ref();
this.el.append( child_1.el );
- var child_2 = new Xcls_Button18( _this );
+ var child_2 = new Xcls_Button19( _this );
child_2.ref();
this.el.append( child_2.el );
- var child_3 = new Xcls_MenuButton19( _this );
+ var child_3 = new Xcls_MenuButton20( _this );
child_3.ref();
this.el.append( child_3.el );
- var child_4 = new Xcls_Label24( _this );
+ var child_4 = new Xcls_Label25( _this );
child_4.ref();
this.el.append( child_4.el );
new Xcls_statusbar( _this );
this.el.append( _this.statusbar.el );
- var child_6 = new Xcls_Box26( _this );
+ var child_6 = new Xcls_Box27( _this );
child_6.ref();
this.el.append( child_6.el );
new Xcls_statusbar_compile_spinner( _this );
// user defined functions
}
- public class Xcls_Button17 : Object
+ public class Xcls_Button18 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
public bool always_show_image;
// ctor
- public Xcls_Button17(Xcls_MainWindow _owner )
+ public Xcls_Button18(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
// user defined functions
}
- public class Xcls_Button18 : Object
+ public class Xcls_Button19 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
public bool always_show_image;
// ctor
- public Xcls_Button18(Xcls_MainWindow _owner )
+ public Xcls_Button19(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
// user defined functions
}
- public class Xcls_MenuButton19 : Object
+ public class Xcls_MenuButton20 : Object
{
public Gtk.MenuButton el;
private Xcls_MainWindow _this;
public bool always_show_image;
// ctor
- public Xcls_MenuButton19(Xcls_MainWindow _owner )
+ public Xcls_MenuButton20(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.MenuButton();
// my vars (dec)
// set gobject values
- var child_1 = new Xcls_Box21( _this );
+ var child_1 = new Xcls_Box22( _this );
child_1.ref();
this.el.set_child ( child_1.el );
// user defined functions
}
- public class Xcls_Box21 : Object
+ public class Xcls_Box22 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Box21(Xcls_MainWindow _owner )
+ public Xcls_Box22(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (dec)
// set gobject values
- var child_1 = new Xcls_Button22( _this );
+ var child_1 = new Xcls_Button23( _this );
child_1.ref();
this.el.append( child_1.el );
- var child_2 = new Xcls_Button23( _this );
+ var child_2 = new Xcls_Button24( _this );
child_2.ref();
this.el.append( child_2.el );
}
// user defined functions
}
- public class Xcls_Button22 : Object
+ public class Xcls_Button23 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Button22(Xcls_MainWindow _owner )
+ public Xcls_Button23(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
// user defined functions
}
- public class Xcls_Button23 : Object
+ public class Xcls_Button24 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Button23(Xcls_MainWindow _owner )
+ public Xcls_Button24(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
- public class Xcls_Label24 : Object
+ public class Xcls_Label25 : Object
{
public Gtk.Label el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Label24(Xcls_MainWindow _owner )
+ public Xcls_Label25(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Label( " " );
// user defined functions
}
- public class Xcls_Box26 : Object
+ public class Xcls_Box27 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Box26(Xcls_MainWindow _owner )
+ public Xcls_Box27(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// my vars (dec)
// set gobject values
- var child_1 = new Xcls_SearchBar35( _this );
- child_1.ref();
- this.el.append( child_1.el );
+ new Xcls_filesearch( _this );
+ this.el.append( _this.filesearch.el );
var child_2 = new Xcls_Box38( _this );
child_2.ref();
this.el.append( child_2.el );
_this.treeview.el.set_model(_this.treeselmodel.el);
- _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
}
}
- public class Xcls_SearchBar35 : Object
- {
- public Gtk.SearchBar el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SearchBar35(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.SearchBar();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.search_mode_enabled = true;
- new Xcls_filesearch( _this );
- this.el.child = _this.filesearch.el;
- }
-
- // user defined functions
- }
public class Xcls_filesearch : Object
{
public Gtk.SearchEntry el;
}
-
public class Xcls_Box38 : Object
{
public Gtk.Box el;
//listeners
this.el.clicked.connect( ( ) => {
+ _this.splitview.el.show_sidebar = false;
_this.windowstate.showPopoverFiles(this.el, _this.project, false);
});
}
"( GLib.ListStore? ls) {",
"\tGLib.debug(\"errors : update\");",
" if (ls == null || ls.get_n_items() < 1) {",
- " \t GLib.debug(\"errors : none available\");",
+ " \t// GLib.debug(\"errors : none available\");",
" \treturn;",
"\t}",
"\t",
- "\tGLib.debug(\"Loading list into tree\");",
+ "\t//GLib.debug(\"Loading list into tree\");",
"\tthis.tree.el.hide();",
"\tvar tm = new Gtk.TreeListModel(",
"\t\tls, //..... << that's our store..",
- static Xcls_ValaCompileErrors _ValaCompileErrors;
-
- public class Xcls_ValaCompileErrors : Object
- {
- public Gtk.Popover el;
- private Xcls_ValaCompileErrors _this;
-
- public static Xcls_ValaCompileErrors singleton()
- {
- if (_ValaCompileErrors == null) {
- _ValaCompileErrors= new Xcls_ValaCompileErrors();
- }
- return _ValaCompileErrors;
- }
- public Xcls_compile_view compile_view;
- public Xcls_tree tree;
- public Xcls_selmodel selmodel;
- public Xcls_sortmodel sortmodel;
- public Xcls_model model;
-
- // my vars (def)
- public Xcls_MainWindow window;
- public bool loaded;
-
- // ctor
- public Xcls_ValaCompileErrors()
- {
- _this = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
- this.loaded = false;
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.autohide = true;
- this.el.position = Gtk.PositionType.TOP;
- new Xcls_compile_view( _this );
- this.el.set_child ( _this.compile_view.el );
- }
-
- // user defined functions
- public void updateNotices ( GLib.ListStore? ls) {
- GLib.debug("errors : update");
- if (ls == null || ls.get_n_items() < 1) {
- GLib.debug("errors : none available");
- return;
- }
-
- GLib.debug("Loading list into tree");
- this.tree.el.hide();
- var tm = new Gtk.TreeListModel(
- ls, //..... << that's our store..
- false, // passthru
- false, // autexpand
- (item) => {
-
- return ((Palete.CompileError)item).lines;
-
- }
-
- );
-
- _this.model.el = tm;
- _this.sortmodel.el.set_model(tm);
- this.tree.el.show();
- }
- public void show ( ) {
- GLib.debug("errors : show");
-
- if (_this.model.el.get_n_items() < 1) {
-
- GLib.debug("errors : none available");
- return;
- }
- //this.el.present();
- //this.el.popup();
-
- //print("looking for %s\n", id);
- // loop through parent childnre
-
-
- ; //<< very important!!!
-
- // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- var win = this.window.el;
- var w = win.get_width();
- var h = win.get_height();
-
-
- // left tree = 250, editor area = 500?
-
- // min 450?
- var new_w = int.min(650, w-100);
- if (new_w > (w-100)) {
- new_w = w-100;
- }
- GLib.debug("set size");
- this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
-
-
- // this.el.set_relative_to(onbtn);
- //Gtk.Allocation rect;
- //onbtn.get_allocation(out rect);
- //this.el.set_pointing_to(rect);
- //this.el.present();
-
- GLib.debug("call popup");
- this.el.popup();
- // only need to load once.
- //if (!this.loaded) {
-
- //this.loaded = true;
- //}
-
-
-
- //if (expand != null) {
- // _this.compile_tree.el.expand_row( store.get_path(expand) , true);
- // }
-
- // this.hpane.el.set_position( 0);
- }
- public class Xcls_compile_view : Object
- {
- public Gtk.Box el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.compile_view = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = false;
- var child_1 = new Xcls_ScrolledWindow3( _this );
- child_1.ref();
- this.el.append( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow3 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_tree( _this );
- this.el.set_child ( _this.tree.el );
-
- // init method
-
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_tree : Object
- {
- public Gtk.ColumnView el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_tree(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.tree = this;
- new Xcls_selmodel( _this );
- this.el = new Gtk.ColumnView( _this.selmodel.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_2 = new Xcls_ColumnViewColumn11( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- var child_3 = new Xcls_GestureClick13( _this );
- child_3.ref();
- this.el.add_controller( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_selmodel : Object
- {
- public Gtk.SingleSelection el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.selmodel = this;
- new Xcls_sortmodel( _this );
- this.el = new Gtk.SingleSelection( _this.sortmodel.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public Json.Object getNodeAt (uint row) {
-
- var tr = (Gtk.TreeListRow)this.el.get_item(row);
-
- var a = tr.get_item();;
- GLib.debug("get_item (2) = %s", a.get_type().name());
-
- return (Json.Object)tr.get_item();
-
- }
- }
- public class Xcls_sortmodel : Object
- {
- public Gtk.SortListModel el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.sortmodel = this;
- new Xcls_model( _this );
- var child_2 = new Xcls_TreeListRowSorter8( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public Json.Object getNodeAt (uint row) {
-
- var tr = (Gtk.TreeListRow)this.el.get_item(row);
-
-
- // GLib.debug("get_item (2) = %s", a.get_type().name());
-
-
- return (Json.Object)tr.get_item();
-
- }
- }
- public class Xcls_model : Object
- {
- public Gtk.TreeListModel el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.TreeListModel(
+static Xcls_ValaCompileErrors _ValaCompileErrors;
+
+public class Xcls_ValaCompileErrors : Object
+{
+ public Gtk.Popover el;
+ private Xcls_ValaCompileErrors _this;
+
+ public static Xcls_ValaCompileErrors singleton()
+ {
+ if (_ValaCompileErrors == null) {
+ _ValaCompileErrors= new Xcls_ValaCompileErrors();
+ }
+ return _ValaCompileErrors;
+ }
+ public Xcls_compile_view compile_view;
+ public Xcls_tree tree;
+ public Xcls_selmodel selmodel;
+ public Xcls_sortmodel sortmodel;
+ public Xcls_model model;
+
+ // my vars (def)
+ public Xcls_MainWindow window;
+ public bool loaded;
+
+ // ctor
+ public Xcls_ValaCompileErrors()
+ {
+ _this = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+ this.loaded = false;
+
+ // set gobject values
+ this.el.width_request = 900;
+ this.el.height_request = 800;
+ this.el.autohide = true;
+ this.el.position = Gtk.PositionType.TOP;
+ new Xcls_compile_view( _this );
+ this.el.set_child ( _this.compile_view.el );
+ }
+
+ // user defined functions
+ public void updateNotices ( GLib.ListStore? ls) {
+ GLib.debug("errors : update");
+ if (ls == null || ls.get_n_items() < 1) {
+ // GLib.debug("errors : none available");
+ return;
+ }
+
+ //GLib.debug("Loading list into tree");
+ this.tree.el.hide();
+ var tm = new Gtk.TreeListModel(
+ ls, //..... << that's our store..
+ false, // passthru
+ false, // autexpand
+ (item) => {
+
+ return ((Palete.CompileError)item).lines;
+
+ }
+
+ );
+
+ _this.model.el = tm;
+ _this.sortmodel.el.set_model(tm);
+ this.tree.el.show();
+ }
+ public void show ( ) {
+ GLib.debug("errors : show");
+
+ if (_this.model.el.get_n_items() < 1) {
+
+ GLib.debug("errors : none available");
+ return;
+ }
+ //this.el.present();
+ //this.el.popup();
+
+ //print("looking for %s\n", id);
+ // loop through parent childnre
+
+
+ ; //<< very important!!!
+
+ // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+
+ var win = this.window.el;
+ var w = win.get_width();
+ var h = win.get_height();
+
+
+ // left tree = 250, editor area = 500?
+
+ // min 450?
+ var new_w = int.min(650, w-100);
+ if (new_w > (w-100)) {
+ new_w = w-100;
+ }
+ GLib.debug("set size");
+ this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
+
+
+ // this.el.set_relative_to(onbtn);
+ //Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ //this.el.set_pointing_to(rect);
+ //this.el.present();
+
+ GLib.debug("call popup");
+ this.el.popup();
+ // only need to load once.
+ //if (!this.loaded) {
+
+ //this.loaded = true;
+ //}
+
+
+
+ //if (expand != null) {
+ // _this.compile_tree.el.expand_row( store.get_path(expand) , true);
+ // }
+
+ // this.hpane.el.set_position( 0);
+ }
+ public class Xcls_compile_view : Object
+ {
+ public Gtk.Box el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.compile_view = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.hexpand = false;
+ var child_1 = new Xcls_ScrolledWindow3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ScrolledWindow3 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_tree( _this );
+ this.el.set_child ( _this.tree.el );
+
+ // init method
+
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_tree : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_tree(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.tree = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_2 = new Xcls_ColumnViewColumn11( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ var child_3 = new Xcls_GestureClick13( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_sortmodel( _this );
+ this.el = new Gtk.SingleSelection( _this.sortmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public Json.Object getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+ var a = tr.get_item();;
+ GLib.debug("get_item (2) = %s", a.get_type().name());
+
+ return (Json.Object)tr.get_item();
+
+ }
+ }
+ public class Xcls_sortmodel : Object
+ {
+ public Gtk.SortListModel el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.sortmodel = this;
+ new Xcls_model( _this );
+ var child_2 = new Xcls_TreeListRowSorter8( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public Json.Object getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+
+ // GLib.debug("get_item (2) = %s", a.get_type().name());
+
+
+ return (Json.Object)tr.get_item();
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new Gtk.TreeListModel(
new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
false, // passthru
false, // autexpand
);
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_TreeListRowSorter8 : Object
- {
- public Gtk.TreeListRowSorter el;
- private Xcls_ValaCompileErrors _this;
+ public class Xcls_TreeListRowSorter8 : Object
+ {
+ public Gtk.TreeListRowSorter el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_StringSorter9( _this );
- child_1.ref();
- this.el = new Gtk.TreeListRowSorter( child_1.el );
+ // ctor
+ public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_StringSorter9( _this );
+ child_1.ref();
+ this.el = new Gtk.TreeListRowSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_StringSorter9 : Object
- {
- public Gtk.StringSorter el;
- private Xcls_ValaCompileErrors _this;
+ // user defined functions
+ }
+ public class Xcls_StringSorter9 : Object
+ {
+ public Gtk.StringSorter el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression10( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
+ // ctor
+ public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression10( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_PropertyExpression10 : Object
- {
- public Gtk.PropertyExpression el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-
-
- public class Xcls_ColumnViewColumn11 : Object
- {
- public Gtk.ColumnViewColumn el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory12( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.expand = true;
- this.el.resizable = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory12 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var expand = new Gtk.TreeExpander();
-
- expand.set_indent_for_depth(true);
- expand.set_indent_for_icon(true);
-
- var lbl = new Gtk.Label("");
- lbl.use_markup = true;
-
-
- lbl.justify = Gtk.Justification.LEFT;
- lbl.xalign = 0;
-
-
- expand.set_child(lbl);
- ((Gtk.ListItem)listitem).set_child(expand);
- ((Gtk.ListItem)listitem).activatable = false;
- });
- this.el.bind.connect( (listitem) => {
- //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
-
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
-
-
- var lbl = (Gtk.Label) expand.child;
-
- if (lbl.label != "") { // do not update
- return;
- }
-
-
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var np = (Palete.CompileError) lr.get_item();
-
-
- //GLib.debug("change %s to %s", lbl.label, np.name);
- lbl.label = np.linemsg;
- //lbl.tooltip_markup = np.to_property_option_tooltip();
-
- expand.set_hide_expander( np.lines.n_items < 1);
- expand.set_list_row(lr);
-
- // expand current file.
- // this causes problems? - critical errors?
- // maybe do it on show
- //if (_this.window.windowstate.file.path == np.file.path &&
- // np.line < 0) {
- // lr.expanded = true;
-
- //}
-
- // bind image...
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_GestureClick13 : Object
- {
- public Gtk.GestureClick el;
- private Xcls_ValaCompileErrors _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
- this.el.button = 0;
-
- //listeners
- this.el.pressed.connect( (n_press, x, y) => {
-
- if (n_press < 2) { /// doubleclick?
- return;
- }
-
-
-
- // use selection?!
- var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
- //GLib.debug("SELECTED = %s", tr.item.get_type().name());
- var ce = (Palete.CompileError) tr.item;
-
- if (ce.line < 0) {
- // did not click on a line.
- return;
- }
-
-
- var fname = ce.file;
- var line = ce.line;
- GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
-
-
- var bjsf = "";
- try {
- var regex = new Regex("\\.vala$");
-
-
- bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
- } catch (GLib.RegexError e) {
- return;
- }
- var p = _this.window.project;
-
-
-
- var jsr = p.getByPath(bjsf);
- if (jsr != null) {
- _this.window.windowstate.fileViewOpen(jsr, true, line);
-
- if (jsr.path == _this.window.windowstate.file.path) {
-
- }
- _this.el.hide();
-
- return;
-
- }
-
- var pf = p.getByPath(fname.path);
- _this.el.hide();
- _this.window.windowstate.fileViewOpen(pf, true, line);
-
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
- }
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression10 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+
+
+ public class Xcls_ColumnViewColumn11 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory12( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory12 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var expand = new Gtk.TreeExpander();
+
+ expand.set_indent_for_depth(true);
+ expand.set_indent_for_icon(true);
+
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+
+
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+
+
+ expand.set_child(lbl);
+ ((Gtk.ListItem)listitem).set_child(expand);
+ ((Gtk.ListItem)listitem).activatable = false;
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+
+
+ var lbl = (Gtk.Label) expand.child;
+
+ if (lbl.label != "") { // do not update
+ return;
+ }
+
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var np = (Palete.CompileError) lr.get_item();
+
+
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+ lbl.label = np.linemsg;
+ //lbl.tooltip_markup = np.to_property_option_tooltip();
+
+ expand.set_hide_expander( np.lines.n_items < 1);
+ expand.set_list_row(lr);
+
+ // expand current file.
+ // this causes problems? - critical errors?
+ // maybe do it on show
+ //if (_this.window.windowstate.file.path == np.file.path &&
+ // np.line < 0) {
+ // lr.expanded = true;
+
+ //}
+
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_GestureClick13 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_ValaCompileErrors _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.button = 0;
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+
+ if (n_press < 2) { /// doubleclick?
+ return;
+ }
+
+
+
+ // use selection?!
+ var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
+ //GLib.debug("SELECTED = %s", tr.item.get_type().name());
+ var ce = (Palete.CompileError) tr.item;
+
+ if (ce.line < 0) {
+ // did not click on a line.
+ return;
+ }
+
+
+ var fname = ce.file;
+ var line = ce.line;
+ GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
+
+
+ var bjsf = "";
+ try {
+ var regex = new Regex("\\.vala$");
+
+
+ bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
+ } catch (GLib.RegexError e) {
+ return;
+ }
+ var p = _this.window.project;
+
+
+
+ var jsr = p.getByPath(bjsf);
+ if (jsr != null) {
+ _this.window.windowstate.fileViewOpen(jsr, true, line);
+
+ if (jsr.path == _this.window.windowstate.file.path) {
+
+ }
+ _this.el.hide();
+
+ return;
+
+ }
+
+ var pf = p.getByPath(fname.path);
+ _this.el.hide();
+ _this.window.windowstate.fileViewOpen(pf, true, line);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+}
"\t\t ",
"\t\t\t",
"\t\t\treading_header = false;",
- "\t\t\t ",
+ "\t\t\tcontinue;",
"\t }",
"\t ",
"\t \tif (child.has_css_class(\"node-err\")) {",
"| void updateErrors" : [
"() {",
"\tvar file = this.file;",
+ "\tif (file == null) {",
+ "\t\treturn;",
+ "\t}",
"\tvar ar = file.getErrors();",
- "\tif (ar.size < 1) {",
+ "\tif (ar == null || ar.size < 1) {",
"\t\tif (this.last_error_counter != file.error_counter) {",
"\t\t\tthis.removeErrors();",
"\t\t}",
}
public void updateErrors () {
var file = this.file;
+ if (file == null) {
+ return;
+ }
var ar = file.getErrors();
- if (ar.size < 1) {
+ if (ar == null || ar.size < 1) {
if (this.last_error_counter != file.error_counter) {
this.removeErrors();
}
reading_header = false;
-
+ continue;
}
if (child.has_css_class("node-err")) {
"\t\t",
"\t\t var m = (GLib.ListStore) _this.model.el.model;",
" \t_this.main_window.windowstate.file.tree = dropNode; ",
- " ",
+ " \tdropNode.updated_count++;",
" ",
"\t\tm.append(dropNode);",
"\t\t_this.model.selectNode(dropNode); \t",
"\t\t \t\t_this.view.dragNode.remove();",
"\t \t\t}",
"\t \t\t\t",
- "\t \t\t",
+ "\t \t\tdropNode.updated_count++;",
" \t\t\t_this.model.selectNode(dropNode); ",
" \t\t\t",
" \t\t\t_this.changed();\t\t\t\t \t\t",
"\t\t \t\t_this.model.selectNode(null); \t \t\t",
"\t\t \t\t_this.view.dragNode.remove();",
"\t \t\t}",
- "\t",
+ "\t\t\tdropNode.updated_count++;",
" \t\t\t_this.model.selectNode(dropNode); \t\t\t",
" \t\t\t_this.changed();",
" \t\t\treturn true;",
"\t",
" \t\t\t",
" \t\t\tnode.parent.insertAfter(dropNode, node);",
+ " \t\t\tdropNode.updated_count++;",
" \t\t\t_this.model.selectNode(dropNode);\t",
" \t\t\t_this.changed();",
" \t\t\t// select it",
"\tfor (var i = 0; i < s.n_items; i++) {",
"\t\t//GLib.debug(\"check node %s\", s.get_item(i).get_type().name());",
"\t\tvar lr = s.get_item(i) as Gtk.TreeListRow;",
- "\t\tGLib.debug(\"check node %s\", lr.get_item().get_type().name());",
+ "\t\t//GLib.debug(\"check node %s\", lr.get_item().get_type().name());",
"\t\tif ((lr.get_item() as JsRender.Node).oid == node.oid) {",
"\t\t\treturn i;",
"\t\t\t",
" \tvar reading_header = true;",
"\t ",
" \twhile (child != null) {",
- "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
" \t ",
" \t if (reading_header) {",
"\t\t\t\t",
],
"| int getColAt" : [
"(double x, double y) {",
- "/*",
- " \t",
- "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
- " \t ",
- " \t*/",
- "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
- "\t\t//GLib.debug(\"Cehck %d, %d\", x,y);",
- " var child = this.el.get_first_child(); ",
- " \t ",
- " \tvar col = 0;",
- " \tvar offx = 0;",
- " \twhile (child != null) {",
- "\t\t\t",
- "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
- "\t\t\t\tchild = child.get_first_child();",
- "\t\t\t\tcontinue;",
- "\t\t\t}",
+ "\t/*",
"\t\t\t",
- "\t\t\t//child.get_allocation(out alloc);",
- "\t\t\tif (x < (child.get_width() + offx)) {",
- "\t\t\t\treturn col;",
- "\t\t\t}",
- "\t\t\treturn 1;",
- "\t\t\t//offx += child.get_width();",
- "\t\t\t//col++;",
- "\t\t\t//child = child.get_next_sibling();",
+ "\tfrom \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \t ",
+ "\t*/",
+ "\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ "\t//GLib.debug(\"Cehck %d, %d\", x,y);",
+ " var child = this.el.get_first_child(); ",
+ "\t ",
+ "\tvar col = 0;",
+ "\tvar offx = 0;",
+ "\twhile (child != null) {",
+ "\t\t",
+ "\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
+ "\t\t\tchild = child.get_first_child();",
+ "\t\t\tcontinue;",
"\t\t}",
- " \t ",
- "\t\t\t ",
- " return -1;",
+ "\t\t",
+ "\t\t//child.get_allocation(out alloc);",
+ "\t\tif (x < (child.get_width() + offx)) {",
+ "\t\t\treturn col;",
+ "\t\t}",
+ "\t\treturn 1;",
+ "\t\t//offx += child.get_width();",
+ "\t\t//col++;",
+ "\t\t//child = child.get_next_sibling();",
+ "\t}",
+ "\t ",
+ "\t\t ",
+ " return -1;",
"",
" }"
],
" \t*/",
" \t\t ",
" \t\t",
- " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
+ " \t\tGLib.debug(\"get Widget At Row x = %d y = %d\", (int) x, (int) in_y);",
" \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
" var child = this.el.get_first_child(); ",
" \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
"\t\t ",
"\t\t\t",
"\t\t\treading_header = false;",
- "\t\t\t ",
+ "\t\t\t continue;",
"\t }",
"\t ",
"\t \tif (child.has_css_class(\"node-err\")) {",
"| void updateErrors" : [
"() {",
"\tvar file = this.getActiveFile();",
+ "\tif (file == null) {",
+ "\t\treturn;",
+ "\t}",
+ "\t",
"\tvar ar = file.getErrors();",
- "\t\tif (ar.size < 1) {",
+ "\tif (ar == null || ar.size < 1) {",
"\t\tif (this.last_error_counter != file.error_counter) {",
"\t\t\tthis.removeErrors();",
"\t\t}",
// user defined functions
public void updateErrors () {
var file = this.getActiveFile();
+ if (file == null) {
+ return;
+ }
+
var ar = file.getErrors();
- if (ar.size < 1) {
+ if (ar == null || ar.size < 1) {
if (this.last_error_counter != file.error_counter) {
this.removeErrors();
}
reading_header = false;
-
+ continue;
}
if (child.has_css_class("node-err")) {
var reading_header = true;
while (child != null) {
- GLib.debug("Got %s", child.get_type().name());
+ //GLib.debug("Got %s", child.get_type().name());
if (reading_header) {
}
public int getColAt (double x, double y) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
-
- */
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- //GLib.debug("Cehck %d, %d", x,y);
- var child = this.el.get_first_child();
-
- var col = 0;
- var offx = 0;
- while (child != null) {
+ /*
- if (child.get_type().name() == "GtkColumnViewRowWidget") {
- child = child.get_first_child();
- continue;
- }
-
- //child.get_allocation(out alloc);
- if (x < (child.get_width() + offx)) {
- return col;
- }
- return 1;
- //offx += child.get_width();
- //col++;
- //child = child.get_next_sibling();
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+
+ */
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ //GLib.debug("Cehck %d, %d", x,y);
+ var child = this.el.get_first_child();
+
+ var col = 0;
+ var offx = 0;
+ while (child != null) {
+
+ if (child.get_type().name() == "GtkColumnViewRowWidget") {
+ child = child.get_first_child();
+ continue;
}
-
-
- return -1;
+
+ //child.get_allocation(out alloc);
+ if (x < (child.get_width() + offx)) {
+ return col;
+ }
+ return 1;
+ //offx += child.get_width();
+ //col++;
+ //child = child.get_next_sibling();
+ }
+
+
+ return -1;
}
public int getRowAt (double x, double in_y, out string pos) {
*/
- //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
+ GLib.debug("get Widget At Row x = %d y = %d", (int) x, (int) in_y);
var y = in_y + _this.viewwin.el.vadjustment.value;
var child = this.el.get_first_child();
//Gtk.Allocation alloc = { 0, 0, 0, 0 };
var m = (GLib.ListStore) _this.model.el.model;
_this.main_window.windowstate.file.tree = dropNode;
-
+ dropNode.updated_count++;
m.append(dropNode);
_this.model.selectNode(dropNode);
_this.view.dragNode.remove();
}
-
+ dropNode.updated_count++;
_this.model.selectNode(dropNode);
_this.changed();
_this.model.selectNode(null);
_this.view.dragNode.remove();
}
-
+ dropNode.updated_count++;
_this.model.selectNode(dropNode);
_this.changed();
return true;
node.parent.insertAfter(dropNode, node);
+ dropNode.updated_count++;
_this.model.selectNode(dropNode);
_this.changed();
// select it
for (var i = 0; i < s.n_items; i++) {
//GLib.debug("check node %s", s.get_item(i).get_type().name());
var lr = s.get_item(i) as Gtk.TreeListRow;
- GLib.debug("check node %s", lr.get_item().get_type().name());
+ //GLib.debug("check node %s", lr.get_item().get_type().name());
if ((lr.get_item() as JsRender.Node).oid == node.oid) {
return i;
"\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
- "\t\tbuf.remove_source_marks (start, end, null);",
+ "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\t\tthis.last_error_counter = file.error_counter ;",
"\t\tGLib.debug(\"higjlight has no errors\");",
"\t\treturn;",
"\t",
" ",
"\t ",
- "\tbuf.remove_source_marks (start, end, null);",
+ "\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\tbuf.remove_source_marks (start, end, \"DEPR\");",
"\tbuf.remove_tag_by_name (\"ERR\", start, end);",
"\tbuf.remove_tag_by_name (\"WARN\", start, end);",
"\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
this.last_error_counter = file.error_counter ;
GLib.debug("higjlight has no errors");
return;
- buf.remove_source_marks (start, end, null);
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
buf.remove_tag_by_name ("ERR", start, end);
buf.remove_tag_by_name ("WARN", start, end);
buf.remove_tag_by_name ("DEPR", start, end);
public Xcls_RooProjectSettings roo_projectsettings_pop;
public ValaProjectSettingsPopover vala_projectsettings_pop;
public Xcls_PopoverAddObject rightpalete;
- //public Xcls_PopoverEditor code_editor_popover;
- public Editor code_editor_tab;
- public Xcls_WindowRooView window_rooview;
- public Xcls_GtkView window_gladeview;
- public DialogFiles popover_files;
+ public Editor code_editor_tab;
+ public Xcls_WindowRooView window_rooview;
+ public Xcls_GtkView window_gladeview;
+ public DialogFiles popover_files;
//public Xcls_ClutterFiles clutterfiles;
//public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized..
}
//this.left_tree.model.updateSelected();
this.file.save();
+
});
) {
var ar = obj.get_array_member("items");
var tree_base = ar.get_object_element(0);
- this.tree = new Node();
- this.tree.loadFromJson(tree_base, int.parse(bjs_version_str));
-
+ this.loadTree(tree_base, int.parse(bjs_version_str));
}
this.gen_extended ?
NodeToValaExtended.mungeFile(this) :
NodeToValaWrapped.mungeFile(this); // force line numbering..?? should we call toSourceCode???
this.loaded = true;
+ this.updateUndo();
}
+
+
this.last_source = this.gen_extended ?
NodeToValaExtended.mungeFile(this) :
NodeToValaWrapped.mungeFile(this);
+
this.last_source_version = this.version;
+
+
+
return this.last_source;
}
}
- public override void save() {
+ public override void save()
+ {
this.saveBJS();
// this.saveJS(); - disabled at present.. project settings will probably enable this later..
this.saveVala();
+
this.getLanguageServer().document_save.begin(this, (obj, res) => {
this.getLanguageServer().document_save.end(res);
});
return ++this._version; // increased on every call? - bit of a kludge until we do real versioning
}
private set {
+
this._version = value;
+ this.updateUndo();
}
}
+
public string permname;
public string language;
public string content_type;
public Gee.HashMap<string,string> transStrings; // map of md5 -> string.
public Gee.HashMap<string,string> namedStrings;
+
+ public Gee.HashMap<int,string> undo_json;
+
//public Gee.HashMap<string, GLib.ListStore> errorsByType;
private Gee.ArrayList<Lsp.Diagnostic> errors;
public int error_counter {
get; private set; default = 0;
}
- public signal void changed (Node? node, string source);
+ //public signal void changed (Node? node, string source); (not used?)
public signal void compile_notice(string type, string file, int line, string message);
}
}
+
/**
* UI componenets
*
this.childfiles = new GLib.ListStore(typeof(JsRender));
//this.errorsByType = new Gee.HashMap<string, GLib.ListStore>();
this.errors = new Gee.ArrayList<Lsp.Diagnostic>((a,b) => { return a.equals(b); });
-
+ this.undo_json = new Gee.HashMap<int,string>();
}
print("Save failed");
}
}
-
-
-
-
-
-
-
+
+ bool in_undo = false;
+ protected void updateUndo()
+ {
+ if (this.in_undo) {
+ return;
+ }
+ if (this.xtype == "PlainFile") {
+ // handled by gtk sourceview buffer...
+ return;
+ }
+ //GLib.debug("UNDO store %d", this.version);
+ this.undo_json.set(this.version, this.tree.toJsonString());
+ if (this.undo_json.has_key(this.version+1)) {
+ var n = this.version +1;
+ while (this.undo_json.has_key(n)) {
+ this.undo_json.unset(n++);
+ }
+
+ }
+
+ }
+
+ public bool undoStep(int step = -1) // undo back/next
+ {
+
+ if (!this.undo_json.has_key(this.version + step)) {
+ //GLib.debug("UNDO step %d failed - no version available", this.version + step);
+ return false;
+ }
+ var new_version = this.version + step;
+ var pa = new Json.Parser();
+ //GLib.debug("UNDO RESTORE : %d", this.version + step);
+
+ pa.load_from_data(this.undo_json.get(new_version));
+ var node = pa.get_root();
+ this.in_undo = true;
+ this.loadTree(node.get_object(),2);
+ this.tree.updated_count = new_version;
+ this.in_undo = false;
+ return true;
+ }
public string jsonHasOrEmpty(Json.Object obj, string key) {
return obj.has_member(key) ?
return ret;
+ }
+
+ public void loadTree(Json.Object obj, int bjs_version = 2)
+ {
+ if (this.xtype == "PlainFile" ){
+ return;
+ }
+ Node.uid_count = 0;
+ this.tree = new Node();
+ this.tree.loadFromJson(obj,bjs_version);
+ this.tree.version_changed.connect(() => {
+ this.updateUndo();
+ });
+
}
+
public abstract string language_id();
public abstract void save();
public abstract void saveHTML(string html);
public abstract string toGlade();
public abstract string targetName();
public abstract void loadItems() throws GLib.Error;
+
}
+
+
}
this.nodeTitleProp = ""; // ?? should trigger set?
this.iconFilename = "";
this._updated_count = value;
+
+
+ //GLib.debug("Update Node %d p%d - rev %d", this.oid, this.parent != null ? this.parent.oid : -1, value);
if (this.parent != null) {
this.parent.updated_count++;
+ } else {
+ //GLib.debug("UNDO top node is %d", value);
+ this.version_changed();
}
}
} // changes to this trigger updates on the tree..
-
+
+ public string as_source = "";
+ public int as_source_version = -1;
+
+ public signal void version_changed();
+
public Node()
{
this.items = new Gee.ArrayList<Node>();
if ( this.parent.childstore.find(this, out pos)) {
this.parent.childstore.remove(pos);
}
-
+ this.parent.updated_count++;
this.parent.items = nlist;
this.parent = null;
public string munge ( )
{
//return this.mungeToString(this.node);
-
+ if (this.node.as_source_version > 0 &&
+ this.node.as_source_version == this.node.updated_count
+ && this.node.as_source != ""
+ ) {
+ return this.node.as_source;
+ }
this.checkChildren();
this.readProps();
//}
this.mungeOut();
+
+ this.node.as_source_version = this.node.updated_count;
+ this.node.as_source == this.ret;
return this.ret;
+
}
/**
public override string munge ( )
{
//return this.mungeToString(this.node);
+
+ if (this.node.as_source_version > 0 &&
+ this.node.as_source_version == this.node.updated_count
+ && this.node.as_source != ""
+ ) {
+ return this.node.as_source;
+ }
this.child_count = 1;
this.iterChildren(); // add children class definitions.
this.namespaceFooter();
+ this.node.as_source_version = this.node.updated_count;
+ this.node.as_source == this.ret;
return this.ret;
public class JsRender.NodeToValaWrapped : NodeToVala {
-
-
+
public NodeToValaWrapped( JsRender file, Node node, int depth, NodeToVala? parent)
{
base (file, node, depth, parent);
public override string munge ( )
{
//return this.mungeToString(this.node);
-
+ if (this.node.as_source_version > 0 &&
+ this.node.as_source_version == this.node.updated_count
+ && this.node.as_source != ""
+ ) {
+ return this.node.as_source;
+ }
this.namespaceHeader();
this.iterChildren();
this.namespaceFooter();
+
+ this.node.as_source_version = this.node.updated_count;
+ this.node.as_source == this.ret;
return this.ret;
this.file = file;
this.node = node;
this.depth = depth;
- if (parent == null) {
- this.var_name_count = 0;
- }
+
this.top_level_items = new Gee.ArrayList<Node>();
this.cur_line = parent == null ? 0 : parent.cur_line;
this.top = parent == null ? this : parent.top;
}
- int var_name_count = 0; // was vcnt
+ //int var_name_count = 0; // was vcnt
string toValaNS(Node item)
{
public void toValaName(Node item, int depth =0)
{
- this.var_name_count++;
+
var ns = this.toValaNS(item) ;
var cls = ns + item.get("xtype");
item.xvala_cls = cls;
string id = item.get("id").length > 0 ?
- item.get("id") : "%s%d".printf(item.get("xtype"), this.var_name_count);
+ item.get("id") : "%s%d".printf(item.get("xtype"), item.oid);
(character > other.character ? 1 :
(character == other.character ? 0 : -1)) : -1);
}
-
+ public bool equals(Position o) {
+ return o.line == this.line && o.character == this.character;
+ }
+
public string to_string () {
return @"$line:$character";
}
public bool equal_to (Range other) { return this.to_string () == other.to_string (); }
public bool equals (Range o) {
- return this.filename == o.filename && this.start == o.start && this.end == o.end;
+ return this.filename == o.filename && this.start.equals(o.start) && this.end.equals(o.end);
}
public int compare_to (Range other) {
}
public bool equals(Lsp.Diagnostic o) {
- return this.range.equals(o.range) && this.severity == o.severity && this.message == o.message;
+ var ret = this.range.equals(o.range) && this.severity == o.severity && this.message == o.message;
+ //GLib.debug("compare %s (%s == %s)", ret ? "YES" : "NO", this.to_string(), o.to_string());
+
+
+ return ret;
}
public string to_string()
{
{
// extend versions will proably call initialize to start and connect to server.
base(project);
- this.open_files = new Gee.ArrayList<JsRender.JsRender>();
+
this.change_queue_id = GLib.Timeout.add_seconds(1, () => {
if (this.change_queue_file == null) {
return true;
out return_value
);
GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
+ this.open_files = new Gee.ArrayList<JsRender.JsRender>((a,b) => {
+ return a.path == b.path;
+ });
this.initialized = true;
return;
} catch (GLib.Error e) {
public async void restartServer()
{
this.startServer();
- foreach(var f in this.open_files) {
- this.document_open(f);
- }
+
}
public bool isReady()
//this.project.updateErrorsforFile(null);
return;
}
+ //GLib.debug("got Diagnostics for %s", f.path);
f.updateErrors( dg.diagnostics );
if (!this.isReady()) {
return;
}
- if (!this.open_files.contains(file)) {
- this.open_files.add(file);
+ if (this.open_files.contains(file)) {
+ return;
}
+ this.open_files.add(file);
+
GLib.debug ("LS sent open");
try {
if (!this.isReady()) {
return;
}
-
+ if (!this.open_files.contains(file)) {
+ this.document_open(file);
+ }
- GLib.debug ("LS send change");
+ GLib.debug ("LS send change %s rev %d", file.path, file.version);
var ar = new Json.Array();
var obj = new Json.Object();
obj.set_string_member("text", contents);