diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-20 16:38:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-20 16:38:51 +0000 |
commit | ae09a5812b665483daa04adb790ab2f2bd32a29b (patch) | |
tree | 6f270c6712af36943efdb5074f091d6ed5bddbdc /gtk2_ardour/audio_clock.cc | |
parent | db24dda7a2d732c2b87dd4c6ef6d5d21a4dcac5a (diff) |
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
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 284885ad44..57abbe325c 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -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) { |