fix #7968 - language server support for syntax check and completion
[roobuilder] / src / Builder4 / MainWindow.bjs
index ea58dae..d43dd8f 100644 (file)
@@ -1,22 +1,21 @@
 {
  "build_module" : "builder",
+ "gen_extended" : false,
  "items" : [
   {
    "# Project.Project project" : "null",
-   "# WindowState windowstate" : "null",
-   "# int no_windows" : 1,
-   "# string title" : "\"Roo Application Builder\"",
+   "# WindowState windowstate" : "",
    "$ type" : "Gtk.WindowType.TOPLEVEL",
    "$ xns" : "Gtk",
+   "* ctor" : "new Gtk.ApplicationWindow(BuilderApplication.singleton({}))",
    "* init" : [
     " ",
-    "\t  ",
-    "    //this.el.show_all();",
-    "    //try {",
-    "         this.el.set_icon_name(\"roobuilder\");",
-    "\t//} catch (Exception e) {",
-    "\t//\tprint(\"no icon found\");",
-    "//\t}"
+    " ",
+    "     this.el.set_icon_name(\"roobuilder\");",
+    "     ",
+    "   ",
+    "     ",
+    " "
    ],
    "border_width" : 0,
    "default_height" : 850,
@@ -24,6 +23,7 @@
    "id" : "MainWindow",
    "items" : [
     {
+     "$ string title" : "\"Application Builder\"",
      "$ xns" : "Gtk",
      "* pack" : "set_titlebar",
      "bool show_close_button" : true,
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "items" : [
         {
-         "$ tooltop_text" : [
-          "\"Open a new Window",
-          "\""
-         ],
+         "# Gee.ArrayList<Gtk.Widget> mitems" : "",
+         "$ Gtk.Align halign" : "Gtk.Align.START",
          "$ xns" : "Gtk",
-         "* pack" : "add",
-         "bool always_show_image" : true,
-         "id" : "windownew",
+         "* init" : [
+          "{",
+          "\tthis.mitems = new Gee.ArrayList<Gtk.Button>();",
+          "}",
+          ""
+         ],
+         "id" : "windowbtn",
+         "int margin_end" : 4,
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "window-new",
-           "xtype" : "Image"
+           "* pack" : false,
+           "id" : "windowspopup",
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "* pack" : "set_child",
+             "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+             "id" : "popover_menu",
+             "int spacing" : 0,
+             "items" : [
+              {
+               "$ xns" : "Gtk",
+               "* pack" : "append",
+               "items" : [
+                {
+                 "$ Gtk.ShortcutScope scope" : "Gtk.ShortcutScope.GLOBAL",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  "\tthis.el.add_shortcut(",
+                  "\t\tnew Gtk.Shortcut(",
+                  "\t\t\tnew Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),",
+                  "\t\t\tnew Gtk.SignalAction(\"clicked\")",
+                  "\t\t)",
+                  "\t);",
+                  "}",
+                  ""
+                 ],
+                 "xtype" : "ShortcutController"
+                }
+               ],
+               "listeners" : {
+                "clicked" : [
+                 "( ) => {",
+                 "\t_this.windowspopup.el.hide();",
+                 "\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
+                 "}",
+                 ""
+                ]
+               },
+               "string label" : "New Window",
+               "xtype" : "Button"
+              },
+              {
+               "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+               "$ xns" : "Gtk",
+               "* pack" : "append",
+               "xtype" : "Separator"
+              }
+             ],
+             "xtype" : "Box"
+            }
+           ],
+           "xtype" : "Popover"
+          },
+          {
+           "$ xns" : "Gtk",
+           "* prop" : "child",
+           "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "int margin_start" : 4,
+             "string icon_name" : "window-new",
+             "xtype" : "Image"
+            },
+            {
+             "$ xns" : "Gtk",
+             "string label" : "Windows (Add/List)",
+             "xtype" : "Label"
+            }
+           ],
+           "xtype" : "Box"
           }
          ],
          "listeners" : {
           "clicked" : [
-           "  ( ) => {",
-           "     _this.openNewWindow();",
-           "      ",
+           "( ) => {",
+           "\tthis.updateMenu();",
            "",
-           "}"
+           "\t _this.windowspopup.el.set_parent(this.el);",
+           "",
+           "\t _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM); ",
+           "\t _this.windowspopup.el.popup(); ",
+           "}",
+           ""
           ]
          },
