Expose EditorCursor via public editor API

This is in preparation to subscribe to playhead cursor position
changes in the recorder-UI.

This change also clean up the API, replacing a public variable
with a const access method and follows #12 of
https://ardour.org/styleguide.html
This commit is contained in:
Robin Gareus 2021-01-05 21:58:28 +01:00
parent 8ba7df9105
commit 4769c387f3
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
9 changed files with 99 additions and 92 deletions

View file

@ -119,7 +119,7 @@ EditorSummary::set_session (Session* s)
if (_session) {
Region::RegionPropertyChanged.connect (region_property_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
PresentationInfo::Change.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
_editor->playhead_cursor->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
_editor->playhead_cursor()->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
_session->EndTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
_editor->selection->RegionsChanged.connect (sigc::mem_fun(*this, &EditorSummary::set_background_dirty));
@ -301,7 +301,7 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
double r,g,b,a; Gtkmm2ext::color_to_rgba(_phead_color, r,g,b,a);
cairo_set_source_rgb (cr, r,g,b); // playhead color
const double ph= playhead_sample_to_position (_editor->playhead_cursor->current_sample());
const double ph= playhead_sample_to_position (_editor->playhead_cursor ()->current_sample());
cairo_move_to (cr, ph, 0);
cairo_line_to (cr, ph, get_height());
cairo_stroke (cr);