Fix #8089 - phase 1 - code ast navigation
[roobuilder] / src / Builder4 / GtkView.bjs
index 5436a60..ca6a3fb 100644 (file)
 {
- "name" : "GtkView",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/GtkView.bjs",
- "permname" : "",
- "modOrder" : "",
  "build_module" : "builder",
+ "gen_extended" : false,
  "items" : [
   {
-   "listeners" : {
-    "size_allocate" : "(aloc) => {\n \n    this.width = aloc.width;\n    this.height =aloc.height;\n}\n "
-   },
-   "| void scroll_to_line" : "(int line) {\n   this.notebook.el.page = 1;// code preview...\n   \n   GLib.Timeout.add(500, () => {\n   \n   \n\t   \n\t   \n\t\t  var buf = this.sourceview.el.get_buffer();\n\t \n\t\tvar sbuf = (Gtk.SourceBuffer) buf;\n\n\n\t\tGtk.TextIter iter;   \n\t\tsbuf.get_iter_at_line(out iter,  line);\n\t\tthis.sourceview.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);\n\t\treturn false;\n\t});   \n\n   \n}\n",
-   "id" : "GtkView",
    "# Gtk.Widget lastObj" : "null",
-   "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    // only screenshot the gtk preview..\n    if (this.notebook.el.page > 0 ) {\n        return;\n    }\n    \n    \n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n    try {\n         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n         screenshot.save(filename,\"png\");\n    } catch (Error e) {\n        \n    }\n\n   \n    return;\n    \n    \n     \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
-   "| void loadFile" : "(JsRender.JsRender file) \n{\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.notebook.el.page = 0;// gtk preview \n   \n  \n        \n       this.file = file;     \n        this.sourceview.loadFile();\n        this.searchcontext = null;\n        \n\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n        \n        // hide the compile view at present..\n          \n        \n        var w = this.width;\n        var h = this.height;\n        \n        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); \n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = int.max (w-20, 500);\n        h = int.max (h-20, 500); \n        \n        print(\"SET SIZES %d, %d\\n\", w,h);       \n        _this.container.el.set_size_request(w,h);\n        \n        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.\n        var rgba = Gdk.RGBA ();\n        rgba.parse (\"#ccc\");\n        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);\n        \n        \n\tvar x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n        \n         \n        \n}\n ",
-   "int width" : 0,
-   "bool hexpand" : true,
-   "| int search" : "(string txt) {\n\tthis.notebook.el.page = 1;\n \tvar s = new Gtk.SourceSearchSettings();\n\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();\n\tthis.searchcontext = new Gtk.SourceSearchContext(buf,s);\n\tthis.searchcontext.set_highlight(true);\n\ts.set_search_text(txt);\n\t\n\tGtk.TextIter beg, st,en;\n\t \n\tbuf.get_start_iter(out beg);\n\tthis.searchcontext.forward(beg, out st, out en);\n\tthis.last_search_end  = 0;\n\treturn this.searchcontext.get_occurrences_count();\n\n   \n}\n",
-   "int last_search_end" : 0,
-   "xtype" : "Box",
-   "Gtk.SourceSearchContext searchcontext" : "",
+   "# GtkSource.SearchContext searchcontext" : "",
    "# JsRender.JsRender file" : "null",
-   "int height" : 0,
+   "# Xcls_MainWindow main_window" : "",
+   "# int last_error_counter" : 0,
+   "# int last_search_end" : 0,
    "$ xns" : "Gtk",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-   "# Xcls_MainWindow main_window" : "",
-   "| void forwardSearch" : "(bool change_focus) {\n\n\tif (this.searchcontext == null) {\n\t\treturn;\n\t}\n\tthis.notebook.el.page = 1;\n\tGtk.TextIter beg, st,en, stl;\n\t\n\tvar buf = this.sourceview.el.get_buffer();\n\tbuf.get_iter_at_offset(out beg, this.last_search_end);\n\tif (!this.searchcontext.forward(beg, out st, out en)) {\n\t\tthis.last_search_end = 0;\n\t} else { \n\t\tthis.last_search_end = en.get_offset();\n\t\tif (change_focus) {\n\t\t\tthis.sourceview.el.grab_focus();\t\n\t\t}\n\t\tbuf.place_cursor(st);\n\t\tvar ln = st.get_line();\n\t\tbuf.get_iter_at_line(out stl,ln);\n\t\t \n\t\tthis.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);\n\t}\n\n}\n",
+   "bool hexpand" : true,
+   "bool vexpand" : true,
+   "id" : "GtkView",
    "items" : [
     {
-     "id" : "notebook",
-     "xtype" : "Notebook",
-     "* pack" : "pack_start,true,true,0",
      "$ xns" : "Gtk",
+     "Gtk.Overflow overflow" : "Gtk.Overflow.VISIBLE",
+     "id" : "notebook",
      "items" : [
       {
-       "id" : "label_preview",
-       "xtype" : "Label",
-       "* pack" : false,
        "$ xns" : "Gtk",
-       "utf8 label" : "Preview"
+       "* pack" : false,
+       "id" : "label_preview",
+       "utf8 label" : "Preview",
+       "xtype" : "Label"
       },
       {
-       "id" : "label_code",
-       "* pack" : false,
-       "xtype" : "Label",
        "$ xns" : "Gtk",
-       "utf8 label" : "Preview Generated Code"
+       "* pack" : false,
+       "id" : "label_code",
+       "utf8 label" : "Preview Generated Code",
+       "xtype" : "Label"
       },
       {
-       "* pack" : "append_page,_this.label_preview.el",
-       "xtype" : "ScrolledWindow",
        "$ xns" : "Gtk",
+       "* pack" : "append_page,_this.label_preview.el",
        "items" : [
         {
-         "id" : "view_layout",
-         "* pack" : "add",
-         "xtype" : "Layout",
          "$ xns" : "Gtk",
+         "* pack" : "set_child",
+         "id" : "view_layout",
          "items" : [
           {
-           "id" : "container",
-           "xtype" : "Box",
-           "* pack" : "put,10,10",
            "$ xns" : "Gtk",
-           "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL"
+           "* pack" : "put,10,10",
+           "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+           "id" : "container",
+           "xtype" : "Box"
           }
-         ]
+         ],
+         "string name" : "gtkview-view-layout",
+         "xtype" : "Fixed"
         }
-       ]
+       ],
+       "xtype" : "ScrolledWindow"
       },
       {
-       "xtype" : "ScrolledWindow",
-       "* pack" : "append_page,_this.label_code.el",
        "$ xns" : "Gtk",
+       "* pack" : "append_page,_this.label_code.el",
+       "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+       "int spacing" : 0,
        "items" : [
         {
-         "gboolean show_line_marks" : true,
-         "id" : "sourceview",
-         "* init" : "{\n   \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(8000);\n    this.el.override_font(description);\n\n    this.loading = true;\n    var buf = this.el.get_buffer();\n    buf.notify.connect((ps) => {\n        if (this.loading) {\n            return;\n        }\n        if (ps.name != \"cursor-position\") {\n            return;\n        }\n        print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter cpos;\n        buf.get_iter_at_offset(out cpos, buf.cursor_position);\n        \n        var ln = cpos.get_line();\n \n        var node = _this.file.lineToNode(ln);\n \n        if (node == null) {\n            print(\"can not find node\\n\");\n            return;\n        }\n        var ltree = _this.main_window.windowstate.left_tree;\n        var tp = ltree.model.treePathFromNode(node);\n        print(\"got tree path %s\\n\", tp);\n        if (tp != \"\") {\n\t       this.allow_node_scroll = false;        \n\t       print(\"changing cursor on tree..\\n\");\n            ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);\n            // scrolling is disabled... as node selection calls scroll 10ms after it changes.\n            GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n\t            this.allow_node_scroll = true;\n\t            return false;\n            });\n        }\n        \n        // highlight the node..\n        \n    });\n  \n  \n  \n    var attrs = new Gtk.SourceMarkAttributes();\n    var  pink =   Gdk.RGBA();\n    pink.parse ( \"pink\");\n    attrs.set_background ( pink);\n    attrs.set_icon_name ( \"process-stop\");    \n    attrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"ERR\", attrs, 1);\n    \n     var wattrs = new Gtk.SourceMarkAttributes();\n    var  blue =   Gdk.RGBA();\n    blue.parse ( \"#ABF4EB\");\n    wattrs.set_background ( blue);\n    wattrs.set_icon_name ( \"process-stop\");    \n    wattrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"WARN\", wattrs, 1);\n    \n \n    \n     var dattrs = new Gtk.SourceMarkAttributes();\n    var  purple =   Gdk.RGBA();\n    purple.parse ( \"#EEA9FF\");\n    dattrs.set_background ( purple);\n    dattrs.set_icon_name ( \"process-stop\");    \n    dattrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"DEPR\", dattrs, 1);\n    \n    \n    var gattrs = new Gtk.SourceMarkAttributes();\n    var  grey =   Gdk.RGBA();\n    grey.parse ( \"#ccc\");\n    gattrs.set_background ( grey);\n \n    \n    this.el.set_mark_attributes (\"grey\", gattrs, 1);\n    \n    \n    \n    \n    \n    \n}\n ",
-         "| void nodeSelected" : "(JsRender.Node? sel) {\n  \n    \n  \n    // this is connected in widnowstate\n    print(\"Roo-view - node selected\\n\");\n    var buf = this.el.get_buffer();\n \n    var sbuf = (Gtk.SourceBuffer) buf;\n\n   \n    while(Gtk.events_pending()) {\n        Gtk.main_iteration();\n    }\n    \n   \n    // clear all the marks..\n     Gtk.TextIter start;\n    Gtk.TextIter end;     \n        \n    sbuf.get_bounds (out start, out end);\n    sbuf.remove_source_marks (start, end, \"grey\");\n    \n    \n     if (sel == null) {\n        // no highlighting..\n        return;\n    }\n    Gtk.TextIter iter;   \n    sbuf.get_iter_at_line(out iter,  sel.line_start);\n    \n    \n    Gtk.TextIter cur_iter;\n    sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);\n    \n    //var cur_line = cur_iter.get_line();\n    //if (cur_line > sel.line_start && cur_line < sel.line_end) {\n    \n    //} else {\n    if (this.allow_node_scroll) {\n\t\t \n    \tthis.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);\n\t}\n    \n     \n    \n    for (var i = 0; i < buf.get_line_count();i++) {\n        if (i < sel.line_start || i > sel.line_end) {\n           \n            sbuf.get_iter_at_line(out iter, i);\n            sbuf.create_source_mark(null, \"grey\", iter);\n            \n        }\n    \n    }\n    \n\n}\n",
-         "bool loading" : true,
-         "| string toString" : "() {\n   Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_buffer().get_start_iter(out s);\n    this.el.get_buffer().get_end_iter(out e);\n    var ret = this.el.get_buffer().get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n",
-         "| void loadFile" : "( ) {\n    this.loading = true;\n    var buf = this.el.get_buffer();\n    buf.set_text(\"\",0);\n    var sbuf = (Gtk.SourceBuffer) buf;\n\n    \n\n    if (_this.file == null || _this.file.xtype != \"Gtk\") {\n        print(\"xtype != Gtk\");\n        this.loading = false;\n        return;\n    }\n    \n    var valafn = \"\";\n      try {             \n           var  regex = new Regex(\"\\\\.bjs$\");\n        \n         \n            valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");\n         } catch (GLib.RegexError e) {\n             this.loading = false;\n            return;\n        }   \n    \n\n   if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {\n        print(\"File path has no errors\\n\");\n        this.loading = false;\n        return  ;\n    }\n    \n    string str;\n    try {\n    \n        GLib.FileUtils.get_contents (valafn, out str);\n    } catch (Error e) {\n        this.loading = false;\n        return  ;\n    }\n\n//    print(\"setting str %d\\n\", str.length);\n    buf.set_text(str, str.length);\n    var lm = Gtk.SourceLanguageManager.get_default();\n     \n    //?? is javascript going to work as js?\n    \n    ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));\n  \n    \n    Gtk.TextIter start;\n    Gtk.TextIter end;     \n        \n    sbuf.get_bounds (out start, out end);\n    sbuf.remove_source_marks (start, end, null); // remove all marks..\n    \n    \n    if (_this.main_window.windowstate.last_compile_result != null) {\n        var obj = _this.main_window.windowstate.last_compile_result;\n        this.highlightErrorsJson(\"ERR\", obj);\n        this.highlightErrorsJson(\"WARN\", obj);\n        this.highlightErrorsJson(\"DEPR\", obj);\t\t\t\n    }\n    //while (Gtk.events_pending()) {\n     //   Gtk.main_iteration();\n   // }\n    \n    this.loading = false; \n}\n",
-         "* pack" : "add",
-         "xtype" : "SourceView",
-         "bool allow_node_scroll" : true,
-         "| void highlightErrorsJson" : " (string type, Json.Object obj) {\n      Gtk.TextIter start;\n     Gtk.TextIter end;   \n     \n     var buf =  this.el.get_buffer();\n       var sbuf = (Gtk.SourceBuffer)buf;\n        buf.get_bounds (out start, out end);\n        \n        sbuf.remove_source_marks (start, end, type);\n                 \n     \n     // we should highlight other types of errors..\n    \n    if (!obj.has_member(type)) {\n        print(\"Return has no errors\\n\");\n        return  ;\n    }\n    var err = obj.get_object_member(type);\n    \n    if (_this.file == null) { \n        return; // just in case the file has not loaded yet?\n    }\n \n\n    var valafn = \"\";\n      try {             \n           var  regex = new Regex(\"\\\\.bjs$\");\n        \n         \n            valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");\n         } catch (GLib.RegexError e) {\n            return;\n        }   \n\n   if (!err.has_member(valafn)) {\n        print(\"File path has no errors\\n\");\n        return  ;\n    }\n    var lines = err.get_object_member(valafn);\n    \n   \n    \n    var tlines = buf.get_line_count () +1;\n    \n    lines.foreach_member((obj, line, node) => {\n        \n             Gtk.TextIter iter;\n    //        print(\"get inter\\n\");\n            var eline = int.parse(line) -1  ;\n            print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);\n            \n            \n            if (eline > tlines || eline < 0) {\n                return;\n            }\n            sbuf.get_iter_at_line( out iter, eline);\n            //print(\"mark line\\n\");\n            var msg  = type + \" on line: %d - %s\".printf(eline+1, valafn);\n            var ar = lines.get_array_member(line);\n            for (var i = 0 ; i < ar.get_length(); i++) {\n\t\t    msg += (msg.length > 0) ? \"\\n\" : \"\";\n\t\t    msg += ar.get_string_element(i);\n\t    }\n            \n            \n            sbuf.create_source_mark(msg, type, iter);\n        } );\n        return  ;\n    \n \n\n\n}",
          "$ xns" : "Gtk",
-         "gboolean show_line_numbers" : true,
-         "gboolean editable" : false
+         "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);",
+            "            ",
+            "        }",
+            "    ",
+            "    }",
+            "    ",
+            "",
+            "}",
+            ""
+           ]
+          }
+         ],
+         "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"
+          }
+         ],
+         "xtype" : "Box"
         }
-       ]
+       ],
+       "xtype" : "Box"
       }
