add mouse gesture for image delete for large view as well
authorgc <gc>
Thu, 16 Jun 2005 21:19:02 +0000 (21:19 +0000)
committergc <gc>
Thu, 16 Jun 2005 21:19:02 +0000 (21:19 +0000)
bin/booh

index 5651f3a9145241c3c6b2e63e8d7c136184b9bd7e..a3eda3093ea152c64a51fdd26010b15e5b6b808c 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -210,6 +210,9 @@ def view_element(filename, closures)
     end
     evt = Gtk::EventBox.new.add(Gtk::Alignment.new(0.5, 0.5, 0, 0).add(Gtk::Frame.new.add(Gtk::Image.new(dest_img)).set_shadow_type(Gtk::SHADOW_ETCHED_OUT)))
     evt.signal_connect('button-press-event') { |this, event|
+        if event.event_type == Gdk::Event::BUTTON_PRESS && event.button == 1
+            $config['nogestures'] or $gesture_press = { :x => event.x, :y => event.y }
+        end
         if event.event_type == Gdk::Event::BUTTON_PRESS && event.button == 3
             menu = Gtk::Menu.new
             menu.append(delete_item  = Gtk::ImageMenuItem.new(Gtk::Stock::DELETE))
@@ -221,6 +224,16 @@ def view_element(filename, closures)
             menu.popup(nil, nil, event.button, event.time)
         end
     }
+    evt.signal_connect('button-release-event') { |this, event|
+        if $gesture_press
+            if (($gesture_press[:y]-event.y)/($gesture_press[:x]-event.x)).abs > 2 && event.y-$gesture_press[:y] > 5
+                msg 3, "gesture delete: click-drag right button to the bottom"
+                w.destroy
+                closures[:delete].call
+                $statusbar.push(0, utf8(_("Mouse gesture: delete.")))
+            end
+        end
+    }
     tooltips = Gtk::Tooltips.new
     tooltips.set_tip(evt, File.basename(filename).gsub(/\.jpg/, ''), nil)