change implementation of layer display menu items and handlers
The menu items no longer ever apply to the selection, because there will be an Editor-level action to change things "globally"
This commit is contained in:
parent
d1e55ff5b7
commit
743fbaf7bf
@ -652,34 +652,6 @@ RouteTimeAxisView::build_display_menu ()
|
||||
|
||||
RadioMenuItem::Group layers_group;
|
||||
|
||||
/* Find out how many overlaid/stacked tracks we have in the selection */
|
||||
|
||||
int overlaid = 0;
|
||||
int stacked = 0;
|
||||
int unchangeable = 0;
|
||||
TrackSelection const & s = _editor.get_selection().tracks;
|
||||
|
||||
for (TrackSelection::const_iterator i = s.begin(); i != s.end(); ++i) {
|
||||
StreamView* v = (*i)->view ();
|
||||
if (!v) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (v->can_change_layer_display()) {
|
||||
switch (v->layer_display ()) {
|
||||
case Overlaid:
|
||||
++overlaid;
|
||||
break;
|
||||
case Stacked:
|
||||
case Expanded:
|
||||
++stacked;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
unchangeable++;
|
||||
}
|
||||
}
|
||||
|
||||
/* We're not connecting to signal_toggled() here; in the case where these two items are
|
||||
set to be in the `inconsistent' state, it seems that one or other will end up active
|
||||
as well as inconsistent (presumably due to the RadioMenuItem::Group). Then when you
|
||||
@ -690,26 +662,16 @@ RouteTimeAxisView::build_display_menu ()
|
||||
|
||||
layers_items.push_back (RadioMenuElem (layers_group, _("Overlaid")));
|
||||
RadioMenuItem* i = dynamic_cast<RadioMenuItem*> (&layers_items.back ());
|
||||
i->set_active (overlaid != 0 && stacked == 0);
|
||||
i->set_inconsistent (overlaid != 0 && stacked != 0);
|
||||
i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::set_layer_display), Overlaid, true));
|
||||
i->set_active (layer_display() == Overlaid);
|
||||
i->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::layer_display_menu_change), i));
|
||||
overlaid_menu_item = i;
|
||||
|
||||
if (unchangeable) {
|
||||
i->set_sensitive (false);
|
||||
}
|
||||
|
||||
layers_items.push_back (RadioMenuElem (layers_group, _("Stacked")));
|
||||
i = dynamic_cast<RadioMenuItem*> (&layers_items.back ());
|
||||
i->set_active (overlaid == 0 && stacked != 0);
|
||||
i->set_inconsistent (overlaid != 0 && stacked != 0);
|
||||
i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::set_layer_display), Stacked, true));
|
||||
i->set_active (layer_display() == Stacked);
|
||||
i->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::layer_display_menu_change), i));
|
||||
stacked_menu_item = i;
|
||||
|
||||
if (unchangeable) {
|
||||
i->set_sensitive (false);
|
||||
}
|
||||
|
||||
_ignore_set_layer_display = false;
|
||||
|
||||
items.push_back (MenuElem (_("Layers"), *layers_menu));
|
||||
@ -720,13 +682,12 @@ RouteTimeAxisView::build_display_menu ()
|
||||
|
||||
RadioMenuItem::Group align_group;
|
||||
|
||||
/* Same verbose hacks as for the layering options above */
|
||||
|
||||
int existing = 0;
|
||||
int capture = 0;
|
||||
int automatic = 0;
|
||||
int styles = 0;
|
||||
boost::shared_ptr<Track> first_track;
|
||||
TrackSelection const & s = _editor.get_selection().tracks;
|
||||
|
||||
for (TrackSelection::const_iterator t = s.begin(); t != s.end(); ++t) {
|
||||
RouteTimeAxisView* r = dynamic_cast<RouteTimeAxisView*> (*t);
|
||||
@ -889,6 +850,22 @@ RouteTimeAxisView::build_display_menu ()
|
||||
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(_editor, &PublicEditor::remove_tracks)));
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::layer_display_menu_change (Gtk::MenuItem* item)
|
||||
{
|
||||
/* change only if the item is now active, since this will be called for
|
||||
both buttons as one becomes active and the other inactive.
|
||||
*/
|
||||
|
||||
if (dynamic_cast<RadioMenuItem*>(item)->get_active()) {
|
||||
if (item == stacked_menu_item) {
|
||||
set_layer_display (Stacked, false);
|
||||
} else {
|
||||
set_layer_display (Overlaid, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer)
|
||||
{
|
||||
|
@ -291,6 +291,7 @@ protected:
|
||||
UnderlayMirrorList _underlay_mirrors;
|
||||
|
||||
bool _ignore_set_layer_display;
|
||||
void layer_display_menu_change (Gtk::MenuItem* item);
|
||||
|
||||
protected:
|
||||
void update_pan_track_visibility ();
|
||||
|
Loading…
Reference in New Issue
Block a user