-         "string label" : "New Window",
-         "xtype" : "Button"
+         "xtype" : "Button",
+         "| void updateMenu" : [
+          "() {",
+          "\t foreach(var m in  this.mitems) {",
+          "\t \t _this.popover_menu.el.remove(m);",
+          "\t }",
+          "\t this.mitems.clear();",
+          "\t",
+          "\t BuilderApplication.windows.sort((a,b) => {",
+          "\t \tif (a.windowstate == null ||",
+          " \t\t\t a.windowstate.file == null || ",
+          " \t\t\t b.windowstate == null ||",
+          " \t\t\t b.windowstate.file == null",
+          " \t\t\t ) { ",
+          " \t\t\treturn 0;",
+          "\t\t}",
+          "",
+          "\t \tvar ap = a.windowstate.file.project.name;",
+          "\t \tvar bp = b.windowstate.file.project.name;",
+          "\t \t",
+          "",
+          "\t \t",
+          "\t \tif (ap != bp) {",
+          "\t \t\treturn ap.collate(bp);",
+          "\t \t}",
+          "\t \tvar af =  a.windowstate.file == null ? \"\" : a.windowstate.file.getTitle();",
+          "\t \tvar bf = b.windowstate.file == null ? \"\" : b.windowstate.file.getTitle();\t \t",
+          "\t\treturn af.collate(bf);",
+          "\t ",
+          "\t });",
+          "\t ",
+          "\t var p = \"\";",
+          "\t foreach(var w in BuilderApplication.windows) {",
+          "\t \tvar wid = BuilderApplication.windows.index_of(w);",
+          "\t \t// fixme find a better way to display this.",
+          " \t\tif (w.windowstate == null ||",
+          " \t\t\t w.windowstate.file == null || ",
+          " \t\t\t _this.windowstate == null ||",
+          " \t\t\t _this.windowstate.file == null",
+          " \t\t\t ) { ",
+          " \t\t\tcontinue;",
+          "\t\t}",
+          "\t \t// should not happen...",
+          "\t \tif (w.windowstate.file.path == _this.windowstate.file.path) {",
+          "\t \t\tcontinue;",
+          " \t\t}",
+          " \t\tif (w.windowstate.file.project.name != p || p != \"\") {",
+          " \t\t\tvar ms = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);",
+          " \t\t\t_this.popover_menu.el.append(ms);",
+          "\t\t \tms.show();",
+          "\t\t \tthis.mitems.add(ms);",
+          " \t\t}",
+          " \t\t",
+          " \t\tp = w.windowstate.file.project.name;",
+          " \t\t",
+          "",
+          " \t\tGLib.debug(\"add menuitem %s\", w.windowstate.file.path);",
+          " \t\t",
+          " \t\t",
+          " \t\t",
+          "\t \tvar m = new Gtk.Button.with_label(",
+          "\t\t \tw.windowstate.file.project.name + \" : \" + w.windowstate.file.relpath",
+          "\t \t);",
+          "\t \tm.halign = Gtk.Align.START;",
+          "\t \t",
+          "\t \t",
+          "\t \t//w.windowstate.file.path);",
+          "\t \tm.clicked.connect(() => {",
+          "\t\t \t_this.windowspopup.el.hide();",
+          "\t \t\t BuilderApplication.windows.get(wid).el.present();",
+          "\t \t});",
+          "\t \t_this.popover_menu.el.append(m);",
+          "\t \t//m.show();",
+          "\t \tthis.mitems.add(m);",
+          "\t }",
+          "}"
+         ]
         },
         {
-         "$ tooltop_text" : "\"Open File\"",
          "$ xns" : "Gtk",
-         "* pack" : "add",
+         "* pack" : "append",
          "bool always_show_image" : true,
          "id" : "open_projects_btn",
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "system-file-manager",
-           "xtype" : "Image"
-          }
-         ],
          "listeners" : {
           "clicked" : [
            "  ( ) => {",
-           "  \t_this.windowstate.showPopoverFiles(this.el, _this.project);",
-           "",
+           "  \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
            "}"
           ]
          },
+         "string icon_name" : "system-file-manager",
          "string label" : "Files / Projects",
+         "tooltop_text" : "\"Open File\"",
          "xtype" : "Button"
         }
        ],
        "xtype" : "Box"
       }
      ],
