Make faders visually desensitised when their tracks are in automation-play.

git-svn-id: svn://localhost/ardour2/branches/3.0@12518 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-06-01 00:41:28 +00:00
parent 6624f9be37
commit e39a8fc968
15 changed files with 98 additions and 39 deletions

View file

@ -62,6 +62,7 @@ sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays;
GainMeter::MetricPatterns GainMeter::metric_patterns; GainMeter::MetricPatterns GainMeter::metric_patterns;
Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider; Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider;
Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider_desensitised;
void void
@ -70,10 +71,15 @@ GainMeter::setup_slider_pix ()
if ((slider = ::get_icon ("fader_belt")) == 0) { if ((slider = ::get_icon ("fader_belt")) == 0) {
throw failed_constructor(); throw failed_constructor();
} }
if ((slider_desensitised = ::get_icon ("fader_belt_desensitised")) == 0) {
throw failed_constructor();
}
} }
GainMeterBase::GainMeterBase (Session* s, GainMeterBase::GainMeterBase (Session* s,
const Glib::RefPtr<Gdk::Pixbuf>& pix, const Glib::RefPtr<Gdk::Pixbuf>& pix,
const Glib::RefPtr<Gdk::Pixbuf>& pix_desensitised,
bool horizontal, bool horizontal,
int fader_length) int fader_length)
: gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1) : gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1)
@ -95,11 +101,13 @@ GainMeterBase::GainMeterBase (Session* s,
if (horizontal) { if (horizontal) {
gain_slider = manage (new HSliderController (pix, gain_slider = manage (new HSliderController (pix,
pix_desensitised,
&gain_adjustment, &gain_adjustment,
fader_length, fader_length,
false)); false));
} else { } else {
gain_slider = manage (new VSliderController (pix, gain_slider = manage (new VSliderController (pix,
pix_desensitised,
&gain_adjustment, &gain_adjustment,
fader_length, fader_length,
false)); false));
@ -839,7 +847,7 @@ GainMeterBase::on_theme_changed()
} }
GainMeter::GainMeter (Session* s, int fader_length) GainMeter::GainMeter (Session* s, int fader_length)
: GainMeterBase (s, slider, false, fader_length) : GainMeterBase (s, slider, slider_desensitised, false, fader_length)
, gain_display_box(true, 0) , gain_display_box(true, 0)
, hbox(true, 2) , hbox(true, 2)
{ {

View file

@ -65,7 +65,7 @@ namespace Gtk {
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
{ {
public: public:
GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>& pix, GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>&, const Glib::RefPtr<Gdk::Pixbuf> &,
bool horizontal, int); bool horizontal, int);
virtual ~GainMeterBase (); virtual ~GainMeterBase ();
@ -231,6 +231,7 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
std::vector<ARDOUR::DataType> _types; std::vector<ARDOUR::DataType> _types;
static Glib::RefPtr<Gdk::Pixbuf> slider; static Glib::RefPtr<Gdk::Pixbuf> slider;
static Glib::RefPtr<Gdk::Pixbuf> slider_desensitised;
}; };
#endif /* __ardour_gtk_gain_meter_h__ */ #endif /* __ardour_gtk_gain_meter_h__ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

View file

@ -176,7 +176,13 @@ FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t>
throw failed_constructor (); throw failed_constructor ();
} }
_pix_desensitised = ::get_icon (X_("fader_belt_h_desensitised"));
if (_pix_desensitised == 0) {
throw failed_constructor ();
}
_db_slider = manage (new HSliderController (_pix, _db_slider = manage (new HSliderController (_pix,
_pix_desensitised,
&_db_adjustment, &_db_adjustment,
115, 115,
false)); false));

View file

@ -362,6 +362,7 @@ private:
Gtk::Adjustment _db_adjustment; Gtk::Adjustment _db_adjustment;
Gtkmm2ext::HSliderController* _db_slider; Gtkmm2ext::HSliderController* _db_slider;
Glib::RefPtr<Gdk::Pixbuf> _pix; Glib::RefPtr<Gdk::Pixbuf> _pix;
Glib::RefPtr<Gdk::Pixbuf> _pix_desensitised;
Gtk::Entry _db_display; Gtk::Entry _db_display;
Gtk::Label _label; Gtk::Label _label;
Gtk::HBox _box; Gtk::HBox _box;

View file

