Re-work edit group selection in line with suggestions from Paul.
git-svn-id: svn://localhost/ardour2/trunk@2529 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
49763a55c9
commit
3f38e6b7f5
@ -233,8 +233,8 @@ Editor::Editor ()
|
|||||||
|
|
||||||
session = 0;
|
session = 0;
|
||||||
|
|
||||||
selection = new Selection;
|
selection = new Selection (this);
|
||||||
cut_buffer = new Selection;
|
cut_buffer = new Selection (this);
|
||||||
|
|
||||||
selection->TimeChanged.connect (mem_fun(*this, &Editor::time_selection_changed));
|
selection->TimeChanged.connect (mem_fun(*this, &Editor::time_selection_changed));
|
||||||
selection->TracksChanged.connect (mem_fun(*this, &Editor::track_selection_changed));
|
selection->TracksChanged.connect (mem_fun(*this, &Editor::track_selection_changed));
|
||||||
@ -2766,9 +2766,9 @@ Editor::map_transport_state ()
|
|||||||
|
|
||||||
/* UNDO/REDO */
|
/* UNDO/REDO */
|
||||||
|
|
||||||
Editor::State::State ()
|
Editor::State::State (PublicEditor const * e)
|
||||||
{
|
{
|
||||||
selection = new Selection;
|
selection = new Selection (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::State::~State ()
|
Editor::State::~State ()
|
||||||
@ -2779,7 +2779,7 @@ Editor::State::~State ()
|
|||||||
UndoAction
|
UndoAction
|
||||||
Editor::get_memento () const
|
Editor::get_memento () const
|
||||||
{
|
{
|
||||||
State *state = new State;
|
State *state = new State (this);
|
||||||
|
|
||||||
store_state (*state);
|
store_state (*state);
|
||||||
return bind (mem_fun (*(const_cast<Editor*>(this)), &Editor::restore_state), state);
|
return bind (mem_fun (*(const_cast<Editor*>(this)), &Editor::restore_state), state);
|
||||||
|
@ -437,12 +437,12 @@ class Editor : public PublicEditor
|
|||||||
void sort_track_selection ();
|
void sort_track_selection ();
|
||||||
|
|
||||||
void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
|
void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
|
||||||
void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
|
void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
|
||||||
void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*);
|
void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
|
||||||
|
|
||||||
/* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
|
/* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
|
||||||
|
|
||||||
void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
|
void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
|
||||||
void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
|
void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
|
||||||
void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
|
void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
|
||||||
void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
|
void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
|
||||||
@ -1681,10 +1681,10 @@ class Editor : public PublicEditor
|
|||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
Selection* selection;
|
Selection* selection;
|
||||||
double frames_per_unit;
|
double frames_per_unit;
|
||||||
|
|
||||||
State();
|
State (PublicEditor const * e);
|
||||||
~State();
|
~State ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void store_state (State&) const;
|
void store_state (State&) const;
|
||||||
|
@ -293,7 +293,7 @@ Editor::get_relevant_tracks (set<RouteTimeAxisView*>& relevant_tracks)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis)
|
Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis) const
|
||||||
{
|
{
|
||||||
RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
|
RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
|
||||||
if (route_basis == 0) {
|
if (route_basis == 0) {
|
||||||
@ -312,7 +312,7 @@ Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisVie
|
|||||||
if (group && group->is_active()) {
|
if (group && group->is_active()) {
|
||||||
|
|
||||||
/* the basis is a member of an active edit group; find other members */
|
/* the basis is a member of an active edit group; find other members */
|
||||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||||
RouteTimeAxisView* v = dynamic_cast<RouteTimeAxisView*> (*i);
|
RouteTimeAxisView* v = dynamic_cast<RouteTimeAxisView*> (*i);
|
||||||
if (v && v->route()->edit_group() == group) {
|
if (v && v->route()->edit_group() == group) {
|
||||||
tracks.insert (v);
|
tracks.insert (v);
|
||||||
@ -328,7 +328,7 @@ Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t ignored, RegionView* basis, vector<RegionView*>* all_equivs)
|
Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t ignored, RegionView* basis, vector<RegionView*>* all_equivs) const
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Playlist> pl;
|
boost::shared_ptr<Playlist> pl;
|
||||||
vector<boost::shared_ptr<Region> > results;
|
vector<boost::shared_ptr<Region> > results;
|
||||||
@ -357,7 +357,7 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t ignored,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions)
|
Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions) const
|
||||||
{
|
{
|
||||||
mapover_tracks (bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview());
|
mapover_tracks (bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview());
|
||||||
|
|
||||||
@ -437,9 +437,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
|
|||||||
|
|
||||||
case Selection::Set:
|
case Selection::Set:
|
||||||
if (!clicked_regionview->get_selected()) {
|
if (!clicked_regionview->get_selected()) {
|
||||||
|
selection->set (clicked_regionview);
|
||||||
get_equivalent_regions (clicked_regionview, all_equivalent_regions);
|
|
||||||
selection->set (all_equivalent_regions);
|
|
||||||
commit = true;
|
commit = true;
|
||||||
} else {
|
} else {
|
||||||
/* no commit necessary: clicked on an already selected region */
|
/* no commit necessary: clicked on an already selected region */
|
||||||
@ -782,26 +780,6 @@ Editor::select_all_within (nframes_t start, nframes_t end, double top, double bo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `touched' may contain some regions; if so, we need to add equivalent
|
|
||||||
regions from any edit groups */
|
|
||||||
|
|
||||||
list<Selectable*> to_add;
|
|
||||||
|
|
||||||
for (list<Selectable*>::iterator i = touched.begin(); i != touched.end(); ++i) {
|
|
||||||
RegionView* r = dynamic_cast<RegionView*> (*i);
|
|
||||||
if (r) {
|
|
||||||
vector<RegionView*> e;
|
|
||||||
get_equivalent_regions (r, e);
|
|
||||||
for (vector<RegionView*>::iterator j = e.begin(); j != e.end(); ++j) {
|
|
||||||
to_add.push_back (*j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (list<Selectable*>::iterator i = to_add.begin(); i != to_add.end(); ++i) {
|
|
||||||
touched.push_back (*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!touched_tracks.empty()) {
|
if (!touched_tracks.empty()) {
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
|
@ -262,6 +262,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
|
|||||||
virtual TimeAxisView* get_named_time_axis(const std::string & name) = 0;
|
virtual TimeAxisView* get_named_time_axis(const std::string & name) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const = 0;
|
||||||
|
|
||||||
sigc::signal<void> ZoomFocusChanged;
|
sigc::signal<void> ZoomFocusChanged;
|
||||||
sigc::signal<void> ZoomChanged;
|
sigc::signal<void> ZoomChanged;
|
||||||
sigc::signal<void> Resized;
|
sigc::signal<void> Resized;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "selection_templates.h"
|
#include "selection_templates.h"
|
||||||
#include "time_axis_view.h"
|
#include "time_axis_view.h"
|
||||||
#include "automation_time_axis.h"
|
#include "automation_time_axis.h"
|
||||||
|
#include "public_editor.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
@ -290,6 +291,7 @@ Selection::add (RegionView* r)
|
|||||||
{
|
{
|
||||||
if (find (regions.begin(), regions.end(), r) == regions.end()) {
|
if (find (regions.begin(), regions.end(), r) == regions.end()) {
|
||||||
regions.add (r);
|
regions.add (r);
|
||||||
|
select_edit_group_regions ();
|
||||||
add (&r->get_trackview());
|
add (&r->get_trackview());
|
||||||
RegionsChanged ();
|
RegionsChanged ();
|
||||||
}
|
}
|
||||||
@ -310,6 +312,7 @@ Selection::add (vector<RegionView*>& v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
select_edit_group_regions ();
|
||||||
RegionsChanged ();
|
RegionsChanged ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,3 +682,21 @@ Selection::add (vector<AutomationSelectable*>& autos)
|
|||||||
|
|
||||||
PointsChanged ();
|
PointsChanged ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Selection::select_edit_group_regions ()
|
||||||
|
{
|
||||||
|
std::set<RegionView*> regions_to_add;
|
||||||
|
|
||||||
|
for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||||
|
vector<RegionView*> e;
|
||||||
|
editor->get_equivalent_regions (*i, e);
|
||||||
|
for (vector<RegionView*>::iterator j = e.begin(); j != e.end(); ++j) {
|
||||||
|
regions_to_add.insert(*j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (std::set<RegionView*>::iterator i = regions_to_add.begin(); i != regions_to_add.end(); ++i) {
|
||||||
|
add (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
class TimeAxisView;
|
class TimeAxisView;
|
||||||
class RegionView;
|
class RegionView;
|
||||||
class Selectable;
|
class Selectable;
|
||||||
|
class PublicEditor;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Region;
|
class Region;
|
||||||
@ -71,8 +72,7 @@ class Selection : public sigc::trackable
|
|||||||
PlaylistSelection playlists;
|
PlaylistSelection playlists;
|
||||||
PointSelection points;
|
PointSelection points;
|
||||||
|
|
||||||
Selection() {
|
Selection (PublicEditor const * e) : editor (e), next_time_id (0) {
|
||||||
next_time_id = 0;
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,10 @@ class Selection : public sigc::trackable
|
|||||||
void foreach_regionview (void (RegionView::*method)(void));
|
void foreach_regionview (void (RegionView::*method)(void));
|
||||||
template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
|
template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
|
||||||
|
|
||||||
|
void select_edit_group_regions ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
PublicEditor const * editor;
|
||||||
uint32_t next_time_id;
|
uint32_t next_time_id;
|
||||||
|
|
||||||
void add (std::vector<AutomationSelectable*>&);
|
void add (std::vector<AutomationSelectable*>&);
|
||||||
|
Loading…
Reference in New Issue
Block a user