-     "string title" : "Application Builder",
      "xtype" : "HeaderBar"
     },
     {
-     "$ homogeneous" : false,
      "$ xns" : "Gtk",
-     "* pack" : "add",
+     "* pack" : "set_child",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+     "bool homogeneous" : false,
+     "bool vexpand" : true,
      "id" : "vbox",
      "items" : [
       {
        "# int lastWidth" : 0,
        "$ xns" : "Gtk",
-       "* pack" : "pack_start,true,true,0",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+       "bool hexpand" : true,
+       "bool vexpand" : true,
        "id" : "mainpane",
        "items" : [
         {
          "$ xns" : "Gtk",
-         "* pack" : "add",
+         "* prop" : "start_child",
          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+         "bool hexpand" : true,
+         "bool vexpand" : true,
          "id" : "leftpane",
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "pack_start,true,true,0",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
            "id" : "editpane",
            "items" : [
             {
              "$ xns" : "Gtk",
-             "* pack" : "add1",
+             "* prop" : "start_child",
              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+             "bool hexpand" : true,
+             "bool vexpand" : true,
              "id" : "tree",
              "xtype" : "Box"
             },
             {
              "$ xns" : "Gtk",
-             "* pack" : "add2",
+             "* prop" : "end_child",
              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+             "bool hexpand" : true,
+             "bool vexpand" : true,
              "id" : "props",
              "xtype" : "Box"
             }
            ],
            "listeners" : {
             "accept_position" : [
-             "() => {",
-             "\tGLib.debug(\"Accept postion\");",
+             "( ) => {",
+             "\t_this.windowstate.left_tree.onresize();",
              "\treturn true;",
-             "}"
+             "}",
+             ""
             ],
             "move_handle" : [
              "(scroll) => {",
         },
         {
          "$ xns" : "Gtk",
-         "* pack" : "add2",
+         "* prop" : "end_child",
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "bool hexpand" : true,
+         "bool vexpand" : true,
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+           "bool hexpand" : true,
            "bool vexpand" : true,
            "id" : "rooviewbox",
            "xtype" : "Box"
           },
           {
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+           "bool hexpand" : true,
            "bool vexpand" : true,
            "id" : "codeeditviewbox",
            "xtype" : "Box"
          "xtype" : "Box"
         }
        ],
+       "listeners" : {
+        "accept_position" : [
+         "( ) => {",
+         "\t_this.windowstate.left_tree.onresize();",
+         "\treturn true;",
+         "}",
+         ""
+        ]
+       },
        "position" : 400,
        "xtype" : "Paned"
       },
       {
        "$ xns" : "Gtk",
-       "* pack" : "pack_end,false,true,0",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "bool homogeneous" : false,
+       "bool vexpand" : false,
        "items" : [
         {
          "$ tooltip_text" : "\"Project Details\"",
          "$ xns" : "Gtk",
-         "* pack" : "add",
          "bool always_show_image" : true,
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "emblem-system",
-           "xtype" : "Image"
-          }
-         ],
          "listeners" : {
           "clicked" : [
            "  ( ) => {",
            "     ",
-           "     _this.windowstate.projectPopoverShow(this.el, _this.project);",
+           "     _this.windowstate.projectPopoverShow(_this.el, null, null);",
            "   ",
            "  ",
            "}"
           ]
          },
+         "string icon_name" : "emblem-system",
          "string label" : "Edit Project Settings",
          "xtype" : "Button"
         },
         {
          "$ tooltip_text" : "\"File Details\"",
          "$ xns" : "Gtk",
-         "* pack" : "add",
          "bool always_show_image" : true,
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "document-properties",
-           "xtype" : "Image"
-          }
-         ],
          "listeners" : {
           "clicked" : [
            "  ( ) => {",
            "        return  ;",
            "    }",
            "     _this.windowstate.file_details.show(",
-           "        _this.windowstate.file, this.el",
+           "        _this.windowstate.file, _this.el, false",
            "    );",
            "     ",
            "    return  ;    ",
            "}"
           ]
          },
+         "string icon_name" : "document-properties",
          "string label" : "Edit File Properties",
          "xtype" : "Button"
         },
         {
          "$ xns" : "Gtk",
-         "* pack" : "add",
          "bool always_show_image" : true,
          "items" : [
           {
            "$ xns" : "Gtk",
+           "* ctor" : "new Gtk.PopoverMenu.from_model(null)",
            "* init" : [
             "{",
-            "    this.el.show_all();",
+            "   // this.el.show();",
             "}",
             ""
            ],
-           "* pack" : "set_popup",
+           "* prop" : "popover",
            "id" : "topbarmenu",
            "items" : [
             {
              "$ xns" : "Gtk",
-             "* pack" : "append",
-             "listeners" : {
-              "activate" : [
-               " ( ) => {",
-               "         Resources.singleton().fetchStart();",
-               "}"
-              ]
-             },
-             "string label" : "Download updated Resources",
-             "xtype" : "MenuItem"
-            },
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "append",
-             "listeners" : {
-              "activate" : [
-               "() => {",
-               "    About.singleton().el.show();",
-               "    }"
-              ]
-             },
-             "string label" : "About the Builder",
-             "xtype" : "MenuItem"
+             "* pack" : "set_child",
+             "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+             "int spacing" : 0,
+             "items" : [
+              {
+               "$ xns" : "Gtk",
+               "listeners" : {
+                "activate" : [
+                 " ( ) => {",
+                 "         Resources.singleton().fetchStart();",
+                 "}"
+                ]
+               },
+               "string label" : "Download updated Resources",
+               "xtype" : "Button"
+              },
+              {
+               "$ xns" : "Gtk",
+               "listeners" : {
+                "clicked" : [
+                 "() => {",
+                 "    About.singleton().el.show();",
+                 "    }"
+                ]
+               },
+               "string label" : "About the Builder",
+               "xtype" : "Button"
+              }
+             ],
+             "xtype" : "Box"
             }
            ],
-           "xtype" : "Menu"
-          },
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "dialog-information",
-           "xtype" : "Image"
+           "xtype" : "PopoverMenu"
           }
          ],
+         "string icon_name" : "dialog-information",
          "string label" : "About",
          "xtype" : "MenuButton"
         },
         {
          "$ xns" : "Gtk",
-         "* pack" : "pack_start,true,true,0",
+         "bool hexpand" : true,
          "string label" : "   ",
          "xtype" : "Label"
         },
           "}",
           ""
          ],
