13
0

use, or mostly use PresentationInfo for selection status of Routes.

Needs extension to Surfaces, replacing GuiSelectionChanged signal concept
This commit is contained in:
Paul Davis 2016-06-05 20:50:40 -04:00
parent 2c0396c9aa
commit 01812f53c3
11 changed files with 80 additions and 83 deletions

View File

@ -43,7 +43,7 @@ namespace ARDOUR {
* AxisView defines the abstract base class for time-axis trackviews and routes. * 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: public:
ARDOUR::Session* session() const { return _session; } ARDOUR::Session* session() const { return _session; }
@ -97,4 +97,3 @@ class AxisView : public virtual Selectable, public virtual PBD::ScopedConnection
}; /* class AxisView */ }; /* class AxisView */
#endif /* __ardour_gtk_axis_view_h__ */ #endif /* __ardour_gtk_axis_view_h__ */

View File

@ -75,6 +75,8 @@ class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
bool is_metric_display() { return _strip_type == 0; } bool is_metric_display() { return _strip_type == 0; }
ARDOUR::MeterType meter_type(); ARDOUR::MeterType meter_type();
bool selected() const { return false; }
protected: protected:
boost::shared_ptr<ARDOUR::Route> _route; boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnectionList meter_route_connections; PBD::ScopedConnectionList meter_route_connections;

View File

@ -1732,16 +1732,16 @@ MixerStrip::list_route_operations ()
} }
void 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_shadow_type (Gtk::SHADOW_ETCHED_OUT);
global_frame.set_name ("MixerStripSelectedFrame"); global_frame.set_name ("MixerStripSelectedFrame");
} else { } else {
global_frame.set_shadow_type (Gtk::SHADOW_IN); global_frame.set_shadow_type (Gtk::SHADOW_IN);
global_frame.set_name ("MixerStripFrame"); global_frame.set_name ("MixerStripFrame");
} }
global_frame.queue_draw (); global_frame.queue_draw ();
// if (!yn) // 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 Gdk::Color
MixerStrip::color () const MixerStrip::color () const
{ {
@ -2650,4 +2640,3 @@ MixerStrip::set_marked_for_display (bool yn)
{ {
return RouteUI::mark_hidden (!yn); return RouteUI::mark_hidden (!yn);
} }

View File

@ -140,8 +140,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
void vca_assign (boost::shared_ptr<ARDOUR::VCA>); void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
void vca_unassign (boost::shared_ptr<ARDOUR::VCA>); void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
void set_selected (bool yn); void show_selected ();
bool is_selected() const;
static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; } static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }

View File

@ -815,53 +815,49 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
_selection.add (strip); _selection.add (strip);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) { } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
if (!_selection.selected(strip)) { /* extend selection */
/* extend selection */ vector<MixerStrip*> tmp;
bool accumulate = false;
bool found_another = false;
vector<MixerStrip*> tmp; tmp.push_back (strip);
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) {
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) { /* hit clicked strip, start accumulating till we hit the first
if ((*i) == strip) { selected strip
/* hit clicked strip, start accumulating till we hit the first */
selected strip if (accumulate) {
*/ /* done */
if (accumulate) { break;
/* 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;
}
} else { } else {
if (accumulate) { accumulate = true;
tmp.push_back (*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);
} }
} }
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
} }
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 { } else {
_selection.set (strip); _selection.set (strip);
} }

View File

@ -1701,3 +1701,4 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange)
{ {
update_processor_box (); update_processor_box ();
} }

View File

@ -2950,3 +2950,4 @@ RouteTimeAxisView::set_marked_for_display (bool yn)
{ {
return RouteUI::mark_hidden (!yn); return RouteUI::mark_hidden (!yn);
} }

View File

@ -2172,6 +2172,33 @@ RouteUI::route_gui_changed (PropertyChange const& what_changed)
route_color_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 void
@ -2322,12 +2349,6 @@ RouteUI::manage_pins ()
} }
} }
void
RouteUI::set_selected (bool yn)
{
_route->presentation_info().set_selected (yn);
}
bool bool
RouteUI::mark_hidden (bool yn) RouteUI::mark_hidden (bool yn)
{ {

View File

@ -73,7 +73,7 @@ class RoutePinWindowProxy : public WM::ProxyBase
PBD::ScopedConnection going_away_connection; 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: public:
RouteUI (ARDOUR::Session*); RouteUI (ARDOUR::Session*);
@ -105,6 +105,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
Gdk::Color route_color () const; Gdk::Color route_color () const;
void choose_color (); void choose_color ();
bool selected () const;
void set_selected (bool); void set_selected (bool);
bool ignore_toggle; bool ignore_toggle;
@ -307,7 +308,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr
std::string route_state_id () const; std::string route_state_id () const;
protected: protected:
struct SoloMuteRelease { struct SoloMuteRelease {
SoloMuteRelease (bool was_active) SoloMuteRelease (bool was_active)
: active (was_active) : active (was_active)

View File

@ -742,22 +742,9 @@ TimeAxisView::popup_display_menu (guint32 when)
} }
void void
TimeAxisView::set_selected (bool yn) TimeAxisView::show_selected ()
{ {
#if 0 if (selected()) {
/* 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) {
time_axis_frame.set_shadow_type (Gtk::SHADOW_IN); time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
time_axis_frame.set_name ("MixerStripSelectedFrame"); time_axis_frame.set_name ("MixerStripSelectedFrame");
controls_ebox.set_name (controls_base_selected_name); controls_ebox.set_name (controls_base_selected_name);
@ -783,7 +770,6 @@ TimeAxisView::set_selected (bool yn)
} }
time_axis_frame.show(); time_axis_frame.show();
} }
void void

View File

@ -139,7 +139,6 @@ class TimeAxisView : public virtual AxisView
/** @return true if hidden, otherwise false */ /** @return true if hidden, otherwise false */
bool hidden () const { return _hidden; } bool hidden () const { return _hidden; }
void set_selected (bool);
virtual bool selectable() const { return true; } virtual bool selectable() const { return true; }
/** /**
@ -307,7 +306,10 @@ class TimeAxisView : public virtual AxisView
void build_size_menu (); void build_size_menu ();
private: protected:
void show_selected ();
private:
Gtk::VBox* control_parent; Gtk::VBox* control_parent;
int _order; int _order;
uint32_t _effective_height; uint32_t _effective_height;