src/Builder4/WindowRooView.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 19 Jun 2015 07:08:58 +0000 (15:08 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 19 Jun 2015 07:08:58 +0000 (15:08 +0800)
src/Builder4/WindowRooView.vala

src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala

index 07ca48e..cb6c9fd 100644 (file)
@@ -11,7 +11,7 @@
    "| void scroll_to_line" : "(int line) {\n   this.notebook.el.page = 1;// code preview...\n   \n   GLib.Timeout.add(500, () => {\n   \n   \n\t   \n\t   \n\t\t  var buf = this.sourceview.el.get_buffer();\n\t \n\t\tvar sbuf = (Gtk.SourceBuffer) buf;\n\n\n\t\tGtk.TextIter iter;   \n\t\tsbuf.get_iter_at_line(out iter,  line);\n\t\tthis.sourceview.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);\n\t\treturn false;\n\t});   \n\n   \n}\n",
    "id" : "WindowRooView",
    "# 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    try { \n        Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);\n        screenshot.save(filename,\"png\");\n    } catch(Error e) {\n        //noop\n    }\n\n    \n     \n    \n     \n}\n",
+   "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n\tif (this.notebook.el.page > 0 ) {\n        return;\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, this.paned.el.position);\n        screenshot.save(filename,\"png\");\n    } catch(Error e) {\n        //noop\n    }\n\n    \n     \n    \n     \n}\n",
    "| void loadFile" : "\n(JsRender.JsRender file)\n{\n    this.file = file;\n    this.view.renderJS(true);\n    this.notebook.el.page = 0;// gtk preview \n    this.sourceview.loadFile();   \n    \n}\n \n ",
    "int width" : 0,
    "bool hexpand" : true,
    "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"
       },
       {
        "id" : "paned",
-       "* pack" : "add",
        "xtype" : "Paned",
+       "* pack" : "add",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
        "items" : [
         {
          "id" : "viewbox",
-         "* pack" : "pack1,true,true",
          "xtype" : "Box",
+         "* pack" : "pack1,true,true",
          "$ xns" : "Gtk",
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
          "$ homogeneous" : false,
          "items" : [
           {
            "$ vexpand" : false,
-           "$ height_request" : 20,
            "* pack" : "pack_start,false,true,0",
+           "$ height_request" : 20,
            "xtype" : "Box",
            "$ xns" : "Gtk",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
@@ -76,8 +76,8 @@
               "clicked" : "( ) => {\n    _this.view.renderJS(  true);\n}"
              },
              "label" : "Redraw",
-             "xtype" : "Button",
              "* pack" : "pack_start,false,false,0",
+             "xtype" : "Button",
              "$ xns" : "Gtk"
             },
             {
               "clicked" : " () => {\n  _this.view.redraws = 99;\n    _this.view.el.web_context.clear_cache();  \n  //_this.view.renderJS(true);\n  FakeServerCache.clear();\n  _this.view.reInit();\n\n}"
              },
              "label" : "Full Redraw",
-             "xtype" : "Button",
              "* pack" : "pack_start,false,false,0",
+             "xtype" : "Button",
              "$ xns" : "Gtk"
             }
            ]
           },
           {
            "id" : "viewcontainer",
-           "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
            "$ shadow_type" : "Gtk.ShadowType.IN",
+           "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
            "* pack" : "pack_end,true,true,0",
            "xtype" : "ScrolledWindow",
            "$ xns" : "Gtk",
         },
         {
          "id" : "inspectorcontainer",
-         "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
          "$ shadow_type" : "Gtk.ShadowType.IN",
+         "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
          "xtype" : "ScrolledWindow",
          "* pack" : "pack2,true,true",
          "$ xns" : "Gtk"
index 0b50b8f..ec435ac 100644 (file)
@@ -80,6 +80,10 @@ public class Xcls_WindowRooView : Object
         if (this.file == null) {
             return;
         }
+       if (this.notebook.el.page > 0 ) {
+            return;
+        }
+        
         var filename = this.file.getIconFileName(false);
         
         var  win = this.el.get_parent_window();