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_compile_tree compile_tree;
17 public Xcls_compile_result_store compile_result_store;
18 public Xcls_column column;
19 public Xcls_renderer renderer;
22 public Xcls_MainWindow window;
23 public Json.Object notices;
27 public Xcls_ValaCompileErrors()
30 this.el = new Gtk.Popover( null );
36 this.el.width_request = 900;
37 this.el.height_request = 800;
38 this.el.hexpand = false;
40 this.el.position = Gtk.PositionType.TOP;
41 var child_0 = new Xcls_compile_view( _this );
43 this.el.add ( child_0.el );
46 // user defined functions
47 public void show (Json.Object tree, Gtk.Widget onbtn) {
53 //print("looking for %s\n", id);
54 // loop through parent childnre
57 var store = this.compile_result_store.el;
60 Gtk.TreeIter? expand = null;
62 tree.foreach_member((obj, file, node) => {
63 // id line "display text", file
65 var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
67 GLib.debug("Add file %s", title);
68 store.append(out iter, null);
69 var lines = tree.get_object_member(file);
70 title += " (" + lines.get_size().to_string() + ")";
78 if (this.window.windowstate.file.path == file) {
79 GLib.debug("Expanding Row: %s", file);
86 lines.foreach_member((obja, line, nodea) => {
88 var ar = lines.get_array_member(line);
89 for (var i = 0 ; i < ar.get_length(); i++) {
90 msg += (msg.length > 0) ? "\n" : "";
91 msg += ar.get_string_element(i);
94 GLib.debug("Add line %s", line);
95 store.append(out citer, iter);
97 0, file + ":" + int.parse(line).to_string("%09d"),
99 2, GLib.Markup.escape_text(line + ": " + msg),
108 store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
112 this.window.el.get_size(out w, out h);
114 // left tree = 250, editor area = 500?
117 var new_w = int.min(650, w-100);
118 if (new_w > (w-100)) {
121 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
125 if (this.el.relative_to == null) {
126 this.el.set_relative_to(onbtn);
130 if (expand != null) {
131 _this.compile_tree.el.expand_row( store.get_path(expand) , true);
134 while(Gtk.events_pending()) {
135 Gtk.main_iteration();
137 // this.hpane.el.set_position( 0);
139 public class Xcls_compile_view : Object
142 private Xcls_ValaCompileErrors _this;
148 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
151 _this.compile_view = this;
152 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
156 // set gobject values
157 this.el.homogeneous = false;
158 this.el.hexpand = false;
159 var child_0 = new Xcls_Box3( _this );
161 this.el.pack_start ( child_0.el , false,false,0 );
162 var child_1 = new Xcls_ScrolledWindow5( _this );
164 this.el.pack_end ( child_1.el , true,true,0 );
167 // user defined functions
169 public class Xcls_Box3 : Object
172 private Xcls_ValaCompileErrors _this;
178 public Xcls_Box3(Xcls_ValaCompileErrors _owner )
181 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
185 // set gobject values
186 var child_0 = new Xcls_Button4( _this );
188 this.el.pack_start ( child_0.el , true,true,0 );
191 // user defined functions
193 public class Xcls_Button4 : Object
195 public Gtk.Button el;
196 private Xcls_ValaCompileErrors _this;
202 public Xcls_Button4(Xcls_ValaCompileErrors _owner )
205 this.el = new Gtk.Button();
209 // set gobject values
210 this.el.label = "Compile and Run ";
213 // user defined functions
217 public class Xcls_ScrolledWindow5 : Object
219 public Gtk.ScrolledWindow el;
220 private Xcls_ValaCompileErrors _this;
226 public Xcls_ScrolledWindow5(Xcls_ValaCompileErrors _owner )
229 this.el = new Gtk.ScrolledWindow( null, null );
233 // set gobject values
234 var child_0 = new Xcls_compile_tree( _this );
236 this.el.add ( child_0.el );
241 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
247 // user defined functions
249 public class Xcls_compile_tree : Object
251 public Gtk.TreeView el;
252 private Xcls_ValaCompileErrors _this;
258 public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
261 _this.compile_tree = this;
262 this.el = new Gtk.TreeView();
266 // set gobject values
267 var child_0 = new Xcls_compile_result_store( _this );
269 this.el.set_model ( child_0.el );
270 var child_1 = new Xcls_column( _this );
272 this.el.append_column ( child_1.el );
277 var description = new Pango.FontDescription();
278 description.set_size(10000);
279 this.el.override_font(description);
284 this.el.button_press_event.connect( ( ev) => {
286 Gtk.TreeViewColumn col;
290 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
291 print("nothing selected on click");
293 return false; //not on a element.
298 if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) {
305 var mod = _this.compile_result_store.el;
306 mod.get_iter (out iter, path);
312 _this.compile_result_store.el.get_value(iter, 3, out value);
313 var fname = (string)value;
315 _this.compile_result_store.el.get_value(iter, 1, out lvalue);
316 var line = (int) lvalue;
318 print("open %s @ %d\n", fname, line);
323 var regex = new Regex("\\.vala$");
326 bjsf = regex.replace(fname,fname.length , 0 , ".bjs");
327 } catch (GLib.RegexError e) {
330 var p = _this.window.project;
334 var jsr = p.getByPath(bjsf);
336 _this.window.windowstate.fileViewOpen(jsr, true, line);
342 var pf = JsRender.JsRender.factory("PlainFile", p, fname);
343 _this.window.windowstate.fileViewOpen(pf, true, line);
344 } catch (JsRender.Error e) {}
345 // try hiding the left nav..
352 // user defined functions
354 public class Xcls_compile_result_store : Object
356 public Gtk.TreeStore el;
357 private Xcls_ValaCompileErrors _this;
363 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
366 _this.compile_result_store = this;
367 this.el = new Gtk.TreeStore.newv( { typeof(string),
374 // set gobject values
377 // user defined functions
380 public class Xcls_column : Object
382 public Gtk.TreeViewColumn el;
383 private Xcls_ValaCompileErrors _this;
389 public Xcls_column(Xcls_ValaCompileErrors _owner )
393 this.el = new Gtk.TreeViewColumn();
397 // set gobject values
398 this.el.title = "Compile output";
399 var child_0 = new Xcls_renderer( _this );
401 this.el.pack_start ( child_0.el , true );
406 this.el.add_attribute(_this.renderer.el , "markup", 2 );
411 // user defined functions
413 public class Xcls_renderer : Object
415 public Gtk.CellRendererText el;
416 private Xcls_ValaCompileErrors _this;
422 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
425 _this.renderer = this;
426 this.el = new Gtk.CellRendererText();
430 // set gobject values
433 // user defined functions