diff options
author | Carl Hetherington <carl@carlh.net> | 2010-08-05 13:35:43 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-08-05 13:35:43 +0000 |
commit | e7a2b99f3d4f7afe73a30ac85e770e228785c1be (patch) | |
tree | 3b959b78a8d34717e0190f4813225372a4bb3c22 /gtk2_ardour | |
parent | 355c079f1050fbf38327e92ac890d44f2d402031 (diff) |
Clean up handling of track vs region automation a bit.
git-svn-id: svn://localhost/ardour2/branches/3.0@7544 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/automation_streamview.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/automation_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 54 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 2 |
8 files changed, 77 insertions, 54 deletions
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 1f07aaaba7..6beb439b11 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -158,10 +158,11 @@ AutomationStreamView::set_automation_state (AutoState state) if (region_views.empty()) { _pending_automation_state = state; } else { - for (std::list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { - boost::shared_ptr<AutomationLine> line = dynamic_cast<AutomationRegionView*>(*i)->line(); - if (line && line->the_list()) { - line->the_list()->set_automation_state (state); + list<boost::shared_ptr<AutomationLine> > lines = get_lines (); + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + if ((*i)->the_list()) { + (*i)->the_list()->set_automation_state (state); } } } @@ -225,13 +226,12 @@ AutomationStreamView::automation_state () const bool AutomationStreamView::has_automation () const { - list<RegionView*>::const_iterator i = region_views.begin (); - while (i != region_views.end()) { - AutomationRegionView* rv = static_cast<AutomationRegionView*> (*i); - if (rv->line() && rv->line()->npoints() > 0) { + list<boost::shared_ptr<AutomationLine> > lines = get_lines (); + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + if ((*i)->npoints() > 0) { return true; } - ++i; } return false; @@ -243,10 +243,10 @@ AutomationStreamView::has_automation () const void AutomationStreamView::set_interpolation (AutomationList::InterpolationStyle s) { - for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) { - AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i); - assert (arv); - arv->line()->the_list()->set_interpolation (s); + list<boost::shared_ptr<AutomationLine> > lines = get_lines (); + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + (*i)->the_list()->set_interpolation (s); } } @@ -267,10 +267,10 @@ AutomationStreamView::interpolation () const void AutomationStreamView::clear () { - for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { - AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i); - assert (arv); - arv->line()->clear (); + list<boost::shared_ptr<AutomationLine> > lines = get_lines (); + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + (*i)->clear (); } } @@ -287,9 +287,23 @@ AutomationStreamView::get_selectables (nframes_t start, nframes_t end, double bo void AutomationStreamView::set_selected_points (PointSelection& ps) { - for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { + list<boost::shared_ptr<AutomationLine> > lines = get_lines (); + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + (*i)->set_selected_points (ps); + } +} + +list<boost::shared_ptr<AutomationLine> > +AutomationStreamView::get_lines () const +{ + list<boost::shared_ptr<AutomationLine> > lines; + + for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) { AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i); assert (arv); - arv->line()->set_selected_points (ps); + lines.push_back (arv->line()); } + + return lines; } diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index 8c5acdcbd1..8afacd79cf 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -64,6 +64,8 @@ class AutomationStreamView : public StreamView void get_selectables (nframes_t, nframes_t, double, double, std::list<Selectable*> &); void set_selected_points (PointSelection &); + std::list<boost::shared_ptr<AutomationLine> > get_lines () const; + private: void setup_rec_box (); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 1596abfdf8..448cf4e501 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -407,8 +407,9 @@ AutomationTimeAxisView::set_height (uint32_t h) TimeAxisView::set_height (h); _base_rect->property_y2() = h; - if (_line) + if (_line) { _line->set_height(h); + } if (_view) { _view->set_height(h); @@ -480,11 +481,13 @@ AutomationTimeAxisView::set_samples_per_unit (double spu) { TimeAxisView::set_samples_per_unit (spu); - if (_line) + if (_line) { _line->reset (); + } - if (_view) + if (_view) { _view->set_samples_per_unit (spu); + } } void @@ -608,18 +611,26 @@ AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkE _session->set_dirty (); } -bool +void AutomationTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) { - return (_line ? cut_copy_clear_one (*_line, selection, op) : false); + list<boost::shared_ptr<AutomationLine> > lines; + if (_line) { + lines.push_back (_line); + } else if (_view) { + lines = _view->get_lines (); + } + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + cut_copy_clear_one (**i, selection, op); + } } -bool +void AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& selection, CutCopyOp op) { boost::shared_ptr<Evoral::ControlList> what_we_got; boost::shared_ptr<AutomationList> alist (line.the_list()); - bool ret = false; XMLNode &before = alist->get_state(); @@ -628,7 +639,6 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) { _editor.get_cut_buffer().add (what_we_got); _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); - ret = true; } break; case Copy: @@ -640,7 +650,6 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel case Clear: if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) { _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); - ret = true; } break; } @@ -654,8 +663,6 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel (*x)->value = val; } } - - return ret; } void @@ -681,18 +688,26 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& } } -bool +void AutomationTimeAxisView::cut_copy_clear_objects (PointSelection& selection, CutCopyOp op) { - return cut_copy_clear_objects_one (*_line, selection, op); + list<boost::shared_ptr<AutomationLine> > lines; + if (_line) { + lines.push_back (_line); + } else if (_view) { + lines = _view->get_lines (); + } + + for (list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin(); i != lines.end(); ++i) { + cut_copy_clear_objects_one (**i, selection, op); + } } -bool +void AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointSelection& selection, CutCopyOp op) { boost::shared_ptr<Evoral::ControlList> what_we_got; boost::shared_ptr<AutomationList> alist(line.the_list()); - bool ret = false; XMLNode &before = alist->get_state(); @@ -707,7 +722,6 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) { _editor.get_cut_buffer().add (what_we_got); _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state())); - ret = true; } break; case Copy: @@ -719,7 +733,6 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS case Clear: if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) { _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state())); - ret = true; } break; } @@ -727,6 +740,8 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS delete &before; + cout << "CCC objects " << what_we_got->size() << "\n"; + if (what_we_got) { for (AutomationList::iterator x = what_we_got->begin(); x != what_we_got->end(); ++x) { double when = (*x)->when; @@ -736,8 +751,6 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS (*x)->value = val; } } - - return ret; } bool @@ -825,8 +838,9 @@ AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double void AutomationTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result) { - if (_line) + if (_line) { _line->get_inverted_selectables (sel, result); + } } void diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 4b21ec8533..0da6c69acd 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -86,8 +86,8 @@ class AutomationTimeAxisView : public TimeAxisView { /* editing operations */ - bool cut_copy_clear (Selection&, Editing::CutCopyOp); - bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp); + void cut_copy_clear (Selection&, Editing::CutCopyOp); + void cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp); bool paste (nframes_t, float times, Selection&, size_t nth); void reset_objects (PointSelection&); @@ -146,8 +146,8 @@ class AutomationTimeAxisView : public TimeAxisView { void build_display_menu (); - bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp); - bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp); + void cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp); + void cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp); bool paste_one (AutomationLine&, nframes_t, float times, Selection&, size_t nth); void reset_objects_one (AutomationLine&, PointSelection&); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index f167ea598f..48ddeb55d2 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3106,8 +3106,6 @@ RubberbandSelectDrag::finished (GdkEvent* event, bool movement_occurred) _editor->begin_reversible_command (_("rubberband selection")); - cout << "RSD finished, selecting all within <fred>\n"; - if (grab_frame() < last_pointer_frame()) { committed = _editor->select_all_within (grab_frame(), last_pointer_frame() - 1, y1, y2, _editor->track_views, op); } else { diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index d1df63d187..9e50b67fac 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1299,17 +1299,16 @@ RouteTimeAxisView::find_next_region_boundary (nframes64_t pos, int32_t dir) return -1; } -bool +void RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) { boost::shared_ptr<Playlist> what_we_got; boost::shared_ptr<Track> tr = track (); boost::shared_ptr<Playlist> playlist; - bool ret = false; if (tr == 0) { /* route is a bus, not a track */ - return false; + return; } playlist = tr->playlist(); @@ -1339,7 +1338,6 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) _session->add_command (*c); } _session->add_command (new StatefulDiffCommand (playlist)); - ret = true; } break; case Copy: @@ -1359,12 +1357,9 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) } _session->add_command (new StatefulDiffCommand (playlist)); what_we_got->release (); - ret = true; } break; } - - return ret; } bool diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 576c353334..6d832c8077 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -92,7 +92,7 @@ public: nframes64_t find_next_region_boundary (nframes64_t pos, int32_t dir); /* Editing operations */ - bool cut_copy_clear (Selection&, Editing::CutCopyOp); + void cut_copy_clear (Selection&, Editing::CutCopyOp); bool paste (nframes_t, float times, Selection&, size_t nth); TimeAxisView::Children get_child_list(); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 93cb7eced3..dfdff2954e 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -177,7 +177,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful /* editing operations */ - virtual bool cut_copy_clear (Selection&, Editing::CutCopyOp) { return false; } + virtual void cut_copy_clear (Selection&, Editing::CutCopyOp) {} virtual bool paste (nframes_t, float /*times*/, Selection&, size_t /*nth*/) { return false; } virtual void set_selected_regionviews (RegionSelection&) {} |