1 static Xcls_GladeView _GladeView;
3 public class Xcls_GladeView : Object
5 public Glade.DesignView el;
6 private Xcls_GladeView _this;
8 public static Xcls_GladeView singleton()
10 if (_GladeView == null) {
11 _GladeView= new Xcls_GladeView();
17 public JsRender.JsRender file;
20 public Xcls_GladeView()
23 this.el = new Glade.DesignView(new Glade.Project());
31 // user defined functions
32 public void createThumb () {
35 if (this.file == null) {
38 var filename = this.file.getIconFileName(false);
40 var win = this.el.get_parent_window();
41 var width = win.get_width();
42 var height = win.get_height();
44 Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
46 screenshot.save(filename,"png");
55 // should we hold until it's printed...
66 public void loadFile (JsRender.JsRender file)
73 // clear existing elements from project?
75 var p = this.el.get_project();
76 var li = p.get_objects().copy();
77 // should remove all..
78 for (var i =0; i < li.length(); i++) {
79 p.remove_object(li.nth_data(i));
82 if (file.tree == null) {
86 // print("%s\n",tf.tree.toJsonString());
87 var x = new JsRender.NodeToGlade(file.tree, "");
90 FileIOStream iostream;
91 var f = File.new_tmp ("tpl-XXXXXX.glade", out iostream);
92 var ostream = iostream.output_stream;
93 var dostream = new DataOutputStream (ostream);
94 dostream.put_string (x.munge());
96 print("LOADING %s\n",f.get_path ());
97 p.load_from_file(f.get_path ());