Add option to collect a route group, so that its member routes are reordered to be together in the editor. A few cleanups along the way.
git-svn-id: svn://localhost/ardour2/branches/3.0@5319 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
36564e4f91
commit
40b0b216de
@ -1175,8 +1175,6 @@ Editor::connect_to_session (Session *t)
|
|||||||
//tempo_map_changed (Change (0));
|
//tempo_map_changed (Change (0));
|
||||||
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
|
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
|
||||||
|
|
||||||
_routes->initial_display ();
|
|
||||||
|
|
||||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||||
(static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
|
(static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
|
||||||
}
|
}
|
||||||
@ -1203,6 +1201,7 @@ Editor::connect_to_session (Session *t)
|
|||||||
_route_groups->connect_to_session (session);
|
_route_groups->connect_to_session (session);
|
||||||
_regions->connect_to_session (session);
|
_regions->connect_to_session (session);
|
||||||
_snapshots->connect_to_session (session);
|
_snapshots->connect_to_session (session);
|
||||||
|
_routes->connect_to_session (session);
|
||||||
|
|
||||||
start_updating ();
|
start_updating ();
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,7 @@ EditorRouteGroups::menu (RouteGroup* g)
|
|||||||
items.push_back (MenuElem (_("Edit..."), bind (mem_fun (*this, &EditorRouteGroups::edit), g)));
|
items.push_back (MenuElem (_("Edit..."), bind (mem_fun (*this, &EditorRouteGroups::edit), g)));
|
||||||
items.push_back (MenuElem (_("Fit to Window"), bind (mem_fun (*_editor, &Editor::fit_route_group), g)));
|
items.push_back (MenuElem (_("Fit to Window"), bind (mem_fun (*_editor, &Editor::fit_route_group), g)));
|
||||||
items.push_back (MenuElem (_("Subgroup"), bind (mem_fun (*this, &EditorRouteGroups::subgroup), g)));
|
items.push_back (MenuElem (_("Subgroup"), bind (mem_fun (*this, &EditorRouteGroups::subgroup), g)));
|
||||||
|
items.push_back (MenuElem (_("Collect"), bind (mem_fun (*this, &EditorRouteGroups::collect), g)));
|
||||||
}
|
}
|
||||||
items.push_back (SeparatorElem());
|
items.push_back (SeparatorElem());
|
||||||
items.push_back (MenuElem (_("Activate All"), mem_fun(*this, &EditorRouteGroups::activate_all)));
|
items.push_back (MenuElem (_("Activate All"), mem_fun(*this, &EditorRouteGroups::activate_all)));
|
||||||
@ -665,4 +666,51 @@ EditorRouteGroups::connect_to_session (Session* s)
|
|||||||
groups_changed ();
|
groups_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Collect all members of a RouteGroup so that they are together in the Editor.
|
||||||
|
* @param g Group to collect.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EditorRouteGroups::collect (RouteGroup* g)
|
||||||
|
{
|
||||||
|
list<Route*> routes = g->route_list ();
|
||||||
|
int const N = routes.size ();
|
||||||
|
|
||||||
|
list<Route*>::iterator i = routes.begin ();
|
||||||
|
Editor::TrackViewList::const_iterator j = _editor->get_track_views().begin();
|
||||||
|
|
||||||
|
int diff = 0;
|
||||||
|
int coll = -1;
|
||||||
|
while (i != routes.end() && j != _editor->get_track_views().end()) {
|
||||||
|
|
||||||
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*j);
|
||||||
|
if (rtv) {
|
||||||
|
|
||||||
|
boost::shared_ptr<Route> r = rtv->route ();
|
||||||
|
int const k = r->order_key (N_ ("editor"));
|
||||||
|
|
||||||
|
if (*i == r.get()) {
|
||||||
|
|
||||||
|
if (coll == -1) {
|
||||||
|
coll = k;
|
||||||
|
diff = N - 1;
|
||||||
|
} else {
|
||||||
|
--diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->set_order_key (N_ ("editor"), coll);
|
||||||
|
|
||||||
|
++coll;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
r->set_order_key (N_ ("editor"), k + diff);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
|
_editor->_routes->sync_order_keys (N_ ("editor"));
|
||||||
|
}
|
||||||
|
@ -65,8 +65,9 @@ private:
|
|||||||
|
|
||||||
void activate_all ();
|
void activate_all ();
|
||||||
void disable_all ();
|
void disable_all ();
|
||||||
void subgroup (ARDOUR::RouteGroup*);
|
void subgroup (ARDOUR::RouteGroup *);
|
||||||
void unsubgroup (ARDOUR::RouteGroup*);
|
void unsubgroup (ARDOUR::RouteGroup *);
|
||||||
|
void collect (ARDOUR::RouteGroup *);
|
||||||
|
|
||||||
void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
|
void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
|
||||||
void name_edit (const Glib::ustring&, const Glib::ustring&);
|
void name_edit (const Glib::ustring&, const Glib::ustring&);
|
||||||
|
@ -108,6 +108,14 @@ EditorRoutes::EditorRoutes (Editor* e)
|
|||||||
Route::SyncOrderKeys.connect (mem_fun (*this, &EditorRoutes::sync_order_keys));
|
Route::SyncOrderKeys.connect (mem_fun (*this, &EditorRoutes::sync_order_keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorRoutes::connect_to_session (Session* s)
|
||||||
|
{
|
||||||
|
EditorComponent::connect_to_session (s);
|
||||||
|
|
||||||
|
initial_display ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRoutes::on_tv_rec_enable_toggled (Glib::ustring const & path_string)
|
EditorRoutes::on_tv_rec_enable_toggled (Glib::ustring const & path_string)
|
||||||
{
|
{
|
||||||
@ -216,7 +224,7 @@ EditorRoutes::redisplay ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
|
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
|
||||||
_editor->current_session()->sync_order_keys (N_ ("editor"));
|
_session->sync_order_keys (N_ ("editor"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +232,7 @@ void
|
|||||||
EditorRoutes::route_deleted (Gtk::TreeModel::Path const & path)
|
EditorRoutes::route_deleted (Gtk::TreeModel::Path const & path)
|
||||||
{
|
{
|
||||||
/* this could require an order reset & sync */
|
/* this could require an order reset & sync */
|
||||||
_editor->current_session()->set_remote_control_ids();
|
_session->set_remote_control_ids();
|
||||||
_ignore_reorder = true;
|
_ignore_reorder = true;
|
||||||
redisplay ();
|
redisplay ();
|
||||||
_ignore_reorder = false;
|
_ignore_reorder = false;
|
||||||
@ -236,7 +244,7 @@ EditorRoutes::changed (Gtk::TreeModel::Path const & path, Gtk::TreeModel::iterat
|
|||||||
{
|
{
|
||||||
/* never reset order keys because of a property change */
|
/* never reset order keys because of a property change */
|
||||||
_redisplay_does_not_reset_order_keys = true;
|
_redisplay_does_not_reset_order_keys = true;
|
||||||
_editor->current_session()->set_remote_control_ids();
|
_session->set_remote_control_ids();
|
||||||
redisplay ();
|
redisplay ();
|
||||||
_redisplay_does_not_reset_order_keys = false;
|
_redisplay_does_not_reset_order_keys = false;
|
||||||
}
|
}
|
||||||
@ -398,7 +406,9 @@ EditorRoutes::reordered (TreeModel::Path const & path, TreeModel::iterator const
|
|||||||
redisplay ();
|
redisplay ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** If src == "editor", take editor order keys from each route and use them to rearrange the
|
||||||
|
* route list so that the visual arrangement of routes matches the order keys from the routes.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
EditorRoutes::sync_order_keys (string const & src)
|
EditorRoutes::sync_order_keys (string const & src)
|
||||||
{
|
{
|
||||||
@ -406,9 +416,7 @@ EditorRoutes::sync_order_keys (string const & src)
|
|||||||
TreeModel::Children rows = _model->children();
|
TreeModel::Children rows = _model->children();
|
||||||
TreeModel::Children::iterator ri;
|
TreeModel::Children::iterator ri;
|
||||||
|
|
||||||
ARDOUR::Session* s = _editor->current_session ();
|
if (src != N_ ("editor") || !_session || (_session->state_of_the_state() & Session::Loading) || rows.empty()) {
|
||||||
|
|
||||||
if (src != N_ ("editor") || !s || (s->state_of_the_state() & Session::Loading) || rows.empty()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,7 +635,7 @@ struct EditorOrderRouteSorter {
|
|||||||
void
|
void
|
||||||
EditorRoutes::initial_display ()
|
EditorRoutes::initial_display ()
|
||||||
{
|
{
|
||||||
boost::shared_ptr<RouteList> routes = _editor->current_session()->get_routes();
|
boost::shared_ptr<RouteList> routes = _session->get_routes();
|
||||||
RouteList r (*routes);
|
RouteList r (*routes);
|
||||||
EditorOrderRouteSorter sorter;
|
EditorOrderRouteSorter sorter;
|
||||||
|
|
||||||
@ -669,7 +677,7 @@ void
|
|||||||
EditorRoutes::track_list_reorder (Gtk::TreeModel::Path const & path, Gtk::TreeModel::iterator const & iter, int* new_order)
|
EditorRoutes::track_list_reorder (Gtk::TreeModel::Path const & path, Gtk::TreeModel::iterator const & iter, int* new_order)
|
||||||
{
|
{
|
||||||
_redisplay_does_not_sync_order_keys = true;
|
_redisplay_does_not_sync_order_keys = true;
|
||||||
_editor->current_session()->set_remote_control_ids();
|
_session->set_remote_control_ids();
|
||||||
redisplay ();
|
redisplay ();
|
||||||
_redisplay_does_not_sync_order_keys = false;
|
_redisplay_does_not_sync_order_keys = false;
|
||||||
}
|
}
|
||||||
@ -797,7 +805,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
|||||||
|
|
||||||
_model->reorder (neworder);
|
_model->reorder (neworder);
|
||||||
|
|
||||||
_editor->current_session()->sync_order_keys (N_ ("editor"));
|
_session->sync_order_keys (N_ ("editor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -22,12 +22,13 @@ class EditorRoutes : public EditorComponent
|
|||||||
public:
|
public:
|
||||||
EditorRoutes (Editor *);
|
EditorRoutes (Editor *);
|
||||||
|
|
||||||
|
void connect_to_session (ARDOUR::Session *);
|
||||||
|
|
||||||
Gtk::Widget& widget () {
|
Gtk::Widget& widget () {
|
||||||
return _scroller;
|
return _scroller;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_selected_tracks (bool);
|
void move_selected_tracks (bool);
|
||||||
void initial_display ();
|
|
||||||
void show_track_in_display (TimeAxisView &);
|
void show_track_in_display (TimeAxisView &);
|
||||||
void suspend_redisplay () {
|
void suspend_redisplay () {
|
||||||
_no_redisplay = true;
|
_no_redisplay = true;
|
||||||
@ -43,9 +44,11 @@ public:
|
|||||||
std::list<TimeAxisView*> views () const;
|
std::list<TimeAxisView*> views () const;
|
||||||
void hide_all_tracks (bool);
|
void hide_all_tracks (bool);
|
||||||
void clear ();
|
void clear ();
|
||||||
|
void sync_order_keys (std::string const &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void initial_display ();
|
||||||
void on_tv_rec_enable_toggled (Glib::ustring const &);
|
void on_tv_rec_enable_toggled (Glib::ustring const &);
|
||||||
void build_menu ();
|
void build_menu ();
|
||||||
void show_menu ();
|
void show_menu ();
|
||||||
@ -54,7 +57,6 @@ private:
|
|||||||
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
|
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
|
||||||
bool button_press (GdkEventButton *);
|
bool button_press (GdkEventButton *);
|
||||||
void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
|
void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
|
||||||
void sync_order_keys (std::string const &);
|
|
||||||
void route_removed (TimeAxisView *);
|
void route_removed (TimeAxisView *);
|
||||||
void handle_gui_changes (std::string const &, void *);
|
void handle_gui_changes (std::string const &, void *);
|
||||||
void update_rec_display ();
|
void update_rec_display ();
|
||||||
|
@ -66,7 +66,6 @@ public:
|
|||||||
gain_t get_min_factor(gain_t factor);
|
gain_t get_min_factor(gain_t factor);
|
||||||
|
|
||||||
int size() { return routes.size();}
|
int size() { return routes.size();}
|
||||||
ARDOUR::Route * first () const { return *routes.begin();}
|
|
||||||
|
|
||||||
void set_active (bool yn, void *src);
|
void set_active (bool yn, void *src);
|
||||||
void set_relative (bool yn, void *src);
|
void set_relative (bool yn, void *src);
|
||||||
|
@ -204,6 +204,10 @@ Route::set_order_key (std::string const & name, long n)
|
|||||||
_session.set_dirty ();
|
_session.set_dirty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set all order keys to be the same as that for `base', if such a key
|
||||||
|
* exists in this route.
|
||||||
|
* @param base Base key.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
Route::sync_order_keys (std::string const & base)
|
Route::sync_order_keys (std::string const & base)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user