src/Builder4/PopoverEditor.bjs
authorAlan <alan@roojs.com>
Thu, 5 May 2022 02:20:41 +0000 (10:20 +0800)
committerAlan <alan@roojs.com>
Thu, 5 May 2022 02:20:41 +0000 (10:20 +0800)
src/Builder4/PopoverEditor.vala

src/Builder4/PopoverEditor.bjs
src/Builder4/PopoverEditor.vala

index 74a6eec..097fb6b 100644 (file)
@@ -3,7 +3,6 @@
  "items" : [
   {
    "$ xns" : "Gtk",
-   "@ void select" : "(string key, string type, string skel, string prop_or_listener)",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Xcls_MainWindow mainwindow" : "",
    "bool active" : false,
       "",
       "} "
      ],
-     "| void forwardSearch" : [
-      "(bool change_focus) {",
-      "",
-      "\tif (this.searchcontext == null) {",
-      "\t\treturn;",
-      "\t}",
-      "\t",
-      "\tGtk.TextIter beg, st,en;",
-      "\t ",
-      "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
-      "\tif (!this.searchcontext.forward(beg, out st, out en)) {",
-      "\t",
-      "\t\tthis.last_search_end = 0;",
-      "\t} else {",
-      "\t\tthis.last_search_end = en.get_offset();",
-      "\t\tif (change_focus) {",
-      "\t\t\tthis.view.el.grab_focus();",
-      "\t\t}",
-      "\t\tthis.buffer.el.place_cursor(st);",
-      "\t\tthis.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);",
-      "\t}",
-      "",
-      "}",
-      ""
-     ],
      "| void scroll_to_line" : [
       "(int line) {",
       "",
     "}",
     ""
    ],
+   "| return_type forwardSearch" : [
+    "(bool change_focus) {",
+    "",
+    "\tif (this.searchcontext == null) {",
+    "\t\treturn;",
+    "\t}",
+    "\t",
+    "\tGtk.TextIter beg, st,en;",
+    "\t ",
+    "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
+    "\tif (!this.searchcontext.forward(beg, out st, out en)) {",
+    "\t",
+    "\t\tthis.last_search_end = 0;",
+    "\t} else {",
+    "\t\tthis.last_search_end = en.get_offset();",
+    "\t\tif (change_focus) {",
+    "\t\t\tthis.view.el.grab_focus();",
+    "\t\t}",
+    "\t\tthis.buffer.el.place_cursor(st);",
+    "\t\tthis.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);",
+    "\t}",
+    "",
+    "}",
+    ""
+   ],
    "| void clear" : [
     "() {",
     " this.model.el.clear();",
index 4a478ad..34b26d8 100644 (file)
@@ -20,7 +20,6 @@ public class Xcls_PopoverEditor : Object
 
         // my vars (def)
     public bool active;
-    public signal void select (string key, string type, string skel, string prop_or_listener);
     public Xcls_MainWindow mainwindow;
     public string prop_or_listener;
 
@@ -117,6 +116,28 @@ public class Xcls_PopoverEditor : Object
        return this.searchcontext.get_occurrences_count();
     
       
+    }
+    public return_type forwardSearch (bool change_focus) {
+    
+       if (this.searchcontext == null) {
+               return;
+       }
+       
+       Gtk.TextIter beg, st,en;
+        
+       this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
+       if (!this.searchcontext.forward(beg, out st, out en)) {
+       
+               this.last_search_end = 0;
+       } else {
+               this.last_search_end = en.get_offset();
+               if (change_focus) {
+                       this.view.el.grab_focus();
+               }
+               this.buffer.el.place_cursor(st);
+               this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
+       }
+    
     }
     public void hide () {
        this.prop_or_listener = "";
@@ -230,28 +251,6 @@ public class Xcls_PopoverEditor : Object
                        return false;
                });   
         }
-        public void forwardSearch (bool change_focus) {
-        
-               if (this.searchcontext == null) {
-                       return;
-               }
-               
-               Gtk.TextIter beg, st,en;
-                
-               this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
-               if (!this.searchcontext.forward(beg, out st, out en)) {
-               
-                       this.last_search_end = 0;
-               } else {
-                       this.last_search_end = en.get_offset();
-                       if (change_focus) {
-                               this.view.el.grab_focus();
-                       }
-                       this.buffer.el.place_cursor(st);
-                       this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
-               }
-        
-        }
     }
     public class Xcls_Box3 : Object
     {