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.
*
*/
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__ */

View File

@ -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;

View File

@ -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);
}

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_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; }

View File

@ -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 */
/* extend selection */
vector<MixerStrip*> tmp;
bool accumulate = false;
bool found_another = false;
vector<MixerStrip*> tmp;
bool accumulate = false;
bool found_another = false;
tmp.push_back (strip);
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;
}
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;
}
} 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 {
_selection.set (strip);
}

View File

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

View File

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

View File

@ -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)
{

View File

@ -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)

View File

@ -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

View File

@ -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;