{ "build_module" : "builder", "gen_extended" : false, "items" : [ { "# Project.Project project" : "null", "# WindowState windowstate" : "", "$ type" : "Gtk.WindowType.TOPLEVEL", "$ xns" : "Gtk", "* ctor" : "new Gtk.ApplicationWindow(BuilderApplication.singleton({}))", "* init" : [ " ", " ", " this.el.set_icon_name(\"roobuilder\");", " ", " ", " ", " " ], "border_width" : 0, "default_height" : 850, "default_width" : 1200, "id" : "MainWindow", "items" : [ { "$ string title" : "\"Application Builder\"", "$ xns" : "Gtk", "* pack" : "set_titlebar", "bool show_close_button" : true, "id" : "headerbar", "items" : [ { "$ xns" : "Gtk", "* pack" : "pack_start", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "items" : [ { "# Gee.ArrayList mitems" : "", "$ Gtk.Align halign" : "Gtk.Align.START", "$ xns" : "Gtk", "* init" : [ "{", "\tthis.mitems = new Gee.ArrayList();", "}", "" ], "id" : "windowbtn", "int margin_end" : 4, "items" : [ { "$ xns" : "Gtk", "* 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" : [ "( ) => {", "\tthis.updateMenu();", "", "\t _this.windowspopup.el.set_parent(this.el);", "", "\t _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM); ", "\t _this.windowspopup.el.popup(); ", "}", "" ] }, "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 }", "}" ] }, { "$ xns" : "Gtk", "* pack" : "append", "bool always_show_image" : true, "id" : "open_projects_btn", "listeners" : { "clicked" : [ " ( ) => {", " \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" } ], "xtype" : "HeaderBar" }, { "$ xns" : "Gtk", "* pack" : "set_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool homogeneous" : false, "bool vexpand" : true, "id" : "vbox", "items" : [ { "# int lastWidth" : 0, "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "mainpane", "items" : [ { "$ xns" : "Gtk", "* prop" : "start_child", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "leftpane", "items" : [ { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "id" : "editpane", "items" : [ { "$ xns" : "Gtk", "* prop" : "start_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "tree", "xtype" : "Box" }, { "$ xns" : "Gtk", "* prop" : "end_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "props", "xtype" : "Box" } ], "listeners" : { "accept_position" : [ "( ) => {", "\t_this.windowstate.left_tree.onresize();", "\treturn true;", "}", "" ], "move_handle" : [ "(scroll) => {", "\tGLib.debug(\"Move handle\");", "\treturn true;", "}" ] }, "xtype" : "Paned" } ], "xtype" : "Box" }, { "$ xns" : "Gtk", "* prop" : "end_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "items" : [ { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "id" : "rooviewbox", "xtype" : "Box" }, { "$ xns" : "Gtk", "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", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool homogeneous" : false, "bool vexpand" : false, "items" : [ { "$ tooltip_text" : "\"Project Details\"", "$ xns" : "Gtk", "bool always_show_image" : true, "listeners" : { "clicked" : [ " ( ) => {", " ", " _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", "bool always_show_image" : true, "listeners" : { "clicked" : [ " ( ) => {", " ", " // create a new file in project..", " if (_this.project == null || _this.windowstate.file == null) {", " return ;", " }", " _this.windowstate.file_details.show(", " _this.windowstate.file, _this.el, false", " );", " ", " return ; ", "", "", "}" ] }, "string icon_name" : "document-properties", "string label" : "Edit File Properties", "xtype" : "Button" }, { "$ xns" : "Gtk", "bool always_show_image" : true, "items" : [ { "$ xns" : "Gtk", "* ctor" : "new Gtk.PopoverMenu.from_model(null)", "* init" : [ "{", " // this.el.show();", "}", "" ], "* prop" : "popover", "id" : "topbarmenu", "items" : [ { "$ xns" : "Gtk", "* 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" : "PopoverMenu" } ], "string icon_name" : "dialog-information", "string label" : "About", "xtype" : "MenuButton" }, { "$ xns" : "Gtk", "bool hexpand" : true, "string label" : " ", "xtype" : "Label" }, { "$ xns" : "Gtk", "* init" : [ "{", " this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {", " if (pos < 1) {", " this.el.hide();", " _this.mainpane.el.set_sensitive(true);", " ", " return;", " }", " _this.mainpane.el.set_sensitive(false);", " this.el.show();", " this.el.set_fraction ((1.0f * pos) / (1.0f * total));", " this.el.set_text(\"Fetching Resource : %s/%s\".printf(pos.to_string(), total.to_string()));", " ", " });", "}", "" ], "bool show_text" : true, "id" : "statusbar", "ulong handler_id" : "-1", "xtype" : "ProgressBar" }, { "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "$ xns" : "Gtk", "items" : [ { "$ xns" : "Gtk", "id" : "statusbar_compilestatus_label", "int margin_end" : 4, "int margin_start" : 4, "string label" : "Compile Status:", "xtype" : "Label" }, { "# GLib.ListStore notices" : "null", "$ xns" : "Gtk", "Xcls_ValaCompileErrors popup" : "", "id" : "statusbar_errors", "listeners" : { "clicked" : [ "() => {", " ", "", " ", " if (this.popup == null) {", " this.popup = new Xcls_ValaCompileErrors();", " this.popup.window = _this;", " //this.popup.el.application = _this.el.application;", "\t // this.popup.el.set_transient_for( _this.el );", " this.popup.el.set_parent(this.el);", " }", " if (_this.statusbar_compile_spinner.el.spinning) {", "\t\tthis.popup.el.show(); \t", " \treturn;", "\t} ", " this.popup.show(this.notices, this.el);", " return;", "}" ] }, "string icon_name" : "dialog-error", "string label" : "0 Errors", "xtype" : "Button", "| void setNotices" : [ "(GLib.ListStore nots, int qty, int tf) {", " ", " if (qty < 1 ) {", " \tthis.el.hide();", " \tif (this.popup != null && this.popup.el.visible) {", " \t\tthis.popup.el.hide();", "\t\t}", " \treturn;", " }", " ", " this.el.show();", " this.el.label = \"%d/%d Errors\".printf(tf,qty);", " this.notices = nots;", "\tif (this.popup != null && this.popup.el.visible) {", "\t\t this.popup.show(this.notices, this.el);", " }", "}", "" ] }, { "# GLib.ListStore notices" : "null", "$ xns" : "Gtk", "Xcls_ValaCompileErrors popup" : "", "id" : "statusbar_warnings", "listeners" : { "clicked" : [ "() => {", " ", "\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);", " }", " if (_this.statusbar_compile_spinner.el.spinning) {", "\t\tthis.popup.el.show(); \t", " \treturn;", "\t} ", " this.popup.show(this.notices, this.el);", " return;", "}" ] }, "string icon_name" : "dialog-warning", "string label" : "0 Warnings", "xtype" : "Button", "| void setNotices" : [ "(GLib.ListStore nots, int qty, int tf) {", " ", " if (qty < 1 ) {", " \tthis.el.hide();", " \tif (this.popup != null && this.popup.el.visible) {", " \t\tthis.popup.el.hide();", "\t\t}", " \treturn;", " }", " this.el.show();", " this.el.label = \"%d/%d Warnings\".printf(tf,qty);", " this.notices = nots;", " if (this.popup != null && this.popup.el.visible) {", "\t\t this.popup.show(this.notices, this.el);", " }", " ", "", "}", "" ] }, { "# GLib.ListStore notices" : "null", "$ xns" : "Gtk", "Xcls_ValaCompileErrors popup" : "", "id" : "statusbar_depricated", "listeners" : { "clicked" : [ "() => {", " ", "\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);", " }", " if (_this.statusbar_compile_spinner.el.spinning) {", "\t\tthis.popup.el.show(); \t", " \treturn;", "\t} ", " ", " this.popup.show(this.notices, this.el);", " return;", "}" ] }, "string icon_name" : "dialog-information", "string label" : "0 Depricated", "xtype" : "Button", "| void setNotices" : [ "(GLib.ListStore nots, int qty, int tf) {", " if (qty < 1) {", " \tthis.el.hide();", " \tif (this.popup != null && this.popup.el.visible) {", "\t\t\t this.popup.el.hide();", "\t\t}", " ", " \treturn;", "\t}", " ", " this.el.show();", " ", " this.el.label = \"%d/%d Depricated\".printf(tf,qty);", " this.notices = nots;", "\tif (this.popup != null && this.popup.el.visible) {", "\t\t this.popup.show(this.notices, this.el);", " }", "}", "" ] }, { "$ xns" : "Gtk", "Xcls_ValaCompileErrors popup" : "", "id" : "statusbar_run", "listeners" : { "clicked" : [ "() => {", " ", " 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}", "\tBuilderApplication.valacompilequeue.addFile( ", "\t \t\t\t\t\tPalete.ValaCompileRequestType.RUN, ", "\t \t\t\t\t\t_this.windowstate.file, \"\", true ) ;", "", "\t_this.windowstate.compile_results.el.set_parent(this.el);", "\t_this.windowstate.compile_results.show(this.el,true);", "\t ", "}" ] }, "string icon_name" : "media-playback-start", "string label" : "Run", "xtype" : "Button" } ], "xtype" : "Box" }, { "$ xns" : "Gtk", "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 ", "}", "" ], "| void stop" : [ "() {", " this.el.stop();", " this.el.hide();", " ", "}", "" ] } ], "xtype" : "Box" } ], "xtype" : "Box" } ], "listeners" : { "close_request" : [ "( ) => {", "\t Resources.singleton().disconnect(_this.statusbar.handler_id);", "\t ", "\t BuilderApplication.removeWindow(this);", "\t ", "\t if (BuilderApplication.windows.size < 1) {", "", "\t\tBuilderApplication.singleton( null ).quit();", "\t }", "\treturn true;", "}", "" ], "hide" : [ "() => {", " ", " ", "", "}" ], "show" : [ " ( ) => {", " // hide the file editing..", " ", " //this.hideViewEditing();", " // 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();", " ", " ", "", "}" ] }, "string title" : "Roo Application Builder", "xtype" : "ApplicationWindow", "| void initChildren" : [ " () {", " // this needs putting in a better place..", " this.windowstate = new WindowState(this);", " ", "", " ", "", " ", "", "", "", "}", "" ], "| void openNewWindow" : [ "() {", " ", " 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" : [ "(Palete.ValaCompileRequest? req) {", "", "\tif (req == null) {", " ", "\t _this.statusbar_errors.el.hide();", "\t\t_this.statusbar_warnings.el.hide();", "\t\t_this.statusbar_depricated.el.hide();", "\t\treturn;", "\t}", "\t", "\t", "\tthis.statusbar_errors.setNotices(", "\t\treq.errorByType.get(\"ERR\"),", "\t\treq.totalErrors(\"ERR\"),", "\t\treq.totalErrors(\"ERR\", this.windowstate.file)", "\t);", "\tthis.statusbar_warnings.setNotices(", "\t\treq.errorByType.get(\"WARN\"),", "\t\treq.totalErrors(\"WARN\"),", "\t\treq.totalErrors(\"WARN\", this.windowstate.file)", "\t);", "\tthis.statusbar_depricated.setNotices(", "\t\treq.errorByType.get(\"DEPR\"),", "\t\treq.totalErrors(\"DEPR\"),", "\t\treq.totalErrors(\"DEPR\", this.windowstate.file)", "\t);", "", "\t_this.statusbar_run.el.hide();", "", "\tif (req.totalErrors(\"ERR\") < 1) {", "\t\t_this.statusbar_run.el.show();", "\t}", "\t", "}" ] } ], "name" : "MainWindow" }