* @param edit_items List to add the items to.
*/
void
-Editor::add_crossfade_context_items (AudioStreamView* /*view*/, boost::shared_ptr<Crossfade> xfade, Menu_Helpers::MenuList& edit_items, bool many)
+Editor::add_crossfade_context_items (AudioStreamView* view, boost::shared_ptr<Crossfade> xfade, Menu_Helpers::MenuList& edit_items, bool many)
{
using namespace Menu_Helpers;
Menu *xfade_menu = manage (new Menu);
str = _("Unmute");
}
- items.push_back (MenuElem (str, sigc::bind (sigc::mem_fun(*this, &Editor::toggle_xfade_active), boost::weak_ptr<Crossfade> (xfade))));
- items.push_back (MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun(*this, &Editor::edit_xfade), boost::weak_ptr<Crossfade> (xfade))));
+ items.push_back (
+ MenuElem (str, sigc::bind (sigc::mem_fun (*this, &Editor::toggle_xfade_active), &view->trackview(), boost::weak_ptr<Crossfade> (xfade)))
+ );
+
+ items.push_back (
+ MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun (*this, &Editor::edit_xfade), boost::weak_ptr<Crossfade> (xfade)))
+ );
if (xfade->can_follow_overlap()) {
str = _("Convert to Full");
}
- items.push_back (MenuElem (str, sigc::bind (sigc::mem_fun(*this, &Editor::toggle_xfade_length), xfade)));
+ items.push_back (
+ MenuElem (str, sigc::bind (sigc::mem_fun (*this, &Editor::toggle_xfade_length), &view->trackview(), xfade))
+ );
}
if (many) {
}
void
-Editor::toggle_xfade_active (boost::weak_ptr<Crossfade> wxfade)
+Editor::toggle_xfade_active (RouteTimeAxisView* tv, boost::weak_ptr<Crossfade> wxfade)
{
boost::shared_ptr<Crossfade> xfade (wxfade.lock());
- if (xfade) {
- xfade->clear_changes ();
- xfade->set_active (!xfade->active());
- _session->begin_reversible_command (_("Change crossfade active state"));
- _session->add_command (new StatefulDiffCommand (xfade));
- _session->commit_reversible_command ();
+ if (!xfade) {
+ return;
+ }
+
+ vector<boost::shared_ptr<Crossfade> > all = get_equivalent_crossfades (*tv, xfade, ARDOUR::Properties::edit.property_id);
+
+ _session->begin_reversible_command (_("Change crossfade active state"));
+
+ for (vector<boost::shared_ptr<Crossfade> >::iterator i = all.begin(); i != all.end(); ++i) {
+ (*i)->clear_changes ();
+ (*i)->set_active (!(*i)->active());
+ _session->add_command (new StatefulDiffCommand (*i));
}
+
+ _session->commit_reversible_command ();
}
void
-Editor::toggle_xfade_length (boost::weak_ptr<Crossfade> wxfade)
+Editor::toggle_xfade_length (RouteTimeAxisView* tv, boost::weak_ptr<Crossfade> wxfade)
{
boost::shared_ptr<Crossfade> xfade (wxfade.lock());
- if (xfade) {
- XMLNode& before = xfade->get_state ();
- xfade->set_follow_overlap (!xfade->following_overlap());
- XMLNode& after = xfade->get_state ();
+ if (!xfade) {
+ return;
+ }
+
+ vector<boost::shared_ptr<Crossfade> > all = get_equivalent_crossfades (*tv, xfade, ARDOUR::Properties::edit.property_id);
- /* This can't be a StatefulDiffCommand as the fade shapes are not
- managed by the Stateful properties system.
- */
- _session->begin_reversible_command (_("Change crossfade length"));
- _session->add_command (new MementoCommand<Crossfade> (*xfade.get(), &before, &after));
- _session->commit_reversible_command ();
+ /* This can't be a StatefulDiffCommand as the fade shapes are not
+ managed by the Stateful properties system.
+ */
+ _session->begin_reversible_command (_("Change crossfade length"));
+
+ for (vector<boost::shared_ptr<Crossfade> >::iterator i = all.begin(); i != all.end(); ++i) {
+ XMLNode& before = (*i)->get_state ();
+ (*i)->set_follow_overlap (!(*i)->following_overlap());
+ XMLNode& after = (*i)->get_state ();
+
+ _session->add_command (new MementoCommand<Crossfade> (*i->get(), &before, &after));
}
+
+ _session->commit_reversible_command ();
}
void
void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
+ std::vector<boost::shared_ptr<ARDOUR::Crossfade> > get_equivalent_crossfades (
+ RouteTimeAxisView&, boost::shared_ptr<ARDOUR::Crossfade>, PBD::PropertyID
+ ) const;
void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
void mapover_tracks_with_unique_playlists (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
/* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
-
void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
-
- /* end */
-
+ void mapped_get_equivalent_crossfades (
+ RouteTimeAxisView&, uint32_t, boost::shared_ptr<ARDOUR::Crossfade>, std::vector<boost::shared_ptr<ARDOUR::Crossfade> >*
+ ) const;
+
void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
bool button_release_can_deselect;
ImageFrameSocketHandler* image_socket_listener ;
#endif
- void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
- void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
+ void toggle_xfade_active (RouteTimeAxisView *, boost::weak_ptr<ARDOUR::Crossfade>);
+ void toggle_xfade_length (RouteTimeAxisView *, boost::weak_ptr<ARDOUR::Crossfade>);
void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
void xfade_edit_left_region ();
void xfade_edit_right_region ();
#include "ardour/route_group.h"
#include "ardour/profile.h"
#include "ardour/midi_region.h"
+#include "ardour/audioplaylist.h"
#include "editor.h"
#include "actions.h"
#include "audio_streamview.h"
#include "automation_line.h"
#include "control_point.h"
+#include "crossfade_view.h"
#include "editor_regions.h"
#include "editor_cursors.h"
#include "midi_region_view.h"
}
}
+void
+Editor::mapped_get_equivalent_crossfades (
+ RouteTimeAxisView& tv, uint32_t, boost::shared_ptr<Crossfade> basis, vector<boost::shared_ptr<Crossfade> >* equivs
+ ) const
+{
+ boost::shared_ptr<Playlist> pl;
+ vector<boost::shared_ptr<Crossfade> > results;
+ boost::shared_ptr<Track> tr;
+
+ if ((tr = tv.track()) == 0) {
+ /* bus */
+ return;
+ }
+
+ if ((pl = tr->playlist()) != 0) {
+ boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
+ if (apl) {
+ apl->get_equivalent_crossfades (basis, *equivs);
+ }
+ }
+
+ /* We might have just checked basis for equivalency with itself, so we need to remove dupes */
+ sort (equivs->begin (), equivs->end ());
+ unique (equivs->begin (), equivs->end ());
+}
+
void
Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, PBD::PropertyID property) const
{
return equivalent;
}
+vector<boost::shared_ptr<Crossfade> >
+Editor::get_equivalent_crossfades (RouteTimeAxisView& v, boost::shared_ptr<Crossfade> c, PBD::PropertyID prop) const
+{
+ vector<boost::shared_ptr<Crossfade> > e;
+ mapover_tracks_with_unique_playlists (
+ sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_crossfades), c, &e),
+ &v,
+ prop
+ );
+
+ return e;
+}
int
Editor::get_regionview_count_from_region_list (boost::shared_ptr<Region> region)
void update (const CrossfadeListProperty::ChangeRecord &);
boost::shared_ptr<Crossfade> find_crossfade (const PBD::ID &) const;
+ void get_equivalent_crossfades (boost::shared_ptr<Crossfade>, std::vector<boost::shared_ptr<Crossfade> > &);
protected:
_session.add_command (new StatefulDiffCommand (*i));
}
}
+
+void
+AudioPlaylist::get_equivalent_crossfades (boost::shared_ptr<Crossfade> c, vector<boost::shared_ptr<Crossfade> > & results)
+{
+ for (list<boost::shared_ptr<Crossfade> >::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
+ if ((*i)->equivalent (c)) {
+ results.push_back (*i);
+ }
+ }
+}