1 static Xcls_ValaCompileErrors _ValaCompileErrors;
3 public class Xcls_ValaCompileErrors : Object
6 private Xcls_ValaCompileErrors _this;
8 public static Xcls_ValaCompileErrors singleton()
10 if (_ValaCompileErrors == null) {
11 _ValaCompileErrors= new Xcls_ValaCompileErrors();
13 return _ValaCompileErrors;
15 public Xcls_compile_view compile_view;
16 public Xcls_tree tree;
17 public Xcls_selmodel selmodel;
18 public Xcls_sortmodel sortmodel;
19 public Xcls_model model;
22 public Xcls_MainWindow window;
26 public Xcls_ValaCompileErrors()
29 this.el = new Gtk.Popover();
35 this.el.width_request = 900;
36 this.el.height_request = 800;
37 this.el.autohide = true;
38 this.el.position = Gtk.PositionType.TOP;
39 new Xcls_compile_view( _this );
40 this.el.set_child ( _this.compile_view.el );
43 // user defined functions
44 public void updateNotices ( GLib.ListStore? ls) {
45 GLib.debug("errors : update");
46 if (ls == null || ls.get_n_items() < 1) {
47 // GLib.debug("errors : none available");
51 //GLib.debug("Loading list into tree");
53 var tm = new Gtk.TreeListModel(
54 ls, //..... << that's our store..
59 return ((Palete.CompileError)item).lines;
66 _this.sortmodel.el.set_model(tm);
69 public void show ( ) {
70 GLib.debug("errors : show");
72 if (_this.model.el.get_n_items() < 1) {
74 GLib.debug("errors : none available");
80 //print("looking for %s\n", id);
81 // loop through parent childnre
84 ; //<< very important!!!
86 // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
88 var win = this.window.el;
89 var w = win.get_width();
90 var h = win.get_height();
93 // left tree = 250, editor area = 500?
96 var new_w = int.min(650, w-100);
97 if (new_w > (w-100)) {
100 GLib.debug("set size");
101 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
104 // this.el.set_relative_to(onbtn);
105 //Gtk.Allocation rect;
106 //onbtn.get_allocation(out rect);
107 //this.el.set_pointing_to(rect);
110 GLib.debug("call popup");
112 // only need to load once.
113 //if (!this.loaded) {
115 //this.loaded = true;
120 //if (expand != null) {
121 // _this.compile_tree.el.expand_row( store.get_path(expand) , true);
124 // this.hpane.el.set_position( 0);
126 public class Xcls_compile_view : Object
129 private Xcls_ValaCompileErrors _this;
135 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
138 _this.compile_view = this;
139 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
143 // set gobject values
144 this.el.homogeneous = false;
145 this.el.hexpand = false;
146 var child_1 = new Xcls_ScrolledWindow3( _this );
148 this.el.append( child_1.el );
151 // user defined functions
153 public class Xcls_ScrolledWindow3 : Object
155 public Gtk.ScrolledWindow el;
156 private Xcls_ValaCompileErrors _this;
162 public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
165 this.el = new Gtk.ScrolledWindow();
169 // set gobject values
170 new Xcls_tree( _this );
171 this.el.set_child ( _this.tree.el );
176 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
182 // user defined functions
184 public class Xcls_tree : Object
186 public Gtk.ColumnView el;
187 private Xcls_ValaCompileErrors _this;
193 public Xcls_tree(Xcls_ValaCompileErrors _owner )
197 new Xcls_selmodel( _this );
198 this.el = new Gtk.ColumnView( _this.selmodel.el );
202 // set gobject values
203 this.el.hexpand = true;
204 this.el.vexpand = true;
205 var child_2 = new Xcls_ColumnViewColumn11( _this );
207 this.el.append_column ( child_2.el );
208 var child_3 = new Xcls_GestureClick13( _this );
210 this.el.add_controller( child_3.el );
213 // user defined functions
215 public class Xcls_selmodel : Object
217 public Gtk.SingleSelection el;
218 private Xcls_ValaCompileErrors _this;
224 public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
227 _this.selmodel = this;
228 new Xcls_sortmodel( _this );
229 this.el = new Gtk.SingleSelection( _this.sortmodel.el );
233 // set gobject values
236 // user defined functions
237 public Json.Object getNodeAt (uint row) {
239 var tr = (Gtk.TreeListRow)this.el.get_item(row);
241 var a = tr.get_item();;
242 GLib.debug("get_item (2) = %s", a.get_type().name());
244 return (Json.Object)tr.get_item();
248 public class Xcls_sortmodel : Object
250 public Gtk.SortListModel el;
251 private Xcls_ValaCompileErrors _this;
257 public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
260 _this.sortmodel = this;
261 new Xcls_model( _this );
262 var child_2 = new Xcls_TreeListRowSorter8( _this );
264 this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
268 // set gobject values
271 // user defined functions
272 public Json.Object getNodeAt (uint row) {
274 var tr = (Gtk.TreeListRow)this.el.get_item(row);
277 // GLib.debug("get_item (2) = %s", a.get_type().name());
280 return (Json.Object)tr.get_item();
284 public class Xcls_model : Object
286 public Gtk.TreeListModel el;
287 private Xcls_ValaCompileErrors _this;
293 public Xcls_model(Xcls_ValaCompileErrors _owner )
297 this.el = new Gtk.TreeListModel(
298 new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
304 return ((Palete.CompileError)item).lines;
313 // set gobject values
316 // user defined functions
319 public class Xcls_TreeListRowSorter8 : Object
321 public Gtk.TreeListRowSorter el;
322 private Xcls_ValaCompileErrors _this;
328 public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
331 var child_1 = new Xcls_StringSorter9( _this );
333 this.el = new Gtk.TreeListRowSorter( child_1.el );
337 // set gobject values
340 // user defined functions
342 public class Xcls_StringSorter9 : Object
344 public Gtk.StringSorter el;
345 private Xcls_ValaCompileErrors _this;
351 public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
354 var child_1 = new Xcls_PropertyExpression10( _this );
356 this.el = new Gtk.StringSorter( child_1.el );
360 // set gobject values
363 // user defined functions
365 public class Xcls_PropertyExpression10 : Object
367 public Gtk.PropertyExpression el;
368 private Xcls_ValaCompileErrors _this;
374 public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
377 this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
381 // set gobject values
384 // user defined functions
391 public class Xcls_ColumnViewColumn11 : Object
393 public Gtk.ColumnViewColumn el;
394 private Xcls_ValaCompileErrors _this;
400 public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
403 var child_1 = new Xcls_SignalListItemFactory12( _this );
405 this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
409 // set gobject values
410 this.el.expand = true;
411 this.el.resizable = true;
414 // user defined functions
416 public class Xcls_SignalListItemFactory12 : Object
418 public Gtk.SignalListItemFactory el;
419 private Xcls_ValaCompileErrors _this;
425 public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
428 this.el = new Gtk.SignalListItemFactory();
432 // set gobject values
435 this.el.setup.connect( (listitem) => {
437 var expand = new Gtk.TreeExpander();
439 expand.set_indent_for_depth(true);
440 expand.set_indent_for_icon(true);
442 var lbl = new Gtk.Label("");
443 lbl.use_markup = true;
446 lbl.justify = Gtk.Justification.LEFT;
450 expand.set_child(lbl);
451 ((Gtk.ListItem)listitem).set_child(expand);
452 ((Gtk.ListItem)listitem).activatable = false;
454 this.el.bind.connect( (listitem) => {
455 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
459 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
460 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
463 var lbl = (Gtk.Label) expand.child;
465 if (lbl.label != "") { // do not update
470 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
471 var np = (Palete.CompileError) lr.get_item();
474 //GLib.debug("change %s to %s", lbl.label, np.name);
475 lbl.label = np.linemsg;
476 //lbl.tooltip_markup = np.to_property_option_tooltip();
478 expand.set_hide_expander( np.lines.n_items < 1);
479 expand.set_list_row(lr);
481 // expand current file.
482 // this causes problems? - critical errors?
483 // maybe do it on show
484 //if (_this.window.windowstate.file.path == np.file.path &&
486 // lr.expanded = true;
495 // user defined functions
499 public class Xcls_GestureClick13 : Object
501 public Gtk.GestureClick el;
502 private Xcls_ValaCompileErrors _this;
508 public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
511 this.el = new Gtk.GestureClick();
515 // set gobject values
519 this.el.pressed.connect( (n_press, x, y) => {
521 if (n_press < 2) { /// doubleclick?
528 var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
529 //GLib.debug("SELECTED = %s", tr.item.get_type().name());
530 var ce = (Palete.CompileError) tr.item;
533 // did not click on a line.
540 GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
545 var regex = new Regex("\\.vala$");
548 bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
549 } catch (GLib.RegexError e) {
552 var p = _this.window.project;
556 var jsr = p.getByPath(bjsf);
558 _this.window.windowstate.fileViewOpen(jsr, true, line);
560 if (jsr.path == _this.window.windowstate.file.path) {
569 var pf = p.getByPath(fname.path);
571 _this.window.windowstate.fileViewOpen(pf, true, line);
577 // user defined functions