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);
}
}
}
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;
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);
}
}
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 ();
}
}
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;
}
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 ();
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
- if (_line)
+ if (_line) {
_line->set_height(h);
+ }
if (_view) {
_view->set_height(h);
{
TimeAxisView::set_samples_per_unit (spu);
- if (_line)
+ if (_line) {
_line->reset ();
+ }
- if (_view)
+ if (_view) {
_view->set_samples_per_unit (spu);
+ }
}
void
_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();
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:
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;
}
(*x)->value = val;
}
}
-
- return ret;
}
void
}
}
-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();
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:
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;
}
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;
(*x)->value = val;
}
}
-
- return ret;
}
bool
void
AutomationTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
{
- if (_line)
+ if (_line) {
_line->get_inverted_selectables (sel, result);
+ }
}
void
/* 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&);
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&);
_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 {
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();
_session->add_command (*c);
}
_session->add_command (new StatefulDiffCommand (playlist));
- ret = true;
}
break;
case Copy:
}
_session->add_command (new StatefulDiffCommand (playlist));
what_we_got->release ();
- ret = true;
}
break;
}
-
- return ret;
}
bool
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();
/* 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&) {}