Fix #8089 - phase 1 - code ast navigation
[roobuilder] / src / Builder4 / GtkView.bjs
index 34dc1dc..ca6a3fb 100644 (file)
@@ -1,23 +1,23 @@
 {
  "build_module" : "builder",
+ "gen_extended" : false,
  "items" : [
   {
    "# Gtk.Widget lastObj" : "null",
+   "# GtkSource.SearchContext searchcontext" : "",
    "# JsRender.JsRender file" : "null",
    "# Xcls_MainWindow main_window" : "",
+   "# int last_error_counter" : 0,
+   "# int last_search_end" : 0,
    "$ xns" : "Gtk",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-   "Gtk.SourceSearchContext searchcontext" : "",
    "bool hexpand" : true,
    "bool vexpand" : true,
    "id" : "GtkView",
-   "int height" : 0,
-   "int last_search_end" : 0,
-   "int width" : 0,
    "items" : [
     {
      "$ xns" : "Gtk",
-     "* pack" : "pack_start,true,true,0",
+     "Gtk.Overflow overflow" : "Gtk.Overflow.VISIBLE",
      "id" : "notebook",
      "items" : [
       {
@@ -40,7 +40,7 @@
        "items" : [
         {
          "$ xns" : "Gtk",
-         "* pack" : "add",
+         "* pack" : "set_child",
          "id" : "view_layout",
          "items" : [
           {
@@ -51,7 +51,8 @@
            "xtype" : "Box"
           }
          ],
-         "xtype" : "Layout"
+         "string name" : "gtkview-view-layout",
+         "xtype" : "Fixed"
         }
        ],
        "xtype" : "ScrolledWindow"
       {
        "$ xns" : "Gtk",
        "* pack" : "append_page,_this.label_code.el",
+       "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+       "int spacing" : 0,
        "items" : [
         {
          "$ xns" : "Gtk",
-         "* init" : [
-          "{",
-          "   ",
-          "    var description =   Pango.FontDescription.from_string(\"monospace\");",
-          "    description.set_size(8000);",
-          "    this.el.override_font(description);",
-          "",
-          "    this.loading = true;",
-          "    var buf = this.el.get_buffer();",
-          "    buf.notify.connect((ps) => {",
-          "        if (this.loading) {",
-          "            return;",
-          "        }",
-          "        if (ps.name != \"cursor-position\") {",
-          "            return;",
-          "        }",
-          "        print(\"cursor changed : %d\\n\", buf.cursor_position);",
-          "        Gtk.TextIter cpos;",
-          "        buf.get_iter_at_offset(out cpos, buf.cursor_position);",
-          "        ",
-          "        var ln = cpos.get_line();",
-          " ",
-          "        var node = _this.file.lineToNode(ln);",
-          " ",
-          "        if (node == null) {",
-          "            print(\"can not find node\\n\");",
-          "            return;",
-          "        }",
-          "        var ltree = _this.main_window.windowstate.left_tree;",
-          "        var tp = ltree.model.treePathFromNode(node);",
-          "        print(\"got tree path %s\\n\", tp);",
-          "        if (tp != \"\") {",
-          "\t       this.allow_node_scroll = false;        ",
-          "\t       print(\"changing cursor on tree..\\n\");",
-          "            ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);",
-          "            // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
-          "            GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {",
-          "\t            this.allow_node_scroll = true;",
-          "\t            return false;",
-          "            });",
-          "        }",
-          "        ",
-          "        // highlight the node..",
-          "        ",
-          "    });",
-          "  ",
-          "  ",
-          "  ",
-          "    var attrs = new Gtk.SourceMarkAttributes();",
-          "    var  pink =   Gdk.RGBA();",
-          "    pink.parse ( \"pink\");",
-          "    attrs.set_background ( pink);",
-          "    attrs.set_icon_name ( \"process-stop\");    ",
-          "    attrs.query_tooltip_text.connect(( mark) => {",
-          "        //print(\"tooltip query? %s\\n\", mark.name);",
-          "        return mark.name;",
-          "    });",
-          "    ",
-          "    this.el.set_mark_attributes (\"ERR\", attrs, 1);",
-          "    ",
-          "     var wattrs = new Gtk.SourceMarkAttributes();",
-          "    var  blue =   Gdk.RGBA();",
-          "    blue.parse ( \"#ABF4EB\");",
-          "    wattrs.set_background ( blue);",
-          "    wattrs.set_icon_name ( \"process-stop\");    ",
-          "    wattrs.query_tooltip_text.connect(( mark) => {",
-          "        //print(\"tooltip query? %s\\n\", mark.name);",
-          "        return mark.name;",
-          "    });",
-          "    ",
-          "    this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
-          "    ",
-          " ",
-          "    ",
-          "     var dattrs = new Gtk.SourceMarkAttributes();",
-          "    var  purple =   Gdk.RGBA();",
-          "    purple.parse ( \"#EEA9FF\");",
-          "    dattrs.set_background ( purple);",
-          "    dattrs.set_icon_name ( \"process-stop\");    ",
-          "    dattrs.query_tooltip_text.connect(( mark) => {",
-          "        //print(\"tooltip query? %s\\n\", mark.name);",
-          "        return mark.name;",
-          "    });",
-          "    ",
-          "    this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
-          "    ",
-          "    ",
-          "    var gattrs = new Gtk.SourceMarkAttributes();",
-          "    var  grey =   Gdk.RGBA();",
-          "    grey.parse ( \"#ccc\");",
-          "    gattrs.set_background ( grey);",
-          " ",
-          "    ",
-          "    this.el.set_mark_attributes (\"grey\", gattrs, 1);",
-          "    ",
-          "    ",
-          "    ",
-          "    ",
-          "    ",
-          "    ",
-          "}",
-          " "
-         ],
-         "* pack" : "add",
-         "bool allow_node_scroll" : true,
-         "bool loading" : true,
-         "gboolean editable" : false,
-         "gboolean show_line_marks" : true,
-         "gboolean show_line_numbers" : true,
-         "id" : "sourceview",
-         "xtype" : "SourceView",
-         "| string toString" : [
-          "() {",
-          "   Gtk.TextIter s;",
-          "    Gtk.TextIter e;",
-          "    this.el.get_buffer().get_start_iter(out s);",
-          "    this.el.get_buffer().get_end_iter(out e);",
-          "    var ret = this.el.get_buffer().get_text(s,e,true);",
-          "    //print(\"TO STRING? \" + ret);",
-          "    return ret;",
-          "}",
-          ""
-         ],
-         "| void highlightErrorsJson" : [
-          " (string type, Json.Object obj) {",
-          "      Gtk.TextIter start;",
-          "     Gtk.TextIter end;   ",
-          "     ",
-          "     var buf =  this.el.get_buffer();",
-          "       var sbuf = (Gtk.SourceBuffer)buf;",
-          "        buf.get_bounds (out start, out end);",
-          "        ",
-          "        sbuf.remove_source_marks (start, end, type);",
-          "                 ",
-          "     ",
-          "     // we should highlight other types of errors..",
-          "    ",
-          "    if (!obj.has_member(type)) {",
-          "        print(\"Return has no errors\\n\");",
-          "        return  ;",
-          "    }",
-          "    var err = obj.get_object_member(type);",
-          "    ",
-          "    if (_this.file == null) { ",
-          "        return; // just in case the file has not loaded yet?",
-          "    }",
-          " ",
-          "",
-          "    var valafn = \"\";",
-          "      try {             ",
-          "           var  regex = new Regex(\"\\\\.bjs$\");",
-          "        ",
-          "         ",
-          "            valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
-          "         } catch (GLib.RegexError e) {",
-          "            return;",
-          "        }   ",
-          "",
-          "   if (!err.has_member(valafn)) {",
-          "        print(\"File path has no errors\\n\");",
-          "        return  ;",
-          "    }",
-          "    var lines = err.get_object_member(valafn);",
-          "    ",
-          "   ",
-          "    ",
-          "    var tlines = buf.get_line_count () +1;",
-          "    ",
-          "    lines.foreach_member((obj, line, node) => {",
-          "        ",
-          "             Gtk.TextIter iter;",
-          "    //        print(\"get inter\\n\");",
-          "            var eline = int.parse(line) -1  ;",
-          "            print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);",
-          "            ",
-          "            ",
-          "            if (eline > tlines || eline < 0) {",
-          "                return;",
-          "            }",
-          "            sbuf.get_iter_at_line( out iter, eline);",
-          "            //print(\"mark line\\n\");",
-          "            var msg  = type + \" on line: %d - %s\".printf(eline+1, valafn);",
-          "            var ar = lines.get_array_member(line);",
-          "            for (var i = 0 ; i < ar.get_length(); i++) {",
-          "\t\t    msg += (msg.length > 0) ? \"\\n\" : \"\";",
-          "\t\t    msg += ar.get_string_element(i);",
-          "\t    }",
-          "            ",
-          "            ",
-          "            sbuf.create_source_mark(msg, type, iter);",
-          "        } );",
-          "        return  ;",
-          "    ",
-          " ",
-          "",
-          "",
-          "}"
+         "bool vexpand" : true,
+         "id" : "sourceviewscroll",
+         "items" : [
+          {
+           "# JsRender.Node? node_selected" : "",
+           "# bool loading" : false,
+           "# string prop_selected" : "\"\"",
+           "$ xns" : "GtkSource",
+           "* init" : [
+            "{",
+            "",
+            "  ",
+            "\tthis.loading = true;",
+            "",
+            " ",
+            "\tvar attrs = new GtkSource.MarkAttributes();",
+            "\t attrs.set_icon_name ( \"process-stop\");    ",
+            "\tattrs.query_tooltip_text.connect(( mark) => {",
+            "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+            "\t\treturn mark.name;",
+            "\t});",
+            "",
+            "\tthis.el.set_mark_attributes (\"ERR\", attrs, 1);",
+            "",
+            "\t var wattrs = new GtkSource.MarkAttributes();",
+            "\t  wattrs.set_icon_name ( \"process-stop\");    ",
+            "\twattrs.query_tooltip_text.connect(( mark) => {",
+            "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+            "\t\treturn mark.name;",
+            "\t});",
+            "",
+            "\tthis.el.set_mark_attributes (\"WARN\", wattrs, 1);",
+            "",
+            "",
+            "",
+            "\t var dattrs = new GtkSource.MarkAttributes();",
+            "\tdattrs.set_icon_name ( \"process-stop\");    ",
+            "\tdattrs.query_tooltip_text.connect(( mark) => {",
+            "\t\t//print(\"tooltip query? %s\\n\", mark.name);",
+            "\t\treturn mark.name;",
+            "\t});",
+            "",
+            "\tthis.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
+            "",
+            "",
+            "\tvar gattrs = new GtkSource.MarkAttributes();",
+            "\tvar  grey =   Gdk.RGBA();",
+            "\tgrey.parse ( \"#ccc\");",
+            "\tgattrs.set_background ( grey);",
+            "",
+            "",
+            "\tthis.el.set_mark_attributes (\"grey\", gattrs, 1);",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "",
+            "\t}",
+            ""
+           ],
+           "* pack" : "set_child",
+           "css_classes" : "{ \"code-editor\" }",
+           "gboolean editable" : false,
+           "gboolean show_line_marks" : true,
+           "gboolean show_line_numbers" : true,
+           "id" : "sourceview",
+           "items" : [
+            {
+             "$ xns" : "GtkSource",
+             "* init" : [
+              "",
+              "var buf = this.el;",
+              "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
+              "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
+              "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
+              "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
+              "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
+              "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
+              "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
+              "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
+              "",
+              "",
+              "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
+              "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
+              "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
+              "",
+              "",
+              ""
+             ],
+             "* pack" : "set_buffer",
+             "bool dirty" : false,
+             "bool in_cursor_change" : false,
+             "id" : "buffer",
+             "int error_line" : "-1",
+             "int last_line" : "-1",
+             "listeners" : {
+              "cursor_moved" : [
+               "( ) => {",
+               "GLib.debug(\"cursor moved called\");",
+               "",
+               "",
+               " \tif (this.in_cursor_change ) {",
+               "        GLib.debug(\"cursor changed : %d [ignoring nested call)\", this.el.cursor_position);",
+               "        return;",
+               "    }",
+               "   ",
+               "    GLib.debug(\"cursor changed : %d\", this.el.cursor_position);",
+               "    Gtk.TextIter cpos;",
+               "    this.el.get_iter_at_offset(out cpos, this.el.cursor_position);",
+               "    ",
+               "    var ln = cpos.get_line();",
+               "    if (this.last_line == ln ){",
+               "    \treturn;",
+               "\t}",
+               "\tthis.last_line = ln;",
+               "    var node = _this.file.lineToNode(ln);",
+               "",
+               "    if (node == null) {",
+               "        print(\"can not find node\\n\");",
+               "        return;",
+               "    }",
+               "    this.in_cursor_change  = true;",
+               "    var ltree = _this.main_window.windowstate.left_tree;",
+               "    ltree.model.selectNode(node);",
+               "    this.in_cursor_change  = false;",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "Buffer"
+            },
+            {
+             "# bool is_control" : false,
+             "$ xns" : "Gtk",
+             "id" : "keystate",
+             "listeners" : {
+              "key_pressed" : [
+               "(keyval, keycode, state) => {",
+               "",
+               "\tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
+               " \t\tthis.is_control = true;",
+               "\t}",
+               "\t ",
+               "\t if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+               "\t    GLib.debug(\"SAVE: ctrl-g  pressed\");",
+               "\t\t_this.forwardSearch(true);",
+               "\t    return true;",
+               "\t}",
+               "    if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+               "\t    GLib.debug(\"SAVE: ctrl-f  pressed\");",
+               "\t\t_this.search_entry.el.grab_focus();",
+               "\t    return true;",
+               "\t}",
+               "\t ",
+               "\treturn false;",
+               "}\t ",
+               "\t"
+              ],
+              "key_released" : [
+               "(keyval, keycode, state) => {",
+               "",
+               "\t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
+               " \t\tthis.is_control = false;",
+               "\t}",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "EventControllerKey"
+            },
+            {
+             "# double distance" : "0.0f",
+             "$ xns" : "Gtk",
+             "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
+             "listeners" : {
+              "scroll" : [
+               "(dx, dy) => {",
+               "\tif (!_this.keystate.is_control) {",
+               "\t\treturn false;",
+               "\t}",
+               "\t//GLib.debug(\"scroll %f\",  dy);",
+               "\t",
+               "\tthis.distance += dy;",
+               "\t if (this.distance < -1) {",
+               "\t\tBuilderApplication.settings.editor_font_size ++;",
+               "\t\tthis.distance = 0;",
+               "\t}",
+               "\tif (this.distance > 1) {",
+               "\t\tBuilderApplication.settings.editor_font_size --;",
+               "\t\tthis.distance = 0;",
+               "\t}",
+               "",
+               "\treturn true;",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "EventControllerScroll"
+            }
+           ],
+           "listeners" : {
+            "query_tooltip" : [
+             "(x, y, keyboard_tooltip, tooltip) => {",
+             "\t",
+             "\t//GLib.debug(\"query tooltip\");",
+             "\tGtk.TextIter iter;",
+             "\tint trailing;",
+             "\t",
+             "\tvar yoff = (int) _this.sourceviewscroll.el.vadjustment.value;",
+             "\t",
+             "\tthis.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);",
+             "\t ",
+             "\tvar l = iter.get_line();",
+             "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
+             "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
+             "\tif (marks.is_empty()) {",
+             "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
+             "\t}",
+             "\tif (marks.is_empty()) {",
+             "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
+             "\t}",
+             "\t",
+             "\t// GLib.debug(\"query tooltip line marks %d\", (int) marks.length());",
+             "\tvar str = \"\";",
+             "\tmarks.@foreach((m) => { ",
+             "\t\t//GLib.debug(\"got mark %s\", m.name);",
+             "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.name;",
+             "\t});",
+             "\t",
+             "\t// true if there is a mark..",
+             "\ttooltip.set_text( str);",
+             "\treturn str.length > 0 ? true : false;",
+             "",
+             "}",
+             ""
+            ]
+           },
+           "string name" : "gtkview-view",
+           "uint tab_width" : 4,
+           "xtype" : "View",
+           "| string toString" : [
+            "() {",
+            "   Gtk.TextIter s;",
+            "    Gtk.TextIter e;",
+            "    this.el.get_buffer().get_start_iter(out s);",
+            "    this.el.get_buffer().get_end_iter(out e);",
+            "    var ret = this.el.get_buffer().get_text(s,e,true);",
+            "    //print(\"TO STRING? \" + ret);",
+            "    return ret;",
+            "}",
+            ""
+           ],
+           "| void loadFile" : [
+            "( ) {",
+            "    this.loading = true;",
+            "    var buf = this.el.get_buffer();",
+            "    buf.set_text(\"\",0);",
+            " ",
+            "\tvar cpos = buf.cursor_position;",
+            "    ",
+            "   \tprint(\"BEFORE LOAD cursor = %d\\n\", cpos);",
+            "        var vadj_pos = this.el.get_vadjustment().get_value();",
+            "",
+            "    if (_this.file == null || _this.file.xtype != \"Gtk\") {",
+            "        print(\"xtype != Gtk\");",
+            "        this.loading = false;",
+            "        return;",
+            "    }",
+            "    /*",
+            "    var valafn = \"\";",
+            "      try {             ",
+            "           var  regex = new Regex(\"\\\\.bjs$\");",
+            "        ",
+            "         ",
+            "            valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
+            "         } catch (GLib.RegexError e) {",
+            "             this.loading = false;",
+            "            return;",
+            "        }   ",
+            "    ",
+            "",
+            "   if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {",
+            "        print(\"File path has no errors\\n\");",
+            "        this.loading = false;",
+            "        return  ;",
+            "    }",
+            "    ",
+            "    string str;",
+            "    try {",
+            "    ",
+            "        GLib.FileUtils.get_contents (valafn, out str);",
+            "    } catch (Error e) {",
+            "        this.loading = false;",
+            "        return  ;",
+            "    }",
+            "    */",
+            "    var str = _this.file.toSource();",
+            "",
+            "//    print(\"setting str %d\\n\", str.length);",
+            "    buf.set_text(str, str.length);",
+            "    var lm = GtkSource.LanguageManager.get_default();",
+            "     ",
+            "    //?? is javascript going to work as js?",
+            "    ",
+            "    ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));",
+            "  ",
+            "     ",
+            "   _this.main_window.windowstate.updateErrorMarksAll(); ",
+            "   //  restore the cursor position?",
+            "    // after reloading the contents.",
+            "     GLib.Timeout.add(500, () => {",
+            "\t\t_this.buffer.in_cursor_change = true;",
+            "        print(\"RESORTING cursor to = %d\\n\", cpos);",
+            "\t\tGtk.TextIter cpos_iter;",
+            "\t\tbuf.get_iter_at_offset(out cpos_iter, cpos);",
+            "\t\tbuf.place_cursor(cpos_iter); ",
+            "\t\t",
+            "\t\tthis.el.get_vadjustment().set_value(vadj_pos);;",
+            "\t\t_this.buffer.in_cursor_change = false;",
+            " ",
+            "\t\t",
+            "\t\t",
+            "\t\t//_this.buffer.checkSyntax();",
+            "\t\treturn false;",
+            "\t});",
+            "  ",
+            "    ",
+            "    this.loading = false; ",
+            "}",
+            ""
+           ],
+           "| void nodeSelected" : [
+            "(JsRender.Node? sel, bool scroll) {",
+            "  ",
+            "    ",
+            "    if (this.loading) {",
+            "    \treturn;",
+            "\t}",
+            "    // this is connected in widnowstate",
+            "    print(\"Roo-view - node selected\\n\");",
+            "    var buf = this.el.get_buffer();",
+            " ",
+            "    var sbuf = (GtkSource.Buffer) buf;",
+            "",
+            "   ",
+            " ",
+            "    ",
+            "   ",
+            "    // clear all the marks..",
+            "     Gtk.TextIter start;",
+            "    Gtk.TextIter end;     ",
+            "        ",
+            "    sbuf.get_bounds (out start, out end);",
+            "    sbuf.remove_source_marks (start, end, \"grey\");",
+            "    ",
+            "        this.node_selected = sel;",
+            "     if (sel == null) {",
+            "        // no highlighting..",
+            "        return;",
+            "    }",
+            "    Gtk.TextIter iter;   ",
+            "    sbuf.get_iter_at_line(out iter,  sel.line_start);",
+            "    ",
+            "    ",
+            "    Gtk.TextIter cur_iter;",
+            "    sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);",
+            "    ",
+            "    ",
+            "    if (!_this.buffer.in_cursor_change) {",
+            "",
+            "    \tthis.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
+            "\t}  ",
+            "    ",
+            "     ",
+            "    ",
+            "    for (var i = 0; i < buf.get_line_count();i++) {",
+            "        if (i < sel.line_start || i > sel.line_end) {",
+            "           ",
+            "            sbuf.get_iter_at_line(out iter, i);",
+            "            sbuf.create_source_mark(null, \"grey\", iter);",
+            "            ",
+            "        }",
+            "    ",
+            "    }",
+            "    ",
+            "",
+            "}",
+            ""
+           ]
+          }
          ],
-         "| void loadFile" : [
-          "( ) {",
-          "    this.loading = true;",
-          "    var buf = this.el.get_buffer();",
-          "    buf.set_text(\"\",0);",
-          "    var sbuf = (Gtk.SourceBuffer) buf;",
-          "",
-          "    ",
-          "",
-          "    if (_this.file == null || _this.file.xtype != \"Gtk\") {",
-          "        print(\"xtype != Gtk\");",
-          "        this.loading = false;",
-          "        return;",
-          "    }",
-          "    ",
-          "    var valafn = \"\";",
-          "      try {             ",
-          "           var  regex = new Regex(\"\\\\.bjs$\");",
-          "        ",
-          "         ",
-          "            valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
-          "         } catch (GLib.RegexError e) {",
-          "             this.loading = false;",
-          "            return;",
-          "        }   ",
-          "    ",
-          "",
-          "   if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {",
-          "        print(\"File path has no errors\\n\");",
-          "        this.loading = false;",
-          "        return  ;",
-          "    }",
-          "    ",
-          "    string str;",
-          "    try {",
-          "    ",
-          "        GLib.FileUtils.get_contents (valafn, out str);",
-          "    } catch (Error e) {",
-          "        this.loading = false;",
-          "        return  ;",
-          "    }",
-          "",
-          "//    print(\"setting str %d\\n\", str.length);",
-          "    buf.set_text(str, str.length);",
-          "    var lm = Gtk.SourceLanguageManager.get_default();",
-          "     ",
-          "    //?? is javascript going to work as js?",
-          "    ",
-          "    ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));",
-          "  ",
-          "    ",
-          "    Gtk.TextIter start;",
-          "    Gtk.TextIter end;     ",
-          "        ",
-          "    sbuf.get_bounds (out start, out end);",
-          "    sbuf.remove_source_marks (start, end, null); // remove all marks..",
-          "    ",
-          "    ",
-          "    if (_this.main_window.windowstate.last_compile_result != null) {",
-          "        var obj = _this.main_window.windowstate.last_compile_result;",
-          "        this.highlightErrorsJson(\"ERR\", obj);",
-          "        this.highlightErrorsJson(\"WARN\", obj);",
-          "        this.highlightErrorsJson(\"DEPR\", obj);\t\t\t",
-          "    }",
-          "    //while (Gtk.events_pending()) {",
-          "     //   Gtk.main_iteration();",
-          "   // }",
-          "    ",
-          "    this.loading = false; ",
-          "}",
-          ""
+         "xtype" : "ScrolledWindow"
+        },
+        {
+         "$ xns" : "Gtk",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+         "bool homogeneous" : false,
+         "bool vexpand" : false,
+         "int spacing" : 0,
+         "items" : [
+          {
+           "$ xns" : "Gtk",
+           "Gtk.CssProvider css" : "",
+           "bool hexpand" : true,
+           "id" : "search_entry",
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "listeners" : {
+              "key_pressed" : [
+               "(keyval, keycode, state) => {",
+               "",
+               "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+               "\t    GLib.debug(\"SAVE: ctrl-g  pressed\");",
+               "\t\t_this.forwardSearch(true);",
+               "\t    return true;",
+               "\t}",
+               "    ",
+               "  ",
+               " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
+               "\t\t_this.forwardSearch(true);",
+               "\t\t",
+               "\t\t",
+               "\t    return true;",
+               "",
+               "\t}    ",
+               "   // print(event.key.keyval)",
+               "   ",
+               "    return false;",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "EventControllerKey"
+            }
+           ],
+           "listeners" : {
+            "search_changed" : [
+             " () => {",
+             "  \t ",
+             "\t_this.search(_this.search_entry.el.text);",
+             "\t _this.search_results.updateResults();",
+             "",
+             "\tGLib.Timeout.add_seconds(1,() => {",
+             "\t\t _this.search_results.updateResults();",
+             "\t\t return false;",
+             "\t });",
+             "\t  ",
+             "   ",
+             "    ",
+             "}"
+            ]
+           },
+           "string name" : "gtkview-search-entry",
+           "string placeholder_text" : "Press enter to search",
+           "uint search_delay" : 3,
+           "xtype" : "SearchEntry",
+           "| void forwardSearch" : [
+            "(bool change_focus) {",
+            "",
+            "",
+            "\t_this.forwardSearch(change_focus);",
+            "",
+            "/*",
+            "",
+            "\tswitch(_this.windowstate.state) {",
+            "\t\tcase WindowState.State.CODEONLY:",
+            "\t\t//case WindowState.State.CODE:",
+            "\t\t\t// search the code being edited..",
+            "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
+            "\t\t\t ",
+            "\t\t\tbreak;",
+            "\t\tcase WindowState.State.PREVIEW:",
+            "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
+            "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
+            "\t\t\t} else { ",
+            "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
+            "\t\t\t}",
+            "\t\t",
+            "\t\t\tbreak;",
+            "\t}",
+            "\t*/",
+            "\t",
+            "}",
+            ""
+           ]
+          },
+          {
+           "$ xns" : "Gtk",
+           "id" : "search_results",
+           "int margin_end" : 4,
+           "int margin_start" : 4,
+           "string label" : "No Results",
+           "xtype" : "Label",
+           "| void updateResults" : [
+            "() {",
+            "\tthis.el.visible = true;",
+            "\t",
+            "\tvar res = _this.searchcontext.get_occurrences_count();",
+            "\tif (res < 0) {",
+            "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
+            "\t\treturn;",
+            "\t}",
+            "",
+            "\t_this.nextBtn.el.sensitive = false;",
+            "\t_this.backBtn.el.sensitive = false;\t",
+            "",
+            "\tif (res > 0) {",
+            "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
+            "\t\t_this.nextBtn.el.sensitive = true;",
+            "\t\t_this.backBtn.el.sensitive = true;",
+            "\t\treturn;",
+            "\t} ",
+            "\t_this.search_results.el.label = \"No Matches\";",
+            "\t",
+            "}"
+           ]
+          },
+          {
+           "$ xns" : "Gtk",
+           "bool always_show_image" : true,
+           "bool sensitive" : false,
+           "id" : "nextBtn",
+           "listeners" : {
+            "clicked" : [
+             "( ) => {",
+             "_this.forwardSearch(true);",
+             "\t ",
+             "",
+             "}",
+             ""
+            ]
+           },
+           "string icon_name" : "go-down",
+           "xtype" : "Button"
+          },
+          {
+           "$ xns" : "Gtk",
+           "bool always_show_image" : true,
+           "bool sensitive" : false,
+           "id" : "backBtn",
+           "listeners" : {
+            "clicked" : [
+             "( ) => {",
+             "",
+             "_this.backSearch(true);",
+             "\t",
+             "}",
+             ""
+            ]
+           },
+           "string icon_name" : "go-up",
+           "xtype" : "Button"
+          },
+          {
+           "$ xns" : "Gtk",
+           "bool always_show_arrow" : true,
+           "bool always_show_image" : true,
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "* ctor" : "new Gtk.PopoverMenu.from_model(null)",
+             "* prop" : "popover",
+             "id" : "search_settings",
+             "items" : [
+              {
+               "$ xns" : "Gtk",
+               "* pack" : "set_child",
+               "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+               "int spacing" : 0,
+               "items" : [
+                {
+                 "$ xns" : "Gtk",
+                 "id" : "case_sensitive",
+                 "string label" : "Case Sensitive",
+                 "xtype" : "CheckButton"
+                },
+                {
+                 "$ xns" : "Gtk",
+                 "id" : "regex",
+                 "string label" : "Regex",
+                 "xtype" : "CheckButton"
+                },
+                {
+                 "$ xns" : "Gtk",
+                 "id" : "multiline",
+                 "string label" : "Multi-line (add \\n)",
+                 "xtype" : "CheckButton"
+                }
+               ],
+               "xtype" : "Box"
+              }
+             ],
+             "xtype" : "PopoverMenu"
+            }
+           ],
+           "string icon_name" : "emblem-system",
+           "xtype" : "MenuButton"
+          }
          ],
-         "| void nodeSelected" : [
-          "(JsRender.Node? sel) {",
-          "  ",
-          "    ",
-          "  ",
-          "    // this is connected in widnowstate",
-          "    print(\"Roo-view - node selected\\n\");",
-          "    var buf = this.el.get_buffer();",
-          " ",
-          "    var sbuf = (Gtk.SourceBuffer) buf;",
-          "",
-          "   ",
-          "    while(Gtk.events_pending()) {",
-          "        Gtk.main_iteration();",
-          "    }",
-          "    ",
-          "   ",
-          "    // clear all the marks..",
-          "     Gtk.TextIter start;",
-          "    Gtk.TextIter end;     ",
-          "        ",
-          "    sbuf.get_bounds (out start, out end);",
-          "    sbuf.remove_source_marks (start, end, \"grey\");",
-          "    ",
-          "    ",
-          "     if (sel == null) {",
-          "        // no highlighting..",
-          "        return;",
-          "    }",
-          "    Gtk.TextIter iter;   ",
-          "    sbuf.get_iter_at_line(out iter,  sel.line_start);",
-          "    ",
-          "    ",
-          "    Gtk.TextIter cur_iter;",
-          "    sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);",
-          "    ",
-          "    //var cur_line = cur_iter.get_line();",
-          "    //if (cur_line > sel.line_start && cur_line < sel.line_end) {",
-          "    ",
-          "    //} else {",
-          "    if (this.allow_node_scroll) {",
-          "\t\t ",
-          "    \tthis.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
-          "\t}",
-          "    ",
-          "     ",
-          "    ",
-          "    for (var i = 0; i < buf.get_line_count();i++) {",
-          "        if (i < sel.line_start || i > sel.line_end) {",
-          "           ",
-          "            sbuf.get_iter_at_line(out iter, i);",
-          "            sbuf.create_source_mark(null, \"grey\", iter);",
-          "            ",
-          "        }",
-          "    ",
-          "    }",
-          "    ",
-          "",
-          "}",
-          ""
-         ]
+         "xtype" : "Box"
         }
        ],
-       "xtype" : "ScrolledWindow"
+       "xtype" : "Box"
       }
      ],
      "xtype" : "Notebook"
     }
    ],
-   "listeners" : {
-    "size_allocate" : [
-     "(aloc) => {",
-     " ",
-     "    this.width = aloc.width;",
-     "    this.height =aloc.height;",
-     "}",
-     " "
-    ]
-   },
    "xtype" : "Box",
    "| int search" : [
-    "(string txt) {",
+    "(string in_txt) {",
     "\tthis.notebook.el.page = 1;",
-    " \tvar s = new Gtk.SourceSearchSettings();",
-    "\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();",
-    "\tthis.searchcontext = new Gtk.SourceSearchContext(buf,s);",
+    "\t",
+    " ",
+    "   ",
+    "\tvar s = new GtkSource.SearchSettings();",
+    "\ts.case_sensitive = _this.case_sensitive.el.active;",
+    "\ts.regex_enabled = _this.regex.el.active;\t",
+    "\ts.wrap_around = false;",
+    "\t",
+    "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
     "\tthis.searchcontext.set_highlight(true);",
-    "\ts.set_search_text(txt);",
+    "\tvar txt = in_txt;",
+    "\t",
+    "\tif (_this.multiline.el.active) {",
+    "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
+    "\t}",
     "\t",
+    "\ts.set_search_text(txt);",
     "\tGtk.TextIter beg, st,en;",
-    "\t ",
-    "\tbuf.get_start_iter(out beg);",
-    "\tthis.searchcontext.forward(beg, out st, out en);",
-    "\tthis.last_search_end  = 0;",
+    "\tbool has_wrapped_around;",
+    "\tthis.buffer.el.get_start_iter(out beg);",
+    "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
+    "\tthis.last_search_end = 0;",
+    "\t",
     "\treturn this.searchcontext.get_occurrences_count();",
     "",
-    "   ",
+    " ",
+    "    ",
+    "",
+    "}",
+    ""
+   ],
+   "| void backSearch" : [
+    "(bool change_focus) {",
+    "",
+    "\tif (this.searchcontext == null) {",
+    "\t\treturn;",
+    "\t} ",
+    "\t",
+    "\tGtk.TextIter beg, st,en;",
+    "\tbool has_wrapped_around;",
+    "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
+    "\t",
+    "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
+    "\t",
+    "\t\tthis.last_search_end = 0;",
+    "\t\treturn;",
+    "\t}",
+    "\tthis.last_search_end = en.get_offset();",
+    "\tif (change_focus) {",
+    "\t\tthis.sourceview.el.grab_focus();",
+    "\t}",
+    "\tthis.buffer.el.place_cursor(st);",
+    "\tthis.sourceview.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);",
+    "\tvar ln = st.get_line();",
+    "\tthis.highlightNodeAtLine(ln);",
+    "\t ",
     "}",
     ""
    ],
     "    }",
     "    ",
     "    ",
-    "    var filename = this.file.getIconFileName(false);",
-    "    ",
-    "    var  win = this.el.get_parent_window();",
-    "    var width = win.get_width();",
-    "    var height = win.get_height();",
-    "    try {",
-    "         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?",
-    "         screenshot.save(filename,\"png\");",
-    "    } catch (Error e) {",
-    "        ",
-    "    }",
+    " \tthis.file.widgetToIcon(this.container.el); ",
     "",
-    "   ",
+    "    ",
     "    return;",
     "    ",
     "    ",
     "     ",
     "    ",
     "    // should we hold until it's printed...",
-    "    ",
-    "      ",
-    "",
-    "    ",
-    "    ",
-    "",
+    "     ",
     "",
     "    ",
     "     ",
     "\t\treturn;",
     "\t}",
     "\tthis.notebook.el.page = 1;",
-    "\tGtk.TextIter beg, st,en, stl;",
-    "\t",
+    "\tGtk.TextIter beg, st,en;",
+    "\tbool has_wrapped_around;",
     "\tvar buf = this.sourceview.el.get_buffer();",
     "\tbuf.get_iter_at_offset(out beg, this.last_search_end);",
-    "\tif (!this.searchcontext.forward(beg, out st, out en)) {",
+    "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
     "\t\tthis.last_search_end = 0;",
-    "\t} else { ",
-    "\t\tthis.last_search_end = en.get_offset();",
-    "\t\tif (change_focus) {",
-    "\t\t\tthis.sourceview.el.grab_focus();\t",
+    "\t\treturn;",
+    "\t}",
+    "\tthis.last_search_end = en.get_offset();",
+    "\tif (change_focus) {",
+    "\t\tthis.sourceview.el.grab_focus();",
+    "\t}",
+    "\tbuf.place_cursor(st);",
+    "\t",
+    " ",
+    "\t ",
+    "\tthis.sourceview.el.scroll_to_iter(st,  0.0f, true, 0.0f, 0.5f);",
+    "\t",
+    "\t",
+    "\tvar ln = st.get_line();",
+    "\t",
+    "\tthis.highlightNodeAtLine(ln);",
+    "}\t",
+    "  "
+   ],
+   "| void highlightNodeAtLine" : [
+    "(int ln) {",
+    "",
+    "\t// this is done from clicking on the editor..",
+    "\t ",
+    "\t// highlight node...",
+    "\t",
+    "\t\t",
+    "    var node = _this.file.lineToNode(ln+1);",
+    " ",
+    "    if (node == null) {",
+    "        //print(\"can not find node\\n\");",
+    "        return;",
+    "    }",
+    "    var prop = node.lineToProp(ln+1);",
+    "    print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
+    "        ",
+    "        ",
+    "    // ---------- this selects the tree's node...",
+    "    ",
+    "    var ltree = _this.main_window.windowstate.left_tree;",
+    "    ltree.model.selectNode(node);",
+    "    //var tp = ltree.model.treePathFromNode(node);",
+    "    ",
+    "    //print(\"got tree path %s\\n\", tp);",
+    "    //if (tp == \"\") {",
+    "\t//\treturn;",
+    "\t//}",
+    "    //_this.sourceview.allow_node_scroll = false; /// block node scrolling..",
+    "\t       ",
+    "   ",
+    "    //print(\"changing cursor on tree..\\n\");",
+    "   ",
+    "",
+    "    ",
+    "    // let's try allowing editing on the methods.",
+    "    // a little klunky at present..",
+    "\t_this.sourceview.prop_selected = \"\";",
+    "\t/*",
+    "    if (prop != null) {",
+    "\t\t//see if we can find it..",
+    "\t\tvar kv = prop.split(\":\");",
+    "\t\tif (kv[0] == \"p\") {",
+    "\t\t",
+    "    \t\t//var k = prop.get_key(kv[1]);",
+    "    \t\t// fixme -- need to determine if it's an editable property...",
+    "    \t\t_this.sourceview.prop_selected = prop;",
+    "    \t\t",
+    "\t\t} else if (kv[0] == \"l\") {",
+    "\t\t\t _this.sourceview.prop_selected = prop;",
+    "\t\t\t",
     "\t\t}",
-    "\t\tbuf.place_cursor(st);",
-    "\t\tvar ln = st.get_line();",
-    "\t\tbuf.get_iter_at_line(out stl,ln);",
+    "    }",
+    "    */",
+    "    //ltree.view.setCursor(tp, \"editor\");",
+    "   // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
+    "   _this.sourceview.nodeSelected(node,false);",
+    "    ",
+    "            // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
+    "      //      GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {",
+    "\t  //          this.allow_node_scroll = true;",
+    "\t  //          return false;",
+    "      //      });",
+    "      //  }",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
+    "\t\t",
     "\t\t ",
-    "\t\tthis.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);",
-    "\t}",
     "",
     "}",
-    ""
+    " "
    ],
    "| void loadFile" : [
     "(JsRender.JsRender file) ",
     "        if (file.tree == null) {",
     "            return;",
     "        }",
+    "        this.last_error_counter = -1;",
     "        this.notebook.el.page = 0;// gtk preview ",
     "   ",
     "  ",
     "        ",
     "       this.file = file;     ",
     "        this.sourceview.loadFile();",
+    "       ",
     "        this.searchcontext = null;",
-    "        ",
-    "",
+    "        this.last_error_counter = -1;",
+    "\t\tthis.updateErrorMarks();",
     "        if (this.lastObj != null) {",
     "            this.container.el.remove(this.lastObj);",
     "        }",
     "        // hide the compile view at present..",
     "          ",
     "        ",
-    "        var w = this.width;",
-    "        var h = this.height;",
+    "        var w = this.el.get_width();",
+    "        var h = this.el.get_height();",
     "        ",
     "        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); ",
     "        ",
     "        print(\"SET SIZES %d, %d\\n\", w,h);       ",
     "        _this.container.el.set_size_request(w,h);",
     "        ",
-    "        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.",
-    "        var rgba = Gdk.RGBA ();",
-    "        rgba.parse (\"#ccc\");",
-    "        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);",
-    "        ",
-    "        ",
-    "\tvar x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);",
-    "        var obj = x.munge() as Gtk.Widget;",
-    "        this.lastObj = null;",
-    "\tif (obj == null) {",
-    "        \treturn;",
-    "\t}",
-    "\tthis.lastObj = obj;",
-    "        ",
-    "        this.container.el.add(obj);",
-    "        obj.show_all();",
+    "        _this.view_layout.el.set_size_request(w,h); ",
+    "        // should be baded on calc.. -- see update_scrolled.",
+    "       ",
+    "       var fc = this.container.el.get_first_child();",
+    "       if (fc != null) {",
+    "       \t\tthis.container.el.remove(fc);",
+    "   \t\t}",
     "        ",
+    "   \t\tvar xmlstr = JsRender.NodeToGlade.mungeFile( file);",
+    "   \t\tvar builder = new Gtk.Builder();",
+    "   \t\ttry {",
+    "\t   \t\tif (!builder.add_from_string(xmlstr, xmlstr.length)) {",
+    "\t   \t\t\treturn;",
+    "\t\t\t}",
+    "\t\t} catch(GLib.Error e) {",
+    "\t\t\tGLib.debug(e.message);",
+    "\t\t\treturn;",
+    "\t\t}",
+    "   \t\t",
+    "",
+    "   \t\tvar obj = (Gtk.Widget) builder.get_object(\"w\"+ file.tree.oid.to_string());",
+    "   \t\t this.container.el.append(obj);",
+    "\t    obj.show();",
+    "        this.createThumb();",
     "         ",
+    "        \t ",
+    "       ",
     "        ",
     "}",
     " "
    ],
    "| void scroll_to_line" : [
     "(int line) {",
-    "   this.notebook.el.page = 1;// code preview...",
+    "  // code preview...",
     "   ",
-    "   GLib.Timeout.add(500, () => {",
+    "   GLib.Timeout.add(100, () => {",
     "   ",
     "   ",
-    "\t   ",
+    "\t    this.notebook.el.set_current_page(1);",
     "\t   ",
     "\t\t  var buf = this.sourceview.el.get_buffer();",
     "\t ",
-    "\t\tvar sbuf = (Gtk.SourceBuffer) buf;",
+    "\t\tvar sbuf = (GtkSource.Buffer) buf;",
     "",
     "",
     "\t\tGtk.TextIter iter;   ",
     "   ",
     "}",
     ""
+   ],
+   "| void updateErrorMarks" : [
+    "() {",
+    "\t",
+    " ",
+    "",
+    "\tvar buf = _this.buffer.el;",
+    "\tGtk.TextIter start;",
+    "\tGtk.TextIter end;     ",
+    "\tbuf.get_bounds (out start, out end);",
+    "",
+    "",
+    " ",
+    "\t//GLib.debug(\"highlight errors\");\t\t ",
+    "",
+    "\t // we should highlight other types of errors..",
+    "",
+    " ",
+    "",
+    "\t ",
+    "\tif (_this.file == null) {",
+    "\t\tGLib.debug(\"file is null?\");",
+    "\t\treturn;",
+    "",
+    "\t}",
+    "\tvar ar = this.file.getErrors();",
+    "\tif (ar.size < 1) {",
+    "\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, \"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\t//GLib.debug(\"higjlight has no errors\");",
+    "\t\treturn;",
+    "\t}",
+    " \tif (this.last_error_counter == file.error_counter) {",
+    "\t\treturn;",
+    "\t}",
+    "\t",
+    "",
+    " ",
+    "\t ",
+    "",
+    "\tvar tlines = buf.get_line_count () +1;",
+    "\t",
+    " ",
+    "\t ",
+    "\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);",
+    "\tforeach(var diag in ar) { ",
+    "\t",
+    "\t\t",
+    "\t     Gtk.TextIter iter;",
+    "//        print(\"get inter\\n\");",
+    "\t    var eline = (int)diag.range.start.line ;",
+    "\t    var eline_to = (int)diag.range.end.line;",
+    "\t    if (eline > tlines || eline < 0) {",
+    "\t        return;",
+    "\t    }",
+    "\t   ",
+    "\t    ",
+    "\t    buf.get_iter_at_line( out iter, eline);",
+    "\t   ",
+    "\t  \t buf.get_iter_at_line_offset( out start, ",
+    " \t    \teline, (int)diag.range.start.character); ",
+    " \t    buf.get_iter_at_line_offset( out end, ",
+    " \t    \teline_to, (int)diag.range.end.character); ",
+    " \t    \t",
+    "\t    buf.apply_tag_by_name(diag.category, start, end);",
+    "\t   ",
+    "\t   ",
+    "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
+    "\t    buf.create_source_mark( msg, diag.category, iter);",
+    "\t    GLib.debug(\"set line %d to %s\", eline, msg);",
+    "\t    //this.marks.set(eline, msg);",
+    "\t}",
+    "\tthis.last_error_counter = file.error_counter ;",
+    "",
+    "",
+    "",
+    " ",
+    "",
+    "}"
    ]
   }
  ],
- "modOrder" : "",
- "name" : "GtkView",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/GtkView.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "GtkView"
 }
\ No newline at end of file