src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 11 May 2015 12:22:53 +0000 (20:22 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 11 May 2015 12:22:53 +0000 (20:22 +0800)
src/Builder4/GtkView.vala

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

index 2130406..5c601c5 100644 (file)
@@ -12,8 +12,8 @@
     "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",
+   "# Gtk.Widget lastObj" : "null",
    "| void loadFile" : "(JsRender.JsRender file) \n{\n        file.compile_notice.connect(this.compileNotice);\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,
    "Xcls_MainWindow main_window" : "",
      "items" : [
       {
        "id" : "view_layout",
-       "* pack" : "add",
        "xtype" : "Layout",
+       "* pack" : "add",
        "$ xns" : "Gtk",
        "items" : [
         {
          "id" : "container",
-         "xtype" : "HBox",
          "* pack" : "put,10,10",
+         "xtype" : "HBox",
          "$ xns" : "Gtk"
         }
        ]
@@ -46,8 +46,8 @@
     },
     {
      "id" : "compile_view",
-     "* pack" : "pack2,true,true",
      "xtype" : "VBox",
+     "* pack" : "pack2,true,true",
      "gboolean homogeneous" : false,
      "$ xns" : "Gtk",
      "items" : [
        ]
       },
       {
-       "xtype" : "HPaned",
        "* pack" : "pack_start,true,true,0",
+       "xtype" : "HPaned",
        "$ xns" : "Gtk",
        "items" : [
         {
          "* init" : "{\n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n\n}\n",
-         "xtype" : "ScrolledWindow",
          "* pack" : "add",
+         "xtype" : "ScrolledWindow",
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "compile_tree",
-           "xtype" : "TreeView",
            "* pack" : "add",
+           "xtype" : "TreeView",
            "$ xns" : "Gtk",
            "items" : [
             {
              "items" : [
               {
                "id" : "renderer",
-               "* pack" : "pack_start,true",
                "xtype" : "CellRendererText",
+               "* pack" : "pack_start,true",
                "$ xns" : "Gtk"
               }
              ]
          "items" : [
           {
            "gboolean show_line_marks" : true,
-           "* pack" : "add",
            "xtype" : "SourceView",
+           "* pack" : "add",
            "$ xns" : "Gtk",
            "gboolean show_line_numbers" : true,
            "gboolean editable" : false
    ]
   }
  ]
-}
+}
\ No newline at end of file
index fcffff2..f120a3a 100644 (file)
@@ -592,14 +592,14 @@ public class Xcls_GtkView : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_View15( _this );
+            var child_0 = new Xcls_SourceView15( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
         }
 
         // user defined functions 
     }
-    public class Xcls_View15 : Object 
+    public class Xcls_SourceView15 : Object 
     {
         public Gtk.SourceView el;
         private Xcls_GtkView  _this;
@@ -608,7 +608,7 @@ public class Xcls_GtkView : Object
             // my vars (def)
 
         // ctor 
-        public Xcls_View15(Xcls_GtkView _owner )
+        public Xcls_SourceView15(Xcls_GtkView _owner )
         {
             _this = _owner;
             this.el = new Gtk.SourceView();