summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-06-05 20:50:40 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-06-05 20:50:57 -0400
commit01812f53c34bf0298430da42bc636ee29dcdfd6a (patch)
tree9224019f8db18c66b03e7b26143079faa4186275 /gtk2_ardour
parent2c0396c9aa762be226d154cc3ed201c39ff6a2ec (diff)
use, or mostly use PresentationInfo for selection status of Routes.
Needs extension to Surfaces, replacing GuiSelectionChanged signal concept
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/axis_view.h3
-rw-r--r--gtk2_ardour/meter_strip.h2
-rw-r--r--gtk2_ardour/mixer_strip.cc17
-rw-r--r--gtk2_ardour/mixer_strip.h3
-rw-r--r--gtk2_ardour/mixer_ui.cc80
-rw-r--r--gtk2_ardour/monitor_section.cc1
-rw-r--r--gtk2_ardour/route_time_axis.cc1
-rw-r--r--gtk2_ardour/route_ui.cc33
-rw-r--r--gtk2_ardour/route_ui.h5
-rw-r--r--gtk2_ardour/time_axis_view.cc18
-rw-r--r--gtk2_ardour/time_axis_view.h6
11 files changed, 83 insertions, 86 deletions
diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h
index 7a2a0fb079..bc16aed06b 100644
--- a/gtk2_ardour/axis_view.h
+++ b/gtk2_ardour/axis_view.h
@@ -43,7 +43,7 @@ namespace ARDOUR {
* AxisView defines the abstract base class for time-axis trackviews and routes.
*
*/
-class AxisView : public virtual Selectable, public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr
+class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable
{
public:
ARDOUR::Session* session() const { return _session; }
@@ -97,4 +97,3 @@ class AxisView : public virtual Selectable, public virtual PBD::ScopedConnection
}; /* class AxisView */
#endif /* __ardour_gtk_axis_view_h__ */
-
diff --git a/gtk2_ardour/meter_strip.h b/gtk2_ardour/meter_strip.h
index 2f0924e909..00a2c4089d 100644
--- a/gtk2_ardour/meter_strip.h
+++ b/gtk2_ardour/meter_strip.h
@@ -75,6 +75,8 @@ class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
bool is_metric_display() { return _strip_type == 0; }
ARDOUR::MeterType meter_type();
+ bool selected() const { return false; }
+
protected:
boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnectionList meter_route_connections;
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 30859c8d5e..ada9730b3b 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1732,16 +1732,16 @@ MixerStrip::list_route_operations ()
}
void
-MixerStrip::set_selected (bool yn)
+MixerStrip::show_selected ()
{
- AxisView::set_selected (yn);
- if (_selected) {
+ if (selected()) {
global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
global_frame.set_name ("MixerStripSelectedFrame");
} else {
global_frame.set_shadow_type (Gtk::SHADOW_IN);
global_frame.set_name ("MixerStripFrame");
}
+
global_frame.queue_draw ();
// if (!yn)
@@ -2623,16 +2623,6 @@ MixerStrip::update_track_number_visibility ()
}
}
-bool
-MixerStrip::is_selected () const
-{
- if (!_route) {
- return false;
- }
-
- return _route->presentation_info().selected();
-}
-
Gdk::Color
MixerStrip::color () const
{
@@ -2650,4 +2640,3 @@ MixerStrip::set_marked_for_display (bool yn)
{
return RouteUI::mark_hidden (!yn);
}
-
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index 369f634033..408315dbb5 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -140,8 +140,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
- void set_selected (bool yn);
- bool is_selected() const;
+ void show_selected ();
static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 55bfbf8589..776e711fbd 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -815,53 +815,49 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
_selection.add (strip);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
- if (!_selection.selected(strip)) {
-
- /* extend selection */
-
- vector<MixerStrip*> tmp;
- bool accumulate = false;
- bool found_another = false;
-
- tmp.push_back (strip);
-
- for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
- if ((*i) == strip) {
- /* hit clicked strip, start accumulating till we hit the first
- selected strip
- */
- if (accumulate) {
- /* done */
- break;
- } else {
- accumulate = true;
- }
- } else if (_selection.selected (*i)) {
- /* hit selected strip. if currently accumulating others,
- we're done. if not accumulating others, start doing so.
- */
- found_another = true;
- if (accumulate) {
- /* done */
- break;
- } else {
- accumulate = true;
- }
+ /* extend selection */
+
+ vector<MixerStrip*> tmp;
+ bool accumulate = false;
+ bool found_another = false;
+
+ tmp.push_back (strip);
+
+ for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
+ if ((*i) == strip) {
+ /* hit clicked strip, start accumulating till we hit the first
+ selected strip
+ */
+ if (accumulate) {
+ /* done */
+ break;
} else {
- if (accumulate) {
- tmp.push_back (*i);
- }
+ accumulate = true;
}
- }
-
- if (found_another) {
- for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
- _selection.add (*i);
+ } else if (_selection.selected (*i)) {
+ /* hit selected strip. if currently accumulating others,
+ we're done. if not accumulating others, start doing so.
+ */
+ found_another = true;
+ if (accumulate) {
+ /* done */
+ break;
+ } else {
+ accumulate = true;
+ }
+ } else {
+ if (accumulate) {
+ tmp.push_back (*i);
}
- } else
- _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
+ }
}
+ if (found_another) {
+ for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
+ _selection.add (*i);
+ }
+ } else
+ _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
} else {
_selection.set (strip);
}
diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc
index 4399c8a364..eb131a7d3c 100644
--- a/gtk2_ardour/monitor_section.cc
+++ b/gtk2_ardour/monitor_section.cc
@@ -1701,3 +1701,4 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange)
{
update_processor_box ();
}
+
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index f8a87245ae..d3b28bd042 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -2950,3 +2950,4 @@ RouteTimeAxisView::set_marked_for_display (bool yn)
{
return RouteUI::mark_hidden (!yn);
}
+
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index c6a1677cc0..3cb96c29f4 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -2172,6 +2172,33 @@ RouteUI::route_gui_changed (PropertyChange const& what_changed)
route_color_changed ();
}
}
+
+ if (what_changed.contains (Properties::selected)) {
+ show_selected ();
+ }
+}
+
+void
+RouteUI::set_selected (bool yn)
+{
+ Selectable::set_selected (yn);
+ if (_route) {
+ _route->presentation_info().set_selected (yn);
+ }
+}
+
+bool
+RouteUI::selected () const
+{
+ /* XXX not sure if this is a wise design. Probably don't really want
+ * the cached _selected value from Selectable.
+ */
+
+ if (!_route) {
+ return _selected;
+ }
+
+ return _route->presentation_info().selected();
}
void
@@ -2322,12 +2349,6 @@ RouteUI::manage_pins ()
}
}
-void
-RouteUI::set_selected (bool yn)
-{
- _route->presentation_info().set_selected (yn);
-}
-
bool
RouteUI::mark_hidden (bool yn)
{
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index aedea7380b..d8e50ed8c2 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -73,7 +73,7 @@ class RoutePinWindowProxy : public WM::ProxyBase
PBD::ScopedConnection going_away_connection;
};
-class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::trackable, public virtual PBD::ScopedConnectionList
+class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectable, public virtual PBD::ScopedConnectionList
{
public:
RouteUI (ARDOUR::Session*);
@@ -105,6 +105,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
Gdk::Color route_color () const;
void choose_color ();
+ bool selected () const;
void set_selected (bool);
bool ignore_toggle;
@@ -307,7 +308,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
std::string route_state_id () const;
-protected:
+ protected:
struct SoloMuteRelease {
SoloMuteRelease (bool was_active)
: active (was_active)
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 4885c58b54..de8c17f456 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -742,22 +742,9 @@ TimeAxisView::popup_display_menu (guint32 when)
}
void
-TimeAxisView::set_selected (bool yn)
+TimeAxisView::show_selected ()
{
-#if 0
- /* end any name edit in progress */
- if (can_edit_name()) {
- end_name_edit (string(), 0);
- }
-#endif
-
- if (yn == _selected) {
- return;
- }
-
- Selectable::set_selected (yn);
-
- if (_selected) {
+ if (selected()) {
time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
time_axis_frame.set_name ("MixerStripSelectedFrame");
controls_ebox.set_name (controls_base_selected_name);
@@ -783,7 +770,6 @@ TimeAxisView::set_selected (bool yn)
}
time_axis_frame.show();
-
}
void
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 9ab2d3596b..1920d668a7 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -139,7 +139,6 @@ class TimeAxisView : public virtual AxisView
/** @return true if hidden, otherwise false */
bool hidden () const { return _hidden; }
- void set_selected (bool);
virtual bool selectable() const { return true; }
/**
@@ -307,7 +306,10 @@ class TimeAxisView : public virtual AxisView
void build_size_menu ();
-private:
+ protected:
+ void show_selected ();
+
+ private:
Gtk::VBox* control_parent;
int _order;
uint32_t _effective_height;