use normal stuff for autoscrolling (allocation) thanks detlef reichl, autoscroll...
authorgc <gc>
Sun, 8 Jul 2007 17:21:21 +0000 (17:21 +0000)
committergc <gc>
Sun, 8 Jul 2007 17:21:21 +0000 (17:21 +0000)
bin/booh-classifier

index 068a8f222ab85912bb42820aea00e3b3e5a0f075..894c60a4310b39ab8c9ee21614b6941710155bf5 100644 (file)
@@ -408,21 +408,19 @@ def check_memory_free_cache_if_needed
 end
 
 def autoscroll_if_needed(button)
-    xpos_left = button.event_window.position[0]
-    xpos_right = button.event_window.position[0] + button.event_window.size[0]
+    xpos_left = button.allocation.x
+    xpos_right = button.allocation.x + button.allocation.width
     hadj = $imagesline_sw.hadjustment
     current_minx_visible = hadj.value
     current_maxx_visible = hadj.value + hadj.page_size
     if xpos_left < current_minx_visible
         #- autoscroll left
-        newval = hadj.value -
-            ((hadj.value - xpos_left - 1) / hadj.step_increment + 1) * hadj.step_increment
+        newval = hadj.value - (current_minx_visible - xpos_left)
         hadj.value = newval
         button.queue_draw  #- TOREMOVE: the visual focus is displayed incorrectly
     elsif xpos_right > current_maxx_visible
         #- autoscroll right
-        newval = hadj.value +
-            ((xpos_right - (hadj.value + hadj.page_size) - 1) / hadj.step_increment + 1) * hadj.step_increment
+        newval = hadj.value + (xpos_right - current_maxx_visible)
         if newval > hadj.upper - hadj.page_size
             newval = hadj.upper - hadj.page_size
         end
@@ -487,7 +485,8 @@ def open_dir(path)
         end
         Dir.entries(dir).each { |file|
             type = entry2type(file)
-            if type && $allentries.size < 5
+            if type
+#&& $allentries.size < 5
                 $allentries << Entry.new(File.join(dir, file), type)
             end
         }