{ "build_module" : "builder", "gen_extended" : false, "items" : [ { "# Xcls_MainWindow window" : "", "$ xns" : "Gtk", "* ctor" : "new Gtk.Popover()", "Gtk.PositionType position" : "Gtk.PositionType.TOP", "bool autohide" : true, "bool loaded" : false, "id" : "ValaCompileErrors", "int height_request" : 800, "int width_request" : 900, "items" : [ { "$ xns" : "Gtk", "* pack" : "set_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : false, "gboolean homogeneous" : false, "id" : "compile_view", "items" : [ { "$ xns" : "Gtk", "* init" : [ "{", " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);", " ", "", "}", "" ], "items" : [ { "$ xns" : "Gtk", "* pack" : "set_child", "bool hexpand" : true, "bool vexpand" : true, "id" : "tree", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "id" : "selmodel", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "id" : "sortmodel", "items" : [ { "$ xns" : "Gtk", "* ctor" : [ "new Gtk.TreeListModel(", " new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..", " false, // passthru", " false, // autexpand", " (item) => {", " ", " \t ", " \t return ((Palete.CompileError)item).lines;", " ", " }", " ", " ", ")" ], "* prop" : "model", "id" : "model", "xtype" : "TreeListModel" }, { "$ xns" : "Gtk", "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", "* prop" : "expression", "GLib.Type this_type" : "typeof(Palete.CompileError)", "string property_name" : "linemsg", "xtype" : "PropertyExpression" } ], "xtype" : "StringSorter" } ], "xtype" : "TreeListRowSorter" } ], "xtype" : "SortListModel", "| Json.Object getNodeAt" : [ "(uint row) {", "", " var tr = (Gtk.TreeListRow)this.el.get_item(row);", " ", " ", " // GLib.debug(\"get_item (2) = %s\", a.get_type().name());", " \t", " ", " return (Json.Object)tr.get_item();", "\t ", "}" ] } ], "xtype" : "SingleSelection", "| Json.Object getNodeAt" : [ "(uint row) {", "", " var tr = (Gtk.TreeListRow)this.el.get_item(row);", " ", " var a = tr.get_item();; ", " GLib.debug(\"get_item (2) = %s\", a.get_type().name());", " ", " return (Json.Object)tr.get_item();", "\t ", "}" ] }, { "$ xns" : "Gtk", "* pack" : "append_column", "bool expand" : true, "bool resizable" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());", "\t", "\t", "\t", "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\t ", " ", "\tvar lbl = (Gtk.Label) expand.child;", "\t", "\t if (lbl.label != \"\") { // do not update", "\t \treturn;", " \t}", "\t", "", "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();", "\tvar np = (Palete.CompileError) lr.get_item();", "\t", "\t", "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);", "\tlbl.label = np.linemsg;", "\t//lbl.tooltip_markup = np.to_property_option_tooltip();", "\t ", " expand.set_hide_expander( np.lines.n_items < 1);", "\texpand.set_list_row(lr);", " ", " \t// expand current file.", " \t// this causes problems? - critical errors?", " \t// maybe do it on show", " \t//if (_this.window.windowstate.file.path == np.file.path &&", " \t//\tnp.line < 0) {", " \t//\tlr.expanded = true;", " \t", "\t//}", " \t ", " \t// bind image...", " \t", "}", "" ], "setup" : [ "(listitem) => {", "\t", "\tvar expand = new Gtk.TreeExpander();", "\t ", "\texpand.set_indent_for_depth(true);", "\texpand.set_indent_for_icon(true);", "\t ", "\tvar lbl = new Gtk.Label(\"\");", "\tlbl.use_markup = true;", "\t", "\t", " \tlbl.justify = Gtk.Justification.LEFT;", " \tlbl.xalign = 0;", "", " ", "\texpand.set_child(lbl);", "\t((Gtk.ListItem)listitem).set_child(expand);", "\t((Gtk.ListItem)listitem).activatable = false;", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "Compile Result", "xtype" : "ColumnViewColumn" }, { "$ xns" : "Gtk", "listeners" : { "pressed" : [ "(n_press, x, y) => {", "\t", "\tif (n_press < 2) { /// doubleclick?", "\t\treturn;", "\t}", " ", "\t", "\t", "\t// use selection?!", "\tvar tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;", "\t//GLib.debug(\"SELECTED = %s\", tr.item.get_type().name());", "\tvar ce = (Palete.CompileError) tr.item;", "", "\tif (ce.line < 0) {", "\t\t// did not click on a line.", "\t\treturn;", "\t}", "\t ", "\t ", " var fname = ce.file;", " \tvar line = ce.line; ", " GLib.debug(\"open %s @ %d\\n\", ce.file.path, ce.line);", " ", " ", " var bjsf = \"\";", " try { ", " var regex = new Regex(\"\\\\.vala$\");", " ", " ", " bjsf = regex.replace(fname.path,fname.path.length , 0 , \".bjs\");", " } catch (GLib.RegexError e) {", " return;", " } ", " var p = _this.window.project;", " ", " ", " ", " var jsr = p.getByPath(bjsf);", " if (jsr != null) {", " _this.window.windowstate.fileViewOpen(jsr, true, line);", " ", " if (jsr.path == _this.window.windowstate.file.path) {", " ", " \t}", " \t_this.el.hide();", " ", " return;", " ", " }", " ", "\tvar pf = p.getByPath(fname.path);", "\t_this.el.hide();", "\t_this.window.windowstate.fileViewOpen(pf, true, line);", "", " ", "}", "" ] }, "uint button" : 0, "xtype" : "GestureClick" } ], "xtype" : "ColumnView" } ], "xtype" : "ScrolledWindow" } ], "xtype" : "Box" } ], "xtype" : "Popover", "| void show" : [ "( ) {", "\tGLib.debug(\"errors : show\");", "\t", "\tif (_this.model.el.get_n_items() < 1) {", " ", " \t GLib.debug(\"errors : none available\");", " \treturn;", "\t}", " \t//this.el.present();", " //this.el.popup();", " ", " //print(\"looking for %s\\n\", id);", " // loop through parent childnre", " ", " ", " ; //<< very important!!!", " ", " // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);", " ", " var win = this.window.el;", " var w = win.get_width();", " var h = win.get_height();", "", " ", " // left tree = 250, editor area = 500?", " ", " // min 450?", " var new_w = int.min(650, w-100);", " if (new_w > (w-100)) {", " new_w = w-100;", " }", " GLib.debug(\"set size\");", " this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));", " ", "", " // this.el.set_relative_to(onbtn);", "\t//Gtk.Allocation rect;", "\t//onbtn.get_allocation(out rect);", " //this.el.set_pointing_to(rect);", "\t//this.el.present();", "\t", "\tGLib.debug(\"call popup\");", " this.el.popup();", " // only need to load once.", " \t//if (!this.loaded) {", " \t\t ", "\t\t//this.loaded = true;", "\t //}", "\t ", " ", " ", " \t//if (expand != null) {", " //\t_this.compile_tree.el.expand_row( store.get_path(expand) , true);", "//\t}", " ", " // this.hpane.el.set_position( 0);", "}", "" ], "| void updateNotices" : [ "( GLib.ListStore? ls) {", "\tGLib.debug(\"errors : update\");", " if (ls == null || ls.get_n_items() < 1) {", " \t GLib.debug(\"errors : none available\");", " \treturn;", "\t}", "\t", "\tGLib.debug(\"Loading list into tree\");", "\tthis.tree.el.hide();", "\tvar tm = new Gtk.TreeListModel(", "\t\tls, //..... << that's our store..", "\t\tfalse, // passthru", "\t\tfalse, // autexpand", "\t\t(item) => {", "\t\t", "\t\t\t return ((Palete.CompileError)item).lines;", "\t\t", "\t\t}", "\t\t", "\t);", " ", "\t_this.model.el = tm;", "\t_this.sortmodel.el.set_model(tm);", "\t this.tree.el.show();", "}" ] } ], "name" : "ValaCompileErrors" }