update statusbar asap instead of after mainview loading; do not autoscroll on focus...
authorgc <gc>
Sun, 27 Apr 2008 18:26:16 +0000 (18:26 +0000)
committergc <gc>
Sun, 27 Apr 2008 18:26:16 +0000 (18:26 +0000)
bin/booh-classifier

index 12e42b3..fa5931c 100644 (file)
@@ -654,6 +654,7 @@ class MainView < Gtk::DrawingArea
     end
 
     def redraw
+        @entry and sb_msg(_("Selected %s") % @entry.get_beautified_name)
         if ! update_shown
             return
         end
@@ -662,7 +663,6 @@ class MainView < Gtk::DrawingArea
         window.clear
         draw
         window.end_paint
-        @entry and sb_msg(_("Selected %s") % @entry.get_beautified_name)
         Gtk.main_iteration while Gtk.events_pending?
     end
 
@@ -859,13 +859,17 @@ def thumbnail_keypressed(entry, event)
         end
 
     elsif event.state & Gdk::Window::CONTROL_MASK != 0
-        #- CONTROL pressed: Ctrl-z and Ctrl-r for undo/redo
+        #- CONTROL pressed: Ctrl-z and Ctrl-r for undo/redo, Ctrl-space for recentre
         if event.keyval == Gdk::Keyval::GDK_z
             perform_undo
         end
         if event.keyval == Gdk::Keyval::GDK_r
             perform_redo
         end
+        if event.keyval == Gdk::Keyval::GDK_space
+            shown = $mainview.get_shown_entry
+            shown and autoscroll_if_needed(shown.button)
+        end
 
     else
         removed_before = entry.removed
@@ -1020,19 +1024,21 @@ def show_entry(entry, i, tips)
     end
     tips.set_tip(entry.button, entry.get_beautified_name, nil)
     $imagesline.pack_start(entry.alignment = Gtk::Alignment.new(0.5, 1, 0, 0).add(entry.button).show_all, false, false)
-    $last_shown = nil
     entry.button.signal_connect('clicked') {
-        $lastshown and $lastshown.alignment.set(0.5, 1, 0, 0)
-        entry.alignment.set(0.5, 0, 0, 0)
-        $lastshown = entry
-        $mainview.set_shown_entry(entry)
+        shown = $mainview.get_shown_entry
+        if shown != entry
+            shown and shown.alignment.set(0.5, 1, 0, 0)
+            entry.alignment.set(0.5, 0, 0, 0)
+            autoscroll_if_needed(entry.button)
+            $mainview.set_shown_entry(entry)
+        end
     }
     entry.button.signal_connect('button-press-event') { |w, event|
         if entry.type == 'video' && event.event_type == Gdk::Event::BUTTON2_PRESS
             video_view(entry)
         end
     }
-    entry.button.signal_connect('focus-in-event') { autoscroll_if_needed(entry.button); entry.button.clicked }
+    entry.button.signal_connect('focus-in-event') { entry.button.clicked }
     entry.button.signal_connect('key-press-event') { |w, e| thumbnail_keypressed(entry, e) }
     if i == 0
         entry.button.grab_focus
@@ -1684,6 +1690,7 @@ the <i>to remove</i> label, and copy or move images with the labels you defined.
 <span foreground='darkblue'>Space</span>: clear any label on current image
 <span foreground='darkblue'>Control-z</span>: undo
 <span foreground='darkblue'>Control-r</span>: redo
+<span foreground='darkblue'>Control-Space</span>: autoscroll thumbnails to view current item
 
 Any alphabetical key will assign (or popup for) the associated label on current image.
 ")), { :pos_centered => true, :not_transient => true })