src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Sun, 17 May 2015 11:01:28 +0000 (19:01 +0800)
committerAlan Knowles <alan@roojs.com>
Sun, 17 May 2015 11:01:28 +0000 (19:01 +0800)
src/Builder4/GtkView.vala

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

index 4dc1c8b..f96ef03 100644 (file)
     "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    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 ",
+   "| 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        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" : "",
    "xtype" : "VBox",
    "# JsRender.JsRender file" : "null",
    "int height" : 0,
-   "| void compileNotice" : "( string  type,   string file,   int line,   string  message) {\n    // if type = \"START\"... then we reset the tree?\n    // the issue is that the compiler is continually going..\n    // so editing a file etc.. may change things.?\n    // probably not an issue.\n    print(\"err %s / %s:%d / %s\\n\", type,file,line,message);\n    var cs = _this.compile_result_store;    \n    if (type ==\"START\") {\n        // reset the tree;\n        cs.el.clear();   \n//        cs.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);   \n        return;\n    }\n    if (type ==\"END\") {\n        // reset the tree;\n\n        _this.compile_tree.el.expand_all(); \n        cs.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);   \n        return;\n    }\n    \n    var top = 0;\n    var title = \"\";\n    switch(type) {\n        case \"ERR\":\n            title = \"Errors\";\n            top =0;\n            break;\n        \n        case \"WARN\":\n            title = \"Warnings\";\n            top =1;\n            break;\n            \n        case \"DEPR\":\n            title = \"Depricated\";\n            top=2;\n            break;\n        \n        default:\n            title = type;\n            top =3;\n            break;\n    }\n            \n    \n     var tv = cs.nodeFindOrCreate(null, top.to_string(), title);\n     var ftv = cs.nodeFindOrCreate(tv, \"%d:%s\".printf(top, file), GLib.Path.get_basename( file) );\n     \n      cs.nodeAppendOrCreate(ftv, \"%d:%s:%d\".printf(top, file,line), file,line, message);         \n  }\n  \n ",
    "$ xns" : "Gtk",
    "items" : [
     {
      "items" : [
       {
        "id" : "view_layout",
-       "xtype" : "Layout",
        "* pack" : "add",
+       "xtype" : "Layout",
        "$ xns" : "Gtk",
        "items" : [
         {
          "id" : "container",
-         "* pack" : "put,10,10",
          "xtype" : "HBox",
+         "* pack" : "put,10,10",
          "$ xns" : "Gtk"
         }
        ]
index 61021b3..fa3d562 100644 (file)
@@ -84,9 +84,6 @@ public class Xcls_GtkView : Object
     }
     public void loadFile (JsRender.JsRender file) 
     {
-            file.compile_notice.connect(this.compileNotice);
-           // this.el.set_position((int)(this.el.max_position * 0.7));
-            this.el.set_position(this.el.max_position );
             this.file = null;
             
             if (file.tree == null) {
@@ -132,57 +129,6 @@ public class Xcls_GtkView : Object
              
             
     }
-    public void compileNotice ( string  type,   string file,   int line,   string  message) {
-        // if type = "START"... then we reset the tree?
-        // the issue is that the compiler is continually going..
-        // so editing a file etc.. may change things.?
-        // probably not an issue.
-        print("err %s / %s:%d / %s\n", type,file,line,message);
-        var cs = _this.compile_result_store;    
-        if (type =="START") {
-            // reset the tree;
-            cs.el.clear();   
-    //        cs.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);   
-            return;
-        }
-        if (type =="END") {
-            // reset the tree;
-    
-            _this.compile_tree.el.expand_all(); 
-            cs.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);   
-            return;
-        }
-        
-        var top = 0;
-        var title = "";
-        switch(type) {
-            case "ERR":
-                title = "Errors";
-                top =0;
-                break;
-            
-            case "WARN":
-                title = "Warnings";
-                top =1;
-                break;
-                
-            case "DEPR":
-                title = "Depricated";
-                top=2;
-                break;
-            
-            default:
-                title = type;
-                top =3;
-                break;
-        }
-                
-        
-         var tv = cs.nodeFindOrCreate(null, top.to_string(), title);
-         var ftv = cs.nodeFindOrCreate(tv, "%d:%s".printf(top, file), GLib.Path.get_basename( file) );
-         
-          cs.nodeAppendOrCreate(ftv, "%d:%s:%d".printf(top, file,line), file,line, message);         
-      }
     public class Xcls_ScrolledWindow2 : Object 
     {
         public Gtk.ScrolledWindow el;