"gen_extended" : false,
"items" : [
{
+ "# Gee.ArrayList<Gtk.Widget>? error_widgets" : "null",
"# JsRender.JsRender file" : "",
"# JsRender.Node node" : "",
"# Xcls_MainWindow main_window" : "null",
"\t_this.view.popover.show(",
"\t\t_this.view.el, ",
"\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
+ "\t\t new JsRender.NodeProp.user(\"\", \"string\", \"\") ,",
"\t\t-1, ",
"\t\ttrue",
"\t);",
" _this.view.popover.show(",
"\t\t_this.view.el, ",
"\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
+ "\t\t new JsRender.NodeProp.user(\"\", \"int\", \"0\") ,",
"\t\t-1, ",
"\t\ttrue",
"\t);",
" _this.view.popover.show(",
"\t\t_this.view.el, ",
"\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
+ "\t\t new JsRender.NodeProp.user(\"\", \"bool\", \"true\") ,",
"\t\t-1, ",
"\t\ttrue",
"\t); ",
"id" : "EditProps",
"items" : [
{
+ "# Xcls_PopoverProperty popover" : "null",
"$ enable_tree_lines" : true,
"$ headers_visible" : true,
"$ xns" : "Gtk",
- "* init" : [
- "{",
- " ",
- " \tthis.css = new Gtk.CssProvider();",
- "\t ",
- "\t\tthis.css.load_from_string(\"",
- "#leftprops-view { font-size: 12px;}",
- "\t ",
- "#leftprops-view dropdown button { ",
- "\t\t\tmin-height: 16px;\t\t\t ",
- "\t\t\toutline-offset : 0;",
- "\t\t}",
- "#leftprops-view cell dropdown label {",
- " \t\tpadding-top:0px;",
- "\t\tpadding-bottom:0px;",
- "}",
- "#leftprops-view cell { ",
- " \t\tpadding-top:2px;",
- "\t\tpadding-bottom:2px;",
- "\t\t}",
- "#leftprops-view cell label, #leftprops-view cell editablelable {",
- " \t\tpadding-top:4px;",
- "\t\tpadding-bottom:4px;",
- "}\");",
- " ",
- "\t\tGtk.StyleContext.add_provider_for_display(",
- "\t\tthis.el.get_display(),",
- "\t\tthis.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
- "\t);",
- "\t\t",
- " ",
- "}",
- ""
- ],
"* pack" : "set_child",
- "Gtk.CssProvider css" : "",
- "Xcls_PopoverProperty popover" : "null",
"bool hexpand" : true,
"bool show_row_separators" : true,
"bool single_click_activate" : false,
"items" : [
{
"$ xns" : "Gtk",
+ "bool has_frame" : false,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "string label" : "Delete Property / Method",
+ "xtype" : "Label"
+ }
+ ],
"listeners" : {
"clicked" : [
"( ) => {",
" \t\t ",
" \t}",
" \t*/",
- "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
+ "\t\t//GLib.debug(\"Get Widget At Row %d\", (int)row);",
" var child = this.el.get_first_child(); ",
" \tvar line_no = -1; ",
" \tvar reading_header = true;",
"",
" \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 if (reading_header) {",
"\t\t\t ",
"\t\t\t ",
"\t\t }",
"\t\t line_no++;",
"\t\t\tif (line_no == row) {",
- "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
+ "\t\t\t\t//GLib.debug(\"Returning widget %s\", child.get_type().name());",
"\t\t\t return (Gtk.Widget)child;",
"\t\t }",
"\t child = child.get_next_sibling(); ",
" \t}",
- "\t\tGLib.debug(\"Rturning null\");",
+ "\t\t//GLib.debug(\"Rturning null\");",
" return null;",
"",
" }"
" }"
],
"| int getRowAt" : [
- "(double x, double in_y, out string pos) {",
- "",
+ "(double x, double y, out string pos) {",
"",
+ "\tpos = \"\";",
+ "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
+ "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
+ "\tif (w == null) {",
+ "\t\treturn -1;",
+ "\t}",
+ "\t",
+ "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
+ "\tif (row == null) {",
+ "\t\treturn -1;",
+ "\t}",
+ "\t",
+ "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
"\t ",
- "",
- "/*",
- " \t",
- "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
- " \tvar colview = gesture.widget;",
- " \tvar line_no = check_list_widget(colview, x,y);",
- " if (line_no > -1) {",
- " \t\tvar item = colview.model.get_item(line_no);",
- " \t\t ",
- " \t}",
- " \t*/",
- " \t\t ",
- " \t\t",
- " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
- " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
- " var child = this.el.get_first_child(); ",
- " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
- " \tvar line_no = -1; ",
- " \tvar reading_header = true;",
- " \tvar real_y = 0;",
- " \tvar header_height = 0;",
- " \tpos = \"none\";",
- " \tvar h = 0;",
- " \twhile (child != null) {",
- "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
- " \t if (reading_header) {",
- "\t\t\t\t",
- "",
- "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
- "\t\t\t h += child.get_height();",
- "\t\t\t\t\tchild = child.get_next_sibling();",
- "\t\t\t\t\tcontinue;",
- "\t\t\t\t}",
- "\t\t\t\t// should be columnlistview",
- "\t\t\t\tchild = child.get_first_child(); ",
- "\t\t\t GLib.debug(\"header height=%d\", h);",
- "\t\t\t\theader_height = h;",
- "\t\t\t\t",
- "\t\t\t\treading_header = false;",
- "\t\t\t\t",
- "\t }",
- "\t ",
- "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
- " \t\t child = child.get_next_sibling();",
- " \t\t continue;",
- "\t\t }",
- "\t\t ",
- "\t\t \tif (y < header_height) {",
- "\t\t \treturn -1;",
- "\t \t}",
- "\t\t ",
- "\t\t line_no++;",
- "\t\t\tvar hh = child.get_height();",
- "\t\t\t//child.get_allocation(out alloc);",
- "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
- "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
- "\t\t\t",
- "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
- "",
- "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
- "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
- "\t\t \t\tpos = \"below\";",
- "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
- "\t \t\t\tpos = \"over\";",
- " \t\t\t} else {",
- " \t\t\t\tpos = \"above\";",
- "\t\t\t\t}",
- "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
- "\t\t\t return line_no;",
- "\t\t }",
- " ",
- "",
- "\t\t if (real_y + hh > y) {",
- "\t\t return -1;",
- "\t }",
- "\t real_y += hh;",
- "\t child = child.get_next_sibling(); ",
- " \t}",
- " return -1;",
- "",
+ "\tvar rn = 0;",
+ "\tvar cr = row;",
+ "\t ",
+ "\twhile (cr.get_prev_sibling() != null) {",
+ "\t\trn++;",
+ "\t\tcr = cr.get_prev_sibling();",
+ "\t}",
+ "\t",
+ "\t//GLib.debug(\"row number is %d\", rn);",
+ "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
+ "\t// above or belw",
+ "\tGraphene.Rect bounds;",
+ "\trow.compute_bounds(this.el, out bounds);",
+ "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
+ "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
+ "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
+ "\t//\t);",
+ "\tvar ypos = y - bounds.get_y();",
+ "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
+ "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
+ "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
+ "\tpos = \"over\";",
+ "\t",
+ "\tif (rpos > 80) {",
+ "\t\tpos = \"below\";",
+ "\t} else if (rpos < 20) {",
+ "\t\tpos = \"above\";",
+ "\t} ",
+ "\treturn rn;",
" }"
],
"| void editProp" : [
"",
"}"
],
- "| void a_addProp" : [
- " (JsRender.NodeProp prop) {",
- " // info includes key, val, skel, etype..",
- " //console.dump(info);",
- " //type = info.type.toLowerCase();",
- " //var data = this.toJS();",
- " ",
- " ",
- " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
- " if (this.node.listeners.has_key(prop.name)) {",
- " return;",
- " }",
- " this.node.listeners.set(prop.name,prop);",
- " } else {",
- " assert(this.node != null);",
- " assert(this.node.props != null);",
- " if (this.node.props.has_key(prop.to_index_key())) {",
- " return;",
- " }",
- " this.node.props.set(prop.to_index_key(),prop);",
- " }",
- " ",
- " ",
- " // add a row???",
- " this.load(this.file, this.node);",
- " ",
- " ",
- " ",
- " ",
- " GLib.debug(\"trying to find new iter\");",
- " ",
- " ",
- " ",
- "}",
- ""
- ],
"| void deleteSelected" : [
" () {",
" ",
" if (node ==null) {",
" return ;",
" }",
- " node.loadProps(this.model.el); ",
+ "",
+ " node.loadProps(this.model.el, _this.main_window.windowstate.project); ",
" ",
" ",
" //GLib.debug(\"clear selection\\n\");",
],
"| 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(\"node-err\")) {",
+ "\t\tif (this.error_widgets == null || this.error_widgets.size < 1) {",
+ " \t\treturn;",
+ "\t}",
+ "\tforeach(var child in this.error_widgets) {",
+ "\t",
+ "\t\tif (child.has_css_class(\"node-err\")) {",
"\t\t\tchild.remove_css_class(\"node-err\");",
"\t\t}",
"\t\tif (child.has_css_class(\"node-warn\")) {",
"\t\tif (child.has_css_class(\"node-depr\")) {",
"\t\t\tchild.remove_css_class(\"node-depr\");",
"\t\t}",
- "\t\t",
- " child = child.get_next_sibling(); ",
"\t}",
+ "\tthis.error_widgets = null;",
+ "\treturn;",
"\t//GLib.debug(\"Rturning null\");",
" ",
"}"
"| void updateErrors" : [
"() {",
"\tvar file = this.file;",
+ "\tif (file == null) {",
+ "\t\treturn;",
+ "\t}",
"\tvar ar = file.getErrors();",
- "\tif (ar.size < 1) {",
- "\t\tthis.removeErrors();",
+ "\tif (ar == null || ar.size < 1) {",
+ "\t\tif (this.last_error_counter != file.error_counter) {",
+ "\t\t\tthis.removeErrors();",
+ "\t\t}",
+ "",
"\t\tthis.last_error_counter = file.error_counter ;",
"",
"\t\treturn;",
"\t\treturn;",
"\t}",
"\tthis.removeErrors();",
- "\t",
+ "\tthis.error_widgets = new Gee.ArrayList<Gtk.Widget>();",
"\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 var node = file.lineToNode( (int)diag.range.start.line) ;",
+ "\t if (node == null || this.node == null || node.oid != this.node.oid) {",
"\t \tcontinue;",
" \t}",
" \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
- " \t",
+ " \tif (prop == null) {",
+ " \t\tcontinue;",
+ "\t\t}",
" \tvar row = _this.selmodel.propToRow(prop);",
" \tif (row < 0) {",
" \t\tcontinue;",
" \tif (w == null) {",
" \t\treturn;",
"\t\t}",
- "\t \t\tvar ed = diag.category.down();",
+ "",
+ "\t\t",
+ " \t\tvar ed = diag.category.down();",
"\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
"\t\t\tcontinue;",
"\t\t}",
+ "\t\tthis.error_widgets.add(w);\t\t",
"\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
"\t\t\tw.remove_css_class(\"node-warn\");",
"\t\t}",