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.hexpand = true;
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;
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 print("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() + ")";
71 store.set(iter, 0, file, 1, 0, 2, title, 3, file,-1);
73 lines.foreach_member((obja, line, nodea) => {
75 var ar = lines.get_array_member(line);
76 for (var i = 0 ; i < ar.get_length(); i++) {
77 msg += (msg.length > 0) ? "\n" : "";
78 msg += ar.get_string_element(i);
81 print("Add line %s", line);
82 store.append(out citer, iter);
86 2, GLib.Markup.escape_text(line + ": " + msg),
96 this.window.el.get_size(out w, out h);
98 // left tree = 250, editor area = 500?
100 var new_w = int.min(250, w-100);
101 if (new_w > (w-100)) {
104 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
108 if (this.el.relative_to == null) {
109 this.el.set_relative_to(onbtn);
113 while(Gtk.events_pending()) {
114 Gtk.main_iteration();
116 // this.hpane.el.set_position( 0);
118 public class Xcls_compile_view : Object
121 private Xcls_ValaCompileErrors _this;
127 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
130 _this.compile_view = this;
131 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
135 // set gobject values
136 this.el.homogeneous = false;
137 var child_0 = new Xcls_Box3( _this );
139 this.el.pack_start ( child_0.el , false,false,0 );
140 var child_1 = new Xcls_ScrolledWindow5( _this );
142 this.el.pack_end ( child_1.el , true,true,0 );
145 // user defined functions
147 public class Xcls_Box3 : Object
150 private Xcls_ValaCompileErrors _this;
156 public Xcls_Box3(Xcls_ValaCompileErrors _owner )
159 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
163 // set gobject values
164 var child_0 = new Xcls_Button4( _this );
166 this.el.pack_start ( child_0.el , true,true,0 );
169 // user defined functions
171 public class Xcls_Button4 : Object
173 public Gtk.Button el;
174 private Xcls_ValaCompileErrors _this;
180 public Xcls_Button4(Xcls_ValaCompileErrors _owner )
183 this.el = new Gtk.Button();
187 // set gobject values
188 this.el.label = "Compile and Run ";
191 // user defined functions
195 public class Xcls_ScrolledWindow5 : Object
197 public Gtk.ScrolledWindow el;
198 private Xcls_ValaCompileErrors _this;
204 public Xcls_ScrolledWindow5(Xcls_ValaCompileErrors _owner )
207 this.el = new Gtk.ScrolledWindow( null, null );
211 // set gobject values
212 var child_0 = new Xcls_compile_tree( _this );
214 this.el.add ( child_0.el );
219 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
225 // user defined functions
227 public class Xcls_compile_tree : Object
229 public Gtk.TreeView el;
230 private Xcls_ValaCompileErrors _this;
236 public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
239 _this.compile_tree = this;
240 this.el = new Gtk.TreeView();
244 // set gobject values
245 var child_0 = new Xcls_compile_result_store( _this );
247 this.el.set_model ( child_0.el );
248 var child_1 = new Xcls_column( _this );
250 this.el.append_column ( child_1.el );
255 var description = new Pango.FontDescription();
256 description.set_size(8000);
257 this.el.override_font(description);
262 this.el.button_press_event.connect( ( ev) => {
264 Gtk.TreeViewColumn col;
268 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
269 print("nothing selected on click");
271 return false; //not on a element.
276 if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) {
283 var mod = _this.compile_result_store.el;
284 mod.get_iter (out iter, path);
290 _this.compile_result_store.el.get_value(iter, 3, out value);
291 var fname = (string)value;
293 //_this.compile_result_store.el.get_value(iter, 1, out lvalue);
294 //var line = (int) lvalue;
299 var regex = new Regex("\\.vala$");
302 bjsf = regex.replace(fname,fname.length , 0 , ".bjs");
303 } catch (GLib.RegexError e) {
306 var p = _this.window.project;
310 var jsr = p.getByPath(bjsf);
312 _this.window.windowstate.fileViewOpen(jsr);
318 var pf = JsRender.JsRender.factory("PlainFile", p, fname);
319 _this.window.windowstate.fileViewOpen(pf);
321 // try hiding the left nav..
328 // user defined functions
330 public class Xcls_compile_result_store : Object
332 public Gtk.TreeStore el;
333 private Xcls_ValaCompileErrors _this;
339 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
342 _this.compile_result_store = this;
343 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
347 // set gobject values
350 // user defined functions
353 public class Xcls_column : Object
355 public Gtk.TreeViewColumn el;
356 private Xcls_ValaCompileErrors _this;
362 public Xcls_column(Xcls_ValaCompileErrors _owner )
365 this.el = new Gtk.TreeViewColumn();
369 // set gobject values
370 this.el.title = "Compile output";
371 var child_0 = new Xcls_renderer( _this );
373 this.el.pack_start ( child_0.el , true );
378 this.el.add_attribute(_this.renderer.el , "markup", 2 );
383 // user defined functions
385 public class Xcls_renderer : Object
387 public Gtk.CellRendererText el;
388 private Xcls_ValaCompileErrors _this;
394 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
397 _this.renderer = this;
398 this.el = new Gtk.CellRendererText();
402 // set gobject values
405 // user defined functions