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

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

index 9ce5028..48aa6d1 100644 (file)
@@ -5,30 +5,34 @@
  "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowRooView.bjs",
  "permname" : "",
  "modOrder" : "",
+ "build_module" : "",
  "items" : [
   {
    "id" : "WindowRooView",
-   "| 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, this.el.position);\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n    \n    \n    var p = new WebKit.PrintOperation(_this.view.el);\n     \n    var ps = new Gtk.PrintSettings();\n    ps.set_printer(\"Print to File\");\n    ps.set(\"output-file-format\", \"pdf\");\n    ps.set(\"output-uri\", \"file://\" + filename + \".pdf\");\n\n    // find the printer...\n    \n    /*\n    var ar = Gtk.PaperSize.get_paper_sizes(false);\n    var psetup = new Gtk.PageSetup();\n    for(var i = 0; i < ar.length(); i++) {\n        if (ar.nth_data(i).get_name() ==\"iso_a4\") {\n            psetup.set_paper_size(ar.nth_data(i));\n        }\n    }\n    psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);\n    \n     \n    p.set_page_setup(psetup);\n    */\n    p.set_print_settings(ps);\n    \n    p.finished.connect(() => {\n        print(\"creating thumbnail for \" + filename + \".pdf\\n\"); \n        var s = new Cairo.PdfSurface(filename + \".pdf\", 400,400);\n    \n        s.write_to_png (filename);\n        \n       // var f = GLib.File.new_for_path (filename + \".pdf\");\n       // f.delete();\n    });\n    \n    \n    p.print();\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 = file;\n    this.view.renderJS(true);\n}",
+   "| 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, this.el.position);\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n    \n    \n    var p = new WebKit.PrintOperation(_this.view.el);\n     \n    var ps = new Gtk.PrintSettings();\n    ps.set_printer(\"Print to File\");\n    ps.set(\"output-file-format\", \"pdf\");\n    ps.set(\"output-uri\", \"file://\" + filename + \".pdf\");\n\n    // find the printer...\n    \n    /*\n    var ar = Gtk.PaperSize.get_paper_sizes(false);\n    var psetup = new Gtk.PageSetup();\n    for(var i = 0; i < ar.length(); i++) {\n        if (ar.nth_data(i).get_name() ==\"iso_a4\") {\n            psetup.set_paper_size(ar.nth_data(i));\n        }\n    }\n    psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);\n    \n     \n    p.set_page_setup(psetup);\n    */\n    p.set_print_settings(ps);\n    \n    p.finished.connect(() => {\n        print(\"creating thumbnail for \" + filename + \".pdf\\n\"); \n        var s = new Cairo.PdfSurface(filename + \".pdf\", 400,400);\n    \n        s.write_to_png (filename);\n        \n       // var f = GLib.File.new_for_path (filename + \".pdf\");\n       // f.delete();\n    });\n    \n    \n    p.print();\n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
    "* pack" : "add",
-   "xtype" : "VPaned",
+   "xtype" : "Paned",
    "# JsRender.JsRender file" : "",
    "| void requestRedraw" : "() {\n    this.view.renderJS(false);\n}",
    "$ xns" : "Gtk",
+   "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
    "items" : [
     {
      "id" : "viewbox",
+     "xtype" : "Box",
      "* pack" : "pack1,true,true",
-     "xtype" : "VBox",
      "$ 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" : "HBox",
        "$ xns" : "Gtk",
+       "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "$ homogeneous" : true,
        "items" : [
         {
@@ -36,8 +40,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 205f753..62760d7 100644 (file)
@@ -1,8 +1,8 @@
 static Xcls_WindowRooView  _WindowRooView;
 
-public class Xcls_WindowRooView : Object 
+public class Xcls_WindowRooView : Object
 {
-    public Gtk.VPaned el;
+    public Gtk.Paned el;
     private Xcls_WindowRooView  _this;
 
     public static Xcls_WindowRooView singleton()
@@ -21,11 +21,11 @@ public class Xcls_WindowRooView : Object
         // my vars (def)
     public JsRender.JsRender file;
 
-    // ctor 
+    // ctor
     public Xcls_WindowRooView()
     {
         _this = this;
-        this.el = new Gtk.VPaned();
+        this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
 
         // my vars (dec)
 
@@ -38,7 +38,12 @@ public class Xcls_WindowRooView : Object
         this.el.pack2 (  child_1.el , true,true );
     }
 
-    // user defined functions 
+    // user defined functions
+    public void loadFile (JsRender.JsRender file)
+    {
+        this.file = file;
+        this.view.renderJS(true);
+    }
     public void createThumb () {
         
         
@@ -109,33 +114,29 @@ public class Xcls_WindowRooView : Object
     
         
          
-    }
-    public void loadFile (JsRender.JsRender file)
-    {
-        this.file = file;
-        this.view.renderJS(true);
     }
     public void requestRedraw () {
         this.view.renderJS(false);
     }
-    public class Xcls_viewbox : Object 
+    public class Xcls_viewbox : Object
     {
-        public Gtk.VBox el;
+        public Gtk.Box el;
         private Xcls_WindowRooView  _this;
 
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_viewbox(Xcls_WindowRooView _owner )
         {
             _this = _owner;
             _this.viewbox = this;
-            this.el = new Gtk.VBox( false, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = false;
             var child_0 = new Xcls_HBox3( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,true,0 );
@@ -144,9 +145,9 @@ public class Xcls_WindowRooView : Object
             this.el.pack_end (  child_1.el , true,true,0 );
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_HBox3 : Object 
+    public class Xcls_HBox3 : Object
     {
         public Gtk.HBox el;
         private Xcls_WindowRooView  _this;
@@ -154,7 +155,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_HBox3(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -164,6 +165,7 @@ public class Xcls_WindowRooView : Object
 
             // set gobject values
             this.el.height_request = 20;
+            this.el.orientation = Gtk.Orientation.HORIZONTAL;
             this.el.vexpand = false;
             var child_0 = new Xcls_Button4( _this );
             child_0.ref();
@@ -176,9 +178,9 @@ public class Xcls_WindowRooView : Object
             this.el.pack_start (  child_2.el , false,false,0 );
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_Button4 : Object 
+    public class Xcls_Button4 : Object
     {
         public Gtk.Button el;
         private Xcls_WindowRooView  _this;
@@ -186,7 +188,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_Button4(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -197,15 +199,16 @@ public class Xcls_WindowRooView : Object
             // set gobject values
             this.el.label = "Redraw";
 
-            // listeners 
+            //listeners
             this.el.clicked.connect( ( ) => {
                 _this.view.renderJS(  true);
             });
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_AutoRedraw : Object 
+
+    public class Xcls_AutoRedraw : Object
     {
         public Gtk.CheckButton el;
         private Xcls_WindowRooView  _this;
@@ -213,7 +216,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -226,15 +229,16 @@ public class Xcls_WindowRooView : Object
             this.el.active = true;
             this.el.label = "Auto Redraw On";
 
-            // listeners 
+            //listeners
             this.el.toggled.connect( (state) => {
                 this.el.set_label(this.el.active  ? "Auto Redraw On" : "Auto Redraw Off");
             });
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_Button6 : Object 
+
+    public class Xcls_Button6 : Object
     {
         public Gtk.Button el;
         private Xcls_WindowRooView  _this;
@@ -242,7 +246,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_Button6(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -253,7 +257,7 @@ public class Xcls_WindowRooView : Object
             // set gobject values
             this.el.label = "Full Redraw";
 
-            // listeners 
+            //listeners
             this.el.clicked.connect( () => {
               _this.view.redraws = 99;
                 _this.view.el.web_context.clear_cache();  
@@ -264,9 +268,11 @@ public class Xcls_WindowRooView : Object
             });
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_viewcontainer : Object 
+
+
+    public class Xcls_viewcontainer : Object
     {
         public Gtk.ScrolledWindow el;
         private Xcls_WindowRooView  _this;
@@ -274,7 +280,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_viewcontainer(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -289,14 +295,14 @@ public class Xcls_WindowRooView : Object
             child_0.ref();
             this.el.add (  child_0.el  );
 
-            // init method 
+            // init method
 
             this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_view : Object 
+    public class Xcls_view : Object
     {
         public WebKit.WebView el;
         private Xcls_WindowRooView  _this;
@@ -312,7 +318,7 @@ public class Xcls_WindowRooView : Object
         public string runhtml;
         public bool pendingRedraw;
 
-        // ctor 
+        // ctor
         public Xcls_view(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -330,7 +336,7 @@ public class Xcls_WindowRooView : Object
 
             // set gobject values
 
-            // init method 
+            // init method
 
             {
                 // this may not work!?
@@ -384,7 +390,7 @@ public class Xcls_WindowRooView : Object
                 
             }
 
-            // listeners 
+            //listeners
             this.el.script_dialog.connect( (dialog) => {
                 if (this.el == null) {
                     return true;
@@ -448,7 +454,7 @@ public class Xcls_WindowRooView : Object
             });
         }
 
-        // user defined functions 
+        // user defined functions
         public void reInit () {
            print("reInit?");
                  // if this happens destroy the webkit..
@@ -713,7 +719,10 @@ public class Xcls_WindowRooView : Object
             this.refreshRequired  = true;
         }
     }
-    public class Xcls_inspectorcontainer : Object 
+
+
+
+    public class Xcls_inspectorcontainer : Object
     {
         public Gtk.ScrolledWindow el;
         private Xcls_WindowRooView  _this;
@@ -721,7 +730,7 @@ public class Xcls_WindowRooView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
         {
             _this = _owner;
@@ -733,11 +742,12 @@ public class Xcls_WindowRooView : Object
             // set gobject values
             this.el.shadow_type = Gtk.ShadowType.IN;
 
-            // init method 
+            // init method
 
             this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
         }
 
-        // user defined functions 
+        // user defined functions
     }
+
 }