change AxisView color API to be virtual and implement per-type variants

This commit is contained in:
Paul Davis 2016-06-05 15:39:22 -04:00
parent 2aeb33989e
commit 384d05dd35
13 changed files with 80 additions and 7 deletions

View file

@ -1050,3 +1050,9 @@ AutomationTimeAxisView::stripable () const
{ {
return _route; return _route;
} }
Gdk::Color
AutomationTimeAxisView::color () const
{
return gdk_color_from_rgb (_route->presentation_info().color());
}

View file

@ -72,6 +72,7 @@ class AutomationTimeAxisView : public TimeAxisView {
virtual void set_height (uint32_t, TrackHeightMode m = OnlySelf); virtual void set_height (uint32_t, TrackHeightMode m = OnlySelf);
void set_samples_per_pixel (double); void set_samples_per_pixel (double);
std::string name() const { return _name; } std::string name() const { return _name; }
Gdk::Color color () const;
boost::shared_ptr<ARDOUR::Stripable> stripable() const; boost::shared_ptr<ARDOUR::Stripable> stripable() const;
ARDOUR::PresentationInfo const & presentation_info () const; ARDOUR::PresentationInfo const & presentation_info () const;

View file

@ -43,15 +43,13 @@ 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 PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr class AxisView : public virtual Selectable, public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr
{ {
public: public:
/** @return the track's own color */
Gdk::Color color () const { return _color; }
ARDOUR::Session* session() const { return _session; } ARDOUR::Session* session() const { return _session; }
virtual std::string name() const = 0; virtual std::string name() const = 0;
virtual Gdk::Color color() const = 0;
sigc::signal<void> Hiding; sigc::signal<void> Hiding;

View file

@ -967,3 +967,15 @@ MeterStrip::set_meter_type_multi (int what, RouteGroup* group, MeterType type)
break; break;
} }
} }
string
MeterStrip::name () const
{
return _route->name();
}
Gdk::Color
MeterStrip::color () const
{
return RouteUI::route_color ();
}

View file

@ -43,13 +43,16 @@ namespace Gtk {
class Style; class Style;
} }
class MeterStrip : public Gtk::VBox, public RouteUI class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
{ {
public: public:
MeterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>); MeterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
MeterStrip (int, ARDOUR::MeterType); MeterStrip (int, ARDOUR::MeterType);
~MeterStrip (); ~MeterStrip ();
std::string name() const;
Gdk::Color color () const;
void set_session (ARDOUR::Session* s); void set_session (ARDOUR::Session* s);
void fast_update (); void fast_update ();
boost::shared_ptr<ARDOUR::Route> route() { return _route; } boost::shared_ptr<ARDOUR::Route> route() { return _route; }

View file

@ -450,6 +450,15 @@ MixerStrip::mixer_strip_leave_event (GdkEventCrossing *ev)
return false; return false;
} }
string
MixerStrip::name() const
{
if (_route) {
return _route->name();
}
return string();
}
void void
MixerStrip::set_route (boost::shared_ptr<Route> rt) MixerStrip::set_route (boost::shared_ptr<Route> rt)
{ {
@ -2616,6 +2625,13 @@ MixerStrip::update_track_number_visibility ()
number_label.hide (); number_label.hide ();
} }
} }
Gdk::Color
MixerStrip::color () const
{
return route_color ();
}
bool bool
MixerStrip::marked_for_display () const MixerStrip::marked_for_display () const
{ {

View file

@ -47,6 +47,7 @@
#include "pbd/fastlog.h" #include "pbd/fastlog.h"
#include "axis_view.h"
#include "ardour_knob.h" #include "ardour_knob.h"
#include "route_ui.h" #include "route_ui.h"
#include "gain_meter.h" #include "gain_meter.h"
@ -74,13 +75,15 @@ class MotionController;
class RouteGroupMenu; class RouteGroupMenu;
class ArdourWindow; class ArdourWindow;
class MixerStrip : public RouteUI, public Gtk::EventBox class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
{ {
public: public:
MixerStrip (Mixer_UI&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true); MixerStrip (Mixer_UI&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
MixerStrip (Mixer_UI&, ARDOUR::Session*, bool in_mixer = true); MixerStrip (Mixer_UI&, ARDOUR::Session*, bool in_mixer = true);
~MixerStrip (); ~MixerStrip ();
std::string name() const;
Gdk::Color color () const;
bool marked_for_display () const; bool marked_for_display () const;
bool set_marked_for_display (bool); bool set_marked_for_display (bool);

View file

@ -342,6 +342,15 @@ RouteTimeAxisView::~RouteTimeAxisView ()
CatchDeletion (this); CatchDeletion (this);
} }
string
RouteTimeAxisView::name() const
{
if (_route) {
return _route->name();
}
return string();
}
void void
RouteTimeAxisView::post_construct () RouteTimeAxisView::post_construct ()
{ {
@ -2932,6 +2941,12 @@ RouteTimeAxisView::stripable () const
return _route; return _route;
} }
Gdk::Color
RouteTimeAxisView::color () const
{
return route_color ();
}
bool bool
RouteTimeAxisView::marked_for_display () const RouteTimeAxisView::marked_for_display () const
{ {

View file

@ -78,6 +78,11 @@ public:
RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas); RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
virtual ~RouteTimeAxisView (); virtual ~RouteTimeAxisView ();
std::string name() const;
Gdk::Color color () const;
bool marked_for_display () const;
bool set_marked_for_display (bool);
void set_route (boost::shared_ptr<ARDOUR::Route>); void set_route (boost::shared_ptr<ARDOUR::Route>);
boost::shared_ptr<ARDOUR::Stripable> stripable() const; boost::shared_ptr<ARDOUR::Stripable> stripable() const;
@ -134,7 +139,6 @@ public:
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param); boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter); virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
std::string name() const;
StreamView* view() const { return _view; } StreamView* view() const { return _view; }
ARDOUR::RouteGroup* route_group() const; ARDOUR::RouteGroup* route_group() const;
boost::shared_ptr<ARDOUR::Playlist> playlist() const; boost::shared_ptr<ARDOUR::Playlist> playlist() const;

View file

@ -548,3 +548,9 @@ VCAMasterStrip::drop_button_press ()
{ {
drop_all_slaves (); drop_all_slaves ();
} }
Gdk::Color
VCAMasterStrip::color () const
{
return gdk_color_from_rgb (_vca->presentation_info().color ());
}

View file

@ -42,11 +42,13 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
~VCAMasterStrip (); ~VCAMasterStrip ();
std::string name() const; std::string name() const;
Gdk::Color color () const;
std::string state_id() const { return "VCAMasterStrip"; } std::string state_id() const { return "VCAMasterStrip"; }
boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; } boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
static PBD::Signal1<void,VCAMasterStrip*> CatchDeletion; static PBD::Signal1<void,VCAMasterStrip*> CatchDeletion;
private: private:
boost::shared_ptr<ARDOUR::VCA> _vca; boost::shared_ptr<ARDOUR::VCA> _vca;
GainMeter gain_meter; GainMeter gain_meter;

View file

@ -288,3 +288,9 @@ VCATimeAxisView::stripable () const
{ {
return _vca; return _vca;
} }
Gdk::Color
VCATimeAxisView::color () const
{
return gdk_color_from_rgb (_vca->presentation_info().color ());
}

View file

@ -46,6 +46,7 @@ class VCATimeAxisView : public TimeAxisView
boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; } boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
std::string name() const; std::string name() const;
Gdk::Color color () const;
std::string state_id() const; std::string state_id() const;
bool selectable() const { return false; } bool selectable() const { return false; }