-         "* pack" : "pack_start,true,true,0",
          "bool show_text" : true,
          "id" : "statusbar",
          "ulong handler_id" : "-1",
          "xtype" : "ProgressBar"
         },
         {
+         "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
          "$ xns" : "Gtk",
-         "* init" : [
-          "var description =   Pango.FontDescription.from_string(\"monospace\");",
-          "\tdescription.set_size(8000);",
-          "\t this.el.override_font(description);",
-          "",
-          ""
-         ],
-         "* pack" : "pack_start,false,true,0",
-         "id" : "search_entry",
-         "int width_request" : 300,
-         "listeners" : {
-          "changed" : [
-           "() => {",
-           "\tif (this.el.text == \"\") {",
-           "\t\t_this.search_results.el.hide();",
-           "\t\treturn;",
-           "\t}",
-           "\tvar res = 0;",
-           "\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\tres = _this.windowstate.code_editor_tab.search(this.el.text);",
-           "\t\t\t",
-           "\t\t\tbreak;",
-           "\t\tcase WindowState.State.PREVIEW:",
-           "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
-           "\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);",
-           "\t\t\t} else { ",
-           "\t\t\t\t res = _this.windowstate.window_rooview.search(this.el.text);\t\t\t",
-           "\t\t\t}",
-           "\t\t",
-           "\t\t",
-           "\t\t\tbreak;",
-           "\t}",
-           "\t_this.search_results.el.show();",
-           "\tif (res > 0) {",
-           "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
-           "\t} else {",
-           "\t\t_this.search_results.el.label = \"No Matches\";",
-           "\t}",
-           "\t\t",
-           "\t",
-           "\t",
-           "}",
-           ""
-          ],
-          "key_press_event" : [
-           "(event) => {",
-           "    ",
-           " \tif (event.keyval == Gdk.Key.Return) {",
-           "\t\tthis.forwardSearch(false);",
-           "\t    return true;",
-           "",
-           "\t}    ",
-           "   // print(event.key.keyval)",
-           "    ",
-           "    return false;",
-           "",
-           "} "
-          ]
-         },
-         "xtype" : "SearchEntry",
-         "| void forwardSearch" : [
-          "(bool 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",
-          "}",
-          ""
-         ]
-        },
-        {
-         "$ xns" : "Gtk",
-         "* pack" : "add",
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "add",
-           "Xcls_ValaCompileErrors popup" : "",
-           "bool always_show_image" : true,
-           "id" : "search_results",
-           "items" : [
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "set_image",
-             "bool sensitive" : false,
-             "utf8 icon_name" : "system-search",
-             "xtype" : "Image"
-            }
-           ],
-           "listeners" : {
-            "button_press_event" : [
-             "() => {",
-             "/*",
-             "    if (this.popup == null) {",
-             "        this.popup = new Xcls_ValaCompileErrors();",
-             "        this.popup.window = _this;",
-             "    }",
-             "   ",
-             "    ",
-             "    this.popup.show(this.notices, this.el);",
-             "    */",
-             "    return true;",
-             "}"
-            ]
-           },
-           "string label" : "Matches",
-           "xtype" : "ImageMenuItem"
-          },
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "add",
            "id" : "statusbar_compilestatus_label",
