From 341a0c1fb636275be75423b4ff69c069b27b5ba2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 29 Jan 2024 19:02:32 +0800 Subject: [PATCH] fix merge --- .roobuilder.jcfg | 1 - src/Application.vala | 7 +-- src/Builder4/Editor.bjs | 5 +- src/Builder4/Editor.vala | 5 +- src/Builder4/WindowLeftProps.bjs | 83 ++++++++++++++++++++++++++++++- src/Builder4/WindowLeftProps.vala | 79 ++++++++++++++++++++++++++++- src/Builder4/WindowLeftTree.bjs | 3 +- src/Builder4/WindowLeftTree.vala | 3 +- 8 files changed, 173 insertions(+), 13 deletions(-) diff --git a/.roobuilder.jcfg b/.roobuilder.jcfg index 235a9ea20..2d7b1ebd1 100644 --- a/.roobuilder.jcfg +++ b/.roobuilder.jcfg @@ -86,7 +86,6 @@ "libvala-0.56", "libxml-2.0", "posix", - "roojspacker-1.4", "gtksourceview-5", "libgda-5.0", "jsonrpc-glib-1.0", diff --git a/src/Application.vala b/src/Application.vala index cfe0fe03a..4df8de019 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -715,8 +715,9 @@ flutter-project - was try and read flutter data (but desnt work.) GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName()); ww.updateErrors(); - - + ww.windowstate.left_tree.updateErrors(); + ww.windowstate.left_props.updateErrors(); + } } @@ -803,4 +804,4 @@ flutter-project - was try and read flutter data (but desnt work.) - \ No newline at end of file + diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index 730bc8c5a..c0555bf9c 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -634,6 +634,8 @@ " this.el.grab_focus();", " _this.save_button.el.sensitive = false;", " _this.last_error_counter = -1;", + "\t_this.updateErrorMarks();", + " ", "}" ] } @@ -1055,8 +1057,7 @@ "", " // find the text for the node..", " this.view.load( prop.val );", - " ", - " ", + "", " this.close_btn.el.show(); ", " ", " } else {", diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 027d2418b..da17b3e69 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -145,8 +145,7 @@ public class Editor : Object // find the text for the node.. this.view.load( prop.val ); - - + this.close_btn.el.show(); } else { @@ -794,6 +793,8 @@ public class Editor : Object this.el.grab_focus(); _this.save_button.el.sensitive = false; _this.last_error_counter = -1; + _this.updateErrorMarks(); + } } public class Xcls_buffer : Object diff --git a/src/Builder4/WindowLeftProps.bjs b/src/Builder4/WindowLeftProps.bjs index 369cd6ae2..f84d8faca 100644 --- a/src/Builder4/WindowLeftProps.bjs +++ b/src/Builder4/WindowLeftProps.bjs @@ -1007,6 +1007,7 @@ "\t\t\t\t}", "\t\t\t\tchild = child.get_first_child(); ", "\t\t\t\treading_header = false;", + "\t\t\t\tcontinue;", "\t }", "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {", " \t\t child = child.get_next_sibling();", @@ -1102,7 +1103,7 @@ "\t\t\t\theader_height = h;", "\t\t\t\t", "\t\t\t\treading_header = false;", - "\t\t\t\t", + "\t\t\t\tcontinue;", "\t }", "\t ", "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {", @@ -1422,6 +1423,7 @@ " ", " \tthis.loading = false;", " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);", + " this.updateErrors();", " // clear selection?", " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..", " ", @@ -1432,8 +1434,85 @@ " ", "}", "" + ], + "| void removeErrors" : [ + "() {", + "\tvar child = this.view.el.get_first_child(); ", + " ", + "\tvar reading_header = true;", + " ", + "\twhile (child != null) {", + "\t\tGLib.debug(\"Got %s\", child.get_type().name());", + "\t ", + "\t if (reading_header) {", + "\t\t\t", + "", + "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {", + "\t\t\t ", + "\t\t\t\tchild = child.get_next_sibling();", + "\t\t\t\tcontinue;", + "\t\t\t}", + "\t\t\t// should be columnlistview", + "\t\t\tchild = child.get_first_child(); ", + "\t\t ", + "\t\t ", + "\t\t\t", + "\t\t\treading_header = false;", + "\t\t\t ", + "\t }", + "\t ", + "\t \tif (!child.has_css_class(\"error-node\")) {", + "\t\t\tchild.remove_css_class(\"error-node\");", + "\t\t}", + "\t\t", + " child = child.get_next_sibling(); ", + "\t}", + "\t//GLib.debug(\"Rturning null\");", + " ", + "}" + ], + "| void updateErrors" : [ + "() {", + "\tvar file = this.file;", + "\tvar ar = file.getErrors();", + "\tif (ar.size < 1) {", + "\t\tthis.removeErrors();", + "\t\tthis.last_error_counter = file.error_counter ;", + "", + "\t\treturn;", + "\t}", + " \tif (this.last_error_counter == file.error_counter) {", + "\t\treturn;", + "\t}", + "\tthis.removeErrors();", + "\t", + "\tforeach(var diag in ar) { ", + "\t", + "\t\t ", + "// print(\"get inter\\n\");", + "\t var node= file.lineToNode( (int)diag.range.start.line) ;", + "\t if (node == null || node.oid != this.node.oid) {", + "\t \tcontinue;", + " \t}", + " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;", + " \t", + " \tvar row = _this.selmodel.propToRow(prop);", + " \tif (row < 0) {", + " \t\tcontinue;", + "\t\t}", + " \tvar w = this.view.getWidgetAtRow(row);", + " \tif (w == null) {", + " \t\treturn;", + "\t\t}", + "\t\tif (!w.has_css_class(\"node-error\")) {", + "\t\t\tw.add_css_class(\"node-error\");", + "\t\t}", + "\t\t", + "\t}", + "\t", + "}" ] } ], "name" : "WindowLeftProps" -} \ No newline at end of file +} diff --git a/src/Builder4/WindowLeftProps.vala b/src/Builder4/WindowLeftProps.vala index 5da1a3f4d..bed742865 100644 --- a/src/Builder4/WindowLeftProps.vala +++ b/src/Builder4/WindowLeftProps.vala @@ -84,6 +84,47 @@ public class Xcls_LeftProps : Object } + + public void updateErrors () { + var file = this.file; + var ar = file.getErrors(); + if (ar.size < 1) { + this.removeErrors(); + this.last_error_counter = file.error_counter ; + + return; + } + if (this.last_error_counter == file.error_counter) { + return; + } + this.removeErrors(); + + foreach(var diag in ar) { + + + // print("get inter\n"); + var node= file.lineToNode( (int)diag.range.start.line) ; + if (node == null || node.oid != this.node.oid) { + continue; + } + var prop = node.lineToProp( (int)diag.range.start.line) ; + + var row = _this.selmodel.propToRow(prop); + if (row < 0) { + continue; + } + var w = this.view.getWidgetAtRow(row); + if (w == null) { + return; + } + if (!w.has_css_class("node-error")) { + w.add_css_class("node-error"); + } + + } + + } + public string keyFormat (string val, string type) { // Glib.markup_escape_text(val); @@ -185,6 +226,40 @@ public class Xcls_LeftProps : Object _this.changed(); */ } + public void removeErrors () { + var child = this.view.el.get_first_child(); + + var reading_header = true; + + while (child != null) { + GLib.debug("Got %s", child.get_type().name()); + + if (reading_header) { + + + if (child.get_type().name() != "GtkColumnListView") { + + child = child.get_next_sibling(); + continue; + } + // should be columnlistview + child = child.get_first_child(); + + + + reading_header = false; + + } + + if (!child.has_css_class("error-node")) { + child.remove_css_class("error-node"); + } + + child = child.get_next_sibling(); + } + //GLib.debug("Rturning null"); + + } public void a_addProp (JsRender.NodeProp prop) { // info includes key, val, skel, etype.. //console.dump(info); @@ -253,6 +328,7 @@ public class Xcls_LeftProps : Object this.loading = false; this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION); + this.updateErrors(); // clear selection? //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key.. @@ -1288,6 +1364,7 @@ public class Xcls_LeftProps : Object } child = child.get_first_child(); reading_header = false; + continue; } if (child.get_type().name() != "GtkColumnViewRowWidget") { child = child.get_next_sibling(); @@ -1441,7 +1518,7 @@ public class Xcls_LeftProps : Object header_height = h; reading_header = false; - + continue; } if (child.get_type().name() != "GtkColumnViewRowWidget") { diff --git a/src/Builder4/WindowLeftTree.bjs b/src/Builder4/WindowLeftTree.bjs index 6fbd90d5b..5ac6726db 100644 --- a/src/Builder4/WindowLeftTree.bjs +++ b/src/Builder4/WindowLeftTree.bjs @@ -938,6 +938,7 @@ " return;", " }", " \tm.append(f.tree);", + " \t", " \t// expand???", "", "/*", @@ -960,7 +961,7 @@ " //_this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);", " ", " _this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);", - " ", + " _this.updateErrors();", " return;", " ", " ", diff --git a/src/Builder4/WindowLeftTree.vala b/src/Builder4/WindowLeftTree.vala index 443b713f7..f14651f83 100644 --- a/src/Builder4/WindowLeftTree.vala +++ b/src/Builder4/WindowLeftTree.vala @@ -1398,6 +1398,7 @@ public class Xcls_WindowLeftTree : Object return; } m.append(f.tree); + // expand??? /* @@ -1420,7 +1421,7 @@ public class Xcls_WindowLeftTree : Object //_this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32); _this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION); - + _this.updateErrors(); return; -- 2.39.2