From 82cd0093d6051545d9581d4b25a5c8779711e479 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 19 Nov 2011 02:36:30 +0000 Subject: add a signal so that if the Big Clock is closed, the edit window can grab focus back (may not be correct - should really capture close/delete signal; tweak size of audio clocks so that there is less dead space at the RHS, helps scroll wheel events to always do something git-svn-id: svn://localhost/ardour2/branches/3.0@10700 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/ardour_ui_ed.cc | 9 +++++++++ gtk2_ardour/audio_clock.cc | 27 +++++++++++++++++---------- gtk2_ardour/audio_clock.h | 1 + 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 3eeab1c85f..acaf986839 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -355,6 +355,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void big_clock_realized (); bool big_clock_resize_in_progress; int big_clock_height; + void big_clock_catch_focus (); void float_big_clock (Gtk::Window* parent); bool main_window_state_event_handler (GdkEventWindowState*, bool window_was_editor); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 28e6e60fa7..6295400e32 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -630,6 +630,13 @@ ARDOUR_UI::use_menubar_as_top_menubar () app->set_menu_bar (*menu_bar); } +void +ARDOUR_UI::big_clock_catch_focus () +{ + cerr << "catch BC focus\n"; + PublicEditor::instance().reset_focus (); +} + void ARDOUR_UI::setup_clock () { @@ -647,6 +654,8 @@ ARDOUR_UI::setup_clock () big_clock_window->get()->signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), big_clock_window->get()), false); big_clock_window->get()->signal_size_allocate().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_size_allocate)); + big_clock->DropFocus.connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_catch_focus)); + manage_window (*big_clock_window->get()); } diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 0158f00731..6e736d248e 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -341,7 +341,7 @@ AudioClock::on_size_request (Gtk::Requisition* req) where we printf a fractional value (XXX or should) */ - tmp->set_text (" 88|88:88:88,888"); + tmp->set_text (" 88888888888,|"); tmp->get_pixel_size (req->width, req->height); @@ -487,13 +487,20 @@ AudioClock::end_edit (bool modify) void AudioClock::drop_focus () { - /* move focus back to the default widget in the top level window */ - Keyboard::magic_widget_drop_focus (); - Widget* top = get_toplevel(); - if (top->is_toplevel ()) { - Window* win = dynamic_cast (top); - win->grab_focus (); + + DropFocus (); /* EMIT SIGNAL */ + + if (has_focus()) { + + /* move focus back to the default widget in the top level window */ + + Widget* top = get_toplevel(); + + if (top->is_toplevel ()) { + Window* win = dynamic_cast (top); + win->grab_focus (); + } } } @@ -1209,7 +1216,7 @@ AudioClock::index_to_field (int index) const return Timecode_Minutes; } else if (index < 10) { return Timecode_Seconds; - } else if (index < 13) { + } else { return Timecode_Frames; } break; @@ -1218,7 +1225,7 @@ AudioClock::index_to_field (int index) const return Bars; } else if (index < 7) { return Beats; - } else if (index < 12) { + } else { return Ticks; } break; @@ -1229,7 +1236,7 @@ AudioClock::index_to_field (int index) const return MS_Minutes; } else if (index < 9) { return MS_Seconds; - } else if (index < 12) { + } else { return MS_Milliseconds; } break; diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index f4681c279c..1acff95612 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -78,6 +78,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr sigc::signal ValueChanged; sigc::signal mode_changed; sigc::signal ChangeAborted; + sigc::signal DropFocus; static sigc::signal ModeChanged; static std::vector clocks; -- cgit v1.2.3