+           "int margin_end" : 4,
+           "int margin_start" : 4,
            "string label" : "Compile Status:",
-           "xtype" : "MenuItem"
+           "xtype" : "Label"
           },
           {
-           "# Json.Object notices" : "new Json.Object() ",
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Xcls_ValaCompileErrors popup" : "",
-           "bool always_show_image" : true,
            "id" : "statusbar_errors",
-           "items" : [
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "set_image",
-             "utf8 icon_name" : "dialog-error",
-             "xtype" : "Image"
-            }
-           ],
            "listeners" : {
-            "button_press_event" : [
+            "clicked" : [
              "() => {",
-             "    if (this.popup == null) {",
-             "        this.popup = new Xcls_ValaCompileErrors();",
-             "        this.popup.window = _this;",
-             "    }",
+             " ",
+             "\tif (this.popup == null) {",
+             "\t\treturn;",
+             "\t}",
              "   ",
-             "    ",
-             "    this.popup.show(this.notices, this.el);",
-             "    return true;",
+             "    this.popup.show();",
+             "  ",
              "}"
             ]
            },
-           "string label" : "Errors",
-           "xtype" : "ImageMenuItem",
+           "string icon_name" : "dialog-error",
+           "string label" : "0 Errors",
+           "xtype" : "Button",
            "| void setNotices" : [
-            "(Json.Object nots, int qty) {",
+            "(GLib.ListStore nots, GLib.ListStore fe ) {",
+            "    ",
+            "     if (nots.get_n_items() < 1 ) {",
+            "    \tthis.el.hide();",
+            "    \tif (this.popup != null) {",
+            "    \t\tthis.popup.el.hide();",
+            "\t\t}",
+            "    \treturn;",
+            "    }",
+            "    ",
             "    this.el.show();",
-            "    this.el.label = qty.to_string() + \" Errors\";",
-            "    this.notices = nots;",
+            "    this.el.label = \"%d/%d Errors\".printf((int)fe.get_n_items(),(int)nots.get_n_items());",
             "",
+            "    ",
+            " ",
+            "\tif (this.popup == null) {",
+            "        this.popup = new Xcls_ValaCompileErrors();",
+            "        this.popup.window = _this;",
+            "      //    this.popup.el.set_transient_for( _this.el );",
+            "        this.popup.el.set_parent(this.el);",
+            "    }",
+            "\tthis.popup.updateNotices(nots);",
+            "\t ",
             "}",
             ""
            ]
           },
           {
-           "# Json.Object notices" : "new Json.Object()",
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Xcls_ValaCompileErrors popup" : "",
-           "bool always_show_image" : true,
            "id" : "statusbar_warnings",
-           "items" : [
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "set_image",
-             "utf8 icon_name" : "dialog-warning",
-             "xtype" : "Image"
-            }
-           ],
            "listeners" : {
-            "button_press_event" : [
+            "clicked" : [
              "() => {",
-             "    if (this.popup == null) {",
-             "        this.popup = new Xcls_ValaCompileErrors();",
-             "        this.popup.window = _this;",
-             "    }",
-             "    ",
-             "    this.popup.show(this.notices, this.el);",
-             "    return true;",
+             " ",
+             "\tif (this.popup == null) {",
+             "\t\treturn;",
+             "\t}",
+             "   ",
+             "    this.popup.show();",
+             "    return;",
              "}"
             ]
            },
-           "string label" : "Warnings",
-           "xtype" : "ImageMenuItem",
+           "string icon_name" : "dialog-warning",
+           "string label" : "0 Warnings",
+           "xtype" : "Button",
            "| void setNotices" : [
-            "(Json.Object nots, int qty) {",
+            "(GLib.ListStore nots, GLib.ListStore fe ) {",
+            "    ",
+            "     if (nots.get_n_items() < 1 ) {",
+            "    \tthis.el.hide();",
+            "    \tif (this.popup != null) {",
+            "    \t\tthis.popup.el.hide();",
+            "\t\t}",
+            "    \treturn;",
+            "    }",
+            "    ",
             "    this.el.show();",
-            "    this.el.label = qty.to_string() + \" Warnings\";",
-            "    this.notices = nots;",
+            "    this.el.label = \"%d/%d Warnings\".printf((int)fe.get_n_items(),(int)nots.get_n_items());",
             "",
+            "    ",
+            " ",
+            "\tif (this.popup == null) {",
+            "        this.popup = new Xcls_ValaCompileErrors();",
+            "        this.popup.window = _this;",
+            "      //    this.popup.el.set_transient_for( _this.el );",
+            "        this.popup.el.set_parent(this.el);",
+            "    }",
+            "\tthis.popup.updateNotices(nots);",
+            "\t ",
             "}",
             ""
            ]
           },
           {
-           "# Json.Object notices" : "new Json.Object()",
+           "# GLib.ListStore notices" : "null",
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Xcls_ValaCompileErrors popup" : "",
-           "bool always_show_image" : true,
            "id" : "statusbar_depricated",
-           "items" : [
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "set_image",
-             "utf8 icon_name" : "dialog-information",
-             "xtype" : "Image"
-            }
-           ],
            "listeners" : {
-            "button_press_event" : [
+            "clicked" : [
              "() => {",
-             "    if (this.popup == null) {",
-             "        this.popup = new Xcls_ValaCompileErrors();",
-             "        this.popup.window = _this;",
-             "    }",
-             "    ",
-             "    ",
-             "    this.popup.show(this.notices, this.el);",
-             "    return true;",
+             " ",
+             "\tif (this.popup == null) {",
+             "\t\treturn;",
+             "\t}",
+             "   ",
+             "    this.popup.show();",
+             "  ",
              "}"
             ]
            },
-           "string label" : "Depricated",
-           "xtype" : "ImageMenuItem",
+           "string icon_name" : "dialog-information",
+           "string label" : "0 Depricated",
+           "xtype" : "Button",
            "| void setNotices" : [
-            "(Json.Object nots, int qty) {",
+            "",
+            "(GLib.ListStore nots, GLib.ListStore fe ) {",
+            "    ",
+            "     if (nots.get_n_items() < 1 ) {",
+            "    \tthis.el.hide();",
+            "    \tif (this.popup != null) {",
+            "    \t\tthis.popup.el.hide();",
+            "\t\t}",
+            "    \treturn;",
+            "    }",
+            "    ",
             "    this.el.show();",
-            "    this.el.label = qty.to_string() + \" Depricated\";",
-            "    this.notices = nots;",
+            "    this.el.label = \"%d/%d Depricated\".printf((int)fe.get_n_items(),(int)nots.get_n_items());",
             "",
+            "    ",
+            " ",
+            "\tif (this.popup == null) {",
+            "        this.popup = new Xcls_ValaCompileErrors();",
+            "        this.popup.window = _this;",
+            "      //    this.popup.el.set_transient_for( _this.el );",
+            "        this.popup.el.set_parent(this.el);",
+            "    }",
+            "\tthis.popup.updateNotices(nots);",
+            "\t ",
             "}",
             ""
            ]
           },
           {
            "$ xns" : "Gtk",
-           "* pack" : "add",
            "Xcls_ValaCompileErrors popup" : "",
-           "bool always_show_image" : true,
            "id" : "statusbar_run",
-           "items" : [
-            {
-             "$ xns" : "Gtk",
-             "* pack" : "set_image",
-             "utf8 icon_name" : "media-playback-start",
-             "xtype" : "Image"
-            }
-           ],
            "listeners" : {
-            "button_press_event" : [
+            "clicked" : [
              "() => {",
-             "\tif (_this.windowstate.file == null) {",
-             "\t\treturn true;",
+             "   ",
+             "   if (_this.windowstate.file == null) {",
+             "\t\treturn;",
+             "\t}",
+             "   if (_this.statusbar_compile_spinner.el.spinning) {",
+             "    \t_this.windowstate.compile_results.el.set_parent(this.el);",
+             "\t    _this.windowstate.compile_results.el.show(); // show currently running.",
+             "    \treturn;",
              "\t}",
-             "\t_this.windowstate.valasource.spawnExecute(_this.windowstate.file);",
              "\t",
+             "\tvar req = new Palete.ValaCompileRequest(",
+             "\t\tPalete.ValaCompileRequestType.RUN,",
+             "\t\t_this.windowstate.file,",
+             "\t\tnull,",
+             "\t\tnull,",
+             "\t\t\"\"",
+             "\t);",
+             "\treq.run();",
+             "\t ",
+             "\t_this.windowstate.compile_results.el.set_parent(this.el);",
              "\t_this.windowstate.compile_results.show(this.el,true);",
-             "\t",
-             "\treturn true;",
+             "\t         ",
              "}"
             ]
            },
+           "string icon_name" : "media-playback-start",
            "string label" : "Run",
-           "xtype" : "ImageMenuItem"
+           "xtype" : "Button"
           }
          ],
