src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 2 Jun 2015 12:55:42 +0000 (20:55 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 2 Jun 2015 12:55:42 +0000 (20:55 +0800)
src/Builder4/GtkView.vala

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

index b74e65e..9d61543 100644 (file)
    "| void loadFile" : "(JsRender.JsRender file) \n{\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.notebook.el.page = 0;// gtk preview \n   \n  \n        \n       this.file = file;     \n        this.sourceview.loadFile();\n        \n        \n\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,
    "bool hexpand" : true,
-   "| int search" : "(string txt) {\n \tvar s = new Gtk.SourceSearchSettings();\n\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();\n\tthis.sourcecontext = new Gtk.SourceSearchContext(buf,s);\n\tthis.sourcecontext.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurrences_count();\n\n   \n}\n",
+   "| int search" : "(string txt) {\n \tvar s = new Gtk.SourceSearchSettings();\n\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();\n\tthis.searchcontext = new Gtk.SourceSearchContext(buf,s);\n\tthis.searchcontext.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.searchcontext.get_occurrences_count();\n\n   \n}\n",
    "xtype" : "Box",
+   "Gtk.SourceSearchContext searchcontext" : "",
    "# JsRender.JsRender file" : "null",
    "int height" : 0,
    "$ xns" : "Gtk",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
-   "Gtk.SourceSearchContext sourcecontext" : "",
    "# Xcls_MainWindow main_window" : "",
    "items" : [
     {
index 949a2fa..23c68ee 100644 (file)
@@ -22,9 +22,9 @@ public class Xcls_GtkView : Object
         // my vars (def)
     public Gtk.Widget lastObj;
     public int width;
+    public Gtk.SourceSearchContext searchcontext;
     public JsRender.JsRender file;
     public int height;
-    public Gtk.SourceSearchContext sourcecontext;
     public Xcls_MainWindow main_window;
 
     // ctor
@@ -175,10 +175,10 @@ public class Xcls_GtkView : Object
     public int search (string txt) {
        var s = new Gtk.SourceSearchSettings();
        var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
-       this.sourcecontext = new Gtk.SourceSearchContext(buf,s);
-       this.sourcecontext.set_highlight(true);
+       this.searchcontext = new Gtk.SourceSearchContext(buf,s);
+       this.searchcontext.set_highlight(true);
        s.set_search_text(txt);
-       return this.sourcecontext.get_occurrences_count();
+       return this.searchcontext.get_occurrences_count();
     
        
     }