conf7819.file
[app.Builder.js] / src / Builder4 / GtkView.bjs
index 31c9416..c219b4a 100644 (file)
@@ -7,38 +7,50 @@
  "modOrder" : "",
  "items" : [
   {
+   "listeners" : {
+    "size_allocate" : "(aloc) => {\n\n    this.width = aloc.width;\n    this.height =aloc.height;\n    }\n"
+   },
    "id" : "GtkView",
-   "# Gtk.Widget lastObj" : "null",
    "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\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\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \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    \n        this.el.set_position((int)(this.el.max_position * 0.7));\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.file = file;\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n        \n        // hide the compile view at present..\n        _this.compile_view.el.visible = false;\n        \n        \n        uint w,h;\n        \n        _this.view_layout.el.get_size(out w, out h);\n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = uint.min (w-20, 500);\n        h = uint.min (h-20, 500);        \n        _this.container.el.set_size_request((int)w,(int)h);\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         _this.compile_view.el.hide();\n        \n}\n ",
+   "# Gtk.Widget lastObj" : "null",
+   "| void loadFile" : "(JsRender.JsRender file) \n{\n    \n       // this.el.set_position((int)(this.el.max_position * 0.7));\n        this.el.set_position(this.el.max_position );\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.file = file;\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" : "VPaned",
    "# JsRender.JsRender file" : "null",
+   "int height" : 0,
    "$ xns" : "Gtk",
    "items" : [
     {
-     "id" : "view_layout",
      "* pack" : "pack1,true,true",
-     "xtype" : "Layout",
+     "xtype" : "ScrolledWindow",
      "$ xns" : "Gtk",
      "items" : [
       {
-       "id" : "container",
-       "* pack" : "put,10,10",
-       "xtype" : "HBox",
-       "$ xns" : "Gtk"
+       "id" : "view_layout",
+       "xtype" : "Layout",
+       "* pack" : "add",
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "id" : "container",
+         "* pack" : "put,10,10",
+         "xtype" : "HBox",
+         "$ xns" : "Gtk"
+        }
+       ]
       }
      ]
     },
     {
      "id" : "compile_view",
-     "* pack" : "pack2,true,true",
      "xtype" : "VBox",
+     "* pack" : "pack2,true,true",
      "gboolean homogeneous" : false,
      "$ xns" : "Gtk",
      "items" : [
       {
-       "* pack" : "pack_start,false,false,0",
        "xtype" : "HBox",
+       "* pack" : "pack_start,false,false,0",
        "$ xns" : "Gtk",
        "items" : [
         {
          "items" : [
           {
            "gboolean show_line_marks" : true,
-           "* pack" : "add",
            "xtype" : "View",
+           "* pack" : "add",
            "$ xns" : "GtkSource",
            "gboolean show_line_numbers" : true,
            "gboolean editable" : false