remove duplicate page-down/up, add support for stepping in
authorgc <gc>
Sun, 8 May 2005 00:06:08 +0000 (00:06 +0000)
committergc <gc>
Sun, 8 May 2005 00:06:08 +0000 (00:06 +0000)
thumbnails page with up/down keys

bin/booh

index f2f86e20db6ad87880772e636dcc020ba2998969..d2e889784263691d6058bddf8d907bd32df79196 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -222,6 +222,22 @@ def create_editzone(scrolledwindow, pagenum)
         if event.keyval == Gdk::Keyval::GDK_Page_Up || event.keyval == Gdk::Keyval::GDK_Page_Down
             scrolledwindow.signal_emit('key-press-event', event)
         end
+        if (event.keyval == Gdk::Keyval::GDK_Up || event.keyval == Gdk::Keyval::GDK_Down) &&
+           event.state & (Gdk::Window::CONTROL_MASK | Gdk::Window::SHIFT_MASK | Gdk::Window::MOD1_MASK) == 0
+            if event.keyval == Gdk::Keyval::GDK_Up
+                if scrolledwindow.vadjustment.value >= scrolledwindow.vadjustment.lower + scrolledwindow.vadjustment.step_increment
+                    scrolledwindow.vadjustment.value -= scrolledwindow.vadjustment.step_increment
+                else
+                    scrolledwindow.vadjustment.value = scrolledwindow.vadjustment.lower
+                end
+            else
+                if scrolledwindow.vadjustment.value <= scrolledwindow.vadjustment.upper - scrolledwindow.vadjustment.step_increment - scrolledwindow.vadjustment.page_size
+                    scrolledwindow.vadjustment.value += scrolledwindow.vadjustment.step_increment
+                else
+                    scrolledwindow.vadjustment.value = scrolledwindow.vadjustment.upper - scrolledwindow.vadjustment.page_size
+                end
+            end
+        end
         false  #- propagate
     }
     textview.signal_connect('focus-in-event') { |w, event|
@@ -567,9 +583,6 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
 
     textview.signal_connect('key-press-event') { |w, event|
         propagate = true
-        if event.keyval == Gdk::Keyval::GDK_Page_Up || event.keyval == Gdk::Keyval::GDK_Page_Down
-            $autotable_sw.signal_emit('key-press-event', event)
-        end
         if event.state != 0
             x, y = autotable.get_current_pos(vbox)
             control_pressed = event.state & Gdk::Window::CONTROL_MASK != 0