fix line numbering issues with vala generator - hopefully fixes completion in node...
[roobuilder] / src / Builder4 / WindowRooView.bjs
index ad5a80d..506da32 100644 (file)
@@ -1,5 +1,6 @@
 {
  "build_module" : "builder",
+ "gen_extended" : false,
  "items" : [
   {
    "# Gtk.Widget lastObj" : "null",
@@ -7,7 +8,7 @@
    "# Xcls_MainWindow main_window" : "",
    "$ xns" : "Gtk",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-   "Gtk.SourceSearchContext searchcontext" : "",
+   "GtkSource.SearchContext searchcontext" : "",
    "bool hexpand" : true,
    "bool vexpand" : true,
    "id" : "WindowRooView",
@@ -15,7 +16,7 @@
    "items" : [
     {
      "$ xns" : "Gtk",
-     "* pack" : "pack_start,true,true,0",
+     "bool vexpand" : true,
      "id" : "notebook",
      "items" : [
       {
        "$ xns" : "Gtk",
        "* pack" : "append_page,_this.label_preview.el",
        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+       "bool vexpand" : true,
        "id" : "paned",
        "items" : [
         {
          "$ homogeneous" : false,
          "$ xns" : "Gtk",
-         "* pack" : "pack1,true,true",
+         "* pack" : "set_start_child",
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "bool vexpand" : true,
          "id" : "viewbox",
          "items" : [
           {
            "$ homogeneous" : true,
            "$ vexpand" : false,
            "$ xns" : "Gtk",
-           "* pack" : "pack_start,false,true,0",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
            "items" : [
             {
              "$ xns" : "Gtk",
-             "* pack" : "pack_start,false,false,0",
              "label" : "Redraw",
              "listeners" : {
               "clicked" : [
@@ -69,7 +70,6 @@
             {
              "$ active" : true,
              "$ xns" : "Gtk",
-             "* pack" : "pack_start,false,false,0",
              "id" : "AutoRedraw",
              "label" : "Auto Redraw On",
              "listeners" : {
             },
             {
              "$ xns" : "Gtk",
-             "* pack" : "pack_start,false,false,0",
              "label" : "Full Redraw",
              "listeners" : {
               "clicked" : [
                " () => {",
                "  _this.view.redraws = 99;",
-               "    _this.view.el.web_context.clear_cache();  ",
+               " //   _this.view.el.web_context.clear_cache();  ",
                "  //_this.view.renderJS(true);",
                "  FakeServerCache.clear();",
                "  _this.view.reInit();",
-               "",
+               " ",
                "}"
               ]
              },
            "xtype" : "Box"
           },
           {
-           "$ shadow_type" : "Gtk.ShadowType.IN",
-           "$ xns" : "Gtk",
+           "# GLib.DateTime lastRedraw" : "null",
+           "# WebKit.WebInspector inspector" : "",
+           "# bool pendingRedraw" : false,
+           "# bool refreshRequired" : false,
+           "# int redraws" : 0,
+           "# string renderedData" : "\"\"",
+           "# string runhtml" : "\"\"",
+           "# string runjs" : "\"\"",
+           "$ xns" : "WebKit",
            "* init" : [
-            "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+            " {",
+            "    // this may not work!?",
+            "    var settings =  this.el.get_settings();",
+            "    settings.enable_developer_extras = true;",
+            "    ",
+            "    ",
+            "    var fs= new FakeServer(this.el);",
+            "    fs.ref();",
+            "    // this was an attempt to change the url perms.. did not work..",
+            "    // settings.enable_file_access_from_file_uris = true;",
+            "    // settings.enable_offline_web_application_cache - true;",
+            "    // settings.enable_universal_access_from_file_uris = true;",
+            "   ",
+            "     ",
+            "    ",
+            "    ",
+            "    ",
+            "",
+            "     // FIXME - base url of script..",
+            "     // we need it so some of the database features work.",
+            "    this.el.load_html( \"Render not ready\" , ",
+            "            //fixme - should be a config option!",
+            "            // or should we catch stuff and fix it up..",
+            "            \"http://localhost/app.Builder/\"",
+            "    );",
+            "   ",
+            "        ",
+            "   //this.el.open('file:///' + __script_path__ + '/../builder.html');",
+            "    /*",
+            "    Gtk.drag_dest_set",
+            "    (",
+            "            this.el,              //",
+            "            Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,",
+            "            null,            // list of targets",
+            "            Gdk.DragAction.COPY         // what to do with data after dropped ",
+            "    );",
+            "                            ",
+            "   // print(\"RB: TARGETS : \" + LeftTree.atoms[\"STRING\"]);",
+            "    Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);",
+            "    */",
+            "    GLib.Timeout.add_seconds(1,  ()  =>{",
+            "         //print(\"run refresh?\");",
+            "         if (this.el == null) {",
+            "            return false;",
+            "         }",
+            "         this.runRefresh(); ",
+            "         return true;",
+            "     });",
+            "    ",
+            "    ",
+            "}",
+            ""
+           ],
+           "bool vexpand" : true,
+           "id" : "view",
+           "listeners" : {
+            "load_changed" : [
+             "(le) => {",
+             "    if (le != WebKit.LoadEvent.FINISHED) {",
+             "        return;",
+             "    }",
+             "    if (this.runjs.length < 1) {",
+             "        return;",
+             "    }",
+             "  //  this.el.run_javascript(this.runjs, null);",
+             "     FakeServerCache.remove(    this.runjs);",
+             "    this.runjs = \"\";",
+             "}"
+            ],
+            "ready_to_show" : [
+             "( ) => {",
+             "  this.initInspector();",
+             "",
+             "}",
+             ""
+            ],
+            "script_dialog" : [
+             " (dialog) => {",
+             "    ",
+             "    ",
+             "    if (this.el == null) {",
+             "        return true;",
+             "    }",
+             "    ",
+             "     var msg = dialog.get_message();",
+             "     if (msg.length < 4) {",
+             "        return false;",
+             "     }",
+             "     ",
+             "     GLib.debug(\"script dialog got %s\", msg);",
+             "     ",
+             "     if (msg.substring(0,4) != \"IPC:\") {",
+             "         return false;",
+             "     }",
+             "     var ar = msg.split(\":\", 3);",
+             "    if (ar.length < 3) {",
+             "        return false;",
+             "    }",
+             "",
+             "    switch(ar[1]) {",
+             "        case \"SAVEHTML\":",
+             "\t        GLib.debug(\"GOT saveHTML %d\", ar[2].length);",
+             "            _this.file.saveHTML(ar[2]);",
+             "            _this.createThumb();",
+             "            return true;",
+             "        default:",
+             "            return false;",
+             "    }",
+             "    ",
+             "}"
+            ]
+           },
+           "xtype" : "WebView",
+           "| void initInspector" : [
+            "() {",
+            "    ",
             " ",
+            "          ",
+            "   // this.inspector.open_window.connect(() => {",
+            "         this.inspector = this.el.get_inspector();",
+            "         ",
+            "         this.inspector.open_window.connect(() => {",
+            "        print(\"inspector attach\\n\");",
+            "        var wv = this.inspector.get_web_view();",
+            "        if (wv != null) {",
+            "            print(\"got inspector web view\\n\");",
+            "            ",
+            "            var cn = _this.inspectorcontainer.el.get_first_child();",
+            "            if (cn != null) {",
+            "                 _this.inspectorcontainer.el.remove(cn);",
+            "             }",
+            "            ",
+            "            _this.inspectorcontainer.el.append(wv);",
+            "            wv.show();",
+            "        } else {",
+            "\t         print(\"got inspector web view FAILED\\n\");",
+            "            //this.inspector.close();",
+            "            ",
+            "            //this.inspector = null;",
+            "           ",
+            " ",
+            "        }",
+            "      return true;",
+            "       ",
+            "   });",
+            "     this.inspector.show();",
+            "         ",
+            "    ",
+            "  ",
+            "}",
+            ""
+           ],
+           "| void reInit" : [
+            "() {",
+            "   print(\"reInit?\");",
+            "         // if this happens destroy the webkit..",
+            "         // recreate it..",
+            "     this.el.stop_loading();",
+            "         ",
+            "     if (_this.viewbox.el.get_parent() == null) {",
+            "        return;",
+            "     }",
+            "         ",
+            "         /*",
+            "    _this.viewbox.el.remove(_this.viewcontainer.el);",
+            "    //_this.paned.el.remove(_this.inspectorcontainer.el);        ",
+            "         ",
+            "         // destory seems to cause problems.",
+            "         //this.el.destroy();",
+            "        //_this.viewcontainer.el.destroy();",
+            "         //_this.inspectorcontainer.el.destroy();",
+            "     var  inv =new Xcls_inspectorcontainer(_this);",
+            "      ",
+            "      _this.paned.el.set_end_child(inv.el);",
+            "      _this.inspectorcontainer = inv;",
+            "      ",
+            "     this.el = null;         ",
+            "     var nv =new Xcls_viewcontainer(_this);",
+            "    // nv.ref();",
+            "     _this.viewbox.el.append(nv.el);",
+            "         ",
+            "         _this.viewcontainer = nv;",
+            "     inv.el.show();",
+            "     nv.el.show();",
+            "         //while(Gtk.events_pending ()) Gtk.main_iteration ();",
+            "         //_this.view.renderJS(true); ",
+            "     _this.view.refreshRequired  = true;",
+            "     ",
+            "     */",
+            "}",
             ""
            ],
-           "* pack" : "pack_end,true,true,0",
-           "id" : "viewcontainer",
+           "| void renderJS" : [
+            "(bool force) {",
+            "",
+            "    // this is the public redraw call..",
+            "    // we refresh in a loop privately..",
+            "    var autodraw = _this.AutoRedraw.el.active;",
+            "    if (!autodraw && !force) {",
+            "        print(\"Skipping redraw - no force, and autodraw off\");",
+            "        return;",
+            "    }",
+            "     ",
+            "    this.refreshRequired  = true;",
+            "}",
+            ""
+           ],
+           "| void runRefresh" : [
+            " () ",
+            "{",
+            "    // this is run every 2 seconds from the init..",
+            "",
+            "  ",
+            "    ",
+            "    if (!this.refreshRequired) {",
+            "       // print(\"no refresh required\");",
+            "        return;",
+            "    }",
+            "",
+            "    if (this.lastRedraw != null) {",
+            "       // do not redraw if last redraw was less that 5 seconds ago.",
+            "       if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {",
+            "            return;",
+            "        }",
+            "    }",
+            "    ",
+            "    if (_this.file == null) {",
+            "        return;",
+            "    }",
+            "    ",
+            "    ",
+            "     this.refreshRequired = false;",
+            "   //  print(\"HTML RENDERING\");",
+            "     ",
+            "     ",
+            "     //this.get('/BottomPane').el.show();",
+            "     //this.get('/BottomPane').el.set_current_page(2);// webkit inspector",
+            "    _this.file.webkit_page_id  = this.el.get_page_id();",
+            "    ",
+            "    var js = _this.file.toSourcePreview();",
+            "",
+            "    if (js.length < 1) {",
+            "        print(\"no data\");",
+            "        return;",
+            "    }",
+            "//    var  data = js[0];",
+            "    this.redraws++;",
+            "  ",
+            "    var project = (Project.Roo) _this.file.project;  ",
+            "",
+            "     //print (project.fn);",
+            "     // set it to non-empty.",
+            "     ",
+            "//     runhtml = runhtml.length ?  runhtml : '<script type=\"text/javascript\"></script>'; ",
+            "",
+            "",
+            "//   this.runhtml  = this.runhtml || '';",
+            " ",
+            " ",
+            "    // then we need to reload the browser using",
+            "    // load_html_string..",
+            "",
+            "    // then trigger a redraw once it's loaded..",
+            "    this.pendingRedraw = true;",
+            "",
+            "    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;",
+            "    string builderhtml;",
+            "    ",
+            "    try {",
+            "        GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);",
+            "    } catch (Error e) {",
+            "        builderhtml = \"\";",
+            "    }",
+            "",
+            "    runhtml += builderhtml + \"\\n\";",
+            "    runhtml += \"</script>\\n\" ;",
+            "",
+            "    // fix to make sure they are the same..",
+            "    this.runhtml = project.runhtml;",
+            "    // need to modify paths",
+            "",
+            "    string inhtml;",
+            "    var base_template = project.base_template;",
+            "    ",
+            "    if (base_template.length > 0 && !FileUtils.test(",
+            "        BuilderApplication.configDirectory() + \"/resources/\" +  base_template, FileTest.EXISTS)  ",
+            "        ) {",
+            "           print(\"invalid base_template name - using default:  %s\\n\", base_template);",
+            "           base_template = \"\";",
+            "    ",
+            "    }",
+            "    try {",
+            "        GLib.FileUtils.get_contents(",
+            "            BuilderApplication.configDirectory() + \"/resources/\" + ",
+            "                (base_template.length > 0 ? base_template :  \"roo.builder.html\")",
+            "                , out inhtml);",
+            "    ",
+            "    } catch (Error e) {",
+            "        inhtml = \"\";",
+            "    }    ",
+            "    this.renderedData = js;",
+            "",
+            "",
+            "    string js_src = js + \"",
+            "Roo.onReady(function() {",
+            "if (\" + _this.file.name +\".show) {",
+            "\t\t\" + _this.file.name +\".show({});",
+            "\t\t(function() {  ",
+            "\t\t\tBuilder.saveHTML.defer(100, Builder);",
+            "\t\t}).defer(100);",
+            "}",
+            "Roo.XComponent.build();",
+            "});\\n\";",
+            "\t",
+            "   // print(\"render js: \" + js);",
+            "    //if (!this.ready) {",
+            "  //      console.log('not loaded yet');",
+            "    //}",
+            "    this.lastRedraw = new DateTime.now_local();",
+            "",
+            "",
+            "    //this.runjs = js_src;",
+            "    var fc =    FakeServerCache.factory_with_data(js_src);",
+            "    this.runjs = fc.fname;",
+            "    ",
+            "        var html = inhtml.replace(\"</head>\", runhtml + this.runhtml + ",
+            "            \"<script type=\\\"text/javascript\\\" src=\\\"xhttp://localhost\" + fc.fname + \"\\\"></script>\" +   ",
+            "              //  \"<script type=\\\"text/javascript\\\">\\n\" +",
+            "              //  js_src + \"\\n\" + ",
+            "              //  \"</script>\" + ",
+            "                        ",
+            "        \"</head>\");",
+            "        //print(\"LOAD HTML \" + html);",
+            "        ",
+            "         var rootURL = project.rootURL;",
+            "   ",
+            "        ",
+            "        ",
+            "        this.el.load_html( html , ",
+            "            //fixme - should be a config option!",
+            "            (rootURL.length > 0 ? rootURL : \"xhttp://localhost/roobuilder/\")",
+            "        );",
+            "          this.initInspector();   ",
+            "    // force the inspector...        ",
+            "       //   this.initInspector();",
+            "        ",
+            "        // - no need for this, the builder javascript will call it when build is complete",
+            "        //GLib.Timeout.add_seconds(1, () => {",
+            "        //    this.el.run_javascript(\"Builder.saveHTML()\",null);",
+            "        //    return false;",
+            "        //});",
+            "//     print( \"before render\" +    this.lastRedraw);",
+            "//    print( \"after render\" +    (new Date()));",
+            "    ",
+            "}",
+            "                                                                                                                                                                                                                        "
+           ]
+          }
+         ],
+         "xtype" : "Box"
+        },
+        {
+         "$ xns" : "Gtk",
+         "* pack" : "set_end_child",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "bool vexpand" : true,
+         "id" : "inspectorcontainer",
+         "xtype" : "Box"
+        }
+       ],
+       "xtype" : "Paned"
+      },
+      {
+       "$ xns" : "Gtk",
+       "* pack" : "append_page,_this.label_code.el",
+       "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+       "bool vexpand" : true,
+       "int spacing" : 0,
+       "items" : [
+        {
+         "$ xns" : "Gtk",
+         "bool vexpand" : true,
+         "id" : "sourceviewscroll",
+         "items" : [
+          {
+           "# JsRender.Node? node_selected" : "null",
+           "# bool button_is_pressed" : false,
+           "# bool key_is_pressed" : false,
+           "# bool loading" : true,
+           "# int editable_start_pos" : "-1",
+           "# string prop_selected" : "\"\"",
+           "$ xns" : "GtkSource",
+           "* init" : [
+            "{",
+            "   ",
+            "   this.css = new Gtk.CssProvider();",
+            "\t ",
+            "\tthis.css.load_from_string(",
+            "\t\t\"#roo-view { font:  10px monospace; }\"",
+            "\t);",
+            " ",
+            "\tGtk.StyleContext.add_provider_for_display(",
+            "\t\tthis.el.get_display(),",
+            "\t\tthis.css,",
+            "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+            "\t);",
+            "\t\t",
+            "\t ",
+            "    ",
+            "    this.loading = true;",
+            "    //var buf = this.el.get_buffer();",
+            "    //buf.notify.connect(this.onCursorChanged);",
+            "  ",
+            "  ",
+            "    var attrs = new GtkSource.MarkAttributes();",
+            "    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 GtkSource.MarkAttributes();",
+            "    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 GtkSource.MarkAttributes();",
+            "    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 GtkSource.MarkAttributes();",
+            "    var  grey =   Gdk.RGBA();",
+            "    grey.parse ( \"#ccc\");",
+            "    gattrs.set_background ( grey);",
+            " ",
+            "    ",
+            "    this.el.set_mark_attributes (\"grey\", gattrs, 1);",
+            "    ",
+            "    ",
+            "    ",
+            "    ",
+            "    ",
+            "    ",
+            "}",
+            " "
+           ],
+           "* pack" : "set_child",
+           "Gtk.CssProvider css" : "",
+           "gboolean editable" : false,
+           "gboolean show_line_marks" : true,
+           "gboolean show_line_numbers" : true,
+           "id" : "sourceview",
            "items" : [
             {
-             "# GLib.DateTime lastRedraw" : "null",
-             "# WebKit.WebInspector inspector" : "",
-             "# bool pendingRedraw" : false,
-             "# bool refreshRequired" : false,
-             "# int redraws" : 0,
-             "# string renderedData" : "\"\"",
-             "# string runhtml" : "\"\"",
-             "# string runjs" : "\"\"",
-             "$ xns" : "WebKit",
-             "* init" : [
-              " {",
-              "    // this may not work!?",
-              "    var settings =  this.el.get_settings();",
-              "    settings.enable_developer_extras = true;",
-              "    ",
-              "    ",
-              "    var fs= new FakeServer(this.el);",
-              "    fs.ref();",
-              "    // this was an attempt to change the url perms.. did not work..",
-              "    // settings.enable_file_access_from_file_uris = true;",
-              "    // settings.enable_offline_web_application_cache - true;",
-              "    // settings.enable_universal_access_from_file_uris = true;",
-              "   ",
-              "     ",
-              "    ",
-              "    ",
-              "    ",
-              "",
-              "     // FIXME - base url of script..",
-              "     // we need it so some of the database features work.",
-              "    this.el.load_html( \"Render not ready\" , ",
-              "            //fixme - should be a config option!",
-              "            // or should we catch stuff and fix it up..",
-              "            \"http://localhost/app.Builder/\"",
-              "    );",
-              "        ",
-              "        ",
-              "   //this.el.open('file:///' + __script_path__ + '/../builder.html');",
-              "    /*",
-              "    Gtk.drag_dest_set",
-              "    (",
-              "            this.el,              //",
-              "            Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,",
-              "            null,            // list of targets",
-              "            Gdk.DragAction.COPY         // what to do with data after dropped ",
-              "    );",
-              "                            ",
-              "   // print(\"RB: TARGETS : \" + LeftTree.atoms[\"STRING\"]);",
-              "    Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);",
-              "    */",
-              "    GLib.Timeout.add_seconds(1,  ()  =>{",
-              "         //print(\"run refresh?\");",
-              "         if (this.el == null) {",
-              "            return false;",
-              "         }",
-              "         this.runRefresh(); ",
-              "         return true;",
-              "     });",
-              "    ",
-              "    ",
-              "}",
-              ""
-             ],
-             "* pack" : "add",
-             "id" : "view",
+             "$ xns" : "GtkSource",
+             "* pack" : "set_buffer",
+             "bool dirty" : false,
+             "id" : "buffer",
+             "int error_line" : "-1",
              "listeners" : {
-              "drag_drop" : [
-               "  ( ctx, x, y,time, ud) => {",
-               "    return false;",
-               "    /*",
-               "\tprint(\"TARGET: drag-drop\");",
-               "        var is_valid_drop_site = true;",
-               "        ",
-               "         ",
-               "        Gtk.drag_get_data",
-               "        (",
-               "                w,         // will receive 'drag-data-received' signal ",
-               "                ctx,        /* represents the current state of the DnD ",
-               "                this.get('/Window').atoms[\"STRING\"],    /* the target type we want ",
-               "                time            /* time stamp ",
-               "        );",
-               "                        ",
-               "                        ",
-               "                        /* No target offered by source => error ",
-               "                       ",
-               "",
-               "\treturn  is_valid_drop_site;",
-               "\t*/",
-               "}"
-              ],
-              "load_changed" : [
-               "(le) => {",
-               "    if (le != WebKit.LoadEvent.FINISHED) {",
-               "        return;",
-               "    }",
-               "    if (this.runjs.length < 1) {",
-               "        return;",
-               "    }",
-               "  //  this.el.run_javascript(this.runjs, null);",
-               "     FakeServerCache.remove(    this.runjs);",
-               "    this.runjs = \"\";",
-               "}"
-              ],
-              "script_dialog" : [
-               " (dialog) => {",
+              "changed" : [
+               " () => {",
+               "  ",
+               "    // check syntax??",
+               "    // ??needed..??",
+               "   // _this.save_button.el.sensitive = true;",
+               "    ///?? has changed occured during loading?",
                "    ",
+               "    // only trigger this if ",
                "    ",
-               "    if (this.el == null) {",
-               "        return true;",
-               "    }",
                "    ",
-               "     var msg = dialog.get_message();",
-               "     if (msg.length < 4) {",
-               "        return false;",
-               "     }",
-               "     if (msg.substring(0,4) != \"IPC:\") {",
-               "         return false;",
-               "     }",
-               "     var ar = msg.split(\":\", 3);",
-               "    if (ar.length < 3) {",
-               "        return false;",
-               "    }",
+               "    ",
+               "    ",
+               "    if (_this.sourceview.loading) {",
+               "\t\treturn;",
+               "\t}",
+               "\t",
+               "",
+               "\t",
+               "    print(\"- PREVIEW EDITOR CHANGED--\");",
+               "",
+               "    this.dirty = true;  ",
+               "   // this.checkSyntax(); // this calls backs and highlights errors.. in theory...  ",
+               "",
                "",
-               "    switch(ar[1]) {",
-               "        case \"SAVEHTML\":",
-               "\t        print(\"GOT saveHTML %d?\\n\", ar[2].length);",
-               "            _this.file.saveHTML(ar[2]);",
-               "            return true;",
-               "        default:",
-               "            return false;",
-               "    }",
+               "",
+               "\tif (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {",
+               "\t\tprint(\"button or key not pressed to generate change?!\\n\");",
+               "\t\treturn;",
+               "\t}",
+               "\t\t",
                "    ",
-               "}"
-              ],
-              "show" : [
-               "  ( ) => {",
-               "    this.initInspector();;",
-               "}"
+               "\t// what are we editing??",
+               "\tif (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length  < 1) {",
+               "\t\treturn;",
+               "\t}",
+               "\t",
+               "\t// find the colon on the first line...",
+               "\t",
+               "\tif (_this.sourceview.editable_start_pos > -1) {",
+               "\t\t",
+               "\t\tvar buf = (GtkSource.Buffer)_this.sourceview.el.get_buffer();",
+               "\t\t",
+               "        //print(\"cursor changed : %d\\n\", buf.cursor_position);",
+               "        Gtk.TextIter spos,epos;",
+               "        buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);",
+               "        buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..",
+               "        ",
+               "        var gotit= false;",
+               "        var line = spos.get_line();",
+               "        var endline = buf.get_line_count();",
+               "        while (line < endline) {",
+               "    \t\tline++;",
+               "\t        buf.get_iter_at_line(out epos, line);",
+               "\t        if (buf.get_source_marks_at_line(line, \"grey\").length() > 0) {",
+               "\t\t        buf.get_iter_at_line(out epos, line);\t    \t\t",
+               "\t    \t\tgotit=true;",
+               "\t    \t\tbreak;",
+               "    \t\t}",
+               "\t\t}",
+               "        ",
+               " \t\tif (gotit) {",
+               "\t \t\tprint(\"End Offset = %d/%d\\n\", epos.get_line(), epos.get_offset());",
+               "\t\t\t// get the pos...",
+               "\t\t\t// in theory the last char will be '}' or '},' .. or ','",
+               "\t\t\t// we should chop the ',' of the end...",
+               "\t\t\tvar str = buf.get_text(spos, epos, false);",
+               "\t\t\tprint(\"got string\\n%s\\n\", str);",
+               "\t\t",
+               "\t\t}",
+               "\t}",
+               "    return ;",
+               "}",
+               "",
+               " ",
+               ""
               ]
              },
-             "redraws" : 0,
-             "xtype" : "WebView",
-             "| void initInspector" : [
-              "() {",
-              "    ",
-              "   /* if (this.inspector == this.el.get_inspector()) {",
-              "        this.inspector.show();",
-              "        this.inspector.open_window();        ",
-              "        print(\"init inspecter called, and inspector is the same as existing\\n\");",
-              "        return;",
-              "    }",
-              "    print(\"new inspector?\\n\");",
-              "*/",
-              "    this.inspector = this.el.get_inspector();",
-              "    this.inspector.ref();",
-              "    ",
-              "    // got a new inspector...",
-              "        ",
-              "    this.inspector.open_window.connect(() => {",
-              "         this.inspector = this.el.get_inspector();",
-              "        print(\"inspector attach\\n\");",
-              "        var wv = this.inspector.get_web_view();",
-              "        if (wv != null) {",
-              "            print(\"got inspector web view\\n\");",
-              "            ",
-              "            var cn = _this.inspectorcontainer.el.get_child();",
-              "            if (cn != null) {",
-              "                 _this.inspectorcontainer.el.remove(cn);",
-              "             }",
-              "            ",
-              "            _this.inspectorcontainer.el.add(wv);",
-              "            wv.show();",
-              "        } else {",
-              "            //this.inspector.close();",
-              "            ",
-              "            //this.inspector = null;",
-              "           ",
-              " ",
-              "        }",
-              "        return true;",
-              "       ",
-              "    });",
-              "    /*",
-              "    this.inspector.closed.connect(() => {",
-              "         print(\"inspector closed?!?\");",
-              "         // if this happens destroy the webkit..",
-              "         // recreate it..",
-              "         this.el.stop_loading();",
-              "         ",
-              "         if (_this.viewbox.el.get_parent() == null) {",
-              "            return;",
-              "         }",
-              "         ",
-              "         ",
-              "        _this.viewbox.el.remove(_this.viewcontainer.el);",
-              "        _this.el.remove(_this.inspectorcontainer.el);        ",
-              "         ",
-              "         // destory seems to cause problems.",
-              "         //this.el.destroy();",
-              "        //_this.viewcontainer.el.destroy();",
-              "         //_this.inspectorcontainer.el.destroy();",
-              "",
-              "         this.el = null;         ",
-              "         var nv =new Xcls_viewcontainer(_this);",
-              "         nv.ref();",
-              "         _this.viewbox.el.pack_end(nv.el,true,true,0);",
-              "         ",
-              "          var  inv =new Xcls_inspectorcontainer(_this);",
-              "          inv.ref();",
-              "          _this.el.pack2(inv.el,true,true);",
-              "         ",
-              "         inv.el.show_all();",
-              "         nv.el.show_all();",
-              "         //while(Gtk.events_pending ()) Gtk.main_iteration ();",
-              "         //_this.view.renderJS(true); ",
-              "         _this.view.refreshRequired  = true;",
-              "       ",
-              "    }); ",
-              "    */",
-              "    ",
-              "    this.inspector.show();",
-              "}",
-              ""
-             ],
-             "| void reInit" : [
-              "() {",
-              "   print(\"reInit?\");",
-              "         // if this happens destroy the webkit..",
-              "         // recreate it..",
-              "     this.el.stop_loading();",
-              "         ",
-              "     if (_this.viewbox.el.get_parent() == null) {",
-              "        return;",
-              "     }",
-              "         ",
-              "         ",
-              "    _this.viewbox.el.remove(_this.viewcontainer.el);",
-              "    _this.paned.el.remove(_this.inspectorcontainer.el);        ",
-              "         ",
-              "         // destory seems to cause problems.",
-              "         //this.el.destroy();",
-              "        //_this.viewcontainer.el.destroy();",
-              "         //_this.inspectorcontainer.el.destroy();",
-              "     var  inv =new Xcls_inspectorcontainer(_this);",
-              "      inv.ref();",
-              "      _this.paned.el.pack2(inv.el,true,true);",
-              "      ",
-              "      ",
-              "     this.el = null;         ",
-              "     var nv =new Xcls_viewcontainer(_this);",
-              "     nv.ref();",
-              "     _this.viewbox.el.pack_end(nv.el,true,true,0);",
+             "xtype" : "Buffer",
+             "| bool highlightErrors" : [
+              "( Gee.HashMap<int,string> validate_res) {",
               "         ",
-              "         ",
-              "     inv.el.show_all();",
-              "     nv.el.show_all();",
-              "         //while(Gtk.events_pending ()) Gtk.main_iteration ();",
-              "         //_this.view.renderJS(true); ",
-              "     _this.view.refreshRequired  = true;",
-              "}",
-              ""
-             ],
-             "| void renderJS" : [
-              "(bool force) {",
-              "",
-              "    // this is the public redraw call..",
-              "    // we refresh in a loop privately..",
-              "    var autodraw = _this.AutoRedraw.el.active;",
-              "    if (!autodraw && !force) {",
-              "        print(\"Skipping redraw - no force, and autodraw off\");",
-              "        return;",
+              "    this.error_line = validate_res.size;",
+              "\t",
+              "    if (this.error_line < 1) {",
+              "          return true;",
               "    }",
-              "     ",
-              "    this.refreshRequired  = true;",
-              "}",
-              ""
-             ],
-             "| void runRefresh" : [
-              " () ",
-              "{",
-              "    // this is run every 2 seconds from the init..",
-              "",
-              "  ",
+              "    var tlines = this.el.get_line_count ();",
+              "    Gtk.TextIter iter;",
+              "    var valiter = validate_res.map_iterator();",
+              "    while (valiter.next()) {",
               "    ",
-              "    if (!this.refreshRequired) {",
-              "       // print(\"no refresh required\");",
-              "        return;",
-              "    }",
-              "",
-              "    if (this.lastRedraw != null) {",
-              "       // do not redraw if last redraw was less that 5 seconds ago.",
-              "       if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {",
-              "            return;",
+              "//        print(\"get inter\\n\");",
+              "        var eline = valiter.get_key();",
+              "        if (eline > tlines) {",
+              "            continue;",
               "        }",
-              "    }",
-              "    ",
-              "    if (_this.file == null) {",
-              "        return;",
-              "    }",
-              "    ",
-              "    ",
-              "     this.refreshRequired = false;",
-              "   //  print(\"HTML RENDERING\");",
-              "     ",
-              "     ",
-              "     //this.get('/BottomPane').el.show();",
-              "     //this.get('/BottomPane').el.set_current_page(2);// webkit inspector",
-              "    _this.file.webkit_page_id  = this.el.get_page_id();",
-              "    ",
-              "    var js = _this.file.toSourcePreview();",
-              "",
-              "    if (js.length < 1) {",
-              "        print(\"no data\");",
-              "        return;",
-              "    }",
-              "//    var  data = js[0];",
-              "    this.redraws++;",
-              "  ",
-              "    var project = _this.file.project;  ",
-              "",
-              "     //print (project.fn);",
-              "     // set it to non-empty.",
-              "     ",
-              "//     runhtml = runhtml.length ?  runhtml : '<script type=\"text/javascript\"></script>'; ",
-              "",
-              "",
-              "//   this.runhtml  = this.runhtml || '';",
-              " ",
-              " ",
-              "    // then we need to reload the browser using",
-              "    // load_html_string..",
-              "",
-              "    // then trigger a redraw once it's loaded..",
-              "    this.pendingRedraw = true;",
-              "",
-              "    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;",
-              "    string builderhtml;",
-              "    ",
-              "    try {",
-              "        GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);",
-              "    } catch (Error e) {",
-              "        builderhtml = \"\";",
-              "    }",
-              "",
-              "    runhtml += builderhtml + \"\\n\";",
-              "    runhtml += \"</script>\\n\" ;",
-              "",
-              "    // fix to make sure they are the same..",
-              "    this.runhtml = project.runhtml;",
-              "    // need to modify paths",
-              "",
-              "    string inhtml;",
-              "    var base_template = _this.file.project.base_template;",
-              "    ",
-              "    if (base_template.length > 0 && !FileUtils.test(",
-              "        BuilderApplication.configDirectory() + \"/resources/\" +  base_template, FileTest.EXISTS)  ",
-              "        ) {",
-              "           print(\"invalid base_template name - using default:  %s\\n\", base_template);",
-              "           base_template = \"\";",
-              "    ",
-              "    }",
-              "    try {",
-              "        GLib.FileUtils.get_contents(",
-              "            BuilderApplication.configDirectory() + \"/resources/\" + ",
-              "                (base_template.length > 0 ? base_template :  \"roo.builder.html\")",
-              "                , out inhtml);",
-              "    ",
-              "    } catch (Error e) {",
-              "        inhtml = \"\";",
-              "    }    ",
-              "    this.renderedData = js;",
-              "",
-              "",
-              "    string js_src = js + \"\\n\" +",
-              "\t\"Roo.onReady(function() {\\n\" +",
-              "\t\"if (\" + _this.file.name +\".show) \" +  _this.file.name +\".show({});\\n\" +",
-              "\t\"Roo.XComponent.build();\\n\" +",
-              "\t\"});\\n\";",
-              "\t",
-              "   // print(\"render js: \" + js);",
-              "    //if (!this.ready) {",
-              "  //      console.log('not loaded yet');",
-              "    //}",
-              "    this.lastRedraw = new DateTime.now_local();",
-              "",
-              "",
-              "    //this.runjs = js_src;",
-              "    var fc =    FakeServerCache.factory_with_data(js_src);",
-              "    this.runjs = fc.fname;",
-              "    ",
-              "        var html = inhtml.replace(\"</head>\", runhtml + this.runhtml + ",
-              "            \"<script type=\\\"text/javascript\\\" src=\\\"xhttp://localhost\" + fc.fname + \"\\\"></script>\" +   ",
-              "              //  \"<script type=\\\"text/javascript\\\">\\n\" +",
-              "              //  js_src + \"\\n\" + ",
-              "              //  \"</script>\" + ",
-              "                        ",
-              "        \"</head>\");",
-              "        //print(\"LOAD HTML \" + html);",
-              "        ",
-              "         var rootURL = _this.file.project.rootURL;",
-              "   ",
-              "        ",
-              "        ",
-              "        this.el.load_html( html , ",
-              "            //fixme - should be a config option!",
-              "            (rootURL.length > 0 ? rootURL : \"xhttp://localhost/roobuilder/\")",
-              "        );",
-              "        ",
-              "    // force the inspector...        ",
-              "       //   this.initInspector();",
-              "        ",
-              "        // - no need for this, the builder javascript will call it when build is complete",
-              "        //GLib.Timeout.add_seconds(1, () => {",
-              "        //    this.el.run_javascript(\"Builder.saveHTML()\",null);",
-              "        //    return false;",
-              "        //});",
-              "//     print( \"before render\" +    this.lastRedraw);",
-              "//    print( \"after render\" +    (new Date()));",
+              "        this.el.get_iter_at_line( out iter, eline);",
+              "        //print(\"mark line\\n\");",
+              "        this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
+              "    }   ",
+              "    return false;",
+              "}"
+             ],
+             "| string toString" : [
+              "  () {",
               "    ",
+              "    Gtk.TextIter s;",
+              "    Gtk.TextIter e;",
+              "    this.el.get_start_iter(out s);",
+              "    this.el.get_end_iter(out e);",
+              "    var ret = this.el.get_text(s,e,true);",
+              "    //print(\"TO STRING? \" + ret);",
+              "    return ret;",
               "}",
-              "                                                                                                                                                                                                                        "
+              " "
              ]
+            },
+            {
+             "$ xns" : "Gtk",
+             "* pack" : "add_controller",
+             "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 false;",
+               "\t}",
+               "\tif (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 false ;",
+               "\t}",
+               "    ",
+               "\t//this.button_is_pressed = true;",
+               "\t//return false;",
+               "   // print(event.key.keyval)",
+               "    ",
+               "    return false;",
+               " ",
+               " ",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "EventControllerKey"
+            },
+            {
+             "$ xns" : "Gtk",
+             "listeners" : {
+              "released" : [
+               "(n_press, x, y) => {",
+               "",
+               "\tprint(\"BUTTON RELEASE EVENT\\n\");",
+               "\t_this.sourceview.onCursorChanged();",
+               "\t//this.button_is_pressed = false;",
+               "\t ",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "GestureClick"
             }
            ],
-           "xtype" : "ScrolledWindow"
+           "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, null);",
+             "\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// true if there is a mark..",
+             "\tif (str.length > 0 ) {",
+             "\t\t\ttooltip.set_text( str);",
+             "\t}",
+             "\treturn str.length > 0 ? true : false;",
+             "",
+             "}"
+            ]
+           },
+           "string name" : "roo-view",
+           "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 clearGreySelection" : [
+            "() {",
+            " // clear all the marks..",
+            "    var sbuf = (GtkSource.Buffer)this.el.buffer;",
+            "    ",
+            "    Gtk.TextIter start;",
+            "    Gtk.TextIter end;     ",
+            "        ",
+            "    sbuf.get_bounds (out start, out end);",
+            "    sbuf.remove_source_marks (start, end, \"grey\");",
+            "    ",
+            "    ",
+            "}",
+            ""
+           ],
+           "| void highlightErrorsJson" : [
+            " (string type, Json.Object obj) {",
+            "       // this is a hook for the vala code - it has no value in javascript ",
+            "       // as we only have one error ususally....",
+            "        return  ;",
+            "    ",
+            " ",
+            "",
+            "",
+            "}"
+           ],
+           "| void loadFile" : [
+            "( ) {",
+            "    this.loading = true;",
+            "    ",
+            "    ",
+            "    // get the cursor and scroll position....",
+            "    var buf = this.el.get_buffer();",
+            "\tvar cpos = buf.cursor_position;",
+            "    ",
+            "   print(\"BEFORE LOAD cursor = %d\\n\", cpos);",
+            "   ",
+            "    var vadj_pos = this.el.get_vadjustment().get_value();",
+            "   ",
+            "    ",
+            " ",
+            "    buf.set_text(\"\",0);",
+            "    var sbuf = (GtkSource.Buffer) buf;",
+            "",
+            "    ",
+            "",
+            "    if (_this.file == null || _this.file.xtype != \"Roo\") {",
+            "        print(\"xtype != Roo\");",
+            "        this.loading = false;",
+            "        return;",
+            "    }",
+            "    ",
+            "    // get the string from the rendered tree...",
+            "     ",
+            "     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();",
+            "    ",
+            "    // what does this do?",
+            "     GLib.Timeout.add(500, () => {",
+            "",
+            "        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",
+            "",
+            "\t\tthis.onCursorChanged();",
+            "\t\t",
+            "\t\t",
+            "\t\t//_this.buffer.checkSyntax();",
+            "\t\treturn false;",
+            "\t});",
+            "\t\t",
+            "    this.loading = false; ",
+            "    _this.buffer.dirty = false;",
+            "}",
+            ""
+           ],
+           "| void nodeSelected" : [
+            "(JsRender.Node? sel, bool scroll ) {",
+            "  ",
+            "    ",
+            "\t",
+            "    // this is connected in widnowstate",
+            "",
+            "",
+            "\t// not sure why....   ",
+            "  //  while(Gtk.events_pending()) {",
+            "   //     Gtk.main_iteration();",
+            " //   }",
+            "    ",
+            "    this.node_selected = sel;",
+            "    ",
+            "   // this.updateGreySelection(scroll);",
+            "    ",
+            "    ",
+            "    ",
+            "}",
+            "",
+            "   ",
+            ""
+           ],
+           "| void onCursorChanged" : [
+            "(/*ParamSpec ps*/) {",
+            "",
+            "\t\tif (!this.key_is_pressed && !this.button_is_pressed) {",
+            "\t\t\treturn;",
+            "\t\t}",
+            "",
+            "\t   if (this.loading) {",
+            "            return;",
+            "        }",
+            "       // if (ps.name != \"cursor-position\") {",
+            "       //     return;",
+            "       // }",
+            "",
+            "        var buf = this.el.get_buffer();",
+            "        //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();",
+            "        ",
+            "        ",
+            "        // --- select node at line....",
+            "        ",
+            "        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);",
+            "        ",
+            "\t       ",
+            "        //print(\"changing cursor on tree..\\n\");",
+            "       ",
+            "",
+            "        ",
+            "        // let's try allowing editing on the methods.",
+            "        // a little klunky at present..",
+            "        this.prop_selected = \"\";",
+            "        /*",
+            "        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\tthis.prop_selected = prop;",
+            "        \t\t",
+            "    \t\t} else if (kv[0] == \"l\") {",
+            "    \t\t\t this.prop_selected = prop;",
+            "    \t\t\t",
+            "    \t\t}",
+            "        }",
+            "       */",
+            "           // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
+            "           //this.nodeSelected(node,false);",
+            "            ",
+            "            // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
+            "           ",
+            "        ",
+            "        // highlight the node..",
+            "}",
+            " "
+           ],
+           "| void updateGreySelection" : [
+            "(bool scroll) { ",
+            "\tvar sel = this.node_selected;",
+            "\tprint(\"node selected\\n\");",
+            "    var buf = this.el.get_buffer();",
+            "    var sbuf = (GtkSource.Buffer) buf;",
+            "",
+            "   ",
+            "   this.clearGreySelection();",
+            "   ",
+            "   ",
+            "   ",
+            "     if (sel == null) {",
+            "\t     print(\"no selected node\\n\");",
+            "        // no highlighting..",
+            "        return;",
+            "    }",
+            "    ",
+            "    print(\"highlight region %d to %d\\n\", sel.line_start,sel.line_end);",
+            "    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 cursor_at_line = cur_iter.get_line();",
+            "    ",
+            "    ",
+            "    //var cur_line = cur_iter.get_line();",
+            "    //if (cur_line > sel.line_start && cur_line < sel.line_end) {",
+            "    ",
+            "    //} else {",
+            "    if (scroll) {",
+            "\t\tprint(\"scrolling to node -- should occur on node picking.\\n\");",
+            "    \tthis.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
+            "\t}",
+            "    ",
+            "    var start_line = sel.line_start;",
+            "    var end_line = sel.line_end;",
+            "    ",
+            "    ",
+            "    this.el.editable = false;",
+            "    ",
+            "    //var colon_pos = 0;",
+            "    ",
+            "    this.editable_start_pos = -1;",
+            "    ",
+            "    // now if we have selected a property...",
+            "    if (this.prop_selected.length> 0 ) {",
+            "",
+            "\t\tint nstart, nend;",
+            "\t\tif (sel.getPropertyRange(this.prop_selected, out nstart, out nend) && nend > nstart) {",
+            "\t\t\tstart_line = nstart;",
+            "\t\t\tend_line = nend;",
+            "\t\t\t// this.el.editable = true; << cant do this!!?",
+            "\t\t\tprint(\"start line = %d, end line = %d\\n\", start_line, end_line);",
+            "\t\t\t",
+            "\t\t\t\t// see if we are 'right of ':'",
+            "\t\t\t\t// get an iter for the start of the line.",
+            "\t\t\tGtk.TextIter start_first_line_iter,end_first_line_iter;",
+            "\t\t\tthis.el.buffer.get_iter_at_line(out start_first_line_iter, start_line -1);",
+            "\t\t\tthis.el.buffer.get_iter_at_line(out end_first_line_iter, start_line -1);",
+            "\t\t\t ",
+            "\t\t\t",
+            "\t\t\t",
+            "\t\t\t",
+            "\t\t\tif (end_first_line_iter.forward_to_line_end()) {",
+            "\t\t\t\tvar first_line  = this.el.buffer.get_text(start_first_line_iter, end_first_line_iter, false);",
+            "\t\t\t\t",
+            "\t\t\t\tprint(\"first line = %s\\n\", first_line);",
+            "\t\t\t\tif (first_line.contains(\":\")) {",
+            "\t\t\t\t\tthis.editable_start_pos = start_first_line_iter.get_offset() + first_line.index_of(\":\") + 1;",
+            "\t\t\t\t\tprint(\"colon_pos  = %d\\n\", this.editable_start_pos);",
+            "\t\t\t\t}",
+            "\t\t\t\t",
+            "",
+            "\t\t\t\t//Gtk.TextIter colon_iter;",
+            "\t\t\t\t//sbuf.get_iter_at_offset (out colon_iter, colon_pos);",
+            "\t\t\t\t//sbuf.create_source_mark(null, \"active_text\", colon_iter);",
+            "\t\t\t}",
+            "\t\t\t",
+            "\t\t\t",
+            "\t\t\t",
+            "\t\t\t//print(\"is cursor at line? %d ?= %d\\n\", start_line -1 , cursor_at_line);",
+            "\t\t\t//if (start_line - 1 == cursor_at_line) {",
+            "\t\t\t// should be ok - current_posssion can not be less than '-1'...",
+            "\t\t\tif (sbuf.cursor_position < this.editable_start_pos) {",
+            "\t\t\t",
+            "\t\t\t\tprint(\"cursor is before start pos.. - turn off editable...\\n\");",
+            "\t\t\t\t//var before_cursor_string = this.el.buffer.get_text(start_line_iter, cur_iter, false);",
+            "\t\t\t\t//print(\"before cursor string =  %s\\n\", before_cursor_string);",
+            "\t\t\t\t//if (!before_cursor_string.contains(\":\")) {",
+            "\t\t\t\t\tthis.el.editable = false;",
+            "\t\t\t\t//}",
+            "\t\t\t\t",
+            "\t\t\t}",
+            "\t\t\t ",
+            "\t\t\t ",
+            "",
+            "\t\t\t ",
+            "\t\t}",
+            "\t\tprint(\"propSelected = %s range  %d -> %d\\n\", this.prop_selected, start_line, end_line);\t\t",
+            "\t\t",
+            "\t\t",
+            "    }",
+            "    ",
+            "\tprint(\"checking selection\\n\");",
+            "    ",
+            "    ",
+            "    // check selection - if it's out of 'bounds'",
+            "    if (this.el.editable && sbuf.get_has_selection()) {",
+            "\t\tGtk.TextIter sel_start_iter, sel_end_iter;",
+            "\t\tsbuf.get_selection_bounds(out sel_start_iter, out sel_end_iter);",
+            "\t\t",
+            "\t\tif (sel_start_iter.get_line() < start_line || sel_end_iter.get_line() > end_line ||",
+            "\t\t\tsel_start_iter.get_line() > end_line   || sel_end_iter.get_line() < start_line\t\t\t) {",
+            "\t\t\t// save?",
+            "\t\t\tthis.el.editable = false;",
+            "\t\t}",
+            "\t\tif (this.editable_start_pos > 0 &&",
+            "\t\t\t(sel_start_iter.get_offset() < this.editable_start_pos || sel_end_iter.get_offset() < this.editable_start_pos)",
+            "\t\t\t",
+            "\t\t) {",
+            "\t\t\tthis.el.editable = false;",
+            "\t\t}",
+            "\t\t",
+            "\t\t ",
+            "    ",
+            "    }",
+            "    ",
+            "    ",
+            "    ",
+            "    ",
+            "    for (var i = 0; i < buf.get_line_count();i++) {",
+            "        if (i < (start_line -1) || i > (end_line -1)) {",
+            "           ",
+            "            sbuf.get_iter_at_line(out iter, i);",
+            "            sbuf.create_source_mark(null, \"grey\", iter);",
+            "            ",
+            "        }",
+            "    ",
+            "    }",
+            "    if (scroll && (cursor_at_line > end_line || cursor_at_line < start_line)) {",
+            "\t    Gtk.TextIter cpos_iter;",
+            "\t\tbuf.get_iter_at_line(out cpos_iter, start_line);",
+            "\t\t",
+            "\t\tbuf.place_cursor(cpos_iter); ",
+            "\t}",
+            "",
+            "",
+            "}"
+           ]
           }
          ],
-         "xtype" : "Box"
-        },
-        {
-         "$ shadow_type" : "Gtk.ShadowType.IN",
-         "$ xns" : "Gtk",
-         "* init" : [
-          "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
-          " ",
-          ""
-         ],
-         "* pack" : "pack2,true,true",
-         "id" : "inspectorcontainer",
          "xtype" : "ScrolledWindow"
-        }
-       ],
-       "xtype" : "Paned"
-      },
-      {
-       "$ xns" : "Gtk",
-       "* pack" : "append_page,_this.label_code.el",
-       "items" : [
+        },
         {
-         "# JsRender.Node? node_selected" : "null",
-         "# bool button_is_pressed" : false,
-         "# bool key_is_pressed" : false,
-         "# bool loading" : true,
-         "# int editable_start_pos" : "-1",
-         "$ string prop_selected" : "\"\"",
          "$ 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(this.onCursorChanged);",
-          "  ",
-          "  ",
-          "    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",
-         "gboolean editable" : false,
-         "gboolean show_line_marks" : true,
-         "gboolean show_line_numbers" : true,
-         "id" : "sourceview",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+         "bool homogeneous" : false,
+         "bool vexpand" : false,
+         "int spacing" : 0,
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "set_buffer",
-           "bool dirty" : false,
-           "id" : "buffer",
-           "int error_line" : "-1",
+           "* init" : [
+            "this.css = new Gtk.CssProvider();",
+            " ",
+            "this.css.load_from_string(",
+            "\t\"#roo-search-entry { background-color: #ccc; }\"",
+            ");",
+            " ",
+            "Gtk.StyleContext.add_provider_for_display(",
+            "\tthis.el.get_display(),",
+            "\tthis.css,",
+            "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+            ");",
+            "\t\t",
+            "\t ",
+            " ",
+            ""
+           ],
+           "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) {",
+               "\t\t_this.forwardSearch(true);",
+               "\t\t",
+               "\t\t",
+               "\t    return true;",
+               "",
+               "\t}    ",
+               "   // print(event.key.keyval)",
+               "   ",
+               "    return false;",
+               "}",
+               ""
+              ]
+             },
+             "xtype" : "EventControllerKey"
+            }
+           ],
            "listeners" : {
-            "changed" : [
-             " () => {",
-             " ",
-             "",
-             "    // check syntax??",
-             "    // ??needed..??",
-             "   // _this.save_button.el.sensitive = true;",
-             "    ///?? has changed occured during loading?",
-             "    ",
-             "    // only trigger this if ",
-             "    ",
-             "    ",
-             "    ",
-             "    ",
-             "    if (_this.sourceview.loading) {",
-             "\t\treturn;",
-             "\t}",
-             "\t",
-             "",
-             "\t",
-             "    print(\"- PREVIEW EDITOR CHANGED--\");",
-             "",
-             "    this.dirty = true;  ",
-             "    this.checkSyntax(); // this calls backs and highlights errors.. in theory...  ",
+            "search_changed" : [
+             "( ) => {",
              "",
+             "_this.search(_this.search_entry.el.text);",
+             "\t _this.search_results.updateResults();",
              "",
-             "",
-             "\tif (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {",
-             "\t\tprint(\"button or key not pressed to generate change?!\\n\");",
-             "\t\treturn;",
-             "\t}",
-             "\t\t",
-             "    ",
-             "\t// what are we editing??",
-             "\tif (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length  < 1) {",
-             "\t\treturn;",
-             "\t}",
-             "\t",
-             "\t// find the colon on the first line...",
-             "\t",
-             "\tif (_this.sourceview.editable_start_pos > -1) {",
-             "\t\t",
-             "\t\tvar buf = (Gtk.SourceBuffer)_this.sourceview.el.get_buffer();",
-             "\t\t",
-             "        //print(\"cursor changed : %d\\n\", buf.cursor_position);",
-             "        Gtk.TextIter spos,epos;",
-             "        buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);",
-             "        buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..",
-             "        ",
-             "        var gotit= false;",
-             "        var line = spos.get_line();",
-             "        var endline = buf.get_line_count();",
-             "        while (line < endline) {",
-             "    \t\tline++;",
-             "\t        buf.get_iter_at_line(out epos, line);",
-             "\t        if (buf.get_source_marks_at_line(line, \"grey\").length() > 0) {",
-             "\t\t        buf.get_iter_at_line(out epos, line);\t    \t\t",
-             "\t    \t\tgotit=true;",
-             "\t    \t\tbreak;",
-             "    \t\t}",
-             "\t\t}",
-             "        ",
-             " \t\tif (gotit) {",
-             "\t \t\tprint(\"End Offset = %d/%d\\n\", epos.get_line(), epos.get_offset());",
-             "\t\t\t// get the pos...",
-             "\t\t\t// in theory the last char will be '}' or '},' .. or ','",
-             "\t\t\t// we should chop the ',' of the end...",
-             "\t\t\tvar str = buf.get_text(spos, epos, false);",
-             "\t\t\tprint(\"got string\\n%s\\n\", str);",
-             "\t\t",
-             "\t\t}",
-             "\t}",
-             "    return ;",
+             "\tGLib.Timeout.add_seconds(1,() => {",
+             "\t\t _this.search_results.updateResults();",
+             "\t\t return false;",
+             "\t });",
              "}",
-             "",
-             " ",
              ""
             ]
            },
-           "xtype" : "SourceBuffer",
-           "|   bool checkSyntax" : [
-            " () {",
-            " ",
-            "   ",
-            "    var str = this.toString();",
-            "    ",
-            "    // needed???",
-            "    if (this.error_line > 0) {",
-            "         Gtk.TextIter start;",
-            "         Gtk.TextIter end;     ",
-            "        this.el.get_bounds (out start, out end);",
+           "string name" : "roo-search-entry",
+           "string placeholder_text" : "Press enter to search",
+           "xtype" : "SearchEntry",
+           "| void forwardSearch" : [
+            "(bool change_focus) {",
             "",
-            "        this.el.remove_source_marks (start, end, \"WARN\");",
-            "        this.el.remove_source_marks (start, end, \"ERR\");        ",
             "",
-            "    }",
-            "    ",
-            "    if (str.length < 1) {",
-            "        print(\"checkSyntax - empty string?\\n\");",
-            "        return false;",
-            "    }",
-            "    ",
-            "   if (_this.file == null) {",
-            "       return false;",
-            "   }",
-            "    var p = _this.file.project.palete;",
-            "    ",
-            " ",
-            "    if (_this.file.language != \"js\") {",
-            "\t\treturn false; // fake syntax error.",
+            "\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",
-            "    //Gee.HashMap<int,string> ret_x;",
-            "",
-            "\treturn p.javascriptHasErrors(",
-            "\t\t_this.main_window.windowstate,",
-            "        str, ",
-            "         \"\", // _this.key, ",
-            "        \"file\", //_this.ptype,",
-            "        _this.file, ",
-            "        null",
-            "    );    ",
-            "     ",
             "}",
             ""
-           ],
-           "|   string toString" : [
-            "  () {",
-            "    ",
-            "    Gtk.TextIter s;",
-            "    Gtk.TextIter e;",
-            "    this.el.get_start_iter(out s);",
-            "    this.el.get_end_iter(out e);",
-            "    var ret = this.el.get_text(s,e,true);",
-            "    //print(\"TO STRING? \" + ret);",
-            "    return ret;",
-            "}",
-            " "
-           ],
-           "| bool highlightErrors" : [
-            "( Gee.HashMap<int,string> validate_res) {",
-            "         ",
-            "    this.error_line = validate_res.size;",
+           ]
+          },
+          {
+           "$ 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",
-            "    if (this.error_line < 1) {",
-            "          return true;",
-            "    }",
-            "    var tlines = this.el.get_line_count ();",
-            "    Gtk.TextIter iter;",
-            "    var valiter = validate_res.map_iterator();",
-            "    while (valiter.next()) {",
-            "    ",
-            "//        print(\"get inter\\n\");",
-            "        var eline = valiter.get_key();",
-            "        if (eline > tlines) {",
-            "            continue;",
-            "        }",
-            "        this.el.get_iter_at_line( out iter, eline);",
-            "        //print(\"mark line\\n\");",
-            "        this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
-            "    }   ",
-            "    return false;",
             "}"
            ]
+          },
+          {
+           "$ xns" : "Gtk",
+           "bool always_show_image" : true,
+           "bool sensitive" : false,
+           "id" : "nextBtn",
+           "listeners" : {
+            "clicked" : [
+             "(event) => {",
+             "",
+             "\t_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" : [
+             "(event) => {",
+             "",
+             "\t_this.backSearch(true);",
+             "\t",
+             "\t ",
+             "}",
+             ""
+            ]
+           },
+           "string icon_name" : "go-up",
+           "xtype" : "Button"
+          },
+          {
+           "$ xns" : "Gtk",
+           "bool always_show_image" : true,
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "* pack" : false,
+             "* prop" : "popover",
+             "id" : "search_settings",
+             "items" : [
+              {
+               "$ xns" : "Gtk",
+               "* prop" : "child",
+               "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+               "int spacing" : 0,
+               "items" : [
+                {
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  "\tthis.el.show();",
+                  "}",
+                  ""
+                 ],
+                 "id" : "case_sensitive",
+                 "string label" : "Case Sensitive",
+                 "xtype" : "CheckButton"
+                },
+                {
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  "\tthis.el.show();",
+                  "}",
+                  ""
+                 ],
+                 "id" : "regex",
+                 "string label" : "Regex",
+                 "xtype" : "CheckButton"
+                },
+                {
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  "\tthis.el.show();",
+                  "}",
+                  ""
+                 ],
+                 "id" : "multiline",
+                 "string label" : "Multi-line (add \\n)",
+                 "xtype" : "CheckButton"
+                }
+               ],
+               "xtype" : "Box"
+              }
+             ],
+             "xtype" : "Popover"
+            }
+           ],
+           "string icon_name" : "emblem-system",
+           "xtype" : "MenuButton"
           }
          ],
-         "listeners" : {
-          "button_press_event" : [
-           "() => {",
-           "\t",
-           "\t",
-           "\tthis.button_is_pressed = true;",
-           "\treturn false;",
-           "}\t ",
-           ""
-          ],
-          "button_release_event" : [
-           "() => {",
-           "",
-           "\tprint(\"BUTTON RELEASE EVENT\\n\");",
-           "\tthis.onCursorChanged();",
-           "\tthis.button_is_pressed = false;",
-           "\treturn false;",
-           "}"
-          ],
-          "key_press_event" : [
-           "(src, key) => {",
-           "\tthis.key_is_pressed = true;",
-           "\t// is it ctrl-G -- find next?",
-           "\t// which will will still ignore..",
-           "\t ",
-           "\tif \t(key.str == \"g\" && key.state == Gdk.ModifierType.CONTROL_MASK) {",
-           "\t\tthis.key_is_pressed = false;",
-           "\t}",
-           "\t",
-           "\t// if cursor postion is 'at start' of editing range, ",
-           "\t// and backspace is pressed...",
-           "\t// block it..",
-           "\t",
-           "\t var buf = this.el.get_buffer();",
-           "    //print(\"cursor changed : %d\\n\", buf.cursor_position);",
-           "       ",
-           "\tif (buf.cursor_position <= this.editable_start_pos && key.keyval == Gdk.Key.BackSpace) {",
-           "\t\treturn true; // block...",
-           "\t}",
-           "\t// what about 'last line of 'grey...'",
-           "\t// get the buffer - find the line, find the next line ?? see if it's grey?",
-           "\t",
-           "\t",
-           "\tprint(\"KEY PRESS EVENT \\n\");",
-           "\tthis.onCursorChanged();",
-           "\treturn false; ",
-           "}"
-          ],
-          "key_release_event" : [
-           "() => { ",
-           "\tthis.key_is_pressed = false;",
-           "\treturn false;",
-           "}",
-           ""
-          ]
-         },
-         "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 clearGreySelection" : [
-          "() {",
-          " // clear all the marks..",
-          "    var sbuf = (Gtk.SourceBuffer)this.el.buffer;",
-          "    ",
-          "    Gtk.TextIter start;",
-          "    Gtk.TextIter end;     ",
-          "        ",
-          "    sbuf.get_bounds (out start, out end);",
-          "    sbuf.remove_source_marks (start, end, \"grey\");",
-          "    ",
-          "    ",
-          "}",
-          ""
-         ],
-         "| void highlightErrorsJson" : [
-          " (string type, Json.Object obj) {",
-          "       // this is a hook for the vala code - it has no value in javascript ",
-          "       // as we only have one error ususally....",
-          "        return  ;",
-          "    ",
-          " ",
-          "",
-          "",
-          "}"
-         ],
-         "| void loadFile" : [
-          "( ) {",
-          "    this.loading = true;",
-          "    ",
-          "    ",
-          "    // get the cursor and scroll position....",
-          "    var buf = this.el.get_buffer();",
-          "\tvar cpos = buf.cursor_position;",
-          "    ",
-          "   print(\"BEFORE LOAD cursor = %d\\n\", cpos);",
-          "   ",
-          "    var vadj_pos = this.el.get_vadjustment().get_value();",
-          "   ",
-          "    ",
-          " ",
-          "    buf.set_text(\"\",0);",
-          "    var sbuf = (Gtk.SourceBuffer) buf;",
-          "",
-          "    ",
-          "",
-          "    if (_this.file == null || _this.file.xtype != \"Roo\") {",
-          "        print(\"xtype != Roo\");",
-          "        this.loading = false;",
-          "        return;",
-          "    }",
-          "    ",
-          "    // get the string from the rendered tree...",
-          "     ",
-          "     var str = _this.file.toSource();",
-          "     ",
-          "//    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..",
-          "    ",
-          "     GLib.Timeout.add(500, () => {",
-          "",
-          "        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",
-          "",
-          "\t\tthis.onCursorChanged();",
-          "\t\t",
-          "\t\t",
-          "\t\t_this.buffer.checkSyntax();",
-          "\t\treturn false;",
-          "\t});",
-          "\t\t",
-          "    this.loading = false; ",
-          "    _this.buffer.dirty = false;",
-          "}",
-          ""
-         ],
-         "| void nodeSelected" : [
-          "(JsRender.Node? sel, bool scroll ) {",
-          "  ",
-          "    ",
-          "\t",
-          "    // this is connected in widnowstate",
-          "",
-          "",
-          "\t// not sure why....   ",
-          "    while(Gtk.events_pending()) {",
-          "        Gtk.main_iteration();",
-          "    }",
-          "    ",
-          "    this.node_selected = sel;",
-          "    ",
-          "    this.updateGreySelection(scroll);",
-          "    ",
-          "    ",
-          "    ",
-          "}",
-          "",
-          "   ",
-          ""
-         ],
-         "| void onCursorChanged" : [
-          "(/*ParamSpec ps*/) {",
-          "",
-          "\t\tif (!this.key_is_pressed && !this.button_is_pressed) {",
-          "\t\t\treturn;",
-          "\t\t}",
-          "",
-          "\t   if (this.loading) {",
-          "            return;",
-          "        }",
-          "       // if (ps.name != \"cursor-position\") {",
-          "       //     return;",
-          "       // }",
-          "",
-          "        var buf = this.el.get_buffer();",
-          "        //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();",
-          "        ",
-          "        ",
-          "        // --- select node at line....",
-          "        ",
-          "        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);",
-          "        ",
-          "        ",
-          "        // ---------- this selects the tree's node...",
-          "        ",
-          "        var ltree = _this.main_window.windowstate.left_tree;",
-          "        var tp = ltree.model.treePathFromNode(node);",
-          "        print(\"got tree path %s\\n\", tp);",
-          "        if (tp != \"\") {",
-          "\t         ",
-          "\t       ",
-          "\t        //print(\"changing cursor on tree..\\n\");",
-          "\t       ",
-          " ",
-          "            ",
-          "            // let's try allowing editing on the methods.",
-          "            // a little klunky at present..",
-          "            this.prop_selected = \"\";",
-          "            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\t//var k = prop.get_key(kv[1]);",
-          "\t        \t\t// fixme -- need to determine if it's an editable property...",
-          "\t        \t\tthis.prop_selected = prop;",
-          "\t        \t\t",
-          "        \t\t} else if (kv[0] == \"l\") {",
-          "        \t\t\t this.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.nodeSelected(node,false);",
-          "            ",
-          "            // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
-          "             ",
-          "        }",
-          "        ",
-          "        // highlight the node..",
-          "}",
-          " "
-         ],
-         "| void updateGreySelection" : [
-          "(bool scroll) { ",
-          "\tvar sel = this.node_selected;",
-          "\tprint(\"node selected\\n\");",
-          "    var buf = this.el.get_buffer();",
-          "    var sbuf = (Gtk.SourceBuffer) buf;",
-          "",
-          "   ",
-          "   this.clearGreySelection();",
-          "   ",
-          "   ",
-          "   ",
-          "     if (sel == null) {",
-          "\t     print(\"no selected node\\n\");",
-          "        // no highlighting..",
-          "        return;",
-          "    }",
-          "    ",
-          "    print(\"highlight region %d to %d\\n\", sel.line_start,sel.line_end);",
-          "    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 cursor_at_line = cur_iter.get_line();",
-          "    ",
-          "    ",
-          "    //var cur_line = cur_iter.get_line();",
-          "    //if (cur_line > sel.line_start && cur_line < sel.line_end) {",
-          "    ",
-          "    //} else {",
-          "    if (scroll) {",
-          "\t\tprint(\"scrolling to node -- should occur on node picking.\\n\");",
-          "    \tthis.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);",
-          "\t}",
-          "    ",
-          "    var start_line = sel.line_start;",
-          "    var end_line = sel.line_end;",
-          "    ",
-          "    ",
-          "    this.el.editable = false;",
-          "    ",
-          "    //var colon_pos = 0;",
-          "    ",
-          "    this.editable_start_pos = -1;",
-          "    ",
-          "    // now if we have selected a property...",
-          "    if (this.prop_selected.length> 0 ) {",
-          "",
-          "\t\tint nstart, nend;",
-          "\t\tif (sel.getPropertyRange(this.prop_selected, out nstart, out nend) && nend > nstart) {",
-          "\t\t\tstart_line = nstart;",
-          "\t\t\tend_line = nend;",
-          "\t\t\tthis.el.editable = true;",
-          "\t\t\tprint(\"start line = %d, end line = %d\\n\", start_line, end_line);",
-          "\t\t\t",
-          "\t\t\t\t// see if we are 'right of ':'",
-          "\t\t\t\t// get an iter for the start of the line.",
-          "\t\t\tGtk.TextIter start_first_line_iter,end_first_line_iter;",
-          "\t\t\tthis.el.buffer.get_iter_at_line(out start_first_line_iter, start_line -1);",
-          "\t\t\tthis.el.buffer.get_iter_at_line(out end_first_line_iter, start_line -1);",
-          "\t\t\t ",
-          "\t\t\t",
-          "\t\t\t",
-          "\t\t\t",
-          "\t\t\tif (end_first_line_iter.forward_to_line_end()) {",
-          "\t\t\t\tvar first_line  = this.el.buffer.get_text(start_first_line_iter, end_first_line_iter, false);",
-          "\t\t\t\t",
-          "\t\t\t\tprint(\"first line = %s\\n\", first_line);",
-          "\t\t\t\tif (first_line.contains(\":\")) {",
-          "\t\t\t\t\tthis.editable_start_pos = start_first_line_iter.get_offset() + first_line.index_of(\":\") + 1;",
-          "\t\t\t\t\tprint(\"colon_pos  = %d\\n\", this.editable_start_pos);",
-          "\t\t\t\t}",
-          "\t\t\t\t",
-          "",
-          "\t\t\t\t//Gtk.TextIter colon_iter;",
-          "\t\t\t\t//sbuf.get_iter_at_offset (out colon_iter, colon_pos);",
-          "\t\t\t\t//sbuf.create_source_mark(null, \"active_text\", colon_iter);",
-          "\t\t\t}",
-          "\t\t\t",
-          "\t\t\t",
-          "\t\t\t",
-          "\t\t\t//print(\"is cursor at line? %d ?= %d\\n\", start_line -1 , cursor_at_line);",
-          "\t\t\t//if (start_line - 1 == cursor_at_line) {",
-          "\t\t\t// should be ok - current_posssion can not be less than '-1'...",
-          "\t\t\tif (sbuf.cursor_position < this.editable_start_pos) {",
-          "\t\t\t",
-          "\t\t\t\tprint(\"cursor is before start pos.. - turn off editable...\\n\");",
-          "\t\t\t\t//var before_cursor_string = this.el.buffer.get_text(start_line_iter, cur_iter, false);",
-          "\t\t\t\t//print(\"before cursor string =  %s\\n\", before_cursor_string);",
-          "\t\t\t\t//if (!before_cursor_string.contains(\":\")) {",
-          "\t\t\t\t\tthis.el.editable = false;",
-          "\t\t\t\t//}",
-          "\t\t\t\t",
-          "\t\t\t}",
-          "\t\t\t ",
-          "\t\t\t ",
-          "",
-          "\t\t\t ",
-          "\t\t}",
-          "\t\tprint(\"propSelected = %s range  %d -> %d\\n\", this.prop_selected, start_line, end_line);\t\t",
-          "\t\t",
-          "\t\t",
-          "    }",
-          "    ",
-          "\tprint(\"checking selection\\n\");",
-          "    ",
-          "    ",
-          "    // check selection - if it's out of 'bounds'",
-          "    if (this.el.editable && sbuf.get_has_selection()) {",
-          "\t\tGtk.TextIter sel_start_iter, sel_end_iter;",
-          "\t\tsbuf.get_selection_bounds(out sel_start_iter, out sel_end_iter);",
-          "\t\t",
-          "\t\tif (sel_start_iter.get_line() < start_line || sel_end_iter.get_line() > end_line ||",
-          "\t\t\tsel_start_iter.get_line() > end_line   || sel_end_iter.get_line() < start_line\t\t\t) {",
-          "\t\t\t// save?",
-          "\t\t\tthis.el.editable = false;",
-          "\t\t}",
-          "\t\tif (this.editable_start_pos > 0 &&",
-          "\t\t\t(sel_start_iter.get_offset() < this.editable_start_pos || sel_end_iter.get_offset() < this.editable_start_pos)",
-          "\t\t\t",
-          "\t\t) {",
-          "\t\t\tthis.el.editable = false;",
-          "\t\t}",
-          "\t\t",
-          "\t\t ",
-          "    ",
-          "    }",
-          "    ",
-          "    ",
-          "    ",
-          "    ",
-          "    for (var i = 0; i < buf.get_line_count();i++) {",
-          "        if (i < (start_line -1) || i > (end_line -1)) {",
-          "           ",
-          "            sbuf.get_iter_at_line(out iter, i);",
-          "            sbuf.create_source_mark(null, \"grey\", iter);",
-          "            ",
-          "        }",
-          "    ",
-          "    }",
-          "    if (scroll && (cursor_at_line > end_line || cursor_at_line < start_line)) {",
-          "\t    Gtk.TextIter cpos_iter;",
-          "\t\tbuf.get_iter_at_line(out cpos_iter, start_line);",
-          "\t\t",
-          "\t\tbuf.place_cursor(cpos_iter); ",
-          "\t}",
-          "",
-          "",
-          "}"
-         ]
+         "xtype" : "Box"
         }
        ],
-       "xtype" : "ScrolledWindow"
+       "xtype" : "Box"
       }
      ],
      "xtype" : "Notebook"
    ],
    "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",
+    " ",
     "}",
     ""
    ],
     "    if (this.file == null) {",
     "        return;",
     "    }",
