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_renderer renderer;
21 public Xcls_MainWindow window;
23 public JsRender.JsRender? file;
24 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.modal = false;
39 this.el.position = Gtk.PositionType.TOP;
40 var child_0 = new Xcls_compile_view( _this );
42 this.el.add ( child_0.el );
45 this.el.closed.connect( () => {
54 // user defined functions
55 public void show (Json.Object tree, Gtk.Widget onbtn) {
61 //print("looking for %s\n", id);
62 // loop through parent childnre
65 var store = this.compile_result_store.el;
70 tree.foreach_member((obj, file, node) => {
71 // id line "display text", file
73 var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
75 print("Add file %s", title);
76 store.append(out iter, null);
77 var lines = tree.get_object_member(file);
78 title += " (" + lines.get_size().to_string() + ")";
79 store.set(iter, 0, file, 1, 0, 2, title, 3, file,-1);
81 lines.foreach_member((obja, line, nodea) => {
83 var ar = lines.get_array_member(line);
84 for (var i = 0 ; i < ar.get_length(); i++) {
85 msg += (msg.length > 0) ? "\n" : "";
86 msg += ar.get_string_element(i);
89 print("Add line %s", line);
90 store.append(out citer, iter);
94 2, GLib.Markup.escape_text(line + ": " + msg),
104 this.window.el.get_size(out w, out h);
106 // left tree = 250, editor area = 500?
108 var new_w = int.min(250, w-100);
109 if (new_w > (w-100)) {
112 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
116 if (this.el.relative_to == null) {
117 this.el.set_relative_to(onbtn);
121 while(Gtk.events_pending()) {
122 Gtk.main_iteration();
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.VBox( false, 0 );
143 // set gobject values
144 var child_0 = new Xcls_HBox3( _this );
146 this.el.pack_start ( child_0.el , false,false,0 );
147 var child_1 = new Xcls_ScrolledWindow5( _this );
149 this.el.add ( child_1.el );
152 // user defined functions
154 public class Xcls_HBox3 : Object
157 private Xcls_ValaCompileErrors _this;
163 public Xcls_HBox3(Xcls_ValaCompileErrors _owner )
166 this.el = new Gtk.HBox( true, 0 );
170 // set gobject values
171 var child_0 = new Xcls_Button4( _this );
173 this.el.pack_start ( child_0.el , true,true,0 );
176 // user defined functions
178 public class Xcls_Button4 : Object
180 public Gtk.Button el;
181 private Xcls_ValaCompileErrors _this;
187 public Xcls_Button4(Xcls_ValaCompileErrors _owner )
190 this.el = new Gtk.Button();
194 // set gobject values
195 this.el.label = "Compile and Run ";
198 // user defined functions
202 public class Xcls_ScrolledWindow5 : Object
204 public Gtk.ScrolledWindow el;
205 private Xcls_ValaCompileErrors _this;
211 public Xcls_ScrolledWindow5(Xcls_ValaCompileErrors _owner )
214 this.el = new Gtk.ScrolledWindow( null, null );
218 // set gobject values
219 var child_0 = new Xcls_compile_tree( _this );
221 this.el.add ( child_0.el );
226 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
232 // user defined functions
234 public class Xcls_compile_tree : Object
236 public Gtk.TreeView el;
237 private Xcls_ValaCompileErrors _this;
243 public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
246 _this.compile_tree = this;
247 this.el = new Gtk.TreeView();
251 // set gobject values
252 var child_0 = new Xcls_compile_result_store( _this );
254 this.el.set_model ( child_0.el );
255 var child_1 = new Xcls_column( _this );
257 this.el.append_column ( child_1.el );
262 var description = new Pango.FontDescription();
263 description.set_size(8000);
264 this.el.modify_font(description);
269 this.el.button_press_event.connect( ( ev) => {
271 Gtk.TreeViewColumn col;
275 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
276 print("nothing selected on click");
278 return false; //not on a element.
283 if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) {
290 var mod = _this.compile_result_store.el;
291 mod.get_iter (out iter, path);
299 _this.compile_result_store.el.get_value(iter, 3, out value);
300 var fname = (string)value;
302 //_this.compile_result_store.el.get_value(iter, 1, out lvalue);
303 //var line = (int) lvalue;
309 regex = new Regex("\\.vala$");
314 var bjsf = regex.replace(f,f.length , 0 , ".bjs");
316 var p = _this.window.project;
320 var jsr = p.getByPath(bjsf);
322 _this.window.windowstate.fileViewOpen(jsr);
330 this.el.cursor_changed.connect( () => {
331 var sel = this.el.get_selection();
333 if (sel.count_selected_rows() < 1) {
335 print("selected rows < 1\n");
340 //console.log('changed');
344 sel.get_selected(out mod, out iter);
351 _this.compile_result_store.el.get_value(iter, 3, out value);
352 var fname = (string)value;
354 _this.compile_result_store.el.get_value(iter, 1, out lvalue);
355 var line = (int) lvalue;
362 print ("loadfile %s : %d", fname,line);
364 // _this.sourceview.loadFile(fname, line);
366 var f = _this.sourceview.curfname;
368 Regex regex = new Regex("\\.vala$");
370 var bjsf = regex.replace(f,f.length , 0 , ".bjs");
372 var p = _this.window.project;
376 var jsr = p.getByPath(bjsf);
378 _this.window.windowstate.fileViewOpen(jsr);
388 // user defined functions
390 public class Xcls_compile_result_store : Object
392 public Gtk.TreeStore el;
393 private Xcls_ValaCompileErrors _this;
399 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
402 _this.compile_result_store = this;
403 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
407 // set gobject values
410 // user defined functions
413 public class Xcls_column : Object
415 public Gtk.TreeViewColumn el;
416 private Xcls_ValaCompileErrors _this;
422 public Xcls_column(Xcls_ValaCompileErrors _owner )
425 this.el = new Gtk.TreeViewColumn();
429 // set gobject values
430 this.el.title = "Compile output";
431 var child_0 = new Xcls_renderer( _this );
433 this.el.pack_start ( child_0.el , true );
438 this.el.add_attribute(_this.renderer.el , "markup", 2 );
443 // user defined functions
445 public class Xcls_renderer : Object
447 public Gtk.CellRendererText el;
448 private Xcls_ValaCompileErrors _this;
454 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
457 _this.renderer = this;
458 this.el = new Gtk.CellRendererText();
462 // set gobject values
465 // user defined functions