1 static Xcls_GtkView _GtkView;
3 public class Xcls_GtkView : Object
6 private Xcls_GtkView _this;
8 public static Xcls_GtkView singleton()
10 if (_GtkView == null) {
11 _GtkView= new Xcls_GtkView();
15 public Xcls_view_layout view_layout;
16 public Xcls_container container;
17 public Xcls_compile_view compile_view;
18 public Xcls_compile_result_store compile_result_store;
19 public Xcls_renderer renderer;
22 public Gtk.Widget lastObj;
24 public Xcls_MainWindow main_window;
25 public JsRender.JsRender file;
32 this.el = new Gtk.VPaned();
41 var child_0 = new Xcls_ScrolledWindow2( _this );
43 this.el.pack1 ( child_0.el , true,true );
44 var child_1 = new Xcls_compile_view( _this );
46 this.el.pack2 ( child_1.el , true,true );
49 this.el.size_allocate.connect( (aloc) => {
51 this.width = aloc.width;
52 this.height =aloc.height;
56 // user defined functions
57 public void createThumb () {
60 if (this.file == null) {
63 var filename = this.file.getIconFileName(false);
65 var win = this.el.get_parent_window();
66 var width = win.get_width();
67 var height = win.get_height();
69 Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
71 screenshot.save(filename,"png");
80 // should we hold until it's printed...
91 public void loadFile (JsRender.JsRender file)
93 file.compile_notice.connect(this.compileNotice);
94 // this.el.set_position((int)(this.el.max_position * 0.7));
95 this.el.set_position(this.el.max_position );
98 if (file.tree == null) {
102 if (this.lastObj != null) {
103 this.container.el.remove(this.lastObj);
106 // hide the compile view at present..
112 print("ALLOC SET SIZES %d, %d\n", w,h);
114 // set the container size min to 500/500 or 20 px less than max..
115 w = int.max (w-20, 500);
116 h = int.max (h-20, 500);
118 print("SET SIZES %d, %d\n", w,h);
119 _this.container.el.set_size_request(w,h);
121 _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.
122 var rgba = Gdk.RGBA ();
124 _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);
127 var x = new JsRender.NodeToGtk(file.tree);
128 var obj = x.munge() as Gtk.Widget;
135 this.container.el.add(obj);
141 public void compileNotice ( string type, string file, int line, string message) {
142 // if type = "START"... then we reset the tree?
143 // the issue is that the compiler is continually going..
144 // so editing a file etc.. may change things.?
145 // probably not an issue.
146 print("err %s / %s:%d / %s\n", type,file,line,message);
147 var cs = _this.compile_result_store;
148 if (type =="START") {
151 cs.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
170 title = "Depricated";
181 var tv = cs.nodeFindOrCreate(null, top.to_string(), title);
182 tv = cs.nodeFindOrCreate(tv, "%d:%s".printf(top, file), GLib.Path.get_basename( file));
183 cs.nodeAppendOrCreate(tv, "%d:%s:%d".printf(top, file,line), file,line, message);
186 public class Xcls_ScrolledWindow2 : Object
188 public Gtk.ScrolledWindow el;
189 private Xcls_GtkView _this;
195 public Xcls_ScrolledWindow2(Xcls_GtkView _owner )
198 this.el = new Gtk.ScrolledWindow( null, null );
202 // set gobject values
203 var child_0 = new Xcls_view_layout( _this );
205 this.el.add ( child_0.el );
208 // user defined functions
210 public class Xcls_view_layout : Object
212 public Gtk.Layout el;
213 private Xcls_GtkView _this;
219 public Xcls_view_layout(Xcls_GtkView _owner )
222 _this.view_layout = this;
223 this.el = new Gtk.Layout( null, null );
227 // set gobject values
228 var child_0 = new Xcls_container( _this );
230 this.el.put ( child_0.el , 10,10 );
233 // user defined functions
235 public class Xcls_container : Object
238 private Xcls_GtkView _this;
244 public Xcls_container(Xcls_GtkView _owner )
247 _this.container = this;
248 this.el = new Gtk.HBox( true, 0 );
252 // set gobject values
255 // user defined functions
257 public class Xcls_compile_view : Object
260 private Xcls_GtkView _this;
266 public Xcls_compile_view(Xcls_GtkView _owner )
269 _this.compile_view = this;
270 this.el = new Gtk.VBox( false, 0 );
274 // set gobject values
275 var child_0 = new Xcls_HBox6( _this );
277 this.el.pack_start ( child_0.el , false,false,0 );
278 var child_1 = new Xcls_HPaned8( _this );
280 this.el.pack_start ( child_1.el , true,true,0 );
283 // user defined functions
285 public class Xcls_HBox6 : Object
288 private Xcls_GtkView _this;
294 public Xcls_HBox6(Xcls_GtkView _owner )
297 this.el = new Gtk.HBox( true, 0 );
301 // set gobject values
302 var child_0 = new Xcls_Button7( _this );
304 this.el.pack_start ( child_0.el , true,true,0 );
307 // user defined functions
309 public class Xcls_Button7 : Object
311 public Gtk.Button el;
312 private Xcls_GtkView _this;
318 public Xcls_Button7(Xcls_GtkView _owner )
321 this.el = new Gtk.Button();
325 // set gobject values
326 this.el.label = "Full Compile";
329 // user defined functions
331 public class Xcls_HPaned8 : Object
333 public Gtk.HPaned el;
334 private Xcls_GtkView _this;
340 public Xcls_HPaned8(Xcls_GtkView _owner )
343 this.el = new Gtk.HPaned();
347 // set gobject values
348 var child_0 = new Xcls_ScrolledWindow9( _this );
350 this.el.add ( child_0.el );
351 var child_1 = new Xcls_ScrolledWindow14( _this );
353 this.el.add ( child_1.el );
356 // user defined functions
358 public class Xcls_ScrolledWindow9 : Object
360 public Gtk.ScrolledWindow el;
361 private Xcls_GtkView _this;
367 public Xcls_ScrolledWindow9(Xcls_GtkView _owner )
370 this.el = new Gtk.ScrolledWindow( null, null );
374 // set gobject values
375 var child_0 = new Xcls_TreeView10( _this );
377 this.el.add ( child_0.el );
382 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
388 // user defined functions
390 public class Xcls_TreeView10 : Object
392 public Gtk.TreeView el;
393 private Xcls_GtkView _this;
399 public Xcls_TreeView10(Xcls_GtkView _owner )
402 this.el = new Gtk.TreeView();
406 // set gobject values
407 var child_0 = new Xcls_compile_result_store( _this );
409 this.el.set_model ( child_0.el );
410 var child_1 = new Xcls_column( _this );
412 this.el.append_column ( child_1.el );
415 // user defined functions
417 public class Xcls_compile_result_store : Object
419 public Gtk.TreeStore el;
420 private Xcls_GtkView _this;
426 public Xcls_compile_result_store(Xcls_GtkView _owner )
429 _this.compile_result_store = this;
430 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
434 // set gobject values
437 // user defined functions
438 public void nodeAppendOrCreate (Gtk.TreePath par, string id, string file, int line, string message) {
442 this.el.get_iter(out piter, par);
444 // loop through parent childnre
446 var loop = par == null ?
447 this.el.iter_children(out iter, null) :
448 this.el.iter_children(out iter, piter);
452 this.el.get_value(iter, 0, out val);
453 var sval = (string)val;
456 this.el.get_value(iter, 2, out mval);
457 var smval = (string)mval;
458 mval.set_string(smval + "\n" + GLib.Markup.escape_text(message)); //markup?
462 loop = this.el.iter_next(ref iter);
465 // create the node...
467 this.el.append(out iter, null);
469 this.el.append(out iter, piter);
471 this.el.set(iter, 0, id, 1, line,2, GLib.Markup.escape_text("%d: %s".printf(line,message)), 3, file,-1);
476 public Gtk.TreePath nodeFindOrCreate (Gtk.TreePath? par, string id, string title) {
479 //print("looking for %s\n", id);
480 // loop through parent childnre
485 this.el.get_iter(out piter, par);
486 loop = this.el.iter_children(out iter, piter);
488 loop = this.el.iter_children(out iter, null) ;
494 this.el.get_value(iter, 0, out val);
495 var sval = (string)val;
496 //print("got node %s", sval);
498 return this.el.get_path(iter);
500 loop = this.el.iter_next(ref iter);
502 // create the node...
504 this.el.append(out iter, null);
506 this.el.get_iter(out piter, par);
507 this.el.append(out iter, piter);
509 //print("add iter %s / %s", id, title);
510 this.el.set(iter, 0, id, 1, 0, 2, title, 3, "",-1);
512 return this.el.get_path(iter);
516 public class Xcls_column : Object
518 public Gtk.TreeViewColumn el;
519 private Xcls_GtkView _this;
525 public Xcls_column(Xcls_GtkView _owner )
528 this.el = new Gtk.TreeViewColumn();
532 // set gobject values
533 this.el.title = "Compile output";
534 var child_0 = new Xcls_renderer( _this );
536 this.el.pack_start ( child_0.el , true );
541 this.el.add_attribute(_this.renderer.el , "markup", 2 );
546 // user defined functions
548 public class Xcls_renderer : Object
550 public Gtk.CellRendererText el;
551 private Xcls_GtkView _this;
557 public Xcls_renderer(Xcls_GtkView _owner )
560 _this.renderer = this;
561 this.el = new Gtk.CellRendererText();
565 // set gobject values
568 // user defined functions
570 public class Xcls_ScrolledWindow14 : Object
572 public Gtk.ScrolledWindow el;
573 private Xcls_GtkView _this;
579 public Xcls_ScrolledWindow14(Xcls_GtkView _owner )
582 this.el = new Gtk.ScrolledWindow( null, null );
586 // set gobject values
587 var child_0 = new Xcls_View15( _this );
589 this.el.add ( child_0.el );
592 // user defined functions
594 public class Xcls_View15 : Object
596 public Gtk.SourceView el;
597 private Xcls_GtkView _this;
603 public Xcls_View15(Xcls_GtkView _owner )
606 this.el = new Gtk.SourceView();
610 // set gobject values
611 this.el.editable = false;
612 this.el.show_line_marks = true;
613 this.el.show_line_numbers = true;
616 // user defined functions