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.cursor_changed.connect( () => {
270 var sel = this.el.get_selection();
272 if (sel.count_selected_rows() < 1) {
274 print("selected rows < 1\n");
279 //console.log('changed');
283 sel.get_selected(out mod, out iter);
286 0, file + ":" + line,
288 2, GLib.Markup.escape_text(line + ": " + msg),
298 _this.compile_result_store.el.get_value(iter, 3, out value);
299 var fname = (string)value;
301 _this.compile_result_store.el.get_value(iter, 1, out lvalue);
302 var line = (int) lvalue;
309 print ("loadfile %s : %d", fname,line);
311 // _this.sourceview.loadFile(fname, line);
319 // user defined functions
321 public class Xcls_compile_result_store : Object
323 public Gtk.TreeStore el;
324 private Xcls_ValaCompileErrors _this;
330 public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
333 _this.compile_result_store = this;
334 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
338 // set gobject values
341 // user defined functions
344 public class Xcls_column : Object
346 public Gtk.TreeViewColumn el;
347 private Xcls_ValaCompileErrors _this;
353 public Xcls_column(Xcls_ValaCompileErrors _owner )
356 this.el = new Gtk.TreeViewColumn();
360 // set gobject values
361 this.el.title = "Compile output";
362 var child_0 = new Xcls_renderer( _this );
364 this.el.pack_start ( child_0.el , true );
369 this.el.add_attribute(_this.renderer.el , "markup", 2 );
374 // user defined functions
376 public class Xcls_renderer : Object
378 public Gtk.CellRendererText el;
379 private Xcls_ValaCompileErrors _this;
385 public Xcls_renderer(Xcls_ValaCompileErrors _owner )
388 _this.renderer = this;
389 this.el = new Gtk.CellRendererText();
393 // set gobject values
396 // user defined functions