resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / GtkView.vala
index ee4b2c9..9851abb 100644 (file)
@@ -49,10 +49,10 @@ public class Xcls_GtkView : Object
 
         //listeners
         this.el.size_allocate.connect( (aloc) => {
-        
+         
             this.width = aloc.width;
             this.height =aloc.height;
-            });
+        });
     }
 
     // user defined functions
@@ -175,6 +175,7 @@ public class Xcls_GtkView : Object
             
     }
     public int search (string txt) {
+       this.notebook.el.page = 1;
        var s = new Gtk.SourceSearchSettings();
        var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
        this.searchcontext = new Gtk.SourceSearchContext(buf,s);
@@ -190,13 +191,13 @@ public class Xcls_GtkView : Object
     
        
     }
-    public void forwardSearch () {
+    public void forwardSearch (bool change_focus) {
     
        if (this.searchcontext == null) {
                return;
        }
-       
-       Gtk.TextIter beg, st,en;
+       this.notebook.el.page = 1;
+       Gtk.TextIter beg, st,en, stl;
        
        var buf = this.sourceview.el.get_buffer();
        buf.get_iter_at_offset(out beg, this.last_search_end);
@@ -204,12 +205,14 @@ 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);
                 
-               this.sourceview.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
+               this.sourceview.el.scroll_to_iter(stl,  0.0f, true, 0.0f, 0.5f);
        }
     
     }
@@ -525,7 +528,7 @@ public class Xcls_GtkView : Object
             
           
             // this is connected in widnowstate
-            print("node selected\n");
+            print("Roo-view - node selected\n");
             var buf = this.el.get_buffer();
          
             var sbuf = (Gtk.SourceBuffer) buf;
@@ -560,25 +563,11 @@ public class Xcls_GtkView : Object
             
             //} else {
             if (this.allow_node_scroll) {
-                       print("scrolling cursor\n");
-                       this.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
+                        
+               this.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
                }
             
-            /*
-            is the cursor is between start+end... 
-            then assume we do not need to scroll..
-            
-            
-            
-            Gdk.Rectangle rect, target_rect, inter_rect;
-            this.el.get_visible_rect(out rect);
-            this.el.get_iter_location(iter, out target_rect);
-            
-            if (!rect.intersect(target_rect, out inter_rect)) {
-        
-               }
-               */
-               this.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);    
+             
             
             for (var i = 0; i < buf.get_line_count();i++) {
                 if (i < sel.line_start || i > sel.line_end) {