adjusting region fade in/out lengths makes the fade in/out active; new font sizes...
[ardour.git] / gtk2_ardour / utils.cc
index ed460a58640cdd27316261dc9a7be9008d7f1710..a1ca5c2eb095d1818e41fb01fdb7081d331c3657 100644 (file)
@@ -106,7 +106,7 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font
 gint
 just_hide_it (GdkEventAny *ev, Gtk::Window *win)
 {
-       win->hide_all ();
+       win->hide ();
        return TRUE;
 }
 
@@ -403,7 +403,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
        GtkWidget* focus = gtk_window_get_focus (win);
        bool special_handling_of_unmodified_accelerators = false;
 
-#undef  DEBUG_ACCELERATOR_HANDLING
+#undef DEBUG_ACCELERATOR_HANDLING
 #ifdef  DEBUG_ACCELERATOR_HANDLING
        bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0);
 #endif
@@ -460,42 +460,60 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
                   it does allow.
                */
 
+               int fakekey = GDK_VoidSymbol;
                int ret = false;
 
                switch (ev->keyval) {
+               case GDK_Tab:
+               case GDK_ISO_Left_Tab:
+                       fakekey = GDK_nabla;
+                       break;
+
                case GDK_Up:
-                       ret = gtk_accel_groups_activate(G_OBJECT(win), GDK_uparrow, GdkModifierType(ev->state));
+                       fakekey = GDK_uparrow;
                        break;
 
                case GDK_Down:
-                       ret = gtk_accel_groups_activate(G_OBJECT(win), GDK_downarrow, GdkModifierType(ev->state));
+                       fakekey = GDK_downarrow;
                        break;
 
                case GDK_Right:
-                       ret = gtk_accel_groups_activate(G_OBJECT(win), GDK_rightarrow, GdkModifierType(ev->state));
+                       fakekey = GDK_rightarrow;
                        break;
 
                case GDK_Left:
-                       ret = gtk_accel_groups_activate(G_OBJECT(win), GDK_leftarrow, GdkModifierType(ev->state));
+                       fakekey = GDK_leftarrow;
                        break;
 
                default:
                        break;
                }
 
-               if (ret) {
-                       return true;
+               if (fakekey != GDK_VoidSymbol) {
+                       ret = gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state));
+                       
+                       if (ret) {
+                               return true;
+                       }
+
+#ifdef GTKOSX
+                       int oldval = ev->keyval;
+                       ev->keyval = fakekey;
+                       if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
+                               return true;
+                       }
+                       ev->keyval = oldval;
+#endif
                }
        }
-               
-       if (!special_handling_of_unmodified_accelerators ||
-           ev->state & (Gdk::MOD1_MASK|
-                        Gdk::MOD3_MASK|
-                        Gdk::MOD4_MASK|
-                        Gdk::MOD5_MASK|
-                        Gdk::CONTROL_MASK)) {
 
-               /* no special handling or modifiers in effect: accelerate first */
+       /* consider all relevant modifiers but not LOCK or SHIFT */
+
+       guint mask = (Keyboard::RelevantModifierKeyMask & ~(Gdk::SHIFT_MASK|Gdk::LOCK_MASK));
+
+       if (!special_handling_of_unmodified_accelerators || (ev->state & mask)) {
+
+               /* no special handling or there are modifiers in effect: accelerate first */
 
 #ifdef DEBUG_ACCELERATOR_HANDLING
                if (debug) {
@@ -508,12 +526,17 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
                }
 #endif
                if (!gtk_window_activate_key (win, ev)) {
+#ifdef DEBUG_ACCELERATOR_HANDLING
+                       if (debug) {
+                               cerr << "\tnot accelerated, now propagate\n";
+                       }
+#endif
                        return gtk_window_propagate_key_event (win, ev);
                } else {
 #ifdef DEBUG_ACCELERATOR_HANDLING
-               if (debug) {
-                       cerr << "\tnot handled\n";
-               }
+                       if (debug) {
+                               cerr << "\taccelerated - done.\n";
+                       }
 #endif
                        return true;
                } 
@@ -578,7 +601,20 @@ get_icon (const char* cname)
                /*NOTREACHED*/
        }
 
-       return Gdk::Pixbuf::create_from_file (path);
+       Glib::RefPtr<Gdk::Pixbuf> img;
+       try {
+               img = Gdk::Pixbuf::create_from_file (path);
+       }
+       catch (const Gdk::PixbufError &e)
+    {
+        cerr << "Caught PixbufError: " << e.what() << endl;
+    }
+    catch (...)
+    {
+        g_message("Caught ... ");
+    }
+
+       return img;
 }
 
 string