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

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

index 90aec01..21dc840 100644 (file)
@@ -11,7 +11,6 @@
    "listeners" : {
     "size_allocate" : "(aloc) => {\n\n    this.width = aloc.width;\n    this.height =aloc.height;\n    }\n"
    },
-   "| Gee.ArrayList<int> search" : "(string txt) {\n \tvar s = new Gtk.SourceSearchSettings();\n\t\n\tthis.sourcecontext = new Gtk.SourceSearchContext(this.sourceview.el.get_buffer(),s);\n\tsctx.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurences_count();\n\n  \n  \n  return ret;\n}\n",
    "| 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" : "GtkView",
    "# Gtk.Widget lastObj" : "null",
@@ -19,6 +18,7 @@
    "| 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\tsctx.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurences_count();\n\n   \n}\n",
    "xtype" : "Box",
    "# JsRender.JsRender file" : "null",
    "int height" : 0,
index 9d80ab4..f50aa5f 100644 (file)
@@ -53,18 +53,6 @@ public class Xcls_GtkView : Object
     }
 
     // user defined functions
-    public Gee.ArrayList<int> search (string txt) {
-       var s = new Gtk.SourceSearchSettings();
-       
-       this.sourcecontext = new Gtk.SourceSearchContext(this.sourceview.el.get_buffer(),s);
-       sctx.set_highlight(true);
-       s.set_search_text(txt);
-       return this.sourcecontext.get_occurences_count();
-    
-      
-      
-      return ret;
-    }
     public void scroll_to_line (int line) {
        this.notebook.el.page = 1;// code preview...
        
@@ -182,6 +170,16 @@ 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);
+       sctx.set_highlight(true);
+       s.set_search_text(txt);
+       return this.sourcecontext.get_occurences_count();
+    
+       
     }
     public class Xcls_notebook : Object
     {