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 Gee.HashMap<string,Gtk.TreeListRow>? rows;
23 public Xcls_MainWindow window;
27 public Xcls_ValaCompileErrors()
30 this.el = new Gtk.Popover();
37 this.el.width_request = 900;
38 this.el.height_request = 800;
39 this.el.autohide = true;
40 this.el.position = Gtk.PositionType.TOP;
41 new Xcls_compile_view( _this );
42 this.el.set_child ( _this.compile_view.el );
45 // user defined functions
46 public void updateNotices ( GLib.ListStore? ls) {
47 //GLib.debug("errors : update");
48 if (ls == null || ls.get_n_items() < 1) {
49 // GLib.debug("errors : none available");
53 //GLib.debug("Loading list into tree");
55 var tm = new Gtk.TreeListModel(
56 ls, //..... << that's our store..
61 return ((Palete.CompileError)item).lines;
66 this.rows = new Gee.HashMap<string,Gtk.TreeListRow>();
68 _this.sortmodel.el.set_model(tm);
70 if (this.rows.has_key(this.window.windowstate.file.path)) {
71 this.rows.get(this.window.windowstate.file.path).expanded = true;
74 public void show ( ) {
75 GLib.debug("errors : show");
77 if (_this.model.el.get_n_items() < 1) {
79 GLib.debug("errors : none available");
83 var win = this.window.el;
84 var w = win.get_width();
85 var h = win.get_height();
88 // left tree = 250, editor area = 500?
91 var new_w = int.min(650, w-100);
92 if (new_w > (w-100)) {
95 GLib.debug("set size");
96 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
100 GLib.debug("call popup");
102 if (this.rows.has_key(this.window.windowstate.file.path)) {
103 this.rows.get(this.window.windowstate.file.path).expanded = true;
106 public class Xcls_compile_view : Object
109 private Xcls_ValaCompileErrors _this;
115 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
118 _this.compile_view = this;
119 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
123 // set gobject values
124 this.el.homogeneous = false;
125 this.el.hexpand = false;
126 var child_1 = new Xcls_ScrolledWindow2( _this );
128 this.el.append( child_1.el );
131 // user defined functions
133 public class Xcls_ScrolledWindow2 : Object
135 public Gtk.ScrolledWindow el;
136 private Xcls_ValaCompileErrors _this;
142 public Xcls_ScrolledWindow2(Xcls_ValaCompileErrors _owner )
145 this.el = new Gtk.ScrolledWindow();
149 // set gobject values
150 new Xcls_tree( _this );
151 this.el.set_child ( _this.tree.el );
156 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
162 // user defined functions
164 public class Xcls_tree : Object
166 public Gtk.ColumnView el;
167 private Xcls_ValaCompileErrors _this;
173 public Xcls_tree(Xcls_ValaCompileErrors _owner )
177 new Xcls_selmodel( _this );
178 this.el = new Gtk.ColumnView( _this.selmodel.el );
182 // set gobject values
183 this.el.hexpand = true;
184 this.el.vexpand = true;
185 var child_2 = new Xcls_ColumnViewColumn10( _this );
187 this.el.append_column ( child_2.el );
188 var child_3 = new Xcls_GestureClick12( _this );
190 this.el.add_controller( child_3.el );
193 // user defined functions
195 public class Xcls_selmodel : Object
197 public Gtk.SingleSelection el;
198 private Xcls_ValaCompileErrors _this;
204 public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
207 _this.selmodel = this;
208 new Xcls_sortmodel( _this );
209 this.el = new Gtk.SingleSelection( _this.sortmodel.el );
213 // set gobject values
216 // user defined functions
217 public Json.Object getNodeAt (uint row) {
219 var tr = (Gtk.TreeListRow)this.el.get_item(row);
221 var a = tr.get_item();;
222 GLib.debug("get_item (2) = %s", a.get_type().name());
224 return (Json.Object)tr.get_item();
228 public class Xcls_sortmodel : Object
230 public Gtk.SortListModel el;
231 private Xcls_ValaCompileErrors _this;
237 public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
240 _this.sortmodel = this;
241 new Xcls_model( _this );
242 var child_2 = new Xcls_TreeListRowSorter7( _this );
244 this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
248 // set gobject values
251 // user defined functions
252 public Json.Object getNodeAt (uint row) {
254 var tr = (Gtk.TreeListRow)this.el.get_item(row);
257 // GLib.debug("get_item (2) = %s", a.get_type().name());
260 return (Json.Object)tr.get_item();
264 public class Xcls_model : Object
266 public Gtk.TreeListModel el;
267 private Xcls_ValaCompileErrors _this;
273 public Xcls_model(Xcls_ValaCompileErrors _owner )
277 this.el = new Gtk.TreeListModel(
278 new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
284 return ((Palete.CompileError)item).lines;
293 // set gobject values
296 // user defined functions
299 public class Xcls_TreeListRowSorter7 : Object
301 public Gtk.TreeListRowSorter el;
302 private Xcls_ValaCompileErrors _this;
308 public Xcls_TreeListRowSorter7(Xcls_ValaCompileErrors _owner )
311 var child_1 = new Xcls_StringSorter8( _this );
313 this.el = new Gtk.TreeListRowSorter( child_1.el );
317 // set gobject values
320 // user defined functions
322 public class Xcls_StringSorter8 : Object
324 public Gtk.StringSorter el;
325 private Xcls_ValaCompileErrors _this;
331 public Xcls_StringSorter8(Xcls_ValaCompileErrors _owner )
334 var child_1 = new Xcls_PropertyExpression9( _this );
336 this.el = new Gtk.StringSorter( child_1.el );
340 // set gobject values
343 // user defined functions
345 public class Xcls_PropertyExpression9 : Object
347 public Gtk.PropertyExpression el;
348 private Xcls_ValaCompileErrors _this;
354 public Xcls_PropertyExpression9(Xcls_ValaCompileErrors _owner )
357 this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
361 // set gobject values
364 // user defined functions
371 public class Xcls_ColumnViewColumn10 : Object
373 public Gtk.ColumnViewColumn el;
374 private Xcls_ValaCompileErrors _this;
380 public Xcls_ColumnViewColumn10(Xcls_ValaCompileErrors _owner )
383 var child_1 = new Xcls_SignalListItemFactory11( _this );
385 this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
389 // set gobject values
390 this.el.expand = true;
391 this.el.resizable = true;
394 // user defined functions
396 public class Xcls_SignalListItemFactory11 : Object
398 public Gtk.SignalListItemFactory el;
399 private Xcls_ValaCompileErrors _this;
405 public Xcls_SignalListItemFactory11(Xcls_ValaCompileErrors _owner )
408 this.el = new Gtk.SignalListItemFactory();
412 // set gobject values
415 this.el.setup.connect( (listitem) => {
417 var expand = new Gtk.TreeExpander();
419 expand.set_indent_for_depth(true);
420 expand.set_indent_for_icon(true);
422 var lbl = new Gtk.Label("");
423 lbl.use_markup = true;
426 lbl.justify = Gtk.Justification.LEFT;
430 expand.set_child(lbl);
431 ((Gtk.ListItem)listitem).set_child(expand);
432 ((Gtk.ListItem)listitem).activatable = false;
434 this.el.bind.connect( (listitem) => {
435 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
439 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
440 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
443 var lbl = (Gtk.Label) expand.child;
445 if (lbl.label != "") { // do not update
450 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
451 var np = (Palete.CompileError) lr.get_item();
453 if (np.diag == null) {
454 _this.rows.set(np.file.path, lr);
459 //GLib.debug("change %s to %s", lbl.label, np.name);
460 lbl.label = np.linemsg;
461 //lbl.tooltip_markup = np.to_property_option_tooltip();
463 expand.set_hide_expander( np.lines.n_items < 1);
464 expand.set_list_row(lr);
466 // expand current file.
467 // this causes problems? - critical errors?
468 // maybe do it on show
469 //if (_this.window.windowstate.file.path == np.file.path &&
471 // lr.expanded = true;
480 // user defined functions
484 public class Xcls_GestureClick12 : Object
486 public Gtk.GestureClick el;
487 private Xcls_ValaCompileErrors _this;
493 public Xcls_GestureClick12(Xcls_ValaCompileErrors _owner )
496 this.el = new Gtk.GestureClick();
500 // set gobject values
504 this.el.pressed.connect( (n_press, x, y) => {
506 if (n_press < 2) { /// doubleclick?
513 var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
514 //GLib.debug("SELECTED = %s", tr.item.get_type().name());
515 var ce = (Palete.CompileError) tr.item;
518 // did not click on a line.
525 GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
530 var regex = new Regex("\\.vala$");
533 bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
534 } catch (GLib.RegexError e) {
537 var p = _this.window.project;
541 var jsr = p.getByPath(bjsf);
543 _this.window.windowstate.fileViewOpen(jsr, true, line);
545 if (jsr.path == _this.window.windowstate.file.path) {
554 var pf = p.getByPath(fname.path);
556 _this.window.windowstate.fileViewOpen(pf, true, line);
562 // user defined functions