Merge branch 'master' into windows
[ardour.git] / libs / gtkmm2ext / keyboard.cc
index 0a3a1f7adc47e1586d723020db4261b344c3dfd9..5087f61a237480f3359f0213fddb92f8ec13096e 100644 (file)
@@ -58,9 +58,9 @@ guint Keyboard::snap_mod = GDK_MOD3_MASK;
 #ifdef GTKOSX
 
 uint Keyboard::PrimaryModifier = GDK_MOD2_MASK;   // Command
-guint Keyboard::SecondaryModifier = GDK_CONTROL_MASK; // Alt/Option
+guint Keyboard::SecondaryModifier = GDK_CONTROL_MASK; // Control
 guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
-guint Keyboard::Level4Modifier = GDK_MOD1_MASK; // Control
+guint Keyboard::Level4Modifier = GDK_MOD1_MASK; // Alt/Option
 guint Keyboard::CopyModifier = GDK_CONTROL_MASK;      // Control
 guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
 guint Keyboard::button2_modifiers = Keyboard::SecondaryModifier|Keyboard::Level4Modifier;
@@ -91,6 +91,14 @@ const char* Keyboard::rangeselect_modifier_name() { return S_("Key|Shift"); }
 
 #endif
 
+guint Keyboard::GainFineScaleModifier = Keyboard::PrimaryModifier;
+guint Keyboard::GainExtraFineScaleModifier = Keyboard::SecondaryModifier;
+
+guint Keyboard::ScrollZoomVerticalModifier = Keyboard::SecondaryModifier;
+guint Keyboard::ScrollZoomHorizontalModifier = Keyboard::PrimaryModifier;
+guint Keyboard::ScrollHorizontalModifier = Keyboard::TertiaryModifier;
+
+
 Keyboard*    Keyboard::_the_keyboard = 0;
 Gtk::Window* Keyboard::current_window = 0;
 bool         Keyboard::_some_magic_widget_has_focus = false;
@@ -240,6 +248,17 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
                keyval = event->keyval;
        }
 
+       if (event->state & ScrollZoomVerticalModifier) {
+               /* There is a special and rather hacky situation in Editor which makes
+                  it useful to know when the modifier key for vertical zoom has been
+                  released, so emit a signal here (see Editor::_stepping_axis_view).
+                  Note that the state bit for the modifier key is set for the key-up
+                  event when the modifier is released, but not the key-down when it
+                  is pressed, so we get here on key-up, which is what we want.
+               */
+               ZoomVerticalModifierReleased (); /* EMIT SIGNAL */
+       }
+
        if (event->type == GDK_KEY_PRESS) {
 
                if (find (state.begin(), state.end(), keyval) == state.end()) {
@@ -299,11 +318,8 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
        if (event->type == GDK_KEY_RELEASE && modifier_state_equals (event->state, PrimaryModifier)) {
                switch (event->keyval) {
                case GDK_w:
-                       if (current_window) {
-                               current_window->hide ();
-                               current_window = 0;
-                               ret = true;
-                       }
+                       close_current_dialog ();
+                       ret = true;
                        break;
                }
        }
@@ -311,6 +327,15 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
        return ret;
 }
 
+void
+Keyboard::close_current_dialog ()
+{
+       if (current_window) {
+               current_window->hide ();
+               current_window = 0;
+       }
+}
+
 bool
 Keyboard::key_is_down (uint32_t keyval)
 {
@@ -514,7 +539,7 @@ Keyboard::load_keybindings (string path)
 
 
        } catch (...) {
-               error << string_compose (_("Ardour key bindings file not found at \"%1\" or contains errors."), path)
+               error << string_compose (_("key bindings file not found at \"%2\" or contains errors."), path)
                      << endmsg;
                return false;
        }
@@ -556,4 +581,3 @@ Keyboard::load_keybindings (string path)
        return true;
 }
 
-