-         "string tooltip_text" : "Update Resources / About Roobuilder",
-         "xtype" : "MenuBar"
+         "xtype" : "Box"
         },
         {
          "$ xns" : "Gtk",
-         "* pack" : "add",
          "id" : "statusbar_compile_spinner",
+         "int margin_end" : 4,
+         "int margin_start" : 4,
          "string tooltip_text" : "Compiling",
          "xtype" : "Spinner",
          "| void start" : [
           "() {",
           "  this.el.show();",
           "  this.el.start();  ",
+          "  ",
+          "\t ",
           "}",
           ""
          ],
           "() {",
           " this.el.stop();",
           "  this.el.hide();",
+          "   ",
           "}",
           ""
          ]
     }
    ],
    "listeners" : {
-    "delete_event" : [
-     "  (   event) => {",
-     "    return false;",
-     "} "
+    "close_request" : [
+     "( ) => {",
+     "\t Resources.singleton().disconnect(_this.statusbar.handler_id);",
+     "\t ",
+     "\t ",
+     "\t this.windowstate.file.getLanguageServer().document_close(",
+     "\t \tthis.windowstate.file",
+     " \t);",
+     "\t ",
+     "\t BuilderApplication.removeWindow(this);",
+     "\t ",
+     "\t if (BuilderApplication.windows.size  < 1) {",
+     "\t\tthis.windowstate.file.getLanguageServer().exit();",
+     "\t\tBuilderApplication.singleton(  null ).quit();",
+     "\t }",
+     "\treturn true;",
+     "}",
+     ""
     ],
-    "destroy" : [
+    "hide" : [
      "() =>  {",
-     " Xcls_MainWindow.singleton().no_windows--;",
      " ",
-     " Resources.singleton().disconnect(_this.statusbar.handler_id);",
      " ",
-     " ",
-     " if (Xcls_MainWindow.singleton().no_windows < 1) {",
      "",
-     "     Gtk.main_quit();",
-     " }",
      "}"
     ],
-    "key_release_event" : [
-     " (event) => {",
-     "    ",
-     "    if (this.search_entry.el.is_visible()) {",
-     "\t\tif (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
-     "\t\t    print(\"SAVE: ctrl-f  pressed\");",
-     "\t\t\tthis.search_entry.el.grab_focus();",
-     "\t\t    return false;",
-     "\t\t}",
-     "\t\t",
-     "\t\tif (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
-     "\t\t    print(\"SAVE: ctrl-g  pressed\");",
-     "\t\t\tthis.search_entry.forwardSearch(true);",
-     "\t\t    return false;",
-     "\t\t}",
-     "\t\t",
-     "\t}    ",
-     "\t",
-     "\tif (event.keyval == Gdk.Key.n && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
-     "\t\tprint(\"SAVE: ctrl-n  pressed\");",
-     "\t\tthis.openNewWindow();",
-     "\t\treturn false;",
-     "\t}",
-     "\t",
-     "   // print(event.key.keyval)",
-     "    ",
-     "    return false;",
-     "",
-     "} ",
-     "",
-     ""
-    ],
     "show" : [
      "  ( ) => {",
      "    // hide the file editing..",
      "   ",
      "    //this.hideViewEditing();",
-     "    _this.statusbar.el.hide();",
-     "     _this.statusbar_errors.el.hide();",
-     "    _this.statusbar_warnings.el.hide();",
-     "    _this.statusbar_depricated.el.hide();",
+     "    // this is updated by windowstate - we try and fill it in..",
+     "     _this.statusbar.el.hide();",
+     "     //_this.statusbar_errors.el.hide();",
+     "    //_this.statusbar_warnings.el.hide();",
+     "    //_this.statusbar_depricated.el.hide();",
      "    _this.statusbar_compile_spinner.el.hide();",
      "  ",
      "    Resources.singleton().checkResources();",
+     "    ",
+     "  ",
      "",
      "}"
     ]
    },
-   "xtype" : "Window",
-   "|             void setTitle" : [
-    " (string str) {",
-    "    this.headerbar.el.set_title(this.title + \" - \" + str);",
-    "} ",
-    ""
-   ],
-   "|             void show" : [
-    "() {",
-    "   ",
-    "    this.el.show_all();",
-    "",
-    "}"
-   ],
-   "|        void initChildren" : [
+   "string title" : "Roo Application Builder",
+   "xtype" : "ApplicationWindow",
+   "| void initChildren" : [
     " () {",
     "    // this needs putting in a better place..",
     "    this.windowstate = new WindowState(this);",
    ],
    "| void openNewWindow" : [
     "() {",
-    "\tXcls_MainWindow.singleton().no_windows++;",
-    "        var w = new Xcls_MainWindow();",
-    "        w.ref();",
-    "",
-    "        w.el.show_all();",
-    "        w.initChildren();",
-    "        w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project);",
-    "        // should open the file dialog...",
-    "        //w.windowstate.switchState(WindowState.State.FILES);",
+    " ",
+    "    var w = new Xcls_MainWindow();",
+    "    w.ref();",
+    "\tBuilderApplication.addWindow(w);",
+    "    w.el.show();",
+    "    w.initChildren();",
+    "    w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);",
+    "     ",
     "}",
     ""
+   ],
+   "| void setTitle" : [
+    " () {",
+    "    if (_this.windowstate.project == null || ",
+    "\t    _this.windowstate.file == null",
+    "    ) {",
+    "    \tthis.el.set_title(\"Select File\");",
+    "    \treturn;",
+    "\t}",
+    "    _this.el.set_title(",
+    "    \t_this.windowstate.project.name + ",
+    "    \t\" - \" +",
+    "\t\t_this.windowstate.file.relpath);",
+    "} "
+   ],
+   "| void show" : [
+    "() {",
+    "   ",
+    "    this.el.show();",
+    "    if (this.windowstate.file  == null) {",
+    "    \tthis.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);",
+    "    }",
+    "}"
+   ],
+   "| void updateErrors" : [
+    "() {",
+    "",
+    "",
+    " \tGLib.debug(\"updateErrors\");",
+    "\t",
+    "\tvar pr = this.windowstate.project.getErrors(\"ERR\");",
+    "\t",
+    "\tthis.statusbar_errors.setNotices(",
+    "\t\tpr,",
+    "\t\tthis.windowstate.file.getErrors(\"ERR\")",
+    "\t);",
+    "\t",
+    "\tthis.statusbar_warnings.setNotices(",
+    "\t\tthis.windowstate.project.getErrors(\"WARN\"),",
+    "\t\tthis.windowstate.file.getErrors(\"WARN\")",
+    "\t);",
+    "\tthis.statusbar_depricated.setNotices(",
+    "\t\tthis.windowstate.project.getErrors(\"DEPR\"),",
+    "\t\tthis.windowstate.file.getErrors(\"DEPR\")",
+    "\t);",
+    " ",
+    "\t_this.statusbar_run.el.hide();",
+    "",
+    "\tif (pr.get_n_items() < 1) {",
+    "\t\t_this.statusbar_run.el.show();",
+    "\t} ",
+    "\t",
+    "}"
    ]
   }
  ],
- "modOrder" : "",
- "name" : "MainWindow",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/MainWindow.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "MainWindow"
 }
\ No newline at end of file