@ -91,6 +91,7 @@ RefPtr<Action> ProcessorBox::rename_action;
RefPtr<Action> ProcessorBox::edit_action; RefPtr<Action> ProcessorBox::edit_action;
RefPtr<Action> ProcessorBox::edit_generic_action; RefPtr<Action> ProcessorBox::edit_generic_action;
Glib::RefPtr<Gdk::Pixbuf> ProcessorEntry::_slider_pixbuf; Glib::RefPtr<Gdk::Pixbuf> ProcessorEntry::_slider_pixbuf;
Glib::RefPtr<Gdk::Pixbuf> ProcessorEntry::_slider_pixbuf_desensitised;
ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w) ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w)
: _button (ArdourButton::led_default_elements) : _button (ArdourButton::led_default_elements)
@ -121,7 +122,13 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
set<Evoral::Parameter> p = _processor->what_can_be_automated (); set<Evoral::Parameter> p = _processor->what_can_be_automated ();
for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) { for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) {
Control* c = new Control (_slider_pixbuf, _processor->automation_control (*i), _processor->describe_parameter (*i)); Control* c = new Control (
_slider_pixbuf,
_slider_pixbuf_desensitised,
_processor->automation_control (*i),
_processor->describe_parameter (*i)
);
_controls.push_back (c); _controls.push_back (c);
if (boost::dynamic_pointer_cast<Amp> (_processor) == 0) { if (boost::dynamic_pointer_cast<Amp> (_processor) == 0) {
@ -301,6 +308,8 @@ ProcessorEntry::setup_slider_pix ()
{ {
_slider_pixbuf = ::get_icon ("fader_belt_h_thin"); _slider_pixbuf = ::get_icon ("fader_belt_h_thin");
assert (_slider_pixbuf); assert (_slider_pixbuf);
_slider_pixbuf_desensitised = ::get_icon ("fader_belt_h_thin_desensitised");
assert (_slider_pixbuf_desensitised);
} }
void void
@ -398,10 +407,10 @@ ProcessorEntry::toggle_control_visibility (Control* c)
_parent->update_gui_object_state (this); _parent->update_gui_object_state (this);
} }
ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, boost::shared_ptr<AutomationControl> c, string const & n) ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, Glib::RefPtr<Gdk::Pixbuf> sd, boost::shared_ptr<AutomationControl> c, string const & n)
: _control (c) : _control (c)
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
, _slider (s, &_adjustment, 0, false) , _slider (s, sd, &_adjustment, 0, false)
, _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator)) , _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator))
, _ignore_ui_adjustment (false) , _ignore_ui_adjustment (false)
, _visible (false) , _visible (false)

View file

