From 9494ecf6e9a1e1550a9ae7c0cb1e64f4fbe6c906 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 14 May 2025 11:50:30 -0600 Subject: [PATCH] EditorComponent should have a reference, not pointer, to an Editor the value is not allow to be null, and the coding style guide says in such cases to prefer a reference. No semantics change here, just the fact that all EditorComponents receive *this instead of this when the Editor that owns them creates them --- gtk2_ardour/editor.cc | 12 ++--- gtk2_ardour/editor_component.cc | 2 +- gtk2_ardour/editor_component.h | 4 +- gtk2_ardour/editor_group_tabs.cc | 10 ++-- gtk2_ardour/editor_group_tabs.h | 2 +- gtk2_ardour/editor_locations.cc | 2 +- gtk2_ardour/editor_locations.h | 2 +- gtk2_ardour/editor_regions.cc | 20 ++++---- gtk2_ardour/editor_regions.h | 2 +- gtk2_ardour/editor_route_groups.cc | 14 +++--- gtk2_ardour/editor_route_groups.h | 2 +- gtk2_ardour/editor_sources.cc | 26 +++++----- gtk2_ardour/editor_sources.h | 2 +- gtk2_ardour/editor_summary.cc | 78 +++++++++++++++--------------- gtk2_ardour/editor_summary.h | 2 +- 15 files changed, 90 insertions(+), 90 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index ec4db97994..4ea34a1de1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -456,7 +456,7 @@ Editor::Editor () CairoWidget::set_focus_handler (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::reset_focus)); - _summary = new EditorSummary (this); + _summary = new EditorSummary (*this); TempoMap::MapChanged.connect (tempo_map_connection, invalidator (*this), std::bind (&Editor::tempo_map_changed, this), gui_context()); @@ -473,7 +473,7 @@ Editor::Editor () vertical_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &Editor::tie_vertical_scrolling), true); _track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler)); - _group_tabs = new EditorGroupTabs (this); + _group_tabs = new EditorGroupTabs (*this); controls_layout.add (edit_controls_vbox); controls_layout.signal_expose_event ().connect (sigc::bind (sigc::ptr_fun (&ArdourWidgets::ArdourIcon::expose_with_text), &controls_layout, ArdourWidgets::ArdourIcon::ShadedPlusSign, _("Right-click\nor Double-click here\nto add Track, Bus,\n or VCA."))); @@ -536,13 +536,13 @@ Editor::Editor () PresentationInfo::Change.connect (*this, MISSING_INVALIDATOR, std::bind (&Editor::presentation_info_changed, this, _1), gui_context()); - _route_groups = new EditorRouteGroups (this); + _route_groups = new EditorRouteGroups (*this); _routes = new EditorRoutes (); - _regions = new EditorRegions (this); - _sources = new EditorSources (this); + _regions = new EditorRegions (*this); + _sources = new EditorSources (*this); _sections = new EditorSections (*this); _snapshots = new EditorSnapshots (); - _locations = new EditorLocations (this); + _locations = new EditorLocations (*this); _properties_box = new SelectionPropertiesBox (); /* these are static location signals */ diff --git a/gtk2_ardour/editor_component.cc b/gtk2_ardour/editor_component.cc index d4e82bdbb5..d0f5a30511 100644 --- a/gtk2_ardour/editor_component.cc +++ b/gtk2_ardour/editor_component.cc @@ -19,7 +19,7 @@ #include "editor_component.h" -EditorComponent::EditorComponent (Editor* e) +EditorComponent::EditorComponent (Editor& e) : _editor (e) { } diff --git a/gtk2_ardour/editor_component.h b/gtk2_ardour/editor_component.h index 19e262fa65..61aa9c14e8 100644 --- a/gtk2_ardour/editor_component.h +++ b/gtk2_ardour/editor_component.h @@ -23,10 +23,10 @@ class Editor; class EditorComponent { public: - EditorComponent (Editor *); + EditorComponent (Editor&); virtual ~EditorComponent() {} protected: - Editor* _editor; + Editor& _editor; }; diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc index 9223e70850..9c10cd5891 100644 --- a/gtk2_ardour/editor_group_tabs.cc +++ b/gtk2_ardour/editor_group_tabs.cc @@ -38,7 +38,7 @@ using namespace std; using namespace ARDOUR; using namespace ARDOUR_UI_UTILS; -EditorGroupTabs::EditorGroupTabs (Editor* e) +EditorGroupTabs::EditorGroupTabs (Editor& e) : EditorComponent (e) { @@ -54,7 +54,7 @@ EditorGroupTabs::compute_tabs () const tab.group = 0; int32_t y = 0; - for (TrackViewList::iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + for (TrackViewList::iterator i = _editor.track_views.begin(); i != _editor.track_views.end(); ++i) { if ((*i)->marked_for_display() == false) { continue; @@ -155,7 +155,7 @@ EditorGroupTabs::routes_for_tab (Tab const * t) const RouteList routes; int32_t y = 0; - for (TrackViewList::iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + for (TrackViewList::iterator i = _editor.track_views.begin(); i != _editor.track_views.end(); ++i) { if ((*i)->marked_for_display() == false) { continue; @@ -190,7 +190,7 @@ EditorGroupTabs::add_menu_items (Gtk::Menu* m, RouteGroup* g) if (g) { MenuList& items = m->items (); - items.push_back (MenuElem (_("Fit to Window"), sigc::bind (sigc::mem_fun (*_editor, &Editor::fit_route_group), g))); + items.push_back (MenuElem (_("Fit to Window"), sigc::bind (sigc::mem_fun (_editor, &Editor::fit_route_group), g))); } } @@ -199,7 +199,7 @@ EditorGroupTabs::selected_routes () const { RouteList rl; - for (TrackSelection::iterator i = _editor->get_selection().tracks.begin(); i != _editor->get_selection().tracks.end(); ++i) { + for (TrackSelection::iterator i = _editor.get_selection().tracks.begin(); i != _editor.get_selection().tracks.end(); ++i) { RouteTimeAxisView* rtv = dynamic_cast (*i); if (rtv) { rl.push_back (rtv->route()); diff --git a/gtk2_ardour/editor_group_tabs.h b/gtk2_ardour/editor_group_tabs.h index 462d2299d8..3a1ed06787 100644 --- a/gtk2_ardour/editor_group_tabs.h +++ b/gtk2_ardour/editor_group_tabs.h @@ -27,7 +27,7 @@ class Editor; class EditorGroupTabs : public GroupTabs, public EditorComponent { public: - EditorGroupTabs (Editor *); + EditorGroupTabs (Editor&); private: std::list compute_tabs () const; diff --git a/gtk2_ardour/editor_locations.cc b/gtk2_ardour/editor_locations.cc index cabd7743ed..aee0f1ad63 100644 --- a/gtk2_ardour/editor_locations.cc +++ b/gtk2_ardour/editor_locations.cc @@ -25,7 +25,7 @@ using namespace ARDOUR; using namespace Gtk; -EditorLocations::EditorLocations (Editor* e) +EditorLocations::EditorLocations (Editor& e) : EditorComponent (e) { _locations = new LocationUI (X_("EditorLocations")); diff --git a/gtk2_ardour/editor_locations.h b/gtk2_ardour/editor_locations.h index 4f404fc918..7a7d96cf60 100644 --- a/gtk2_ardour/editor_locations.h +++ b/gtk2_ardour/editor_locations.h @@ -35,7 +35,7 @@ namespace Gtk { class EditorLocations : public EditorComponent, public ARDOUR::SessionHandlePtr { public: - EditorLocations (Editor *); + EditorLocations (Editor&); void set_session (ARDOUR::Session *); diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index e35c225ab7..7a193e43bc 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -48,15 +48,15 @@ using namespace Gtk; using Gtkmm2ext::Keyboard; -EditorRegions::EditorRegions (Editor* e) +EditorRegions::EditorRegions (Editor& e) : EditorComponent (e) { init (); _change_connection = _display.get_selection ()->signal_changed ().connect (sigc::mem_fun (*this, &EditorRegions::selection_changed)); - e->EditorFreeze.connect (_editor_freeze_connection, MISSING_INVALIDATOR, std::bind (&EditorRegions::freeze_tree_model, this), gui_context ()); - e->EditorThaw.connect (_editor_thaw_connection, MISSING_INVALIDATOR, std::bind (&EditorRegions::thaw_tree_model, this), gui_context ()); + _editor.EditorFreeze.connect (_editor_freeze_connection, MISSING_INVALIDATOR, std::bind (&EditorRegions::freeze_tree_model, this), gui_context ()); + _editor.EditorThaw.connect (_editor_thaw_connection, MISSING_INVALIDATOR, std::bind (&EditorRegions::thaw_tree_model, this), gui_context ()); } void @@ -107,13 +107,13 @@ EditorRegions::init () void EditorRegions::selection_changed () { - _editor->_region_selection_change_updates_region_list = false; + _editor._region_selection_change_updates_region_list = false; if (_display.get_selection ()->count_selected_rows () > 0) { TreeIter iter; TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows (); - _editor->get_selection ().clear_regions (); + _editor.get_selection ().clear_regions (); for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) { if ((iter = _model->get_iter (*i))) { @@ -125,16 +125,16 @@ EditorRegions::selection_changed () if (region) { _change_connection.block (true); - _editor->set_selected_regionview_from_region_list (region, SelectionAdd); + _editor.set_selected_regionview_from_region_list (region, SelectionAdd); _change_connection.block (false); } } } } else { - _editor->get_selection ().clear_regions (); + _editor.get_selection ().clear_regions (); } - _editor->_region_selection_change_updates_region_list = true; + _editor._region_selection_change_updates_region_list = true; } void @@ -186,7 +186,7 @@ EditorRegions::button_press (GdkEventButton* ev) if (region != 0 && Keyboard::is_button2_event (ev)) { /* start/stop audition */ if (!Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { - _editor->consider_auditioning (region); + _editor.consider_auditioning (region); } return true; } @@ -232,7 +232,7 @@ EditorRegions::regions_changed (std::shared_ptr rl, const PropertyCh grid_interests.add (ARDOUR::Properties::sync_position); if (what_changed.contains (grid_interests)) { - _editor->mark_region_boundary_cache_dirty (); + _editor.mark_region_boundary_cache_dirty (); } RegionListBase::regions_changed (rl, what_changed); diff --git a/gtk2_ardour/editor_regions.h b/gtk2_ardour/editor_regions.h index 0253ad1be8..b0a093c18d 100644 --- a/gtk2_ardour/editor_regions.h +++ b/gtk2_ardour/editor_regions.h @@ -28,7 +28,7 @@ class EditorRegions : public EditorComponent, public RegionListBase { public: - EditorRegions (Editor*); + EditorRegions (Editor&); void set_selected (RegionSelection&); void selection_mapover (sigc::slot>); diff --git a/gtk2_ardour/editor_route_groups.cc b/gtk2_ardour/editor_route_groups.cc index 56ab2ea7db..06d92fcf41 100644 --- a/gtk2_ardour/editor_route_groups.cc +++ b/gtk2_ardour/editor_route_groups.cc @@ -51,7 +51,7 @@ using namespace PBD; using namespace Gtk; using Gtkmm2ext::Keyboard; -EditorRouteGroups::EditorRouteGroups (Editor* e) +EditorRouteGroups::EditorRouteGroups (Editor& e) : EditorComponent (e) , _in_row_change (false) , _in_rebuild (false) @@ -240,7 +240,7 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev) } if (Keyboard::is_context_menu_event (ev)) { - _editor->_group_tabs->get_menu(group)->popup (1, ev->time); + _editor._group_tabs->get_menu(group)->popup (1, ev->time); return true; } @@ -440,7 +440,7 @@ EditorRouteGroups::add (RouteGroup* group) _in_row_change = false; - _editor->_group_tabs->set_dirty (); + _editor._group_tabs->set_dirty (); } void @@ -499,12 +499,12 @@ EditorRouteGroups::property_changed (RouteGroup* group, const PropertyChange&) _in_row_change = false; - for (TrackViewList::const_iterator i = _editor->get_track_views().begin(); i != _editor->get_track_views().end(); ++i) { + for (TrackViewList::const_iterator i = _editor.get_track_views().begin(); i != _editor.get_track_views().end(); ++i) { if ((*i)->route_group() == group) { if (group->is_hidden ()) { - _editor->hide_track_in_display (*i); + _editor.hide_track_in_display (*i); } else { - _editor->show_track_in_display (*i); + _editor.show_track_in_display (*i); } } } @@ -562,7 +562,7 @@ EditorRouteGroups::set_session (Session* s) void EditorRouteGroups::run_new_group_dialog () { - return _editor->_group_tabs->run_new_group_dialog (0, false); + return _editor._group_tabs->run_new_group_dialog (0, false); } /** Called when a model row is deleted, but also when the model is diff --git a/gtk2_ardour/editor_route_groups.h b/gtk2_ardour/editor_route_groups.h index 0464e183b9..816852aba5 100644 --- a/gtk2_ardour/editor_route_groups.h +++ b/gtk2_ardour/editor_route_groups.h @@ -35,7 +35,7 @@ class EditorRouteGroups : public EditorComponent, public ARDOUR::SessionHandlePtr { public: - EditorRouteGroups (Editor *); + EditorRouteGroups (Editor&); void set_session (ARDOUR::Session *); diff --git a/gtk2_ardour/editor_sources.cc b/gtk2_ardour/editor_sources.cc index 11b544d0cd..d9ab70b4f9 100644 --- a/gtk2_ardour/editor_sources.cc +++ b/gtk2_ardour/editor_sources.cc @@ -51,7 +51,7 @@ using namespace Gtk; using namespace Glib; using Gtkmm2ext::Keyboard; -EditorSources::EditorSources (Editor* e) +EditorSources::EditorSources (Editor& e) : EditorComponent (e) { init (); @@ -68,8 +68,8 @@ EditorSources::EditorSources (Editor* e) _change_connection = _display.get_selection ()->signal_changed ().connect (sigc::mem_fun (*this, &EditorSources::selection_changed)); - e->EditorFreeze.connect (_editor_freeze_connection, MISSING_INVALIDATOR, std::bind (&EditorSources::freeze_tree_model, this), gui_context ()); - e->EditorThaw.connect (_editor_thaw_connection, MISSING_INVALIDATOR, std::bind (&EditorSources::thaw_tree_model, this), gui_context ()); + _editor.EditorFreeze.connect (_editor_freeze_connection, MISSING_INVALIDATOR, std::bind (&EditorSources::freeze_tree_model, this), gui_context ()); + _editor.EditorThaw.connect (_editor_thaw_connection, MISSING_INVALIDATOR, std::bind (&EditorSources::thaw_tree_model, this), gui_context ()); } void @@ -109,7 +109,7 @@ EditorSources::selection_changed () TreeIter iter; TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows (); - _editor->get_selection ().clear_regions (); + _editor.get_selection ().clear_regions (); for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) { if ((iter = _model->get_iter (*i))) { @@ -125,14 +125,14 @@ EditorSources::selection_changed () for (set>::iterator region = regions.begin (); region != regions.end (); region++) { _change_connection.block (true); - _editor->set_selected_regionview_from_region_list (*region, SelectionAdd); + _editor.set_selected_regionview_from_region_list (*region, SelectionAdd); _change_connection.block (false); } } } } } else { - _editor->get_selection ().clear_regions (); + _editor.get_selection ().clear_regions (); } } @@ -170,7 +170,7 @@ EditorSources::recover_selected_sources () } /* ToDo */ - _editor->recover_regions (to_be_recovered); // this operation should be undo-able + _editor.recover_regions (to_be_recovered); // this operation should be undo-able } void @@ -206,7 +206,7 @@ EditorSources::remove_selected_sources () TreeIter iter; TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows (); - _editor->get_selection ().clear_regions (); + _editor.get_selection ().clear_regions (); for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) { if ((iter = _model->get_iter (*i))) { @@ -228,7 +228,7 @@ EditorSources::remove_selected_sources () * (Source::drop_references -> Region::source_deleted, * -> Region::drop_references). see f58f5bef55a5aa1 */ - _editor->set_selected_regionview_from_region_list (region, SelectionAdd); + _editor.set_selected_regionview_from_region_list (region, SelectionAdd); _change_connection.block (false); } @@ -237,7 +237,7 @@ EditorSources::remove_selected_sources () } } - _editor->remove_regions (_editor->get_regions_from_selection_and_entered (), false /*can_ripple*/, false /*as_part_of_other_command*/); // this operation is undo-able + _editor.remove_regions (_editor.get_regions_from_selection_and_entered (), false /*can_ripple*/, false /*as_part_of_other_command*/); // this operation is undo-able if (opt == 2) { for (auto const& s : to_be_removed) { @@ -283,7 +283,7 @@ EditorSources::drag_data_received (const RefPtr& context, if (data.get_target () == "GTK_TREE_MODEL_ROW") { /* something is being dragged over the source list */ - _editor->_drags->abort (); + _editor._drags->abort (); _display.on_drag_data_received (context, x, y, data, info, dtime); return; } @@ -293,10 +293,10 @@ EditorSources::drag_data_received (const RefPtr& context, bool copy = ((context->get_actions () & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY); if (UIConfiguration::instance ().get_only_copy_imported_files () || copy) { - _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, + _editor.do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, SMFFileAndTrackName, SMFTempoIgnore, pos); } else { - _editor->do_embed (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, pos); + _editor.do_embed (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, pos); } context->drag_finish (true, false, dtime); } diff --git a/gtk2_ardour/editor_sources.h b/gtk2_ardour/editor_sources.h index 272d246d7f..dc9716586b 100644 --- a/gtk2_ardour/editor_sources.h +++ b/gtk2_ardour/editor_sources.h @@ -23,7 +23,7 @@ class EditorSources : public EditorComponent, public SourceListBase { public: - EditorSources (Editor*); + EditorSources (Editor&); std::shared_ptr get_single_selection (); diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 3f3cff366a..78e7fb5d6b 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -51,7 +51,7 @@ using Gtkmm2ext::Keyboard; /** Construct an EditorSummary. * @param e Editor to represent. */ -EditorSummary::EditorSummary (Editor* e) +EditorSummary::EditorSummary (Editor& e) : EditorComponent (e), _start (0), _end (1), @@ -116,10 +116,10 @@ EditorSummary::set_session (Session* s) if (_session) { Region::RegionsPropertyChanged.connect (region_property_connection, invalidator (*this), std::bind (&EditorSummary::set_background_dirty, this), gui_context()); PresentationInfo::Change.connect (route_ctrl_id_connection, invalidator (*this), std::bind (&EditorSummary::set_background_dirty, this), gui_context()); - _editor->playhead_cursor()->PositionChanged.connect (position_connection, invalidator (*this), std::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context()); + _editor.playhead_cursor()->PositionChanged.connect (position_connection, invalidator (*this), std::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context()); _session->StartTimeChanged.connect (_session_connections, invalidator (*this), std::bind (&EditorSummary::set_background_dirty, this), gui_context()); _session->EndTimeChanged.connect (_session_connections, invalidator (*this), std::bind (&EditorSummary::set_background_dirty, this), gui_context()); - _editor->selection->RegionsChanged.connect (sigc::mem_fun(*this, &EditorSummary::set_background_dirty)); + _editor.selection->RegionsChanged.connect (sigc::mem_fun(*this, &EditorSummary::set_background_dirty)); } UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_colors)); @@ -146,7 +146,7 @@ EditorSummary::render_background_image () /* compute start and end points for the summary */ - std::pair ext = _editor->session_gui_extents(); + std::pair ext = _editor.session_gui_extents(); double theoretical_start = ext.first.samples(); double theoretical_end = ext.second.samples(); @@ -169,7 +169,7 @@ EditorSummary::render_background_image () /* compute track height */ int N = 0; - for (TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + for (TrackViewList::const_iterator i = _editor.track_views.begin(); i != _editor.track_views.end(); ++i) { if (!(*i)->hidden()) { ++N; } @@ -184,7 +184,7 @@ EditorSummary::render_background_image () /* render tracks and regions */ double y = 0; - for (TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + for (TrackViewList::const_iterator i = _editor.track_views.begin(); i != _editor.track_views.end(); ++i) { if ((*i)->hidden()) { continue; @@ -245,12 +245,12 @@ EditorSummary::render (Cairo::RefPtr const& ctx, cairo_rectangle } /* maintain the leftmost and rightmost locations that we've ever reached */ - samplecnt_t const leftmost = _editor->leftmost_sample (); + samplecnt_t const leftmost = _editor.leftmost_sample (); if (leftmost < _leftmost) { _leftmost = leftmost; _background_dirty = true; } - samplecnt_t const rightmost = leftmost + _editor->current_page_samples(); + samplecnt_t const rightmost = leftmost + _editor.current_page_samples(); if (rightmost > _rightmost) { _rightmost = rightmost; _background_dirty = true; @@ -275,7 +275,7 @@ EditorSummary::render (Cairo::RefPtr const& ctx, cairo_rectangle * the visual change. This prevents a flicker. */ - if (_editor->pending_visual_change.idle_handler_id < 0) { + if (_editor.pending_visual_change.idle_handler_id < 0) { get_editor (&_view_rectangle_x, &_view_rectangle_y); } @@ -297,7 +297,7 @@ EditorSummary::render (Cairo::RefPtr 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); @@ -466,7 +466,7 @@ EditorSummary::on_key_release_event (GdkEventKey* key) bool EditorSummary::on_button_press_event (GdkEventButton* ev) { - _old_follow_playhead = _editor->follow_playhead (); + _old_follow_playhead = _editor.follow_playhead (); if (ev->button == 3) { // right-click: show the reset menu action using namespace Gtk::Menu_Helpers; @@ -496,8 +496,8 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) _zoom_trim_position = get_position (ev->x, ev->y); _zoom_trim_dragging = true; - _editor->_dragging_playhead = true; - _editor->set_follow_playhead (false); + _editor._dragging_playhead = true; + _editor.set_follow_playhead (false); if (suspending_editor_updates ()) { get_editor (&_pending_editor_x, &_pending_editor_y); @@ -520,8 +520,8 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) /* start a move+zoom drag */ get_editor (&_pending_editor_x, &_pending_editor_y); _pending_editor_changed = false; - _editor->_dragging_playhead = true; - _editor->set_follow_playhead (false); + _editor._dragging_playhead = true; + _editor.set_follow_playhead (false); _move_dragging = true; @@ -531,7 +531,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) _last_dy = 0; _last_y_delta = 0; - get_window()->set_cursor (*_editor->_cursors->expand_left_right); + get_window()->set_cursor (*_editor._cursors->expand_left_right); } @@ -567,12 +567,12 @@ EditorSummary::get_editor (pair* x, pair* y) con /* Otherwise query the editor for its actual position */ - x->first = (_editor->leftmost_sample () - _start) * _x_scale; - x->second = x->first + _editor->current_page_samples() * _x_scale; + x->first = (_editor.leftmost_sample () - _start) * _x_scale; + x->second = x->first + _editor.current_page_samples() * _x_scale; if (y) { - y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ()); - y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height() - _editor->get_trackview_group()->canvas_origin().y); + y->first = editor_y_to_summary (_editor.vertical_adjustment.get_value ()); + y->second = editor_y_to_summary (_editor.vertical_adjustment.get_value () + _editor.visible_canvas_height() - _editor.get_trackview_group()->canvas_origin().y); } } @@ -609,7 +609,7 @@ EditorSummary::reset_to_extents() _leftmost = max_samplepos; _rightmost = 0; - _editor->temporal_zoom_extents (); + _editor.temporal_zoom_extents (); set_background_dirty (); } @@ -619,16 +619,16 @@ EditorSummary::set_cursor (SummaryPosition p) { switch (p) { case LEFT: - get_window()->set_cursor (*_editor->_cursors->resize_left); + get_window()->set_cursor (*_editor._cursors->resize_left); break; case RIGHT: - get_window()->set_cursor (*_editor->_cursors->resize_right); + get_window()->set_cursor (*_editor._cursors->resize_right); break; case INSIDE: - get_window()->set_cursor (*_editor->_cursors->move); + get_window()->set_cursor (*_editor._cursors->move); break; case TO_LEFT_OR_RIGHT: - get_window()->set_cursor (*_editor->_cursors->move); + get_window()->set_cursor (*_editor._cursors->move); break; default: assert (0); @@ -755,8 +755,8 @@ EditorSummary::on_button_release_event (GdkEventButton*) _move_dragging = false; _zoom_trim_dragging = false; - _editor->_dragging_playhead = false; - _editor->set_follow_playhead (_old_follow_playhead, false); + _editor._dragging_playhead = false; + _editor.set_follow_playhead (_old_follow_playhead, false); if (was_suspended && _pending_editor_changed) { set_editor (_pending_editor_x); @@ -790,25 +790,25 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev) case GDK_SCROLL_LEFT: if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) { - _editor->temporal_zoom_step (false); + _editor.temporal_zoom_step (false); } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) { x -= 64; } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) { x -= 1; } else { - _editor->scroll_left_half_page (); + _editor.scroll_left_half_page (); return true; } break; case GDK_SCROLL_RIGHT: if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) { - _editor->temporal_zoom_step (true); + _editor.temporal_zoom_step (true); } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) { x += 64; } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) { x += 1; } else { - _editor->scroll_right_half_page (); + _editor.scroll_right_half_page (); return true; } break; @@ -828,7 +828,7 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev) void EditorSummary::set_editor (double const x) { - if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.being_handled == true) { + if (_editor.pending_visual_change.idle_handler_id >= 0 && _editor.pending_visual_change.being_handled == true) { /* As a side-effect, the Editor's visual change idle handler processes pending GTK events. Hence this motion notify handler can be called @@ -854,7 +854,7 @@ EditorSummary::set_editor (double const x) void EditorSummary::set_editor (pair const x) { - if (_editor->pending_visual_change.idle_handler_id >= 0) { + if (_editor.pending_visual_change.idle_handler_id >= 0) { /* see comment in other set_editor () */ return; } @@ -882,7 +882,7 @@ EditorSummary::set_editor_x (double x) _pending_editor_changed = true; set_dirty (); } else { - _editor->reset_x_origin (x / _x_scale + _start); + _editor.reset_x_origin (x / _x_scale + _start); } } @@ -906,15 +906,15 @@ EditorSummary::set_editor_x (pair x) _pending_editor_changed = true; set_dirty (); } else { - _editor->reset_x_origin (x.first / _x_scale + _start); + _editor.reset_x_origin (x.first / _x_scale + _start); double const nx = ( ((x.second - x.first) / _x_scale) / - _editor->sample_to_pixel (_editor->current_page_samples()) + _editor.sample_to_pixel (_editor.current_page_samples()) ); - if (nx != _editor->get_current_zoom ()) { - _editor->reset_zoom (nx); + if (nx != _editor.get_current_zoom ()) { + _editor.reset_zoom (nx); } } } @@ -935,7 +935,7 @@ double EditorSummary::editor_y_to_summary (double y) const { double sy = 0; - for (TrackViewList::const_iterator i = _editor->track_views.begin (); i != _editor->track_views.end(); ++i) { + for (TrackViewList::const_iterator i = _editor.track_views.begin (); i != _editor.track_views.end(); ++i) { if ((*i)->hidden()) { continue; diff --git a/gtk2_ardour/editor_summary.h b/gtk2_ardour/editor_summary.h index 8d259e4e20..1ad4921f7b 100644 --- a/gtk2_ardour/editor_summary.h +++ b/gtk2_ardour/editor_summary.h @@ -42,7 +42,7 @@ class RouteTimeAxisView; class EditorSummary : public CairoWidget, public EditorComponent, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList { public: - EditorSummary (Editor *); + EditorSummary (Editor&); ~EditorSummary (); void set_session (ARDOUR::Session *);