{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
- "# Json.Object notices" : "",
"# Xcls_MainWindow window" : "",
"$ xns" : "Gtk",
+ "* ctor" : "new Gtk.Popover()",
"Gtk.PositionType position" : "Gtk.PositionType.TOP",
- "bool active" : false,
- "bool hexpand" : false,
- "bool modal" : true,
+ "bool autohide" : true,
+ "bool loaded" : false,
"id" : "ValaCompileErrors",
"int height_request" : 800,
"int width_request" : 900,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"bool hexpand" : false,
"gboolean homogeneous" : false,
"id" : "compile_view",
"items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "utf8 label" : "Compile and Run ",
- "xtype" : "Button"
- }
- ],
- "xtype" : "Box"
- },
{
"$ xns" : "Gtk",
"* init" : [
"}",
""
],
- "* pack" : "pack_end,true,true,0",
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- " var description = new Pango.FontDescription();",
- " description.set_size(10000);",
- " this.el.override_font(description);",
- "",
- "}",
- ""
- ],
- "* pack" : "add",
- "id" : "compile_tree",
+ "* pack" : "set_child",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "tree",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "columns" : [
- " typeof(string), ",
- " typeof(int),",
- " typeof(string),",
- " typeof(string) "
+ "* 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 ",
+ "}"
+ ]
+ }
],
- "gint n_columns" : 4,
- "id" : "compile_result_store",
- "xtype" : "TreeStore"
+ "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",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.renderer.el , \"markup\", 2 );",
- " ",
- "}",
- ""
- ],
"* pack" : "append_column",
+ "bool expand" : true,
+ "bool resizable" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "renderer",
- "xtype" : "CellRendererText"
+ "* 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 id" : "column",
- "utf8 title" : "Compile output",
- "xtype" : "TreeViewColumn"
+ "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"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " ",
- " Gtk.TreeViewColumn col;",
- " int cell_x;",
- " int cell_y;",
- " Gtk.TreePath path;",
- " if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {",
- " print(\"nothing selected on click\");",
- " ",
- " return false; //not on a element.",
- " }",
- " ",
- " ",
- " // right click.",
- " if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) { ",
- " // show popup!. ",
- " ",
- " ",
- " return false;",
- " }",
- " Gtk.TreeIter iter;",
- " var mod = _this.compile_result_store.el;",
- " mod.get_iter (out iter, path);",
- " ",
- " ",
- " ",
- " // var val = \"\";",
- " GLib.Value value;",
- " _this.compile_result_store.el.get_value(iter, 3, out value);",
- " var fname = (string)value;",
- " GLib.Value lvalue;",
- " _this.compile_result_store.el.get_value(iter, 1, out lvalue);",
- " var line = (int) lvalue;",
- " ",
- " print(\"open %s @ %d\\n\", fname, line);",
- " ",
- " ",
- " var bjsf = \"\";",
- " try { ",
- " var regex = new Regex(\"\\\\.vala$\");",
- " ",
- " ",
- " bjsf = regex.replace(fname,fname.length , 0 , \".bjs\");",
- " } catch (GLib.RegexError e) {",
- " return false;",
- " } ",
- " var p = _this.window.project;",
- " ",
- " ",
- " ",
- " var jsr = p.getByPath(bjsf);",
- " if (jsr != null) {",
- " _this.window.windowstate.fileViewOpen(jsr, true, line);",
- " ",
- " return false;",
- " ",
- " }",
- " ",
- " var pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
- " _this.window.windowstate.fileViewOpen(pf, true, line);",
- " ",
- " // try hiding the left nav..",
- " ",
- " return false;",
- " ",
- " }",
- " "
- ]
- },
- "xtype" : "TreeView"
+ "xtype" : "ColumnView"
}
],
"xtype" : "ScrolledWindow"
],
"xtype" : "Popover",
"| void show" : [
- "(Json.Object tree, Gtk.Widget onbtn) {",
- "",
- " ",
- " ",
- " this.notices = tree;",
+ "( ) {",
+ "\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",
" ",
" ",
- " var store = this.compile_result_store.el; ",
- " ",
- " store.clear();",
- " \tGtk.TreeIter? expand = null;",
- " ",
- " tree.foreach_member((obj, file, node) => {",
- " // id line \"display text\", file",
- " ",
- " var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + \"/\" + GLib.Path.get_basename( file) ;",
- " Gtk.TreeIter iter;",
- " GLib.debug(\"Add file %s\", title);",
- " store.append(out iter, null);",
- " var lines = tree.get_object_member(file);",
- " title += \" (\" + lines.get_size().to_string() + \")\";",
- " store.set(iter, ",
- " \t0, file, ",
- " \t1, -1, ",
- " \t2, title, ",
- " \t3, file,",
- " \t-1);",
- " ",
- " if (this.window.windowstate.file.path == file) {",
- " GLib.debug(\"Expanding Row: %s\", file);",
- " expand = iter ;",
- "",
- " ",
- " }",
- " ",
- " ",
- " lines.foreach_member((obja, line, nodea) => {",
- " var msg = \"\";",
- " var ar = lines.get_array_member(line);",
- " for (var i = 0 ; i < ar.get_length(); i++) {",
- "\t\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
- "\t\t\t\tmsg += ar.get_string_element(i);",
- "\t\t }",
- "\t\t Gtk.TreeIter citer; ",
- "\t\t GLib.debug(\"Add line %s\", line);",
- "\t\t store.append(out citer, iter);",
- "\t\t store.set(citer, ",
- "\t\t 0, file + \":\" + int.parse(line).to_string(\"%09d\"), ",
- "\t\t 1, int.parse(line), ",
- "\t\t 2, GLib.Markup.escape_text(line + \": \" + msg), ",
- "\t\t 3, file, ",
- "\t\t -1);",
- " ",
- " });",
- " ",
- " ",
- " });",
+ " ; //<< very important!!!",
" ",
- " store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " ",
+ " var win = this.window.el;",
+ " var w = win.get_width();",
+ " var h = win.get_height();",
"",
- " ",
- " int w,h;",
- " this.window.el.get_size(out w, out h);",
- " ",
+ " ",
" // left tree = 250, editor area = 500?",
" ",
" // min 450?",
- " var new_w = int.min(450, w-100);",
+ " 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));",
+ " ",
"",
- " ",
- "",
- " if (this.el.relative_to == null) {",
- " this.el.set_relative_to(onbtn);",
- " }",
- " this.el.show_all();",
- " ",
- " \tif (expand != null) {",
- " \t_this.compile_tree.el.expand_row( store.get_path(expand) , true);",
- "\t}",
+ " // 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 ",
+ " ",
" ",
- " while(Gtk.events_pending()) { ",
- " Gtk.main_iteration();",
- " } ",
+ " \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",
+ "\t//GLib.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();",
+ "}"
]
}
],
- "modOrder" : "",
- "name" : "ValaCompileErrors",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileErrors.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "ValaCompileErrors"
}
\ No newline at end of file