13
0

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;
}
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);
void set_samples_per_pixel (double);
std::string name() const { return _name; }
Gdk::Color color () const;
boost::shared_ptr<ARDOUR::Stripable> stripable() 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.
*
*/
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:
/** @return the track's own color */
Gdk::Color color () const { return _color; }
ARDOUR::Session* session() const { return _session; }
virtual std::string name() const = 0;
virtual Gdk::Color color() const = 0;
sigc::signal<void> Hiding;

View File

@ -967,3 +967,15 @@ MeterStrip::set_meter_type_multi (int what, RouteGroup* group, MeterType type)
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 MeterStrip : public Gtk::VBox, public RouteUI
class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
{
public:
MeterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
MeterStrip (int, ARDOUR::MeterType);
~MeterStrip ();
std::string name() const;
Gdk::Color color () const;
void set_session (ARDOUR::Session* s);
void fast_update ();
boost::shared_ptr<ARDOUR::Route> route() { return _route; }

View File

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

View File

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

View File

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

View File

@ -78,6 +78,11 @@ public:
RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
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>);
boost::shared_ptr<ARDOUR::Stripable> stripable() const;
@ -134,7 +139,6 @@ public:
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
std::string name() const;
StreamView* view() const { return _view; }
ARDOUR::RouteGroup* route_group() const;
boost::shared_ptr<ARDOUR::Playlist> playlist() const;

View File

@ -548,3 +548,9 @@ VCAMasterStrip::drop_button_press ()
{
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 ();
std::string name() const;
Gdk::Color color () const;
std::string state_id() const { return "VCAMasterStrip"; }
boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
static PBD::Signal1<void,VCAMasterStrip*> CatchDeletion;
private:
boost::shared_ptr<ARDOUR::VCA> _vca;
GainMeter gain_meter;

View File

@ -288,3 +288,9 @@ VCATimeAxisView::stripable () const
{
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; }
std::string name() const;
Gdk::Color color () const;
std::string state_id() const;
bool selectable() const { return false; }