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_save_btn save_btn;
17 public Xcls_compile_tree compile_tree;
18 public Xcls_compile_result_store compile_result_store;
19 public Xcls_renderer renderer;
22 public Xcls_MainWindow window;
24 public JsRender.JsRender? file;
25 public Json.Object notices;
28 public Xcls_ValaCompileErrors()
31 this.el = new Gtk.Popover( null );
37 this.el.width_request = 900;
38 this.el.height_request = 800;
39 this.el.modal = 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 this.el.closed.connect( () => {
55 // user defined functions
56 public void show (Json.Object tree, Gtk.Widget onbtn) {
62 //print("looking for %s\n", id);
63 // loop through parent childnre
66 var store = this.compile_result_store.el;
71 tree.foreach_member((obj, file, node) => {
72 // id line "display text", file
74 var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
76 print("Add file %s", title);
77 store.append(out iter, null);
78 var lines = tree.get_object_member(file);
79 title += " (" + lines.get_size().to_string() + ")";
80 store.set(iter, 0, file, 1, 0, 2, title, 3, file,-1);
82 lines.foreach_member((obja, line, nodea) => {
84 var ar = lines.get_array_member(line);
85 for (var i = 0 ; i < ar.get_length(); i++) {
86 msg += (msg.length > 0) ? "\n" : "";
87 msg += ar.get_string_element(i);
90 print("Add line %s", line);
91 store.append(out citer, iter);
95 2, GLib.Markup.escape_text(line + ": " + msg),
105 this.window.el.get_size(out w, out h);
107 // left tree = 250, editor area = 500?
109 var new_w = int.min(250, w-100);
110 if (new_w > (w-100)) {
113 this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
117 if (this.el.relative_to == null) {
118 this.el.set_relative_to(onbtn);
121 this.save_btn.el.hide();
122 while(Gtk.events_pending()) {
123 Gtk.main_iteration();
125 this.hpane.el.set_position( 0);
127 public class Xcls_compile_view : Object
130 private Xcls_ValaCompileErrors _this;
136 public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
139 _this.compile_view = this;
140 this.el = new Gtk.VBox( false, 0 );
144 // set gobject values
145 var child_0 = new Xcls_HBox3( _this );
147 this.el.pack_start ( child_0.el , false,false,0 );
148 var child_1 = new Xcls_ScrolledWindow7( _this );
150 this.el.add ( child_1.el );
153 // user defined functions
155 public class Xcls_HBox3 : Object
158 private Xcls_ValaCompileErrors _this;
164 public Xcls_HBox3(Xcls_ValaCompileErrors _owner )
167 this.el = new Gtk.HBox( true, 0 );
171 // set gobject values
172 var child_0 = new Xcls_Button4( _this );
174 this.el.pack_start ( child_0.el , true,true,0 );
175 var child_1 = new Xcls_Button5( _this );
177 this.el.pack_start ( child_1.el , true,true,0 );
178 var child_2 = new Xcls_save_btn( _this );
180 this.el.pack_start ( child_2.el , true,true,0 );
183 // user defined functions
185 public class Xcls_Button4 : Object
187 public Gtk.Button el;
188 private Xcls_ValaCompileErrors _this;
194 public Xcls_Button4(Xcls_ValaCompileErrors _owner )
197 this.el = new Gtk.Button();
201 // set gobject values
202 this.el.label = "Compile and Run";
205 // user defined functions
208 public class Xcls_Button5 : Object
210 public Gtk.Button el;
211 private Xcls_ValaCompileErrors _this;
217 public Xcls_Button5(Xcls_ValaCompileErrors _owner )
220 this.el = new Gtk.Button();
224 // set gobject values
225 this.el.label = "Edit";
228 this.el.clicked.connect( () => {
229 // is the file managed by the builder?
231 var f = _this.sourceview.curfname;
233 Regex regex = new Regex("\\.vala$");
235 var bjsf = regex.replace(f,f.length , 0 , ".bjs");
237 var p = _this.window.project;
241 var jsr = p.getByPath(bjsf);
243 _this.window.windowstate.fileViewOpen(jsr);
253 // user defined functions
256 public class Xcls_save_btn : Object
258 public Gtk.Button el;
259 private Xcls_ValaCompileErrors _this;
265 public Xcls_save_btn(Xcls_ValaCompileErrors _owner )
268 _this.save_btn = this;
269 this.el = new Gtk.Button();
273 // set gobject values
274 this.el.label = "Save";
275 this.el.visible = false;
278 // user defined functions
282 public class Xcls_ScrolledWindow7 : Object
284 public Gtk.ScrolledWindow el;
285 private Xcls_ValaCompileErrors _this;
291 public Xcls_ScrolledWindow7(Xcls_ValaCompileErrors _owner )
294 this.el = new Gtk.ScrolledWindow( null, null );
298 // set gobject values
299 var child_0 = new Xcls_compile_tree( _this );
301 this.el.add ( child_0.el );
306 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
312 // user defined functions
314 public class Xcls_compile_tree : Object
316 public Gtk.TreeView el;
317 private Xcls_ValaCompileErrors _this;
323 public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
326 _this.compile_tree = this;
327 this.el = new Gtk.TreeView();
331 // set gobject values
332 var child_0 = new Xcls_compile_result_store( _this );
334 this.el.set_model ( child_0.el );
335 var child_1 = new Xcls_column( _this );
337 this.el.append_column ( child_1.el );
342 var description = new Pango.FontDescription();
343 description.set_size(8000);
344 this.el.modify_font(description);
349 this.el.cursor_changed.connect( () => {
350 var sel = this.el.get_selection();
352 if (sel.count_selected_rows() < 1) {
354 print("selected rows < 1\n");
359 //console.log('changed');
363 sel.get_selected(out mod, out iter);
366 0, file + ":" + line,
368 2, GLib.Markup.escape_text(line + ": " + msg),
378 _this.compile_result_store.el.get_value(iter, 3, out value);
379 var fname = (string)value;
381 _this.compile_result_store.el.get_value(iter, 1, out lvalue);
382 var line = (int) lvalue;
389 print ("loadfile %s : %d", fname,line);
391 _this.sourceview.loadFile(fname, line);
399 // user defined functions
401 public class Xcls_compile_result_store : Object
403 public Gtk.TreeStore el;
404 private Xcls_ValaCompileErrors _this;
410 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
413 _this.compile_result_store = this;
414 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
418 // set gobject values
421 // user defined functions
424 public class Xcls_column : Object
426 public Gtk.TreeViewColumn el;
427 private Xcls_ValaCompileErrors _this;
433 public Xcls_column(Xcls_ValaCompileErrors _owner )
436 this.el = new Gtk.TreeViewColumn();
440 // set gobject values
441 this.el.title = "Compile output";
442 var child_0 = new Xcls_renderer( _this );
444 this.el.pack_start ( child_0.el , true );
449 this.el.add_attribute(_this.renderer.el , "markup", 2 );
454 // user defined functions
456 public class Xcls_renderer : Object
458 public Gtk.CellRendererText el;
459 private Xcls_ValaCompileErrors _this;
465 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
468 _this.renderer = this;
469 this.el = new Gtk.CellRendererText();
473 // set gobject values
476 // user defined functions