src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 3 Jun 2015 04:00:32 +0000 (12:00 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 3 Jun 2015 04:00:32 +0000 (12:00 +0800)
src/Builder4/GtkView.vala

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

index 5370ac1..644f051 100644 (file)
    "$ xns" : "Gtk",
    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
    "# Xcls_MainWindow main_window" : "",
-   "| void forwardSearch" : "() {\n\n\tif (this.searchcontext == null) {\n\t\treturn;\n\t}\n\tthis.notebook.el.page = 1;\n\tGtk.TextIter beg, st,en, stl;\n\t\n\tvar buf = this.sourceview.el.get_buffer();\n\tbuf.get_iter_at_offset(out beg, this.last_search_end);\n\tif (!this.searchcontext.forward(beg, out st, out en)) {\n\t\tthis.last_search_end = 0;\n\t} else { \n\t\tthis.last_search_end = en.get_offset();\n\t\n\t\tthis.sourceview.el.grab_focus();\n\t \n\t\tbuf.place_cursor(st);\n\t\tvar ln = st.get_line();\n\t\tbuf.get_iter_at_line(out stl,ln);\n\t\t \n\t\tthis.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);\n\t}\n\n}\n",
+   "| void forwardSearch" : "(bool change_focus) {\n\n\tif (this.searchcontext == null) {\n\t\treturn;\n\t}\n\tthis.notebook.el.page = 1;\n\tGtk.TextIter beg, st,en, stl;\n\t\n\tvar buf = this.sourceview.el.get_buffer();\n\tbuf.get_iter_at_offset(out beg, this.last_search_end);\n\tif (!this.searchcontext.forward(beg, out st, out en)) {\n\t\tthis.last_search_end = 0;\n\t} else { \n\t\tthis.last_search_end = en.get_offset();\n\t\tif (change_focus) {\n\t\t\tthis.sourceview.el.grab_focus();\t\n\t\t}\n\t\tbuf.place_cursor(st);\n\t\tvar ln = st.get_line();\n\t\tbuf.get_iter_at_line(out stl,ln);\n\t\t \n\t\tthis.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);\n\t}\n\n}\n",
    "items" : [
     {
      "id" : "notebook",
-     "xtype" : "Notebook",
      "* pack" : "pack_start,true,true,0",
+     "xtype" : "Notebook",
      "$ xns" : "Gtk",
      "items" : [
       {
        "id" : "label_preview",
-       "xtype" : "Label",
        "* pack" : false,
+       "xtype" : "Label",
        "$ xns" : "Gtk",
        "utf8 label" : "Preview"
       },
       {
        "id" : "label_code",
-       "* pack" : false,
        "xtype" : "Label",
+       "* pack" : false,
        "$ xns" : "Gtk",
        "utf8 label" : "Preview Generated Code"
       },
        "items" : [
         {
          "id" : "view_layout",
-         "* pack" : "add",
          "xtype" : "Layout",
+         "* pack" : "add",
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "container",
-           "xtype" : "Box",
            "* pack" : "put,10,10",
+           "xtype" : "Box",
            "$ xns" : "Gtk",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL"
           }
index 527cf9e..a77daf4 100644 (file)
@@ -191,7 +191,7 @@ public class Xcls_GtkView : Object
     
        
     }
-    public void forwardSearch () {
+    public void forwardSearch (bool change_focus) {
     
        if (this.searchcontext == null) {
                return;
@@ -205,9 +205,9 @@ public class Xcls_GtkView : Object
                this.last_search_end = 0;
        } else { 
                this.last_search_end = en.get_offset();
-       
-               this.sourceview.el.grab_focus();
-        
+               if (change_focus) {
+                       this.sourceview.el.grab_focus();        
+               }
                buf.place_cursor(st);
                var ln = st.get_line();
                buf.get_iter_at_line(out stl,ln);