mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 07:05:43 +01:00
fix track/strip sync-reorder issues; don't show mixer strip on selection change if it wasn't already visible
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3875 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b96c0cba68
commit
0d21407834
6 changed files with 100 additions and 65 deletions
|
|
@ -298,7 +298,8 @@ Editor::Editor ()
|
|||
export_dialog = 0;
|
||||
export_range_markers_dialog = 0;
|
||||
show_gain_after_trim = false;
|
||||
ignore_route_list_reorder = false;
|
||||
route_redisplay_does_not_sync_order_keys = false;
|
||||
route_redisplay_does_not_reset_order_keys = false;
|
||||
no_route_list_redisplay = false;
|
||||
verbose_cursor_on = true;
|
||||
route_removal = false;
|
||||
|
|
@ -358,7 +359,6 @@ Editor::Editor ()
|
|||
scrubbing_direction = 0;
|
||||
|
||||
sfbrowser = 0;
|
||||
ignore_route_order_sync = false;
|
||||
|
||||
location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
|
||||
location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
|
||||
|
|
|
|||
|
|
@ -1711,8 +1711,9 @@ public:
|
|||
|
||||
void update_route_visibility ();
|
||||
|
||||
void sync_order_keys (void*);
|
||||
bool ignore_route_order_sync;
|
||||
void sync_order_keys (const char*);
|
||||
bool route_redisplay_does_not_sync_order_keys;
|
||||
bool route_redisplay_does_not_reset_order_keys;
|
||||
|
||||
bool route_list_display_button_press (GdkEventButton*);
|
||||
void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ void
|
|||
Editor::set_selected_mixer_strip (TimeAxisView& view)
|
||||
{
|
||||
AudioTimeAxisView* at;
|
||||
bool show = false;
|
||||
|
||||
if (!session || (at = dynamic_cast<AudioTimeAxisView*>(&view)) == 0) {
|
||||
return;
|
||||
|
|
@ -150,6 +151,10 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
|
|||
return;
|
||||
}
|
||||
|
||||
if (current_mixer_strip->get_parent()) {
|
||||
show = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
|
||||
|
|
@ -159,7 +164,10 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
|
|||
}
|
||||
|
||||
current_mixer_strip->set_route (at->route());
|
||||
show_editor_mixer (true);
|
||||
|
||||
if (show) {
|
||||
show_editor_mixer (true);
|
||||
}
|
||||
}
|
||||
|
||||
double current = 0.0;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ using namespace PBD;
|
|||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
|
||||
const char* _order_key = N_("editor");
|
||||
|
||||
void
|
||||
Editor::handle_new_route (Session::RouteList& routes)
|
||||
{
|
||||
|
|
@ -50,7 +52,7 @@ Editor::handle_new_route (Session::RouteList& routes)
|
|||
TreeModel::Row parent;
|
||||
TreeModel::Row row;
|
||||
|
||||
ignore_route_list_reorder = true;
|
||||
route_redisplay_does_not_sync_order_keys = true;
|
||||
no_route_list_redisplay = true;
|
||||
|
||||
for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
||||
|
|
@ -73,18 +75,16 @@ Editor::handle_new_route (Session::RouteList& routes)
|
|||
|
||||
if ((atv = dynamic_cast<AudioTimeAxisView*> (tv)) != 0) {
|
||||
/* added a new fresh one at the end */
|
||||
if (atv->route()->order_key(N_("editor")) == -1) {
|
||||
atv->route()->set_order_key (N_("editor"), route_display_model->children().size()-1);
|
||||
if (atv->route()->order_key(_order_key) == -1) {
|
||||
atv->route()->set_order_key (_order_key, route_display_model->children().size()-1);
|
||||
}
|
||||
atv->effective_gain_display ();
|
||||
}
|
||||
|
||||
tv->set_old_order_key (route_display_model->children().size() - 1);
|
||||
route->gui_changed.connect (mem_fun(*this, &Editor::handle_gui_changes));
|
||||
tv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), tv));
|
||||
}
|
||||
|
||||
ignore_route_list_reorder = false;
|
||||
no_route_list_redisplay = false;
|
||||
|
||||
redisplay_route_list ();
|
||||
|
|
@ -92,6 +92,8 @@ Editor::handle_new_route (Session::RouteList& routes)
|
|||
if (show_editor_mixer_when_tracks_arrive) {
|
||||
show_editor_mixer (true);
|
||||
}
|
||||
|
||||
route_redisplay_does_not_sync_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -125,13 +127,11 @@ Editor::remove_route (TimeAxisView *tv)
|
|||
entered_track = 0;
|
||||
}
|
||||
|
||||
/* Decrement old order keys for tracks `above' the one that is being removed */
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
TimeAxisView* v = (*ri)[route_display_columns.tv];
|
||||
if (v->old_order_key() > tv->old_order_key()) {
|
||||
v->set_old_order_key (v->old_order_key() - 1);
|
||||
}
|
||||
}
|
||||
/* the core model has changed, there is no need to sync
|
||||
view orders.
|
||||
*/
|
||||
|
||||
route_redisplay_does_not_sync_order_keys = true;
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
if ((*ri)[route_display_columns.tv] == tv) {
|
||||
|
|
@ -140,6 +140,8 @@ Editor::remove_route (TimeAxisView *tv)
|
|||
}
|
||||
}
|
||||
|
||||
route_redisplay_does_not_sync_order_keys = false;
|
||||
|
||||
if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
|
||||
track_views.erase (i);
|
||||
}
|
||||
|
|
@ -224,13 +226,13 @@ Editor::show_track_in_display (TimeAxisView& tv)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::sync_order_keys (void *src)
|
||||
Editor::sync_order_keys (const char *src)
|
||||
{
|
||||
vector<int> neworder;
|
||||
TreeModel::Children rows = route_display_model->children();
|
||||
TreeModel::Children::iterator ri;
|
||||
|
||||
if (src == this || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
|
||||
if ((strcmp (src, _order_key) == 0) || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -239,12 +241,13 @@ Editor::sync_order_keys (void *src)
|
|||
}
|
||||
|
||||
bool changed = false;
|
||||
int order;
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
TimeAxisView* tv = (*ri)[route_display_columns.tv];
|
||||
for (order = 0, ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
||||
boost::shared_ptr<Route> route = (*ri)[route_display_columns.route];
|
||||
int old_key = tv->old_order_key();
|
||||
int new_key = route->order_key (X_("editor"));
|
||||
|
||||
int old_key = order;
|
||||
int new_key = route->order_key (_order_key);
|
||||
|
||||
neworder[new_key] = old_key;
|
||||
|
||||
|
|
@ -254,7 +257,9 @@ Editor::sync_order_keys (void *src)
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
route_redisplay_does_not_reset_order_keys = true;
|
||||
route_display_model->reorder (neworder);
|
||||
route_redisplay_does_not_reset_order_keys = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -285,17 +290,15 @@ Editor::redisplay_route_list ()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!ignore_route_list_reorder) {
|
||||
if (!route_redisplay_does_not_reset_order_keys) {
|
||||
|
||||
/* this reorder is caused by user action, so reassign sort order keys
|
||||
to tracks.
|
||||
*/
|
||||
|
||||
route->set_order_key (N_("editor"), order);
|
||||
route->set_order_key (_order_key, order);
|
||||
}
|
||||
|
||||
tv->set_old_order_key (order);
|
||||
|
||||
bool visible = (*i)[route_display_columns.visible];
|
||||
|
||||
if (visible) {
|
||||
|
|
@ -321,8 +324,8 @@ Editor::redisplay_route_list ()
|
|||
vertical_adjustment.set_value (position + canvas_timebars_vsize - canvas_height);
|
||||
}
|
||||
|
||||
if (Config->get_sync_all_route_ordering() && !ignore_route_list_reorder) {
|
||||
Route::SyncOrderKeys (this); // EMIT SIGNAL
|
||||
if (!route_redisplay_does_not_reset_order_keys && !route_redisplay_does_not_sync_order_keys) {
|
||||
session->sync_order_keys (_order_key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -535,7 +538,7 @@ Editor::route_list_selection_filter (const Glib::RefPtr<TreeModel>& model, const
|
|||
struct EditorOrderRouteSorter {
|
||||
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
||||
/* use of ">" forces the correct sort order */
|
||||
return a->order_key ("editor") < b->order_key ("editor");
|
||||
return a->order_key (_order_key) < b->order_key (_order_key);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -562,20 +565,26 @@ Editor::initial_route_list_display ()
|
|||
void
|
||||
Editor::track_list_reorder (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter, int* new_order)
|
||||
{
|
||||
route_redisplay_does_not_sync_order_keys = true;
|
||||
session->set_remote_control_ids();
|
||||
redisplay_route_list ();
|
||||
route_redisplay_does_not_sync_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::route_list_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter)
|
||||
{
|
||||
/* never reset order keys because of a property change */
|
||||
route_redisplay_does_not_reset_order_keys = true;
|
||||
session->set_remote_control_ids();
|
||||
redisplay_route_list ();
|
||||
route_redisplay_does_not_reset_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::route_list_delete (const Gtk::TreeModel::Path& path)
|
||||
{
|
||||
/* this could require an order reset & sync */
|
||||
session->set_remote_control_ids();
|
||||
redisplay_route_list ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ using namespace std;
|
|||
|
||||
using PBD::atoi;
|
||||
|
||||
|
||||
Mixer_UI::Mixer_UI ()
|
||||
: Window (Gtk::WINDOW_TOPLEVEL)
|
||||
{
|
||||
|
|
@ -70,7 +69,8 @@ Mixer_UI::Mixer_UI ()
|
|||
no_track_list_redisplay = false;
|
||||
in_group_row_change = false;
|
||||
_visible = false;
|
||||
ignore_route_reorder = false;
|
||||
strip_redisplay_does_not_reset_order_keys = false;
|
||||
strip_redisplay_does_not_sync_order_keys = false;
|
||||
|
||||
Route::SyncOrderKeys.connect (mem_fun (*this, &Mixer_UI::sync_order_keys));
|
||||
|
||||
|
|
@ -273,6 +273,9 @@ Mixer_UI::add_strip (Session::RouteList& routes)
|
|||
|
||||
MixerStrip* strip;
|
||||
|
||||
no_track_list_redisplay = true;
|
||||
strip_redisplay_does_not_sync_order_keys = true;
|
||||
|
||||
for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
||||
boost::shared_ptr<Route> route = (*x);
|
||||
|
||||
|
|
@ -291,19 +294,15 @@ Mixer_UI::add_strip (Session::RouteList& routes)
|
|||
|
||||
show_strip (strip);
|
||||
|
||||
no_track_list_redisplay = true;
|
||||
|
||||
TreeModel::Row row = *(track_model->append());
|
||||
row[track_columns.text] = route->name();
|
||||
|
||||
row[track_columns.visible] = strip->marked_for_display();
|
||||
row[track_columns.route] = route;
|
||||
row[track_columns.strip] = strip;
|
||||
|
||||
strip->set_old_order_key (track_model->children().size() - 1);
|
||||
|
||||
no_track_list_redisplay = false;
|
||||
redisplay_track_list ();
|
||||
|
||||
if (route->order_key (N_("signal")) == -1) {
|
||||
route->set_order_key (N_("signal"), track_model->children().size()-1);
|
||||
}
|
||||
|
||||
route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
|
||||
|
||||
|
|
@ -311,6 +310,12 @@ Mixer_UI::add_strip (Session::RouteList& routes)
|
|||
|
||||
strip->signal_button_release_event().connect (bind (mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
|
||||
}
|
||||
|
||||
no_track_list_redisplay = false;
|
||||
|
||||
redisplay_track_list ();
|
||||
|
||||
strip_redisplay_does_not_sync_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -326,13 +331,7 @@ Mixer_UI::remove_strip (MixerStrip* strip)
|
|||
strips.erase (i);
|
||||
}
|
||||
|
||||
/* Decrement old order keys for strips `above' the one that is being removed */
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
MixerStrip* s = (*ri)[track_columns.strip];
|
||||
if (s->old_order_key() > strip->old_order_key()) {
|
||||
s->set_old_order_key (s->old_order_key() - 1);
|
||||
}
|
||||
}
|
||||
strip_redisplay_does_not_sync_order_keys = true;
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
if ((*ri)[track_columns.strip] == strip) {
|
||||
|
|
@ -340,27 +339,32 @@ Mixer_UI::remove_strip (MixerStrip* strip)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strip_redisplay_does_not_sync_order_keys = false;
|
||||
}
|
||||
|
||||
const char*
|
||||
Mixer_UI::get_order_key()
|
||||
{
|
||||
return X_("signal");
|
||||
#if 0
|
||||
if (Config->get_sync_all_route_ordering()) {
|
||||
return X_("editor");
|
||||
} else {
|
||||
return X_("signal");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Mixer_UI::sync_order_keys (void *src)
|
||||
Mixer_UI::sync_order_keys (const char *src)
|
||||
{
|
||||
vector<int> neworder;
|
||||
TreeModel::Children rows = track_model->children();
|
||||
TreeModel::Children::iterator ri;
|
||||
|
||||
if (src == this || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
|
||||
if ((strcmp (src, get_order_key()) == 0) || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -368,15 +372,26 @@ Mixer_UI::sync_order_keys (void *src)
|
|||
neworder.push_back (0);
|
||||
}
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
bool changed = false;
|
||||
int order;
|
||||
|
||||
for (order = 0, ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
||||
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
||||
MixerStrip* strip = (*ri)[track_columns.strip];
|
||||
neworder[route->order_key (get_order_key())] = strip->old_order_key ();
|
||||
int old_key = order;
|
||||
int new_key = route->order_key (get_order_key());
|
||||
|
||||
neworder[new_key] = old_key;
|
||||
|
||||
if (new_key != old_key) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
ignore_route_reorder = true;
|
||||
track_model->reorder (neworder);
|
||||
ignore_route_reorder = false;
|
||||
if (changed) {
|
||||
strip_redisplay_does_not_reset_order_keys = true;
|
||||
track_model->reorder (neworder);
|
||||
strip_redisplay_does_not_reset_order_keys = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -626,24 +641,28 @@ Mixer_UI::hide_all_audiotracks ()
|
|||
void
|
||||
Mixer_UI::track_list_reorder (const TreeModel::Path& path, const TreeModel::iterator& iter, int* new_order)
|
||||
{
|
||||
strip_redisplay_does_not_sync_order_keys = true;
|
||||
session->set_remote_control_ids();
|
||||
redisplay_track_list ();
|
||||
strip_redisplay_does_not_sync_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::track_list_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter)
|
||||
{
|
||||
// never reset order keys because of a property change
|
||||
strip_redisplay_does_not_reset_order_keys = true;
|
||||
session->set_remote_control_ids();
|
||||
redisplay_track_list ();
|
||||
strip_redisplay_does_not_reset_order_keys = false;
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::track_list_delete (const Gtk::TreeModel::Path& path)
|
||||
{
|
||||
/* this could require an order sync */
|
||||
session->set_remote_control_ids();
|
||||
ignore_route_reorder = true;
|
||||
redisplay_track_list ();
|
||||
ignore_route_reorder = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -672,12 +691,10 @@ Mixer_UI::redisplay_track_list ()
|
|||
if (visible) {
|
||||
strip->set_marked_for_display (true);
|
||||
|
||||
if (!ignore_route_reorder) {
|
||||
if (!strip_redisplay_does_not_reset_order_keys) {
|
||||
strip->route()->set_order_key (get_order_key(), order);
|
||||
}
|
||||
|
||||
strip->set_old_order_key (order);
|
||||
|
||||
if (strip->packed()) {
|
||||
|
||||
if (strip->route()->master() || strip->route()->control()) {
|
||||
|
|
@ -710,8 +727,8 @@ Mixer_UI::redisplay_track_list ()
|
|||
}
|
||||
}
|
||||
|
||||
if (Config->get_sync_all_route_ordering() && !ignore_route_reorder) {
|
||||
Route::SyncOrderKeys (this); // EMIT SIGNAL
|
||||
if (!strip_redisplay_does_not_reset_order_keys && !strip_redisplay_does_not_sync_order_keys) {
|
||||
session->sync_order_keys (get_order_key());
|
||||
}
|
||||
|
||||
// Rebind all of the midi controls automatically
|
||||
|
|
@ -719,7 +736,6 @@ Mixer_UI::redisplay_track_list ()
|
|||
if (auto_rebinding) {
|
||||
auto_rebind_midi_controls ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -242,8 +242,9 @@ class Mixer_UI : public Gtk::Window
|
|||
|
||||
Width _strip_width;
|
||||
|
||||
void sync_order_keys (void *src);
|
||||
bool ignore_route_reorder;
|
||||
void sync_order_keys (const char *src);
|
||||
bool strip_redisplay_does_not_reset_order_keys;
|
||||
bool strip_redisplay_does_not_sync_order_keys;
|
||||
|
||||
static const int32_t default_width = 478;
|
||||
static const int32_t default_height = 765;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue