src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 20 May 2015 10:20:57 +0000 (18:20 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 20 May 2015 10:20:57 +0000 (18:20 +0800)
src/Builder4/GtkView.vala

src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala

index 4019fdf..6721114 100644 (file)
@@ -12,8 +12,8 @@
     "size_allocate" : "(aloc) => {\n\n    this.width = aloc.width;\n    this.height =aloc.height;\n    }\n"
    },
    "id" : "GtkView",
-   "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    // only screenshot the gtk preview..\n    if (this.notebook.el.page > 0 ) {\n        return;\n    }\n    \n    \n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n    try {\n         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n         screenshot.save(filename,\"png\");\n    } catch (Error e) {\n        \n    }\n\n   \n    return;\n    \n    \n     \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
    "# Gtk.Widget lastObj" : "null",
+   "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    // only screenshot the gtk preview..\n    if (this.notebook.el.page > 0 ) {\n        return;\n    }\n    \n    \n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n    try {\n         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n         screenshot.save(filename,\"png\");\n    } catch (Error e) {\n        \n    }\n\n   \n    return;\n    \n    \n     \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
    "| void loadFile" : "(JsRender.JsRender file) \n{\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n       this.file = file;     \n        this.sourceview.loadFile();\n        \n        \n\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n        \n        // hide the compile view at present..\n          \n        \n        var w = this.width;\n        var h = this.height;\n        \n        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); \n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = int.max (w-20, 500);\n        h = int.max (h-20, 500); \n        \n        print(\"SET SIZES %d, %d\\n\", w,h);       \n        _this.container.el.set_size_request(w,h);\n        \n        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.\n        var rgba = Gdk.RGBA ();\n        rgba.parse (\"#ccc\");\n        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);\n        \n        \n\tvar x = new JsRender.NodeToGtk(file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n        \n         \n        \n}\n ",
    "int width" : 0,
    "xtype" : "Box",
    "items" : [
     {
      "id" : "notebook",
-     "* pack" : "pack_start,true,true,0",
      "xtype" : "Notebook",
+     "* pack" : "pack_start,true,true,0",
      "$ xns" : "Gtk",
      "items" : [
       {
        "id" : "label_preview",
-       "* pack" : false,
        "xtype" : "Label",
+       "* pack" : false,
        "$ xns" : "Gtk",
        "utf8 label" : "Preview"
       },
       {
        "id" : "label_code",
-       "xtype" : "Label",
        "* pack" : false,
+       "xtype" : "Label",
        "$ xns" : "Gtk",
        "utf8 label" : "Preview Generated Code"
       },
        "items" : [
         {
          "id" : "view_layout",
-         "xtype" : "Layout",
          "* pack" : "add",
+         "xtype" : "Layout",
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "container",
+           "xtype" : "Box",
            "* pack" : "put,10,10",
-           "xtype" : "HBox",
-           "$ xns" : "Gtk"
+           "$ xns" : "Gtk",
+           "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL"
           }
          ]
         }
index 8b677b0..53bc934 100644 (file)
@@ -274,7 +274,7 @@ public class Xcls_GtkView : Object
     }
     public class Xcls_container : Object
     {
-        public Gtk.HBox el;
+        public Gtk.Box el;
         private Xcls_GtkView  _this;
 
 
@@ -285,7 +285,7 @@ public class Xcls_GtkView : Object
         {
             _this = _owner;
             _this.container = this;
-            this.el = new Gtk.HBox( true, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
             // my vars (dec)