13
0

audio clocks: focus-on-clock shortcut now works, scrolling and dragging know about x-offsets; cursor colors defined; click on an off clock no longer locates (time info box)

git-svn-id: svn://localhost/ardour2/branches/3.0@10709 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-11-20 16:38:51 +00:00
parent db24dda7a2
commit ae09a5812b
7 changed files with 39 additions and 10 deletions

View File

@ -6,6 +6,7 @@
<accelerator action='set-mouse-mode-timefx'/>
<accelerator action='set-mouse-mode-object-range'/>
<accelerator action='toggle-internal-edit'/>
<accelerator action='focus-on-clock'/>
<menubar name='Main' action='MainMenu'>
<menu name='Session' action='Session'>

View File

@ -642,33 +642,43 @@
<Option name="transport clock: text" value="6bb620ff"/>
<Option name="transport clock: background" value="000000ff"/>
<Option name="transport clock: edited text" value="ff0000ff"/>
<Option name="transport clock: cursor" value="f11000ff"/>
<Option name="secondary clock: text" value="6bb620ff"/>
<Option name="secondary clock: background" value="000000ff"/>
<Option name="secondary clock: edited text" value="ff0000ff"/>
<Option name="secondary clock: cursor" value="f11000ff"/>
<Option name="big clock: text" value="f0f0f0ff"/>
<Option name="big clock: background" value="020202ff"/>
<Option name="big clock: edited text" value="0073a3ff"/>
<Option name="big clock: cursor" value="f11000ff"/>
<Option name="big clock active: text" value="020202ff"/>
<Option name="big clock active: background" value="f11000ff"/>
<Option name="big clock active: edited text" value="0073a3ff"/>
<Option name="big clock active: cursor" value="f11000ff"/>
<Option name="transport delta clock: text" value="0009f3ff"/>
<Option name="transport delta clock: background" value="000000ff"/>
<Option name="transport delta clock: edited text" value="ff0000ff"/>
<Option name="transport delta clock: cursor" value="f11000ff"/>
<Option name="secondary delta clock: text" value="0009f3ff"/>
<Option name="secondary delta clock: background" value="000000ff"/>
<Option name="secondary delta clock: edited text" value="ff0000ff"/>
<Option name="secondary delta clock: cursor" value="f11000ff"/>
<Option name="punch clock: text" value="6bb620ff"/>
<Option name="punch clock: background" value="000000ff"/>
<Option name="punch clock: edited text" value="ff0000ff"/>
<Option name="punch clock: cursor" value="f11000ff"/>
<Option name="nudge clock: text" value="6bb620ff"/>
<Option name="nudge clock: background" value="000000ff"/>
<Option name="nudge clock: edited text" value="ff0000ff"/>
<Option name="nudge clock: cursor" value="f11000ff"/>
<Option name="selection clock: text" value="6bb620ff"/>
<Option name="selection clock: background" value="000000ff"/>
<Option name="selection clock: edited text" value="ff0000ff"/>
<Option name="selection clock: cursor" value="f11000ff"/>
<Option name="clock: text" value="6bb620ff"/>
<Option name="clock: background" value="000000ff"/>
<Option name="clock: edited text" value="ff0000ff"/>
<Option name="clock: cursor" value="f11000ff"/>
</Canvas>
</Ardour>

View File

@ -202,6 +202,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
AudioClock* primary_clock;
AudioClock* secondary_clock;
void focus_on_clock ();
TimeInfoBox* time_info_box;

View File

@ -354,7 +354,7 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(primary_clock, &AudioClock::focus));
act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -862,3 +862,12 @@ ARDOUR_UI::resize_text_widgets ()
set_size_request_to_display_given_text (cpu_load_label, "DSP: 100.0%", 2, 2);
set_size_request_to_display_given_text (buffer_load_label, "Buffers: p:100% c:100%", 2, 2);
}
void
ARDOUR_UI::focus_on_clock ()
{
if (editor && primary_clock) {
editor->present ();
primary_clock->focus ();
}
}

View File

@ -69,6 +69,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
, _follows_playhead (follows_playhead)
, _off (false)
, _fixed_width (true)
, layout_x_offset (0)
, ops_menu (0)
, editing_attr (0)
, foreground_attr (0)
@ -257,8 +258,6 @@ AudioClock::set_colors ()
void
AudioClock::render (cairo_t* cr)
{
double layout_x_offset;
/* main layout: rounded rect, plus the text */
if (_need_bg) {
@ -272,10 +271,8 @@ AudioClock::render (cairo_t* cr)
}
if (!_fixed_width) {
cairo_move_to (cr, 0, 0);
layout_x_offset = 0;
cairo_move_to (cr, layout_x_offset, 0);
} else {
layout_x_offset = (get_width() - layout_width)/2.0;
cairo_move_to (cr, layout_x_offset, (upper_height - layout_height) / 2.0);
}
@ -383,6 +380,15 @@ AudioClock::on_size_allocate (Gtk::Allocation& alloc)
} else {
upper_height = get_height();
}
if (_fixed_width) {
/* center display in available space */
layout_x_offset = (get_width() - layout_width)/2.0;
} else {
/* left justify */
layout_x_offset = 0;
}
}
void
@ -1371,7 +1377,7 @@ AudioClock::on_button_press_event (GdkEventButton *ev)
*/
y = ev->y - ((upper_height - layout_height)/2);
x = ev->x - x_leading_padding;
x = ev->x - layout_x_offset;
if (_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) {
drag_field = index_to_field (index);
@ -1450,7 +1456,7 @@ AudioClock::on_scroll_event (GdkEventScroll *ev)
*/
y = ev->y - ((upper_height - layout_height)/2);
x = ev->x - x_leading_padding;
x = ev->x - layout_x_offset;
if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) {
/* not in the main layout */
@ -1954,7 +1960,6 @@ AudioClock::focus ()
start_edit ();
}
void
AudioClock::set_corner_radius (double r)
{

View File

@ -97,6 +97,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
bool _follows_playhead;
bool _off;
bool _fixed_width;
int layout_x_offset;
Gtk::Menu *ops_menu;

View File

@ -177,7 +177,9 @@ TimeInfoBox::clock_button_release_event (GdkEventButton* ev, AudioClock* src)
}
if (ev->button == 1) {
_session->request_locate (src->current_time ());
if (!src->off()) {
_session->request_locate (src->current_time ());
}
return true;
}