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
This commit is contained in:
Paul Davis
2011-11-19 02:36:30 +00:00
parent 05283a6339
commit 82cd0093d6
4 changed files with 28 additions and 10 deletions

View File

@@ -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);

View File

@@ -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());
}

View File

@@ -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<Window*> (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<Window*> (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;

View File

@@ -78,6 +78,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
sigc::signal<void> ValueChanged;
sigc::signal<void> mode_changed;
sigc::signal<void> ChangeAborted;
sigc::signal<void> DropFocus;
static sigc::signal<void> ModeChanged;
static std::vector<AudioClock*> clocks;