Fix #8046 - meson generation option (so we can edit the language server..)
[roobuilder] / src / Builder4 / WindowLeftProps.bjs
index d410cf7..c59b667 100644 (file)
@@ -3,6 +3,7 @@
  "gen_extended" : false,
  "items" : [
   {
+   "# Gee.ArrayList<Gtk.Widget>? error_widgets" : "null",
    "# JsRender.JsRender file" : "",
    "# JsRender.Node node" : "",
    "# Xcls_MainWindow main_window" : "null",
      "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,
              " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
              " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
              "",
-             "",
+             " if (item == null) {",
+             " \treturn;",
+             "}",
              "item.bind_property(\"to_display_name_prop\",",
              "                    lb, \"label\",",
              "                   GLib.BindingFlags.SYNC_CREATE);",
              "\tcb.hide();",
              "\t",
              "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
+             " \tif (prop == null || _this.node == null ) {",
+             " \t\tGLib.error(\"something is wrong\");",
+             "\t \t ",
+             "\t}",
+             "\tif ( _this.node.fqn() == \"\") {",
+             " \t\tGLib.debug(\"node is missing fqn\");",
+             "\t \treturn;",
+             "\t}",
+             "\t",
              "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
              "\t//GLib.debug(\"prop.val = %s\", prop.val);",
              "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
         "    \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  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\t}",
         "\t\tif (l.get_visible()) {",
         "\t\t \t_this.stop_editor();",
+        "\t\t \tif (prop.parent == null) {",
+        "\t\t \t\treturn;",
+        "\t \t\t}",
         "\t    \t_this.show_editor(_this.file, prop.parent, prop);",
         "\t\t",
         "\t\t}",
     "    \t",
     "    }",
     "    ",
-    "    GLib.debug(\"load leftprops\\n\");",
+    "    GLib.debug(\"load leftprops\");",
     "",
     "    this.node = node;",
     "    this.file = file;",
     "              ",
     "    //this.get('/RightEditor').el.hide();",
     "    if (node ==null) {",
+    "        GLib.debug(\"node is null return\");",
     "        return ;",
     "    }",
     "",
    ],
    "| void removeErrors" : [
     "() {",
-    "\tvar  child = this.view.el.get_first_child(); ",
-    " ",
-    "\tvar reading_header = true;",
-    " ",
-    "\twhile (child != null) {",
-    "\t\t//GLib.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\tcontinue;",
-    "\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\");",
     "     ",
     "}"
     "\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}",