2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2014-09-01 16:02:51 -04:00
|
|
|
Copyright (C) 2006 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
$Id: fastmeter.h 570 2006-06-07 21:21:21Z sampo $
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
2014-09-01 16:02:51 -04:00
|
|
|
#include <assert.h>
|
2013-01-16 21:32:48 -05:00
|
|
|
|
2013-01-24 16:58:07 -05:00
|
|
|
#include "pbd/stacktrace.h"
|
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
#include "gtkmm2ext/cairo_widget.h"
|
2009-12-10 18:01:45 -05:00
|
|
|
#include "gtkmm2ext/keyboard.h"
|
2014-09-01 16:02:51 -04:00
|
|
|
#include "gtkmm2ext/pixfader.h"
|
2012-12-07 17:38:49 -05:00
|
|
|
#include "gtkmm2ext/utils.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace std;
|
|
|
|
|
2014-09-03 09:35:11 -04:00
|
|
|
#define CORNER_RADIUS 2.5
|
2014-01-05 07:07:31 -05:00
|
|
|
#define CORNER_SIZE 2
|
|
|
|
#define CORNER_OFFSET 1
|
2014-09-03 09:35:11 -04:00
|
|
|
#define FADER_RESERVE 6
|
2012-12-07 17:38:49 -05:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
std::list<PixFader::FaderImage*> PixFader::_patterns;
|
|
|
|
|
2013-01-11 13:33:57 -05:00
|
|
|
PixFader::PixFader (Gtk::Adjustment& adj, int orientation, int fader_length, int fader_girth)
|
2014-09-04 20:24:19 -04:00
|
|
|
: _layout (0)
|
|
|
|
, _tweaks (Tweaks(0))
|
|
|
|
, _adjustment (adj)
|
|
|
|
, _text_width (0)
|
|
|
|
, _text_height (0)
|
2014-09-01 22:46:34 -04:00
|
|
|
, _span (fader_length)
|
|
|
|
, _girth (fader_girth)
|
2014-09-02 10:00:24 -04:00
|
|
|
, _min_span (fader_length)
|
|
|
|
, _min_girth (fader_girth)
|
2013-01-10 10:25:11 -05:00
|
|
|
, _orien (orientation)
|
2014-09-01 22:46:34 -04:00
|
|
|
, _pattern (0)
|
2013-01-11 13:33:57 -05:00
|
|
|
, _hovering (false)
|
2014-09-01 22:46:34 -04:00
|
|
|
, _last_drawn (-1)
|
|
|
|
, _dragging (false)
|
|
|
|
, _centered_text (true)
|
2014-08-29 22:16:18 -04:00
|
|
|
, _current_parent (0)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2014-09-04 20:24:19 -04:00
|
|
|
_default_value = _adjustment.get_value();
|
2013-01-11 13:33:57 -05:00
|
|
|
update_unity_position ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
add_events (
|
|
|
|
Gdk::BUTTON_PRESS_MASK
|
|
|
|
| Gdk::BUTTON_RELEASE_MASK
|
|
|
|
| Gdk::POINTER_MOTION_MASK
|
|
|
|
| Gdk::SCROLL_MASK
|
|
|
|
| Gdk::ENTER_NOTIFY_MASK
|
|
|
|
| Gdk::LEAVE_NOTIFY_MASK
|
|
|
|
);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
|
|
|
|
_adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
|
2014-01-03 23:29:06 -05:00
|
|
|
|
|
|
|
if (_orien == VERT) {
|
2014-09-01 22:46:34 -04:00
|
|
|
DrawingArea::set_size_request(_girth, _span);
|
2014-01-03 23:29:06 -05:00
|
|
|
} else {
|
2014-09-01 22:46:34 -04:00
|
|
|
DrawingArea::set_size_request(_span, _girth);
|
2014-01-03 23:29:06 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PixFader::~PixFader ()
|
|
|
|
{
|
2014-08-30 14:58:03 -04:00
|
|
|
if (_parent_style_change) _parent_style_change.disconnect();
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_layout) _layout.clear (); // drop reference to existing layout
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_pattern_t*
|
|
|
|
PixFader::find_pattern (double afr, double afg, double afb,
|
|
|
|
double abr, double abg, double abb,
|
|
|
|
int w, int h)
|
|
|
|
{
|
|
|
|
for (list<FaderImage*>::iterator f = _patterns.begin(); f != _patterns.end(); ++f) {
|
|
|
|
if ((*f)->matches (afr, afg, afb, abr, abg, abb, w, h)) {
|
|
|
|
return (*f)->pattern;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::create_patterns ()
|
|
|
|
{
|
|
|
|
Gdk::Color c = get_style()->get_fg (get_state());
|
|
|
|
float fr, fg, fb;
|
|
|
|
float br, bg, bb;
|
|
|
|
|
|
|
|
fr = c.get_red_p ();
|
|
|
|
fg = c.get_green_p ();
|
|
|
|
fb = c.get_blue_p ();
|
|
|
|
|
|
|
|
c = get_style()->get_bg (get_state());
|
|
|
|
|
|
|
|
br = c.get_red_p ();
|
|
|
|
bg = c.get_green_p ();
|
|
|
|
bb = c.get_blue_p ();
|
|
|
|
|
|
|
|
cairo_surface_t* surface;
|
|
|
|
cairo_t* tc = 0;
|
|
|
|
|
|
|
|
if (get_width() <= 1 || get_height() <= 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if ((_pattern = find_pattern (fr, fg, fb, br, bg, bb, get_width(), get_height())) != 0) {
|
2014-09-01 16:02:51 -04:00
|
|
|
/* found it - use it */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_orien == VERT) {
|
|
|
|
|
|
|
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, get_width(), get_height() * 2.0);
|
|
|
|
tc = cairo_create (surface);
|
|
|
|
|
|
|
|
/* paint background + border */
|
|
|
|
|
|
|
|
cairo_pattern_t* shade_pattern = cairo_pattern_create_linear (0.0, 0.0, get_width(), 0);
|
2014-09-02 16:58:55 -04:00
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0, br*0.4,bg*0.4,bb*0.4, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.25, br*0.6,bg*0.6,bb*0.6, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 1, br*0.8,bg*0.8,bb*0.8, 1.0);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_set_source (tc, shade_pattern);
|
|
|
|
cairo_rectangle (tc, 0, 0, get_width(), get_height() * 2.0);
|
|
|
|
cairo_fill (tc);
|
|
|
|
|
|
|
|
cairo_pattern_destroy (shade_pattern);
|
|
|
|
|
|
|
|
/* paint lower shade */
|
|
|
|
|
|
|
|
shade_pattern = cairo_pattern_create_linear (0.0, 0.0, get_width() - 2 - CORNER_OFFSET , 0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0, fr*0.8,fg*0.8,fb*0.8, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 1, fr*0.6,fg*0.6,fb*0.6, 1.0);
|
|
|
|
cairo_set_source (tc, shade_pattern);
|
|
|
|
Gtkmm2ext::rounded_top_half_rectangle (tc, CORNER_OFFSET, get_height() + CORNER_OFFSET,
|
|
|
|
get_width() - CORNER_SIZE, get_height(), CORNER_RADIUS);
|
|
|
|
cairo_fill (tc);
|
|
|
|
|
|
|
|
cairo_pattern_destroy (shade_pattern);
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
_pattern = cairo_pattern_create_for_surface (surface);
|
2014-09-01 16:02:51 -04:00
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, get_width() * 2.0, get_height());
|
|
|
|
tc = cairo_create (surface);
|
|
|
|
|
|
|
|
/* paint right shade (background section)*/
|
|
|
|
|
|
|
|
cairo_pattern_t* shade_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
|
2014-09-02 16:58:55 -04:00
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0, br*0.4,bg*0.4,bb*0.4, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.25, br*0.6,bg*0.6,bb*0.6, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 1, br*0.8,bg*0.8,bb*0.8, 1.0);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_set_source (tc, shade_pattern);
|
|
|
|
cairo_rectangle (tc, 0, 0, get_width() * 2.0, get_height());
|
|
|
|
cairo_fill (tc);
|
|
|
|
|
|
|
|
/* paint left shade (active section/foreground) */
|
|
|
|
|
|
|
|
shade_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 0, fr*0.8,fg*0.8,fb*0.8, 1.0);
|
|
|
|
cairo_pattern_add_color_stop_rgba (shade_pattern, 1, fr*0.6,fg*0.6,fb*0.6, 1.0);
|
|
|
|
cairo_set_source (tc, shade_pattern);
|
|
|
|
Gtkmm2ext::rounded_right_half_rectangle (tc, CORNER_OFFSET, CORNER_OFFSET,
|
|
|
|
get_width() - CORNER_OFFSET, get_height() - CORNER_SIZE, CORNER_RADIUS);
|
|
|
|
cairo_fill (tc);
|
|
|
|
cairo_pattern_destroy (shade_pattern);
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
_pattern = cairo_pattern_create_for_surface (surface);
|
2014-09-01 16:02:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* cache it for others to use */
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
_patterns.push_back (new FaderImage (_pattern, fr, fg, fb, br, bg, bb, get_width(), get_height()));
|
2014-09-01 16:02:51 -04:00
|
|
|
|
|
|
|
cairo_destroy (tc);
|
|
|
|
cairo_surface_destroy (surface);
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
bool
|
2013-01-11 13:33:57 -05:00
|
|
|
PixFader::on_expose_event (GdkEventExpose* ev)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2012-12-07 17:38:49 -05:00
|
|
|
Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
|
|
|
|
cairo_t* cr = context->cobj();
|
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
// clip to expose area
|
2014-08-29 22:16:18 -04:00
|
|
|
cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_clip (cr);
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if (!_pattern) {
|
2014-09-01 16:02:51 -04:00
|
|
|
create_patterns();
|
|
|
|
}
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if (!_pattern) {
|
2014-09-01 16:02:51 -04:00
|
|
|
/* this isn't supposed to be happen, but some wackiness whereby
|
|
|
|
* the pixfader ends up with a 1xN or Nx1 size allocation
|
|
|
|
* leads to it. the basic wackiness needs fixing but we
|
|
|
|
* shouldn't crash. just fill in the expose area with
|
|
|
|
* our bg color.
|
|
|
|
*/
|
2014-08-29 22:16:18 -04:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_bg (get_state()), 1);
|
|
|
|
cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
|
|
|
|
cairo_fill (cr);
|
|
|
|
return true;
|
|
|
|
}
|
2013-01-24 08:15:20 -05:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
OnExpose();
|
2014-09-01 16:02:51 -04:00
|
|
|
int ds = display_span ();
|
|
|
|
const float w = get_width();
|
|
|
|
const float h = get_height();
|
2012-12-07 17:38:49 -05:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
CairoWidget::set_source_rgb_a (cr, get_parent_bg(), 1);
|
2014-01-05 07:07:31 -05:00
|
|
|
cairo_rectangle (cr, 0, 0, w, h);
|
|
|
|
cairo_fill(cr);
|
|
|
|
|
2014-09-02 10:00:24 -04:00
|
|
|
cairo_set_line_width (cr, 2);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_set_source_rgba (cr, 0, 0, 0, 1.0);
|
|
|
|
|
|
|
|
cairo_matrix_t matrix;
|
2014-09-03 14:01:11 -04:00
|
|
|
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
|
2014-09-02 10:00:24 -04:00
|
|
|
// we use a 'trick' here: The stoke is off by .5px but filling the interior area
|
|
|
|
// after a stroke of 2px width results in an outline of 1px
|
2014-09-03 14:01:11 -04:00
|
|
|
cairo_stroke_preserve(cr);
|
2009-12-04 12:45:11 -05:00
|
|
|
|
|
|
|
if (_orien == VERT) {
|
2013-01-10 11:25:31 -05:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
if (ds > h - FADER_RESERVE - CORNER_OFFSET) {
|
|
|
|
ds = h - FADER_RESERVE - CORNER_OFFSET;
|
2014-08-27 12:58:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!CairoWidget::flat_buttons() ) {
|
2014-09-01 22:46:34 -04:00
|
|
|
cairo_set_source (cr, _pattern);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_matrix_init_translate (&matrix, 0, (h - ds));
|
2014-09-01 22:46:34 -04:00
|
|
|
cairo_pattern_set_matrix (_pattern, &matrix);
|
2014-09-01 16:02:51 -04:00
|
|
|
} else {
|
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_bg (get_state()), 1);
|
2014-08-27 12:58:09 -04:00
|
|
|
cairo_fill (cr);
|
2014-09-01 16:02:51 -04:00
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_fg (get_state()), 1);
|
|
|
|
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, ds + CORNER_OFFSET,
|
|
|
|
w - CORNER_SIZE, h - ds - CORNER_SIZE, CORNER_RADIUS);
|
2013-01-11 13:33:57 -05:00
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_fill (cr);
|
|
|
|
|
2009-12-04 12:45:11 -05:00
|
|
|
} else {
|
2013-01-10 11:25:31 -05:00
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
if (ds < FADER_RESERVE) {
|
|
|
|
ds = FADER_RESERVE;
|
2014-08-27 12:58:09 -04:00
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
assert(ds <= w);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* if ds == w, the pattern does not need to be translated
|
|
|
|
* if ds == 0 (or FADER_RESERVE), the pattern needs to be moved
|
|
|
|
* w to the left, which is -w in pattern space, and w in user space
|
|
|
|
* if ds == 10, then the pattern needs to be moved w - 10
|
|
|
|
* to the left, which is -(w-10) in pattern space, which
|
|
|
|
* is (w - 10) in user space
|
|
|
|
* thus: translation = (w - ds)
|
|
|
|
*/
|
2014-08-27 12:58:09 -04:00
|
|
|
|
|
|
|
if (!CairoWidget::flat_buttons() ) {
|
2014-09-01 22:46:34 -04:00
|
|
|
cairo_set_source (cr, _pattern);
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_matrix_init_translate (&matrix, w - ds, 0);
|
2014-09-01 22:46:34 -04:00
|
|
|
cairo_pattern_set_matrix (_pattern, &matrix);
|
2014-09-01 16:02:51 -04:00
|
|
|
} else {
|
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_bg (get_state()), 1);
|
2014-08-27 12:58:09 -04:00
|
|
|
cairo_fill (cr);
|
2014-09-01 16:02:51 -04:00
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_fg (get_state()), 1);
|
|
|
|
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET,
|
2014-09-02 10:00:24 -04:00
|
|
|
ds - CORNER_SIZE, h - CORNER_SIZE, CORNER_RADIUS);
|
2013-01-11 13:33:57 -05:00
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
cairo_fill (cr);
|
2012-12-07 17:38:49 -05:00
|
|
|
}
|
2014-08-27 12:58:09 -04:00
|
|
|
|
2012-12-10 15:08:36 -05:00
|
|
|
/* draw the unity-position line if it's not at either end*/
|
2014-09-04 20:24:19 -04:00
|
|
|
if (!(_tweaks & NoShowUnityLine) && _unity_loc > CORNER_RADIUS) {
|
2013-07-08 11:55:29 -04:00
|
|
|
context->set_line_width (1);
|
2014-09-01 16:02:51 -04:00
|
|
|
context->set_line_cap (Cairo::LINE_CAP_ROUND);
|
2013-07-09 18:02:17 -04:00
|
|
|
Gdk::Color c = get_style()->get_fg (Gtk::STATE_ACTIVE);
|
2014-09-02 10:00:24 -04:00
|
|
|
context->set_source_rgba (c.get_red_p() * 1.5, c.get_green_p() * 1.5, c.get_blue_p() * 1.5, 0.85);
|
|
|
|
if (_orien == VERT) {
|
|
|
|
if (_unity_loc < h - CORNER_RADIUS) {
|
2014-09-01 22:46:34 -04:00
|
|
|
context->move_to (1.5, _unity_loc + CORNER_OFFSET + .5);
|
|
|
|
context->line_to (_girth - 1.5, _unity_loc + CORNER_OFFSET + .5);
|
2013-07-09 18:02:17 -04:00
|
|
|
context->stroke ();
|
2013-01-10 11:25:31 -05:00
|
|
|
}
|
2013-07-09 18:02:17 -04:00
|
|
|
} else {
|
2014-09-02 10:00:24 -04:00
|
|
|
if (_unity_loc < w - CORNER_RADIUS) {
|
2014-09-01 22:46:34 -04:00
|
|
|
context->move_to (_unity_loc - CORNER_OFFSET + .5, 1.5);
|
|
|
|
context->line_to (_unity_loc - CORNER_OFFSET + .5, _girth - 1.5);
|
2013-07-09 18:02:17 -04:00
|
|
|
context->stroke ();
|
2013-01-10 11:25:31 -05:00
|
|
|
}
|
2012-12-10 15:08:36 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2014-08-27 12:58:09 -04:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_layout && !_text.empty() && _orien == HORIZ) {
|
|
|
|
cairo_save (cr);
|
|
|
|
if (_centered_text) {
|
|
|
|
/* center text */
|
|
|
|
cairo_move_to (cr, (w - _text_width)/2.0, h/2.0 - _text_height/2.0);
|
|
|
|
} else if (ds > .5 * w) {
|
|
|
|
cairo_move_to (cr, CORNER_OFFSET + 3, h/2.0 - _text_height/2.0);
|
|
|
|
cairo_set_operator(cr, CAIRO_OPERATOR_XOR);
|
|
|
|
} else {
|
|
|
|
cairo_move_to (cr, w - _text_width - CORNER_OFFSET - 3, h/2.0 - _text_height/2.0);
|
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
CairoWidget::set_source_rgb_a (cr, get_style()->get_text (get_state()), 1);
|
2012-12-10 15:08:36 -05:00
|
|
|
pango_cairo_show_layout (cr, _layout->gobj());
|
2014-09-01 22:46:34 -04:00
|
|
|
cairo_restore (cr);
|
2014-09-01 16:02:51 -04:00
|
|
|
}
|
|
|
|
|
2013-07-12 13:07:07 -04:00
|
|
|
if (!get_sensitive()) {
|
2014-01-05 07:07:31 -05:00
|
|
|
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
|
2013-07-12 13:07:07 -04:00
|
|
|
cairo_set_source_rgba (cr, 0.505, 0.517, 0.525, 0.4);
|
|
|
|
cairo_fill (cr);
|
|
|
|
} else if (_hovering) {
|
2014-01-05 07:07:31 -05:00
|
|
|
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
|
2013-07-12 13:07:07 -04:00
|
|
|
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.1);
|
|
|
|
cairo_fill (cr);
|
|
|
|
}
|
2012-12-07 17:38:49 -05:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
_last_drawn = ds;
|
2011-02-08 14:19:55 -05:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::on_size_request (GtkRequisition* req)
|
|
|
|
{
|
2013-01-10 10:25:11 -05:00
|
|
|
if (_orien == VERT) {
|
2014-09-02 10:00:24 -04:00
|
|
|
req->width = (_min_girth ? _min_girth : -1);
|
|
|
|
req->height = (_min_span ? _min_span : -1);
|
2013-01-10 10:25:11 -05:00
|
|
|
} else {
|
2014-09-02 10:00:24 -04:00
|
|
|
req->height = (_min_girth ? _min_girth : -1);
|
|
|
|
req->width = (_min_span ? _min_span : -1);
|
2013-01-10 10:25:11 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
void
|
|
|
|
PixFader::on_size_allocate (Gtk::Allocation& alloc)
|
|
|
|
{
|
|
|
|
DrawingArea::on_size_allocate(alloc);
|
2013-01-10 10:25:11 -05:00
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
if (_orien == VERT) {
|
2014-09-01 22:46:34 -04:00
|
|
|
_girth = alloc.get_width ();
|
|
|
|
_span = alloc.get_height ();
|
2012-12-07 17:38:49 -05:00
|
|
|
} else {
|
2014-09-01 22:46:34 -04:00
|
|
|
_girth = alloc.get_height ();
|
|
|
|
_span = alloc.get_width ();
|
2012-12-07 17:38:49 -05:00
|
|
|
}
|
|
|
|
|
2014-09-01 16:02:51 -04:00
|
|
|
if (is_realized()) {
|
|
|
|
/* recreate patterns in case we've changed size */
|
|
|
|
create_patterns ();
|
|
|
|
}
|
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
update_unity_position ();
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
bool
|
|
|
|
PixFader::on_button_press_event (GdkEventButton* ev)
|
|
|
|
{
|
2011-01-10 19:03:12 -05:00
|
|
|
if (ev->type != GDK_BUTTON_PRESS) {
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_dragging) {
|
|
|
|
remove_modal_grab();
|
|
|
|
_dragging = false;
|
|
|
|
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
|
|
|
StopGesture ();
|
|
|
|
}
|
2014-09-04 20:24:19 -04:00
|
|
|
return (_tweaks & NoButtonForward) ? true : false;
|
2011-01-10 19:03:12 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2011-01-29 20:39:57 -05:00
|
|
|
if (ev->button != 1 && ev->button != 2) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_modal_grab ();
|
2014-09-01 22:46:34 -04:00
|
|
|
StartGesture ();
|
|
|
|
_grab_loc = (_orien == VERT) ? ev->y : ev->x;
|
|
|
|
_grab_start = (_orien == VERT) ? ev->y : ev->x;
|
|
|
|
_grab_window = ev->window;
|
|
|
|
_dragging = true;
|
2013-01-04 11:02:12 -05:00
|
|
|
gdk_pointer_grab(ev->window,false,
|
|
|
|
GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
|
|
|
|
NULL,NULL,ev->time);
|
2011-01-29 20:39:57 -05:00
|
|
|
|
|
|
|
if (ev->button == 2) {
|
|
|
|
set_adjustment_from_event (ev);
|
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
return (_tweaks & NoButtonForward) ? true : false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
PixFader::on_button_release_event (GdkEventButton* ev)
|
|
|
|
{
|
2014-09-02 10:00:24 -04:00
|
|
|
double ev_pos = (_orien == VERT) ? ev->y : ev->x;
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
switch (ev->button) {
|
|
|
|
case 1:
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_dragging) {
|
2008-06-02 17:41:35 -04:00
|
|
|
remove_modal_grab();
|
2014-09-01 22:46:34 -04:00
|
|
|
_dragging = false;
|
2013-01-04 11:02:12 -05:00
|
|
|
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
2014-09-01 22:46:34 -04:00
|
|
|
StopGesture ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-12-10 16:52:55 -05:00
|
|
|
if (!_hovering) {
|
2014-09-06 06:46:03 -04:00
|
|
|
if (!(_tweaks & NoVerticalScroll)) {
|
|
|
|
Keyboard::magic_widget_drop_focus();
|
|
|
|
}
|
2012-12-10 16:52:55 -05:00
|
|
|
queue_draw ();
|
|
|
|
}
|
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if (ev_pos == _grab_start) {
|
2008-06-02 17:41:35 -04:00
|
|
|
/* no motion - just a click */
|
2014-09-02 10:00:24 -04:00
|
|
|
const double slider_pos = display_span();
|
|
|
|
ev_pos = rint(ev_pos);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-12-10 18:01:45 -05:00
|
|
|
if (ev->state & Keyboard::TertiaryModifier) {
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (_default_value);
|
2012-05-31 14:04:47 -04:00
|
|
|
} else if (ev->state & Keyboard::GainFineScaleModifier) {
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (_adjustment.get_lower());
|
2014-09-02 10:00:24 -04:00
|
|
|
} else if (ev_pos == slider_pos) {
|
2014-09-01 22:46:34 -04:00
|
|
|
; // click on current position, no move.
|
2014-09-02 10:00:24 -04:00
|
|
|
} else if ((_orien == VERT && ev_pos < slider_pos) || (_orien == HORIZ && ev_pos > slider_pos)) {
|
2008-06-02 17:41:35 -04:00
|
|
|
/* above the current display height, remember X Window coords */
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (_adjustment.get_value() + _adjustment.get_step_increment());
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (_adjustment.get_value() - _adjustment.get_step_increment());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
2013-01-16 21:41:11 -05:00
|
|
|
return true;
|
2014-09-01 16:02:51 -04:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
break;
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
case 2:
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_dragging) {
|
2008-06-02 17:41:35 -04:00
|
|
|
remove_modal_grab();
|
2014-09-01 22:46:34 -04:00
|
|
|
_dragging = false;
|
|
|
|
StopGesture ();
|
2011-01-29 20:39:57 -05:00
|
|
|
set_adjustment_from_event (ev);
|
2013-01-04 11:02:12 -05:00
|
|
|
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
2013-01-16 21:41:11 -05:00
|
|
|
return true;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
PixFader::on_scroll_event (GdkEventScroll* ev)
|
|
|
|
{
|
|
|
|
double scale;
|
|
|
|
bool ret = false;
|
|
|
|
|
2012-05-31 14:04:47 -04:00
|
|
|
if (ev->state & Keyboard::GainFineScaleModifier) {
|
|
|
|
if (ev->state & Keyboard::GainExtraFineScaleModifier) {
|
2008-06-02 17:41:35 -04:00
|
|
|
scale = 0.01;
|
|
|
|
} else {
|
|
|
|
scale = 0.05;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
scale = 0.25;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_orien == VERT) {
|
|
|
|
switch (ev->direction) {
|
2014-09-04 20:24:19 -04:00
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
_adjustment.set_value (_adjustment.get_value() + (_adjustment.get_page_increment() * scale));
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
_adjustment.set_value (_adjustment.get_value() - (_adjustment.get_page_increment() * scale));
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
2014-09-04 20:24:19 -04:00
|
|
|
int dir = ev->direction;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
if (ev->state & Keyboard::ScrollHorizontalModifier || !(_tweaks & NoVerticalScroll)) {
|
|
|
|
if (ev->direction == GDK_SCROLL_UP) dir = GDK_SCROLL_RIGHT;
|
|
|
|
if (ev->direction == GDK_SCROLL_DOWN) dir = GDK_SCROLL_LEFT;
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
switch (dir) {
|
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
_adjustment.set_value (_adjustment.get_value() + (_adjustment.get_page_increment() * scale));
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
_adjustment.set_value (_adjustment.get_value() - (_adjustment.get_page_increment() * scale));
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
PixFader::on_motion_notify_event (GdkEventMotion* ev)
|
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_dragging) {
|
2011-01-29 20:39:47 -05:00
|
|
|
double scale = 1.0;
|
|
|
|
double const ev_pos = (_orien == VERT) ? ev->y : ev->x;
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
if (ev->window != _grab_window) {
|
|
|
|
_grab_loc = ev_pos;
|
|
|
|
_grab_window = ev->window;
|
2008-06-02 17:41:35 -04:00
|
|
|
return true;
|
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2012-05-31 14:04:47 -04:00
|
|
|
if (ev->state & Keyboard::GainFineScaleModifier) {
|
|
|
|
if (ev->state & Keyboard::GainExtraFineScaleModifier) {
|
2008-06-02 17:41:35 -04:00
|
|
|
scale = 0.05;
|
|
|
|
} else {
|
|
|
|
scale = 0.1;
|
|
|
|
}
|
|
|
|
}
|
2011-01-29 20:39:47 -05:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
double const delta = ev_pos - _grab_loc;
|
|
|
|
_grab_loc = ev_pos;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
double fract = (delta / _span);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
fract = min (1.0, fract);
|
|
|
|
fract = max (-1.0, fract);
|
|
|
|
|
|
|
|
// X Window is top->bottom for 0..Y
|
2014-09-01 16:02:51 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
if (_orien == VERT) {
|
|
|
|
fract = -fract;
|
|
|
|
}
|
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (_adjustment.get_value() + scale * fract * (_adjustment.get_upper() - _adjustment.get_lower()));
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::adjustment_changed ()
|
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
if (display_span() != _last_drawn) {
|
2008-06-02 17:41:35 -04:00
|
|
|
queue_draw ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-04 12:45:11 -05:00
|
|
|
/** @return pixel offset of the current value from the right or bottom of the fader */
|
2014-09-01 16:02:51 -04:00
|
|
|
int
|
2008-06-02 17:41:35 -04:00
|
|
|
PixFader::display_span ()
|
|
|
|
{
|
2014-09-04 20:24:19 -04:00
|
|
|
float fract = (_adjustment.get_value () - _adjustment.get_lower()) / ((_adjustment.get_upper() - _adjustment.get_lower()));
|
2014-09-01 16:02:51 -04:00
|
|
|
int ds;
|
|
|
|
if (_orien == VERT) {
|
2014-09-02 10:00:24 -04:00
|
|
|
ds = (int)rint (_span * (1.0 - fract));
|
2014-09-01 16:02:51 -04:00
|
|
|
} else {
|
2014-09-02 10:00:24 -04:00
|
|
|
ds = (int)rint (_span * fract);
|
2014-09-01 16:02:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return ds;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2011-08-03 14:41:16 -04:00
|
|
|
void
|
|
|
|
PixFader::update_unity_position ()
|
|
|
|
{
|
|
|
|
if (_orien == VERT) {
|
2014-09-04 20:24:19 -04:00
|
|
|
_unity_loc = (int) rint (_span * (1 - ((_default_value - _adjustment.get_lower()) / (_adjustment.get_upper() - _adjustment.get_lower())))) - 1;
|
2011-08-03 14:41:16 -04:00
|
|
|
} else {
|
2014-09-04 20:24:19 -04:00
|
|
|
_unity_loc = (int) rint ((_default_value - _adjustment.get_lower()) * _span / (_adjustment.get_upper() - _adjustment.get_lower()));
|
2009-12-04 12:45:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
queue_draw ();
|
|
|
|
}
|
2009-12-10 18:01:45 -05:00
|
|
|
|
|
|
|
bool
|
|
|
|
PixFader::on_enter_notify_event (GdkEventCrossing*)
|
|
|
|
{
|
2012-12-07 17:38:49 -05:00
|
|
|
_hovering = true;
|
2014-09-06 06:46:03 -04:00
|
|
|
if (!(_tweaks & NoVerticalScroll)) {
|
|
|
|
Keyboard::magic_widget_grab_focus ();
|
|
|
|
}
|
2012-12-07 17:38:49 -05:00
|
|
|
queue_draw ();
|
2009-12-10 18:01:45 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
PixFader::on_leave_notify_event (GdkEventCrossing*)
|
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
if (!_dragging) {
|
2012-12-10 16:52:55 -05:00
|
|
|
_hovering = false;
|
2014-09-06 06:46:03 -04:00
|
|
|
if (!(_tweaks & NoVerticalScroll)) {
|
|
|
|
Keyboard::magic_widget_drop_focus();
|
|
|
|
}
|
2012-12-10 16:52:55 -05:00
|
|
|
queue_draw ();
|
|
|
|
}
|
2009-12-10 18:01:45 -05:00
|
|
|
return false;
|
|
|
|
}
|
2011-01-29 20:39:57 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::set_adjustment_from_event (GdkEventButton* ev)
|
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
double fract = (_orien == VERT) ? (1.0 - (ev->y / _span)) : (ev->x / _span);
|
2011-01-29 20:39:57 -05:00
|
|
|
|
|
|
|
fract = min (1.0, fract);
|
|
|
|
fract = max (0.0, fract);
|
|
|
|
|
2014-09-04 20:24:19 -04:00
|
|
|
_adjustment.set_value (fract * (_adjustment.get_upper () - _adjustment.get_lower ()));
|
2011-01-29 20:39:57 -05:00
|
|
|
}
|
2011-08-03 14:41:16 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::set_default_value (float d)
|
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
_default_value = d;
|
2011-08-03 14:41:16 -04:00
|
|
|
update_unity_position ();
|
|
|
|
}
|
2012-12-10 15:08:36 -05:00
|
|
|
|
|
|
|
void
|
2014-09-04 20:24:19 -04:00
|
|
|
PixFader::set_tweaks (Tweaks t)
|
2014-09-02 10:00:24 -04:00
|
|
|
{
|
2014-09-04 20:24:19 -04:00
|
|
|
bool need_redraw = false;
|
|
|
|
if ((_tweaks & NoShowUnityLine) ^ (t & NoShowUnityLine)) {
|
|
|
|
need_redraw = true;
|
|
|
|
}
|
|
|
|
_tweaks = t;
|
|
|
|
if (need_redraw) {
|
|
|
|
queue_draw();
|
|
|
|
}
|
2014-09-02 10:00:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::set_text (const std::string& str, bool centered, bool expose)
|
2012-12-10 15:08:36 -05:00
|
|
|
{
|
2014-09-01 22:46:34 -04:00
|
|
|
if (_layout && _text == str) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!_layout && !str.empty()) {
|
2012-12-10 15:08:36 -05:00
|
|
|
_layout = Pango::Layout::create (get_pango_context());
|
2014-09-01 16:02:51 -04:00
|
|
|
}
|
2012-12-10 15:08:36 -05:00
|
|
|
|
2014-09-01 22:46:34 -04:00
|
|
|
_text = str;
|
|
|
|
_centered_text = centered;
|
2012-12-10 15:08:36 -05:00
|
|
|
if (_layout) {
|
|
|
|
_layout->set_text (str);
|
2013-01-17 17:33:08 -05:00
|
|
|
_layout->get_pixel_size (_text_width, _text_height);
|
2014-09-02 10:00:24 -04:00
|
|
|
// queue_resize ();
|
|
|
|
if (expose) queue_draw ();
|
2012-12-10 15:08:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-11 13:33:57 -05:00
|
|
|
void
|
|
|
|
PixFader::on_state_changed (Gtk::StateType old_state)
|
|
|
|
{
|
|
|
|
Widget::on_state_changed (old_state);
|
2014-09-01 16:02:51 -04:00
|
|
|
create_patterns ();
|
2014-01-05 07:07:31 -05:00
|
|
|
queue_draw ();
|
2013-01-11 13:33:57 -05:00
|
|
|
}
|
2013-01-21 11:10:39 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
PixFader::on_style_changed (const Glib::RefPtr<Gtk::Style>&)
|
|
|
|
{
|
|
|
|
if (_layout) {
|
|
|
|
std::string txt = _layout->get_text();
|
|
|
|
_layout.clear (); // drop reference to existing layout
|
2014-09-01 22:46:34 -04:00
|
|
|
_text = "";
|
2014-09-02 10:00:24 -04:00
|
|
|
set_text (txt, _centered_text, false);
|
2013-01-21 11:10:39 -05:00
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
/* patterns are cached and re-created as needed
|
|
|
|
* during 'expose' in the GUI thread */
|
2014-09-01 22:46:34 -04:00
|
|
|
_pattern = 0;
|
2014-01-05 07:07:31 -05:00
|
|
|
queue_draw ();
|
2013-01-21 11:10:39 -05:00
|
|
|
}
|
2014-08-29 22:16:18 -04:00
|
|
|
|
|
|
|
Gdk::Color
|
|
|
|
PixFader::get_parent_bg ()
|
|
|
|
{
|
2014-09-01 16:02:51 -04:00
|
|
|
Widget* parent = get_parent ();
|
2014-08-29 22:16:18 -04:00
|
|
|
|
|
|
|
while (parent) {
|
2014-09-01 16:02:51 -04:00
|
|
|
if (parent->get_has_window()) {
|
2014-08-29 22:16:18 -04:00
|
|
|
break;
|
|
|
|
}
|
2014-09-01 16:02:51 -04:00
|
|
|
parent = parent->get_parent();
|
2014-08-29 22:16:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (parent && parent->get_has_window()) {
|
|
|
|
if (_current_parent != parent) {
|
|
|
|
if (_parent_style_change) _parent_style_change.disconnect();
|
|
|
|
_current_parent = parent;
|
|
|
|
_parent_style_change = parent->signal_style_changed().connect (mem_fun (*this, &PixFader::on_style_changed));
|
|
|
|
}
|
|
|
|
return parent->get_style ()->get_bg (parent->get_state());
|
|
|
|
}
|
|
|
|
|
|
|
|
return get_style ()->get_bg (get_state());
|
|
|
|
}
|