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 if (type =="START") {
150 var cs = _this.compile_result_store;
166 title = "Depricated";
177 var tv = cs.nodeFindOrCreate(null, top.to_string(), title);
178 tv = cs.nodeFindOrCreate(tv, "%d:%s".printf(top, file), file);
179 cs.nodeAppendOrCreate(tv, "%d:%s:%d".printf(top, file,line), file,line, message);
182 public class Xcls_ScrolledWindow2 : Object
184 public Gtk.ScrolledWindow el;
185 private Xcls_GtkView _this;
191 public Xcls_ScrolledWindow2(Xcls_GtkView _owner )
194 this.el = new Gtk.ScrolledWindow( null, null );
198 // set gobject values
199 var child_0 = new Xcls_view_layout( _this );
201 this.el.add ( child_0.el );
204 // user defined functions
206 public class Xcls_view_layout : Object
208 public Gtk.Layout el;
209 private Xcls_GtkView _this;
215 public Xcls_view_layout(Xcls_GtkView _owner )
218 _this.view_layout = this;
219 this.el = new Gtk.Layout( null, null );
223 // set gobject values
224 var child_0 = new Xcls_container( _this );
226 this.el.put ( child_0.el , 10,10 );
229 // user defined functions
231 public class Xcls_container : Object
234 private Xcls_GtkView _this;
240 public Xcls_container(Xcls_GtkView _owner )
243 _this.container = this;
244 this.el = new Gtk.HBox( true, 0 );
248 // set gobject values
251 // user defined functions
253 public class Xcls_compile_view : Object
256 private Xcls_GtkView _this;
262 public Xcls_compile_view(Xcls_GtkView _owner )
265 _this.compile_view = this;
266 this.el = new Gtk.VBox( false, 0 );
270 // set gobject values
271 var child_0 = new Xcls_HBox6( _this );
273 this.el.pack_start ( child_0.el , false,false,0 );
274 var child_1 = new Xcls_HBox8( _this );
276 this.el.pack_start ( child_1.el , true,true,0 );
279 // user defined functions
281 public class Xcls_HBox6 : Object
284 private Xcls_GtkView _this;
290 public Xcls_HBox6(Xcls_GtkView _owner )
293 this.el = new Gtk.HBox( true, 0 );
297 // set gobject values
298 var child_0 = new Xcls_Button7( _this );
300 this.el.pack_start ( child_0.el , true,true,0 );
303 // user defined functions
305 public class Xcls_Button7 : Object
307 public Gtk.Button el;
308 private Xcls_GtkView _this;
314 public Xcls_Button7(Xcls_GtkView _owner )
317 this.el = new Gtk.Button();
321 // set gobject values
322 this.el.label = "Full Compile";
325 // user defined functions
327 public class Xcls_HBox8 : Object
330 private Xcls_GtkView _this;
336 public Xcls_HBox8(Xcls_GtkView _owner )
339 this.el = new Gtk.HBox( true, 0 );
343 // set gobject values
344 var child_0 = new Xcls_TreeView9( _this );
346 this.el.add ( child_0.el );
347 var child_1 = new Xcls_ScrolledWindow13( _this );
349 this.el.pack_start ( child_1.el , true,true,0 );
352 // user defined functions
354 public class Xcls_TreeView9 : Object
356 public Gtk.TreeView el;
357 private Xcls_GtkView _this;
363 public Xcls_TreeView9(Xcls_GtkView _owner )
366 this.el = new Gtk.TreeView();
370 // set gobject values
371 var child_0 = new Xcls_compile_result_store( _this );
373 this.el.set_model ( child_0.el );
374 var child_1 = new Xcls_column( _this );
376 this.el.append_column ( child_1.el );
379 // user defined functions
381 public class Xcls_compile_result_store : Object
383 public Gtk.TreeStore el;
384 private Xcls_GtkView _this;
390 public Xcls_compile_result_store(Xcls_GtkView _owner )
393 _this.compile_result_store = this;
394 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
398 // set gobject values
401 // user defined functions
402 public void nodeAppendOrCreate (Gtk.TreePath par, string id, string file, int line, string message) {
406 this.el.get_iter(out piter, par);
408 // loop through parent childnre
410 var loop = par == null ?
411 this.el.iter_children(out iter, null) :
412 this.el.iter_children(out iter, piter);
416 this.el.get_value(iter, 0, out val);
417 var sval = (string)val;
420 this.el.get_value(iter, 2, out mval);
421 var smval = (string)mval;
422 mval.set_string(smval + "\n" + message); //markup?
426 loop = this.el.iter_next(ref iter);
429 // create the node...
431 this.el.append(out iter, null);
433 this.el.append(out iter, piter);
435 this.el.set(iter, id, line, message, file,-1);
440 public Gtk.TreePath nodeFindOrCreate (Gtk.TreePath? par, string id, string title) {
443 print("looking for %s\n", id);
444 // loop through parent childnre
449 this.el.get_iter(out piter, par);
450 loop = this.el.iter_children(out iter, piter);
452 loop = this.el.iter_children(out iter, null) ;
458 this.el.get_value(iter, 0, out val);
459 var sval = (string)val;
460 print("got node %s", sval);
462 return this.el.get_path(iter);
464 loop = this.el.iter_next(ref iter);
466 // create the node...
468 this.el.append(out iter, null);
470 this.el.get_iter(out piter, par);
471 this.el.append(out iter, piter);
473 print("add iter %s / %s", id, title);
474 this.el.set(iter, 0, id, 1, 0, 2, title, 3, "",-1);
476 return this.el.get_path(iter);
480 public class Xcls_column : Object
482 public Gtk.TreeViewColumn el;
483 private Xcls_GtkView _this;
489 public Xcls_column(Xcls_GtkView _owner )
492 this.el = new Gtk.TreeViewColumn();
496 // set gobject values
497 this.el.title = "Compile output";
498 var child_0 = new Xcls_renderer( _this );
500 this.el.pack_start ( child_0.el , true );
505 this.el.add_attribute(_this.renderer.el , "markup", 2 );
510 // user defined functions
512 public class Xcls_renderer : Object
514 public Gtk.CellRendererText el;
515 private Xcls_GtkView _this;
521 public Xcls_renderer(Xcls_GtkView _owner )
524 _this.renderer = this;
525 this.el = new Gtk.CellRendererText();
529 // set gobject values
532 // user defined functions
534 public class Xcls_ScrolledWindow13 : Object
536 public Gtk.ScrolledWindow el;
537 private Xcls_GtkView _this;
543 public Xcls_ScrolledWindow13(Xcls_GtkView _owner )
546 this.el = new Gtk.ScrolledWindow( null, null );
550 // set gobject values
551 var child_0 = new Xcls_View14( _this );
553 this.el.add ( child_0.el );
556 // user defined functions
558 public class Xcls_View14 : Object
560 public Gtk.SourceView el;
561 private Xcls_GtkView _this;
567 public Xcls_View14(Xcls_GtkView _owner )
570 this.el = new Gtk.SourceView();
574 // set gobject values
575 this.el.editable = false;
576 this.el.show_line_marks = true;
577 this.el.show_line_numbers = true;
580 // user defined functions