allow to disallow mouse gestures
authorgc <gc>
Sun, 12 Jun 2005 17:22:55 +0000 (17:22 +0000)
committergc <gc>
Sun, 12 Jun 2005 17:22:55 +0000 (17:22 +0000)
bin/booh

index ac1af7362a44c04af3ab3ce28dc7bb765ddb3088..525c650ba7fa9885f42a6f5976a6da353de6b1be 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -120,7 +120,11 @@ def write_config
         elsif value.is_a? Array
             elem.add_text value.join('~~~')
         else
-            elem.add_text value.to_s
+            if !value
+                elem.remove
+            else
+                elem.add_text value.to_s
+            end
         end
     }
     $xmldoc.write(ios, 0)
@@ -892,7 +896,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
         if event.event_type == Gdk::Event::BUTTON_PRESS && event.button == 1
             if event.state & Gdk::Window::BUTTON3_MASK != 0
                 #- gesture redo: hold right mouse button then click left mouse button
-                perform_redo
+                $config['nogestures'] or perform_redo
                 $ignore_next_release = true
             else
                 shift_or_control = event.state & Gdk::Window::SHIFT_MASK != 0 || event.state & Gdk::Window::CONTROL_MASK != 0
@@ -906,18 +910,17 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
                     delete.call
                 else
                     textview.grab_focus
-                    $gesture_press = { :filename => filename, :x => event.x, :y => event.y }
+                    $config['nogestures'] or $gesture_press = { :filename => filename, :x => event.x, :y => event.y }
                 end
             end
         elsif event.event_type == Gdk::Event::BUTTON_PRESS && event.button == 3
             if event.state & Gdk::Window::BUTTON1_MASK != 0
                 #- gesture undo: hold left mouse button then click right mouse button
-                perform_undo
+                $config['nogestures'] or perform_undo
                 $ignore_next_release = true
             end
         elsif event.event_type == Gdk::Event::BUTTON2_PRESS && event.button == 1
             view_element(filename, { :delete => delete })
-        elsif event.event_type == Gdk::Event::BUTTON2_PRESS && event.button == 3
         end
         false  #- propagate
     }
@@ -2206,6 +2209,8 @@ def preferences
                0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK, 2, 2)
     tbl.attach(Gtk::Alignment.new(0, 0.5, 1, 0).add(smp_hbox = Gtk::HBox.new.add(smp_spin = Gtk::SpinButton.new(2, 16, 1)).add(Gtk::Label.new(utf8(_("processors")))).set_sensitive(false)),
                1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK, 2, 2)
+    tbl.attach(nogestures_check = Gtk::CheckButton.new(utf8(_("Disable mouse gestures"))),
+               0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK, 2, 2)
     smp_check.signal_connect('toggled') {
         if smp_check.active?
             smp_hbox.sensitive = true
@@ -2217,6 +2222,7 @@ def preferences
         smp_check.active = true
         smp_spin.value = $config['mproc'].to_i
     end
+    nogestures_check.active = $config['nogestures']
 
     notebook.append_page(tbl = Gtk::Table.new(0, 0, false), Gtk::Label.new(utf8(_("Advanced"))))
     tbl.attach(Gtk::Label.new.set_markup(utf8(_("Options to pass to <i>convert</i> when\nperforming 'enhance contrast': "))),
@@ -2233,6 +2239,7 @@ def preferences
             else
                 $config.delete('mproc')
             end
+            $config['nogestures'] = nogestures_check.active?
 
             $config['convert-enhance'] = enhance_entry.text
         end