+    "    ",
     "\tif (this.notebook.el.page > 0 ) {",
     "        return;",
     "    }",
     "    ",
-    "    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, this.paned.el.position);",
-    "        screenshot.save(filename,\"png\");",
-    "    } catch(Error e) {",
-    "        //noop",
-    "    }",
+    " \tthis.file.widgetToIcon(this.view.el); ",
     "",
     "    ",
     "     ",
     "\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\treturn;",
     "\t}",
     "\t\tthis.sourceview.el.grab_focus();",
     "\t}",
     "\tbuf.place_cursor(st);",
-    "\tvar ln = st.get_line();",
-    "\tbuf.get_iter_at_line(out stl,ln);",
+    "\t",
+    " ",
     "\t ",
-    "\tthis.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);",
+    "\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 ",
     "\t// highlight node...",
     "\t",
     "\t\t",
     "        return;",
     "    }",
     "    var prop = node.lineToProp(ln+1);",
-    "    print(\"prop : %s\", prop == null ? \"???\" : prop);",
+    "    print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
     "        ",
     "        ",
     "    // ---------- this selects the tree's node...",
     "    ",
     "    var ltree = _this.main_window.windowstate.left_tree;",
-    "    var tp = ltree.model.treePathFromNode(node);",
-    "    print(\"got tree path %s\\n\", tp);",
-    "    if (tp == \"\") {",
-    "\t\treturn;",
-    "\t}",
+    "   ltree.model.selectNode(node);",
+    "        ",
     "    //_this.sourceview.allow_node_scroll = false; /// block node scrolling..",
     "\t       ",
     "   ",
     "    // 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\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);",
     "    ",
     "\t\t ",
     "",
     "}",
