diff options
author | Robin Gareus <robin@gareus.org> | 2012-11-11 20:43:50 +0000 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2012-11-11 20:43:50 +0000 |
commit | 44680aa1bb6c42d261e4b6424d5d76fd42f26624 (patch) | |
tree | 503e1ca720a86b21fac7519a3164c73c8e830b88 /gtk2_ardour/audio_clock.cc | |
parent | 09194dcf883ad0005b9799d1eb4d9d7927cdfac4 (diff) |
fix horiz alignment (corner-radius is added to layout)
and subtract alignment from mouse interaction
git-svn-id: svn://localhost/ardour2/branches/3.0@13440 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 2b65b2ef6d..acd8770c27 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -291,7 +291,7 @@ AudioClock::render (cairo_t* cr) if (!_fixed_width) { cairo_move_to (cr, layout_x_offset, 0); } else { - int xcenter = layout_x_offset != 0 ? 0 : (get_width() - _mode_width[_mode]) /2; + int xcenter = layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2; cairo_move_to (cr, layout_x_offset + xcenter, (upper_height - layout_height) / 2.0); } @@ -374,7 +374,7 @@ AudioClock::render (cairo_t* cr) if (editing) { if (!insert_map.empty()) { - int xcenter = layout_x_offset != 0 ? 0 : (get_width() - _mode_width[_mode]) /2; + int xcenter = layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2; if (input_string.length() < insert_map.size()) { Pango::Rectangle cursor; @@ -1535,9 +1535,10 @@ AudioClock::on_button_press_event (GdkEventButton *ev) /* the text has been centered vertically, so adjust * x and y. */ + int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2; y = ev->y - ((upper_height - layout_height)/2); - x = ev->x - layout_x_offset; + x = ev->x - layout_x_offset - xcenter; if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) { /* pretend it is a character on the far right */ @@ -1579,10 +1580,11 @@ AudioClock::on_button_release_event (GdkEventButton *ev) if (_edit_by_click_field) { + int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2; int index = 0; int trailing; int y = ev->y - ((upper_height - layout_height)/2); - int x = ev->x - layout_x_offset; + int x = ev->x - layout_x_offset - xcenter; Field f; if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) { @@ -1649,8 +1651,9 @@ AudioClock::on_scroll_event (GdkEventScroll *ev) * x and y. */ + int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2; y = ev->y - ((upper_height - layout_height)/2); - x = ev->x - layout_x_offset; + x = ev->x - layout_x_offset - xcenter; if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) { /* not in the main layout */ |