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

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