-    ""
+    " "
    ],
    "| void loadFile" : [
     "",
     "    this.view.renderJS(true);",
     "    this.notebook.el.page = 0;// gtk preview ",
     "    this.sourceview.loadFile();   ",
-    "    ",
     "}",
     " ",
     " "
    ],
    "| void scroll_to_line" : [
     "(int line) {",
-    "   this.notebook.el.page = 1;// code preview...",
-    "   ",
-    "   GLib.Timeout.add(500, () => {",
+    "   // code preview...",
     "   ",
+    "   GLib.Timeout.add(100, () => {",
     "   ",
+    "\t\tthis.notebook.el.set_current_page( 1 );",
     "\t   ",
     "\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" : [
+    "(string category) {",
+    "\t",
+    " ",
+    "",
+    "\tvar buf = _this.buffer.el;",
+    "\tGtk.TextIter start;",
+    "\tGtk.TextIter end;     ",
+    "\tbuf.get_bounds (out start, out end);",
+    "",
+    "\tbuf.remove_source_marks (start, end, category);",
+    " ",
+    "\tGLib.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(category);",
+    "\tif (ar == null || ar.get_n_items() < 1) {",
+    "\t\tGLib.debug(\"higjlight %s has no errors\", category);",
+    "\t\treturn;",
+    "\t}",
+    " ",
+    "",
+    " ",
+    "\t",
+    "\tvar offset = 0;",
+    "\t ",
+    "",
+    "\tvar tlines = buf.get_line_count () +1;",
+    "\t",
+    " ",
+    "\t ",
+    "\tfor (var i = 0; i < ar.get_n_items();i++) {",
+    "\t\tvar err = (Palete.CompileError) ar.get_item(i);",
+    "\t\t",
+    "\t     Gtk.TextIter iter;",
+    "//        print(\"get inter\\n\");",
+    "\t    var eline = err.line - offset;",
+    "\t    GLib.debug(\"GOT ERROR on line %d -- converted to %d  (offset = %d)\",",
+    "\t    \terr.line ,eline, offset);",
+    "\t    ",
+    "\t    ",
+    "\t    if (eline > tlines || eline < 0) {",
+    "\t        return;",
+    "\t    }",
+    "\t   ",
+    "\t    ",
+    "\t    buf.get_iter_at_line( out iter, eline);",
+    "\t   ",
+    "\t   ",
+    "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, err.category, err.msg);",
+    "\t    buf.create_source_mark( msg, err.category, iter);",
+    "\t    GLib.debug(\"set line %d to %s\", eline, msg);",
+    "\t    //this.marks.set(eline, msg);",
+    "\t}",
+    "\treturn ;",
+    "",
+    "",
+    "",
+    " ",
+    "",
+    "}"
    ]
   }
  ],
- "modOrder" : "",
- "name" : "WindowRooView",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowRooView.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "WindowRooView"
 }
\ No newline at end of file