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;
21 public Gtk.Widget lastObj;
23 public Xcls_MainWindow main_window;
24 public JsRender.JsRender file;
31 this.el = new Gtk.VPaned();
40 var child_0 = new Xcls_ScrolledWindow2( _this );
42 this.el.pack1 ( child_0.el , true,true );
43 var child_1 = new Xcls_compile_view( _this );
45 this.el.pack2 ( child_1.el , true,true );
48 this.el.size_allocate.connect( (aloc) => {
50 this.width = aloc.width;
51 this.height =aloc.height;
55 // user defined functions
56 public void createThumb () {
59 if (this.file == null) {
62 var filename = this.file.getIconFileName(false);
64 var win = this.el.get_parent_window();
65 var width = win.get_width();
66 var height = win.get_height();
68 Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
70 screenshot.save(filename,"png");
79 // should we hold until it's printed...
90 public void loadFile (JsRender.JsRender file)
92 file.compile_notice.connect(this.compileNotice);
93 // this.el.set_position((int)(this.el.max_position * 0.7));
94 this.el.set_position(this.el.max_position );
97 if (file.tree == null) {
101 if (this.lastObj != null) {
102 this.container.el.remove(this.lastObj);
105 // hide the compile view at present..
111 print("ALLOC SET SIZES %d, %d\n", w,h);
113 // set the container size min to 500/500 or 20 px less than max..
114 w = int.max (w-20, 500);
115 h = int.max (h-20, 500);
117 print("SET SIZES %d, %d\n", w,h);
118 _this.container.el.set_size_request(w,h);
120 _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.
121 var rgba = Gdk.RGBA ();
123 _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);
126 var x = new JsRender.NodeToGtk(file.tree);
127 var obj = x.munge() as Gtk.Widget;
134 this.container.el.add(obj);
140 public void compileNotice ( string type, string file, int line, string message) {
141 // if type = "START"... then we reset the tree?
142 // the issue is that the compiler is continually going..
143 // so editing a file etc.. may change things.?
144 // probably not an issue.
145 if (type =="START") {
149 var cs = _this.compile_result_store;
165 title = "Depricated";
176 var tv = cs.nodeFindOrCreate(null, top.to_string(), title);
177 tv = cs.nodeFindOrCreate(tv, "%d:%s".printf(top, file), file);
178 cs.nodeAppendOrCreate(tv, "%d:%s:%d".printf(top, file,line), file,line, message);
181 public class Xcls_ScrolledWindow2 : Object
183 public Gtk.ScrolledWindow el;
184 private Xcls_GtkView _this;
190 public Xcls_ScrolledWindow2(Xcls_GtkView _owner )
193 this.el = new Gtk.ScrolledWindow( null, null );
197 // set gobject values
198 var child_0 = new Xcls_view_layout( _this );
200 this.el.add ( child_0.el );
203 // user defined functions
205 public class Xcls_view_layout : Object
207 public Gtk.Layout el;
208 private Xcls_GtkView _this;
214 public Xcls_view_layout(Xcls_GtkView _owner )
217 _this.view_layout = this;
218 this.el = new Gtk.Layout( null, null );
222 // set gobject values
223 var child_0 = new Xcls_container( _this );
225 this.el.put ( child_0.el , 10,10 );
228 // user defined functions
230 public class Xcls_container : Object
233 private Xcls_GtkView _this;
239 public Xcls_container(Xcls_GtkView _owner )
242 _this.container = this;
243 this.el = new Gtk.HBox( true, 0 );
247 // set gobject values
250 // user defined functions
252 public class Xcls_compile_view : Object
255 private Xcls_GtkView _this;
261 public Xcls_compile_view(Xcls_GtkView _owner )
264 _this.compile_view = this;
265 this.el = new Gtk.VBox( false, 0 );
269 // set gobject values
270 var child_0 = new Xcls_HBox6( _this );
272 this.el.pack_start ( child_0.el , false,false,0 );
273 var child_1 = new Xcls_HBox8( _this );
275 this.el.pack_start ( child_1.el , true,true,0 );
278 // user defined functions
280 public class Xcls_HBox6 : Object
283 private Xcls_GtkView _this;
289 public Xcls_HBox6(Xcls_GtkView _owner )
292 this.el = new Gtk.HBox( true, 0 );
296 // set gobject values
297 var child_0 = new Xcls_Button7( _this );
299 this.el.pack_start ( child_0.el , true,true,0 );
302 // user defined functions
304 public class Xcls_Button7 : Object
306 public Gtk.Button el;
307 private Xcls_GtkView _this;
313 public Xcls_Button7(Xcls_GtkView _owner )
316 this.el = new Gtk.Button();
320 // set gobject values
321 this.el.label = "Full Compile";
324 // user defined functions
326 public class Xcls_HBox8 : Object
329 private Xcls_GtkView _this;
335 public Xcls_HBox8(Xcls_GtkView _owner )
338 this.el = new Gtk.HBox( true, 0 );
342 // set gobject values
343 var child_0 = new Xcls_TreeView9( _this );
345 this.el.add ( child_0.el );
346 var child_1 = new Xcls_ScrolledWindow13( _this );
348 this.el.pack_start ( child_1.el , true,true,0 );
351 // user defined functions
353 public class Xcls_TreeView9 : Object
355 public Gtk.TreeView el;
356 private Xcls_GtkView _this;
362 public Xcls_TreeView9(Xcls_GtkView _owner )
365 this.el = new Gtk.TreeView();
369 // set gobject values
370 var child_0 = new Xcls_compile_result_store( _this );
372 this.el.set_model ( child_0.el );
373 var child_1 = new Xcls_column( _this );
377 // user defined functions
379 public class Xcls_compile_result_store : Object
381 public Gtk.TreeStore el;
382 private Xcls_GtkView _this;
388 public Xcls_compile_result_store(Xcls_GtkView _owner )
391 _this.compile_result_store = this;
392 this.el = new Gtk.TreeStore( 4, typeof(string), typeof(int), typeof(string), typeof(string) );
396 // set gobject values
399 // user defined functions
400 public void nodeAppendOrCreate (Gtk.TreePath par, string id, string file, int line, string message) {
404 this.el.get_iter(out piter, par);
406 // loop through parent childnre
408 var loop = this.el.iter_children(out iter, piter);
412 this.el.get_value(iter, 0, out val);
413 var sval = (string)val;
416 this.el.get_value(iter, 2, out mval);
417 var smval = (string)mval;
418 print("add message: %s", message);
419 mval.set_string(smval + "\n" + message); //markup?
420 this.el.set_value(iter, 2, mval);
423 loop = this.el.iter_next(ref iter);
426 // create the node...
428 this.el.append(out iter, null);
430 this.el.append(out iter, piter);
432 print ("add line %s / %d / %s/ %s\n", id, line, message, file);
433 this.el.set(iter, id, line, message, file,-1);
438 public Gtk.TreePath nodeFindOrCreate (Gtk.TreePath? par, string id, string title) {
440 // loop through parent childnre
445 this.el.get_iter(out piter, par);
446 loop = this.el.iter_children(out iter, piter);
448 loop = this.el.iter_children(out iter, null) ;
454 this.el.get_value(iter, 0, out val);
455 var sval = (string)val;
457 return this.el.get_path(iter);
459 loop = this.el.iter_next(ref iter);
461 // create the node...
463 this.el.append(out iter, null);
465 this.el.get_iter(out piter, par);
466 this.el.append(out iter, piter);
469 this.el.set(iter, id, 0, title, "",-1);
471 return this.el.get_path(iter);
475 public class Xcls_column : Object
477 public Gtk.TreeViewColumn el;
478 private Xcls_GtkView _this;
484 public Xcls_column(Xcls_GtkView _owner )
487 this.el = new Gtk.TreeViewColumn();
491 // set gobject values
492 this.el.title = "Compile output";
493 var child_0 = new Xcls_CellRendererText12( _this );
495 this.el.pack_start ( child_0.el , false );
498 // user defined functions
500 public class Xcls_CellRendererText12 : Object
502 public Gtk.CellRendererText el;
503 private Xcls_GtkView _this;
509 public Xcls_CellRendererText12(Xcls_GtkView _owner )
512 this.el = new Gtk.CellRendererText();
516 // set gobject values
519 // user defined functions
521 public class Xcls_ScrolledWindow13 : Object
523 public Gtk.ScrolledWindow el;
524 private Xcls_GtkView _this;
530 public Xcls_ScrolledWindow13(Xcls_GtkView _owner )
533 this.el = new Gtk.ScrolledWindow( null, null );
537 // set gobject values
538 var child_0 = new Xcls_View14( _this );
540 this.el.add ( child_0.el );
543 // user defined functions
545 public class Xcls_View14 : Object
547 public Gtk.SourceView el;
548 private Xcls_GtkView _this;
554 public Xcls_View14(Xcls_GtkView _owner )
557 this.el = new Gtk.SourceView();
561 // set gobject values
562 this.el.editable = false;
563 this.el.show_line_marks = true;
564 this.el.show_line_numbers = true;
567 // user defined functions