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;
23 public GLib.ListStore notices;
26 public Xcls_ValaCompileErrors()
29 this.el = new Gtk.Popover();
34 this.el.width_request = 900;
35 this.el.height_request = 800;
36 this.el.autohide = true;
37 this.el.position = Gtk.PositionType.TOP;
38 new Xcls_compile_view( _this );
39 this.el.set_child ( _this.compile_view.el );
42 // user defined functions
43 public void show ( GLib.ListStore ls , Gtk.Widget onbtn) {
50 //print("looking for %s\n", id);
51 // loop through parent childnre
54 this.tree.el.hide(); //<< very important!!!
56 // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
58 var win = this.window.el;
59 var w = win.get_width();
60 var h = win.get_height();
64 // left tree = 250, editor area = 500?
67 var new_w = int.min(650, w-100);
68 if (new_w > (w-100)) {
71 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
74 // this.el.set_relative_to(onbtn);
75 //Gtk.Allocation rect;
76 //onbtn.get_allocation(out rect);
77 //this.el.set_pointing_to(rect);
82 var tm = new Gtk.TreeListModel(
83 ls, //..... << that's our store..
88 return ((Palete.CompileError)item).lines;
94 _this.sortmodel.el.set_model(tm);
98 //if (expand != null) {
99 // _this.compile_tree.el.expand_row( store.get_path(expand) , true);
102 // this.hpane.el.set_position( 0);
104 public class Xcls_compile_view : Object
107 private Xcls_ValaCompileErrors _this;
113 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
116 _this.compile_view = this;
117 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
121 // set gobject values
122 this.el.homogeneous = false;
123 this.el.hexpand = false;
124 var child_1 = new Xcls_ScrolledWindow3( _this );
126 this.el.append( child_1.el );
129 // user defined functions
131 public class Xcls_ScrolledWindow3 : Object
133 public Gtk.ScrolledWindow el;
134 private Xcls_ValaCompileErrors _this;
140 public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
143 this.el = new Gtk.ScrolledWindow();
147 // set gobject values
148 new Xcls_tree( _this );
149 this.el.set_child ( _this.tree.el );
154 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
160 // user defined functions
162 public class Xcls_tree : Object
164 public Gtk.ColumnView el;
165 private Xcls_ValaCompileErrors _this;
171 public Xcls_tree(Xcls_ValaCompileErrors _owner )
175 new Xcls_selmodel( _this );
176 this.el = new Gtk.ColumnView( _this.selmodel.el );
180 // set gobject values
181 this.el.hexpand = true;
182 this.el.vexpand = true;
183 var child_2 = new Xcls_ColumnViewColumn8( _this );
185 this.el.append_column ( child_2.el );
186 var child_3 = new Xcls_GestureClick10( _this );
188 this.el.add_controller( child_3.el );
191 // user defined functions
193 public class Xcls_selmodel : Object
195 public Gtk.SingleSelection el;
196 private Xcls_ValaCompileErrors _this;
202 public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
205 _this.selmodel = this;
206 new Xcls_sortmodel( _this );
207 this.el = new Gtk.SingleSelection( _this.sortmodel.el );
211 // set gobject values
214 // user defined functions
215 public Json.Object getNodeAt (uint row) {
217 var tr = (Gtk.TreeListRow)this.el.get_item(row);
219 var a = tr.get_item();;
220 GLib.debug("get_item (2) = %s", a.get_type().name());
222 return (Json.Object)tr.get_item();
226 public class Xcls_sortmodel : Object
228 public Gtk.SortListModel el;
229 private Xcls_ValaCompileErrors _this;
235 public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
238 _this.sortmodel = this;
239 new Xcls_model( _this );
240 this.el = new Gtk.SortListModel( _this.model.el, null );
244 // set gobject values
247 // user defined functions
248 public Json.Object getNodeAt (uint row) {
250 var tr = (Gtk.TreeListRow)this.el.get_item(row);
253 // GLib.debug("get_item (2) = %s", a.get_type().name());
256 return (Json.Object)tr.get_item();
260 public class Xcls_model : Object
262 public Gtk.TreeListModel el;
263 private Xcls_ValaCompileErrors _this;
269 public Xcls_model(Xcls_ValaCompileErrors _owner )
273 this.el = new Gtk.TreeListModel(
274 new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
280 return ((Palete.CompileError)item).lines;
289 // set gobject values
292 // user defined functions
297 public class Xcls_ColumnViewColumn8 : Object
299 public Gtk.ColumnViewColumn el;
300 private Xcls_ValaCompileErrors _this;
306 public Xcls_ColumnViewColumn8(Xcls_ValaCompileErrors _owner )
309 var child_1 = new Xcls_SignalListItemFactory9( _this );
311 this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
315 // set gobject values
316 this.el.expand = true;
317 this.el.resizable = true;
320 // user defined functions
322 public class Xcls_SignalListItemFactory9 : Object
324 public Gtk.SignalListItemFactory el;
325 private Xcls_ValaCompileErrors _this;
331 public Xcls_SignalListItemFactory9(Xcls_ValaCompileErrors _owner )
334 this.el = new Gtk.SignalListItemFactory();
338 // set gobject values
341 this.el.setup.connect( (listitem) => {
343 var expand = new Gtk.TreeExpander();
345 expand.set_indent_for_depth(true);
346 expand.set_indent_for_icon(true);
348 var lbl = new Gtk.Label("");
349 lbl.use_markup = true;
352 lbl.justify = Gtk.Justification.LEFT;
356 expand.set_child(lbl);
357 ((Gtk.ListItem)listitem).set_child(expand);
358 ((Gtk.ListItem)listitem).activatable = false;
360 this.el.bind.connect( (listitem) => {
361 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
365 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
366 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
369 var lbl = (Gtk.Label) expand.child;
371 if (lbl.label != "") { // do not update
376 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
377 var np = (Palete.CompileError) lr.get_item();
380 //GLib.debug("change %s to %s", lbl.label, np.name);
381 lbl.label = np.line_msg;
382 //lbl.tooltip_markup = np.to_property_option_tooltip();
384 expand.set_hide_expander( np.lines.n_items < 1);
385 expand.set_list_row(lr);
387 // expand current file.
388 if (_this.window.windowstate.file.path == np.file.path) {
397 // user defined functions
401 public class Xcls_GestureClick10 : Object
403 public Gtk.GestureClick el;
404 private Xcls_ValaCompileErrors _this;
410 public Xcls_GestureClick10(Xcls_ValaCompileErrors _owner )
413 this.el = new Gtk.GestureClick();
417 // set gobject values
421 this.el.pressed.connect( (n_press, x, y) => {
423 if (n_press < 2) { /// doubleclick?
430 var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
431 //GLib.debug("SELECTED = %s", tr.item.get_type().name());
432 var ce = (Palete.CompileError) tr.item;
435 // did not click on a line.
440 var fname = ce.parent.file;
442 GLib.debug("open %s @ %d\n", ce.parent.file.path, ce.line);
447 var regex = new Regex("\\.vala$");
450 bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
451 } catch (GLib.RegexError e) {
454 var p = _this.window.project;
458 var jsr = p.getByPath(bjsf);
460 _this.window.windowstate.fileViewOpen(jsr, true, line);
462 if (jsr.path == _this.window.windowstate.file.path) {
471 var pf = JsRender.JsRender.factory("PlainFile", p, fname.path);
472 _this.window.windowstate.fileViewOpen(pf, true, line);
473 } catch (JsRender.Error e) {}
474 // try hiding the left nav..
481 // user defined functions