@ -140,6 +140,7 @@ protected:
virtual void setup_visuals (); virtual void setup_visuals ();
static Glib::RefPtr<Gdk::Pixbuf> _slider_pixbuf; static Glib::RefPtr<Gdk::Pixbuf> _slider_pixbuf;
static Glib::RefPtr<Gdk::Pixbuf> _slider_pixbuf_desensitised;
private: private:
void led_clicked(); void led_clicked();
@ -157,7 +158,7 @@ private:
class Control { class Control {
public: public:
Control (Glib::RefPtr<Gdk::Pixbuf>, boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &); Control (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &);
void set_pixel_width (int); void set_pixel_width (int);
void set_visible (bool); void set_visible (bool);

View file

@ -86,6 +86,7 @@ using namespace std;
using std::list; using std::list;
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider; Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider_desensitised;
void void
RouteTimeAxisView::setup_slider_pix () RouteTimeAxisView::setup_slider_pix ()
@ -93,6 +94,10 @@ RouteTimeAxisView::setup_slider_pix ()
if ((slider = ::get_icon ("fader_belt_h")) == 0) { if ((slider = ::get_icon ("fader_belt_h")) == 0) {
throw failed_constructor (); throw failed_constructor ();
} }
if ((slider_desensitised = ::get_icon ("fader_belt_h_desensitised")) == 0) {
throw failed_constructor ();
}
} }
RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas) RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
@ -112,7 +117,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& c
, playlist_action_menu (0) , playlist_action_menu (0)
, mode_menu (0) , mode_menu (0)
, color_mode_menu (0) , color_mode_menu (0)
, gm (sess, slider, true, 115) , gm (sess, slider, slider_desensitised, true, 115)
{ {
} }
@ -124,6 +129,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
gm.set_controls (_route, _route->shared_peak_meter(), _route->amp()); gm.set_controls (_route, _route->shared_peak_meter(), _route->amp());
gm.get_level_meter().set_no_show_all(); gm.get_level_meter().set_no_show_all();
gm.get_level_meter().setup_meters(50); gm.get_level_meter().setup_meters(50);
gm.update_gain_sensitive ();
string str = gui_property ("height"); string str = gui_property ("height");
if (!str.empty()) { if (!str.empty()) {

View file

@ -296,6 +296,7 @@ protected:
GainMeterBase gm; GainMeterBase gm;
static Glib::RefPtr<Gdk::Pixbuf> slider; static Glib::RefPtr<Gdk::Pixbuf> slider;
static Glib::RefPtr<Gdk::Pixbuf> slider_desensitised;
XMLNode* underlay_xml_node; XMLNode* underlay_xml_node;
bool set_underlay_state(); bool set_underlay_state();

View file

@ -32,7 +32,7 @@ namespace Gtkmm2ext {
class PixFader : public Gtk::DrawingArea class PixFader : public Gtk::DrawingArea
{ {
public: public:
PixFader (Glib::RefPtr<Gdk::Pixbuf> belt_image, Gtk::Adjustment& adjustment, int orientation, int); PixFader (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, Gtk::Adjustment& adjustment, int orientation, int);
virtual ~PixFader (); virtual ~PixFader ();
void set_fader_length (int); void set_fader_length (int);
@ -59,9 +59,16 @@ class PixFader : public Gtk::DrawingArea
}; };
private: private:
Cairo::RefPtr<Cairo::Context> belt_context;
Cairo::RefPtr<Cairo::ImageSurface> belt_surface; enum State {
Glib::RefPtr<Gdk::Pixbuf> pixbuf; NORMAL,
DESENSITISED,
STATES
};
Cairo::RefPtr<Cairo::Context> belt_context[STATES];
Cairo::RefPtr<Cairo::ImageSurface> belt_surface[STATES];
Glib::RefPtr<Gdk::Pixbuf> pixbuf[STATES];
int span, girth; int span, girth;
int _orien; int _orien;
float left_r; float left_r;

View file

@ -39,7 +39,7 @@ namespace Gtkmm2ext {
class SliderController : public Gtkmm2ext::PixFader class SliderController : public Gtkmm2ext::PixFader
{ {
public: public:
SliderController (Glib::RefPtr<Gdk::Pixbuf> image, Gtk::Adjustment* adj, int orientation, int); SliderController (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, Gtk::Adjustment* adj, int orientation, int);
virtual ~SliderController () {} virtual ~SliderController () {}
@ -66,6 +66,7 @@ class VSliderController : public SliderController
{ {
public: public:
VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, VSliderController (Glib::RefPtr<Gdk::Pixbuf> image,
Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int, Gtk::Adjustment *adj, int,
bool with_numeric = true); bool with_numeric = true);
}; };
@ -74,6 +75,7 @@ class HSliderController : public SliderController
{ {
public: public:
HSliderController (Glib::RefPtr<Gdk::Pixbuf> image, HSliderController (Glib::RefPtr<Gdk::Pixbuf> image,
Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int, Gtk::Adjustment *adj, int,
bool with_numeric = true); bool with_numeric = true);
}; };

View file

@ -28,13 +28,18 @@ using namespace Gtkmm2ext;
using namespace Gtk; using namespace Gtk;
using namespace std; using namespace std;
PixFader::PixFader (Glib::RefPtr<Gdk::Pixbuf> belt, Gtk::Adjustment& adj, int orientation, int fader_length) PixFader::PixFader (
Glib::RefPtr<Gdk::Pixbuf> belt,
Glib::RefPtr<Gdk::Pixbuf> belt_desensitised,
Gtk::Adjustment& adj,
int orientation,
int fader_length
)
: adjustment (adj), : adjustment (adj),
pixbuf (belt),
_orien(orientation) _orien(orientation)
{ {
Cairo::Format format; pixbuf[NORMAL] = belt;
pixbuf[DESENSITISED] = belt_desensitised;
dragging = false; dragging = false;
default_value = adjustment.get_value(); default_value = adjustment.get_value();
@ -44,9 +49,9 @@ PixFader::PixFader (Glib::RefPtr<Gdk::Pixbuf> belt, Gtk::Adjustment& adj, int or
view.y = 0; view.y = 0;
if (orientation == VERT) { if (orientation == VERT) {
view.width = girth = pixbuf->get_width(); view.width = girth = pixbuf[0]->get_width();
} else { } else {
view.height = girth = pixbuf->get_height(); view.height = girth = pixbuf[0]->get_height();
} }
set_fader_length (fader_length); set_fader_length (fader_length);
@ -56,15 +61,20 @@ PixFader::PixFader (Glib::RefPtr<Gdk::Pixbuf> belt, Gtk::Adjustment& adj, int or
adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
if (pixbuf->get_has_alpha()) { for (int i = 0; i < STATES; ++i) {
Cairo::Format format;
if (pixbuf[i]->get_has_alpha()) {
format = Cairo::FORMAT_ARGB32; format = Cairo::FORMAT_ARGB32;
} else { } else {
format = Cairo::FORMAT_RGB24; format = Cairo::FORMAT_RGB24;
} }
belt_surface = Cairo::ImageSurface::create (format, pixbuf->get_width(), pixbuf->get_height());
belt_context = Cairo::Context::create (belt_surface); belt_surface[i] = Cairo::ImageSurface::create (format, pixbuf[i]->get_width(), pixbuf[i]->get_height());
Gdk::Cairo::set_source_pixbuf (belt_context, pixbuf, 0.0, 0.0); belt_context[i] = Cairo::Context::create (belt_surface[i]);
belt_context->paint(); Gdk::Cairo::set_source_pixbuf (belt_context[i], pixbuf[i], 0.0, 0.0);
belt_context[i]->paint();
}
left_r = 0; left_r = 0;
left_g = 0; left_g = 0;
@ -96,6 +106,8 @@ PixFader::set_border_colors (uint32_t left, uint32_t right)
bool bool
PixFader::on_expose_event (GdkEventExpose* ev) PixFader::on_expose_event (GdkEventExpose* ev)
{ {
int const pi = get_sensitive() ? NORMAL : DESENSITISED;
Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context(); Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
int srcx, srcy; int srcx, srcy;
int const ds = display_span (); int const ds = display_span ();
@ -103,9 +115,9 @@ PixFader::on_expose_event (GdkEventExpose* ev)
/* account for fader lengths that are shorter than the fader pixbuf */ /* account for fader lengths that are shorter than the fader pixbuf */
if (_orien == VERT) { if (_orien == VERT) {
offset_into_pixbuf += pixbuf->get_height() / 2 - view.height; offset_into_pixbuf += pixbuf[pi]->get_height() / 2 - view.height;
} else { } else {
offset_into_pixbuf += pixbuf->get_width() / 2 - view.width; offset_into_pixbuf += pixbuf[pi]->get_width() / 2 - view.width;
} }
context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height); context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
@ -122,7 +134,7 @@ PixFader::on_expose_event (GdkEventExpose* ev)
/* fader */ /* fader */
context->save(); context->save();
context->set_source (belt_surface, -srcx, -srcy); context->set_source (belt_surface[pi], -srcx, -srcy);
context->rectangle (0, 0, get_width(), get_height()); context->rectangle (0, 0, get_width(), get_height());
context->clip (); context->clip ();
context->paint(); context->paint();

View file

@ -28,9 +28,14 @@
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
SliderController::SliderController (Glib::RefPtr<Gdk::Pixbuf> image, Gtk::Adjustment *adj, int orientation, int fader_length) SliderController::SliderController (
Glib::RefPtr<Gdk::Pixbuf> image,
: PixFader (image, *adj, orientation, fader_length), Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj,
int orientation,
int fader_length
)
: PixFader (image, image_desensitised, *adj, orientation, fader_length),
spin (*adj, 0, 2) spin (*adj, 0, 2)
{ {
spin.set_name ("SliderControllerValue"); spin.set_name ("SliderControllerValue");
@ -55,11 +60,11 @@ SliderController::on_button_press_event (GdkEventButton *ev)
return PixFader::on_button_press_event (ev); return PixFader::on_button_press_event (ev);
} }
VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int fader_length, Gtk::Adjustment *adj, int fader_length,
bool with_numeric) bool with_numeric)
: SliderController (image, adj, VERT, fader_length) : SliderController (image, image_desensitised, adj, VERT, fader_length)
{ {
if (with_numeric) { if (with_numeric) {
spin_frame.add (spin); spin_frame.add (spin);
@ -70,11 +75,11 @@ VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image,
} }
} }
HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> image, HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> image, Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int fader_length, Gtk::Adjustment *adj, int fader_length,
bool with_numeric) bool with_numeric)
: SliderController (image, adj, HORIZ, fader_length) : SliderController (image, image_desensitised, adj, HORIZ, fader_length)
{ {
if (with_numeric) { if (with_numeric) {
spin_frame.add (spin); spin_frame.add (spin);