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;
39 this.el.position = Gtk.PositionType.TOP;
40 var child_0 = new Xcls_compile_view( _this );
42 this.el.add ( child_0.el );
45 // user defined functions
46 public void show (Json.Object tree, Gtk.Widget onbtn) {
52 //print("looking for %s\n", id);
53 // loop through parent childnre
56 var store = this.compile_result_store.el;
61 tree.foreach_member((obj, file, node) => {
62 // id line "display text", file
64 var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
66 print("Add file %s", title);
67 store.append(out iter, null);
68 var lines = tree.get_object_member(file);
69 title += " (" + lines.get_size().to_string() + ")";
70 store.set(iter, 0, file, 1, 0, 2, title, 3, file,-1);
72 lines.foreach_member((obja, line, nodea) => {
74 var ar = lines.get_array_member(line);
75 for (var i = 0 ; i < ar.get_length(); i++) {
76 msg += (msg.length > 0) ? "\n" : "";
77 msg += ar.get_string_element(i);
80 print("Add line %s", line);
81 store.append(out citer, iter);
85 2, GLib.Markup.escape_text(line + ": " + msg),
95 this.window.el.get_size(out w, out h);
97 // left tree = 250, editor area = 500?
99 var new_w = int.min(250, w-100);
100 if (new_w > (w-100)) {
103 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
107 if (this.el.relative_to == null) {
108 this.el.set_relative_to(onbtn);
112 while(Gtk.events_pending()) {
113 Gtk.main_iteration();
115 // this.hpane.el.set_position( 0);
117 public class Xcls_compile_view : Object
120 private Xcls_ValaCompileErrors _this;
126 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
129 _this.compile_view = this;
130 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
134 // set gobject values
135 this.el.homogeneous = false;
136 var child_0 = new Xcls_Box3( _this );
138 this.el.pack_start ( child_0.el , false,false,0 );
139 var child_1 = new Xcls_ScrolledWindow5( _this );
141 this.el.pack_end ( child_1.el , true,true,0 );
144 // user defined functions
146 public class Xcls_Box3 : Object
149 private Xcls_ValaCompileErrors _this;
155 public Xcls_Box3(Xcls_ValaCompileErrors _owner )
158 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
162 // set gobject values
163 var child_0 = new Xcls_Button4( _this );
165 this.el.pack_start ( child_0.el , true,true,0 );
168 // user defined functions
170 public class Xcls_Button4 : Object
172 public Gtk.Button el;
173 private Xcls_ValaCompileErrors _this;
179 public Xcls_Button4(Xcls_ValaCompileErrors _owner )
182 this.el = new Gtk.Button();
186 // set gobject values
187 this.el.label = "Compile and Run ";
190 // user defined functions
194 public class Xcls_ScrolledWindow5 : Object
196 public Gtk.ScrolledWindow el;
197 private Xcls_ValaCompileErrors _this;
203 public Xcls_ScrolledWindow5(Xcls_ValaCompileErrors _owner )
206 this.el = new Gtk.ScrolledWindow( null, null );
210 // set gobject values
211 var child_0 = new Xcls_compile_tree( _this );
213 this.el.add ( child_0.el );
218 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
224 // user defined functions
226 public class Xcls_compile_tree : Object
228 public Gtk.TreeView el;
229 private Xcls_ValaCompileErrors _this;
235 public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
238 _this.compile_tree = this;
239 this.el = new Gtk.TreeView();
243 // set gobject values
244 var child_0 = new Xcls_compile_result_store( _this );
246 this.el.set_model ( child_0.el );
247 var child_1 = new Xcls_column( _this );
249 this.el.append_column ( child_1.el );
254 var description = new Pango.FontDescription();
255 description.set_size(8000);
256 this.el.override_font(description);
261 this.el.button_press_event.connect( ( ev) => {
263 Gtk.TreeViewColumn col;
267 if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
268 print("nothing selected on click");
270 return false; //not on a element.
275 if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) {
282 var mod = _this.compile_result_store.el;
283 mod.get_iter (out iter, path);
289 _this.compile_result_store.el.get_value(iter, 3, out value);
290 var fname = (string)value;
292 //_this.compile_result_store.el.get_value(iter, 1, out lvalue);
293 //var line = (int) lvalue;
298 var regex = new Regex("\\.vala$");
301 bjsf = regex.replace(fname,fname.length , 0 , ".bjs");
302 } catch (GLib.RegexError e) {
305 var p = _this.window.project;
309 var jsr = p.getByPath(bjsf);
311 _this.window.windowstate.fileViewOpen(jsr);
317 var pf = JsRender.JsRender.factory("PlainFile", p, fname);
318 _this.window.windowstate.fileViewOpen(pf);
320 // try hiding the left nav..
327 // user defined functions
329 public class Xcls_compile_result_store : Object
331 public Gtk.TreeStore el;
332 private Xcls_ValaCompileErrors _this;
338 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
341 _this.compile_result_store = this;
342 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
346 // set gobject values
349 // user defined functions
352 public class Xcls_column : Object
354 public Gtk.TreeViewColumn el;
355 private Xcls_ValaCompileErrors _this;
361 public Xcls_column(Xcls_ValaCompileErrors _owner )
364 this.el = new Gtk.TreeViewColumn();
368 // set gobject values
369 this.el.title = "Compile output";
370 var child_0 = new Xcls_renderer( _this );
372 this.el.pack_start ( child_0.el , true );
377 this.el.add_attribute(_this.renderer.el , "markup", 2 );
382 // user defined functions
384 public class Xcls_renderer : Object
386 public Gtk.CellRendererText el;
387 private Xcls_ValaCompileErrors _this;
393 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
396 _this.renderer = this;
397 this.el = new Gtk.CellRendererText();
401 // set gobject values
404 // user defined functions