Add a clock to the menu bar in full-screen mode. Fixes #1273.

git-svn-id: svn://localhost/ardour2/branches/3.0@8024 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-11-14 13:48:24 +00:00
parent aff8e4e941
commit 91d3ab7cec
7 changed files with 48 additions and 2 deletions

View File

@ -1599,6 +1599,7 @@ widget "*EditPointClock" style:highest "default_clock_display"
widget "*PreRollClock" style:highest "default_clock_display"
widget "*PostRollClock" style:highest "default_clock_display"
widget "*NudgeClock" style:highest "default_clock_display"
widget "*MenuBarClock" style:highest "default_clock_display"
widget "*ZoomRangeClock" style:highest "default_clock_display"
widget "*SMPTEOffsetClock" style:highest "default_clock_display"
widget "*TransportLabel" style:highest "small_bold_text"

View File

@ -174,6 +174,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
auditioning_alert_button (_("AUDITION")),
solo_alert_button (_("SOLO")),
_menu_bar_clock (X_("menu_bar"), false, X_("MenuBarClock"), true, true, false, false),
error_log_button (_("Errors"))
{

View File

@ -237,7 +237,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void add_window_proxy (WindowProxyBase *);
void remove_window_proxy (WindowProxyBase *);
protected:
friend class PublicEditor;
@ -307,7 +307,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void about_signal_response(int response);
private:
Gtk::VBox top_packer;
sigc::connection clock_signal_connection;
@ -538,6 +537,12 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
sigc::connection point_oh_five_second_connection;
sigc::connection point_zero_one_second_connection;
AudioClock _menu_bar_clock;
sigc::connection _menu_bar_clock_connection;
void menu_bar_clock_value_changed ();
void show_menu_bar_clock ();
void hide_menu_bar_clock ();
gint session_menu (GdkEventButton *);
bool _will_create_new_session_automatically;

View File

@ -944,6 +944,8 @@ ARDOUR_UI::editor_realized ()
set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2);
reset_dpi ();
hide_menu_bar_clock ();
}
void
@ -958,6 +960,8 @@ ARDOUR_UI::maximise_editing_space ()
if (Config->get_keep_tearoffs()) {
transport_tearoff->set_visible (true);
}
show_menu_bar_clock ();
}
void
@ -969,4 +973,6 @@ ARDOUR_UI::restore_editing_space ()
transport_tearoff->set_visible (true);
editor->restore_editing_space ();
hide_menu_bar_clock ();
}

View File

@ -87,6 +87,7 @@ ARDOUR_UI::set_session (Session *s)
big_clock.set_session (s);
preroll_clock.set_session (s);
postroll_clock.set_session (s);
_menu_bar_clock.set_session (s);
/* sensitize menu bar options that are now valid */

View File

@ -522,10 +522,15 @@ ARDOUR_UI::build_menu_bar ()
cpu_load_box.set_name ("CPULoad");
cpu_load_label.set_name ("CPULoad");
/* Set up some size requests here to stop the menu-bar clock jumping around in full-screen mode */
/* TRANSLATORS: just translate `Buffers' in this string */
set_size_request_to_display_given_text (buffer_load_label, _("Buffers p:100% c:100%"), 2, 0);
buffer_load_box.add (buffer_load_label);
buffer_load_box.set_name ("BufferLoad");
buffer_load_label.set_name ("BufferLoad");
set_size_request_to_display_given_text (sample_rate_label, X_("384 kHz / 1000 ms"), 2, 0);
sample_rate_box.add (sample_rate_label);
sample_rate_box.set_name ("SampleRate");
sample_rate_label.set_name ("SampleRate");
@ -536,6 +541,9 @@ ARDOUR_UI::build_menu_bar ()
use_menubar_as_top_menubar ();
#endif
_menu_bar_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::menu_bar_clock_value_changed));
menu_hbox.pack_start (_menu_bar_clock, false, false);
if (!Profile->get_small_screen()) {
#ifndef GTKOSX
// OSX provides its own wallclock, thank you very much
@ -773,3 +781,25 @@ ARDOUR_UI::toggle_global_port_matrix (ARDOUR::DataType t)
}
}
void
ARDOUR_UI::show_menu_bar_clock ()
{
_menu_bar_clock.show ();
_menu_bar_clock.set (_session->audible_frame (), true);
_menu_bar_clock_connection = ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (_menu_bar_clock, &AudioClock::set), 'p'));
}
void
ARDOUR_UI::hide_menu_bar_clock ()
{
_menu_bar_clock.hide ();
_menu_bar_clock_connection.disconnect ();
}
void
ARDOUR_UI::menu_bar_clock_value_changed ()
{
if (_session) {
_session->request_locate (_menu_bar_clock.current_time ());
}
}

View File

@ -4092,6 +4092,7 @@ Editor::maximise_editing_space ()
_tools_tearoff->set_visible (true);
_zoom_tearoff->set_visible (true);
}
}
void