-     ]
+     ],
+     "xtype" : "Notebook"
     }
+   ],
+   "xtype" : "Box",
+   "| int search" : [
+    "(string in_txt) {",
+    "\tthis.notebook.el.page = 1;",
+    "\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);",
+    "\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;",
+    "\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 ",
+    "}",
+    ""
+   ],
+   "| void createThumb" : [
+    "() {",
+    "    ",
+    "    ",
+    "    if (this.file == null) {",
+    "        return;",
+    "    }",
+    "    // only screenshot the gtk preview..",
+    "    if (this.notebook.el.page > 0 ) {",
+    "        return;",
+    "    }",
+    "    ",
+    "    ",
+    " \tthis.file.widgetToIcon(this.container.el); ",
+    "",
+    "    ",
+    "    return;",
+    "    ",
+    "    ",
+    "     ",
+    "     ",
+    "    ",
+    "    // should we hold until it's printed...",
+    "     ",
+    "",
+    "    ",
+    "     ",
+    "}",
+    ""
+   ],
+   "| void forwardSearch" : [
+    "(bool change_focus) {",
+    "",
+    "\tif (this.searchcontext == null) {",
+    "\t\treturn;",
+    "\t}",
+    "\tthis.notebook.el.page = 1;",
+    "\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, out has_wrapped_around)) {",
+    "\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}",
+    "\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}",
+    "    }",
+    "    */",
+    "    //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 ",
+    "",
+    "}",
+    " "
+   ],
+   "| void loadFile" : [
+    "(JsRender.JsRender file) ",
+    "{",
+    "        this.file = null;",
+    "        ",
+    "        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.el.get_width();",
+    "        var h = this.el.get_height();",
+    "        ",
+    "        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); ",
+    "        ",
+    "        // set the container size min to 500/500 or 20 px less than max..",
+    "        w = int.max (w-20, 500);",
+    "        h = int.max (h-20, 500); ",
+    "        ",
+    "        print(\"SET SIZES %d, %d\\n\", w,h);       ",
+    "        _this.container.el.set_size_request(w,h);",
+    "        ",
+    "        _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) {",
+    "  // code preview...",
+    "   ",
+    "   GLib.Timeout.add(100, () => {",
+    "   ",
+    "   ",
+    "\t    this.notebook.el.set_current_page(1);",
+    "\t   ",
+    "\t\t  var buf = this.sourceview.el.get_buffer();",
+    "\t ",
+    "\t\tvar sbuf = (GtkSource.Buffer) buf;",
+    "",
+    "",
+    "\t\tGtk.TextIter iter;   ",
+    "\t\tsbuf.get_iter_at_line(out iter,  line);",
+    "\t\tthis.sourceview.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
+    "\t\treturn false;",
+    "\t});   ",
+    "",
+    "   ",
+    "}",
+    ""
+   ],
+   "| 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 ;",
+    "",
+    "",
+    "",
+    " ",
+    "",
+    "}"
    ]
   }
- ]
+ ],
+ "name" : "GtkView"
 }
\ No newline at end of file