summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-04-03 18:48:34 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-04-03 18:54:51 -0600
commit743fbaf7bf992bdd1d277df7fd34e6965f327a16 (patch)
tree9edba81d0dc0a403179d16cd1971b7d06c95b116
parentd1e55ff5b7b4e7f9da32ff05898487aff7d8bdc2 (diff)
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"
-rw-r--r--gtk2_ardour/route_time_axis.cc65
-rw-r--r--gtk2_ardour/route_time_axis.h1
2 files changed, 22 insertions, 44 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index d092f58a45..4d24e73bf8 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -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);
@@ -890,6 +851,22 @@ RouteTimeAxisView::build_display_menu ()
}
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)
{
TimeAxisView::show_timestretch (start, end, layers, layer);
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index de6bb441a9..72b6f736a1 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -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 ();