style "track_controls_inactive"
{
- bg[NORMAL] = { 0.60, 0.60, 0.66 }
+ bg[NORMAL] = { 0.60, 0.20, 0.26 }
bg[ACTIVE] = { 0.60, 0.60, 0.66 }
bg[INSENSITIVE] = { 0.60, 0.60, 0.66 }
bg[SELECTED] = { 0.60, 0.60, 0.66 }
<Option name="button border" value="000000f0"/>
<Option name="processor prefader: fill start" value="873c3cff"/>
<Option name="processor prefader: fill end" value="542525ff"/>
- <Option name="processor prefader: fill start active" value="873c3cff"/>
- <Option name="processor prefader: fill end active" value="542525ff"/>
+ <Option name="processor prefader: fill start active" value="774c4cff"/>
+ <Option name="processor prefader: fill end active" value="603535ff"/>
<Option name="processor prefader: led" value="26550eff"/>
<Option name="processor prefader: led active" value="78cb4eff"/>
<Option name="processor prefader: text" value="aaaaa3ff"/>
<Option name="processor fader: fill start" value="5d90b0ff"/>
<Option name="processor fader: fill end" value="154c6eff"/>
<Option name="processor fader: fill start active" value="5d90b0ff"/>
- <Option name="processor fader: fill end active" value="154d6fff"/>
+ <Option name="processor fader: fill end active" value="256d8fff"/>
<Option name="processor fader: led" value="26550eff"/>
<Option name="processor fader: led active" value="78cb4eff"/>
<Option name="processor fader: text" value="aaaaa3ff"/>
<Option name="processor fader: text active" value="eeeeecff"/>
- <Option name="processor postfader: fill start" value="415947ff"/>
- <Option name="processor postfader: fill end" value="202d23ff"/>
- <Option name="processor postfader: fill start active" value="415947ff"/>
- <Option name="processor postfader: fill end active" value="202d23ff"/>
+ <Option name="processor postfader: fill start" value="354537ff"/>
+ <Option name="processor postfader: fill end" value="202823ff"/>
+ <Option name="processor postfader: fill start active" value="466452ff"/>
+ <Option name="processor postfader: fill end active" value="254528ff"/>
<Option name="processor postfader: led" value="26550eff"/>
<Option name="processor postfader: led active" value="78cb4eff"/>
<Option name="processor postfader: text" value="aaaaa3ff"/>
<Option name="processor control button: text" value="ffffffff"/>
<Option name="processor control button: text active" value="ffffffff"/>
<Option name="monitor button: fill start" value="5f5a58ff"/>
- <Option name="monitor button: fill end" value="3f3a38ff"/>
+ <Option name="monitor button: fill end" value="4f4a48ff"/>
<Option name="monitor button: fill start active" value="553500ff"/>
<Option name="monitor button: fill end active" value="e58505ff"/>
<Option name="monitor button: led" value="660000ff"/>
<Option name="solo safe: text" value="c7c7d8ff"/>
<Option name="solo safe: text active" value="c8c8d9ff"/>
<Option name="monitor section cut: fill start" value="5f5a58ff"/>
- <Option name="monitor section cut: fill end" value="3f3a38ff"/>
+ <Option name="monitor section cut: fill end" value="4f4a48ff"/>
<Option name="monitor section cut: fill start active" value="5f4943ff"/>
<Option name="monitor section cut: fill end active" value="ffa500ff"/>
<Option name="monitor section cut: led" value="473812ff"/>
<Option name="monitor section cut: text" value="c7c7d8ff"/>
<Option name="monitor section cut: text active" value="000000ff"/>
<Option name="monitor section dim: fill start" value="5f5a58ff"/>
- <Option name="monitor section dim: fill end" value="3f3a38ff"/>
+ <Option name="monitor section dim: fill end" value="4f4a48ff"/>
<Option name="monitor section dim: fill start active" value="553500ff"/>
<Option name="monitor section dim: fill end active" value="e58505ff"/>
<Option name="monitor section dim: led active" value="78cb4eff"/>
<Option name="monitor section dim: text" value="c8c8d9ff"/>
<Option name="monitor section dim: text active" value="c8c8d9ff"/>
<Option name="monitor section solo: fill start" value="5f5a58ff"/>
- <Option name="monitor section solo: fill end" value="3f3a38ff"/>
+ <Option name="monitor section solo: fill end" value="4f4a48ff"/>
<Option name="monitor section solo: fill start active" value="104506ff"/>
<Option name="monitor section solo: fill end active" value="4dbb00ff"/>
<Option name="monitor section solo: led" value="473812ff"/>
<Option name="monitor section solo: text" value="00000000"/>
<Option name="monitor section solo: text active" value="00000000"/>
<Option name="monitor section invert: fill start" value="5f5a58ff"/>
- <Option name="monitor section invert: fill end" value="3f3a38ff"/>
+ <Option name="monitor section invert: fill end" value="4f4a48ff"/>
<Option name="monitor section invert: fill start active" value="222260ff"/>
<Option name="monitor section invert: fill end active" value="4242d0ff"/>
<Option name="monitor section invert: led" value="473812ff"/>
<Option name="monitor section invert: text" value="00000000"/>
<Option name="monitor section invert: text active" value="00000000"/>
<Option name="monitor section mono: fill start" value="5f5a58ff"/>
- <Option name="monitor section mono: fill end" value="3f3a38ff"/>
+ <Option name="monitor section mono: fill end" value="4f4a48ff"/>
<Option name="monitor section mono: fill start active" value="222260ff"/>
<Option name="monitor section mono: fill end active" value="3232c0ff"/>
<Option name="monitor section mono: led" value="473812ff"/>
<Option name="mute button: fill start" value="565659ff"/>
<Option name="mute button: fill end" value="484853ff"/>
<Option name="mute button: fill start active" value="5f4943ff"/>
- <Option name="mute button: fill end active" value="ffa500ff"/>
+ <Option name="mute button: fill end active" value="ffff00ff"/>
<Option name="mute button: led" value="00000000"/>
<Option name="mute button: led active" value="00000000"/>
- <Option name="mute button: text" value="bfbfbfff"/>
+ <Option name="mute button: text" value="bfbfafff"/>
<Option name="mute button: text active" value="191919ff"/>
<Option name="solo button: fill start" value="565659ff"/>
<Option name="solo button: fill end" value="484853ff"/>
<Option name="solo button: fill end active" value="4dbb00ff"/>
<Option name="solo button: led" value="00000000"/>
<Option name="solo button: led active" value="00000000"/>
- <Option name="solo button: text" value="bfbfbfff"/>
+ <Option name="solo button: text" value="afbfafff"/>
<Option name="solo button: text active" value="191919ff"/>
<Option name="invert button: fill start" value="565659ff"/>
<Option name="invert button: fill end" value="484853ff"/>
<Option name="route button: fill end active" value="121212ff"/>
<Option name="route button: led" value="4f3300ff"/>
<Option name="route button: led active" value="ffa500ff"/>
- <Option name="route button: text" value="c7c7d8ff"/>
- <Option name="route button: text active" value="c8c8d9ff"/>
+ <Option name="route button: text" value="bfbfbfff"/>
+ <Option name="route button: text active" value="191919ff"/>
<Option name="mixer strip button: fill start" value="565659ff"/>
<Option name="mixer strip button: fill end" value="484853ff"/>
<Option name="mixer strip button: fill start active" value="5f4943ff"/>
widget "*PluginUIClickBox" style:highest "medium_bold_entry"
widget "*PluginUIClickBox*" style:highest "medium_bold_entry"
widget "*PluginSlider" style:highest "plugin_slider"
+widget "*GainFader" style:highest "plugin_slider"
widget "*MixerTrackCommentArea" style:highest "option_entry"
widget "*MixerPanZone" style:highest "pan_zone"
widget "*LHSList" style:highest "treeview_display"
{
_display.set_size_request (100, -1);
_display.set_rules_hint (true);
- _display.set_name ("LHSList");
+ _display.set_name ("EditGroupList");
/* Try to prevent single mouse presses from initiating edits.
This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
_display.get_selection()->set_mode (SELECTION_SINGLE);
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
_display.set_reorderable (true);
- _display.set_name (X_("LHSList"));
+ _display.set_name (X_("EditGroupList"));
_display.set_rules_hint (true);
_display.set_size_request (100, -1);
_display.add_object_drag (_columns.route.index(), "routes");
peak_display.set_label (_("-inf"));
peak_display.unset_flags (Gtk::CAN_FOCUS);
- gain_automation_style_button.set_name ("MixerAutomationModeButton");
- gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+ gain_automation_style_button.set_name ("mixer strip button");
+ gain_automation_state_button.set_name ("mixer strip button");
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed));
ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false));
DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true));
+
+// PBD::ScopedConnection _config_connection;
+// Config->ParameterChanged.connect ( _config_connection, MISSING_INVALIDATOR, boost::bind(&GainMeterBase::set_flat_buttons, this, _1), gui_context() );
+}
+
+void
+GainMeterBase::set_flat_buttons ()
+{
+printf("set_flat_butt\n");
+// gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
}
GainMeterBase::~GainMeterBase ()
{
switch (_width) {
case Wide:
- gain_automation_style_button.set_label (astyle_string(_amp->gain_control()->alist()->automation_style()));
+ gain_automation_style_button.set_text (astyle_string(_amp->gain_control()->alist()->automation_style()));
break;
case Narrow:
- gain_automation_style_button.set_label (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
+ gain_automation_style_button.set_text (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
break;
}
}
switch (_width) {
case Wide:
- gain_automation_state_button.set_label (astate_string(_amp->gain_control()->alist()->automation_state()));
+ gain_automation_state_button.set_text (astate_string(_amp->gain_control()->alist()->automation_state()));
break;
case Narrow:
- gain_automation_state_button.set_label (short_astate_string(_amp->gain_control()->alist()->automation_state()));
+ gain_automation_state_button.set_text (short_astate_string(_amp->gain_control()->alist()->automation_state()));
break;
}
, gain_display_box(true, 0)
, hbox(true, 2)
{
- gain_display_box.pack_start (gain_display, true, true);
+// gain_display_box.pack_start (gain_display, true, true);
meter_metric_area.set_name ("AudioTrackMetrics");
set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
- gain_automation_style_button.set_name ("MixerAutomationModeButton");
- gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+ gain_automation_style_button.set_name ("mixer strip button");
+ gain_automation_state_button.set_name ("mixer strip button");
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
hbox.remove (meter_alignment);
}
- if (peak_display.get_parent()) {
- gain_display_box.remove (peak_display);
- }
+// if (peak_display.get_parent()) {
+// gain_display_box.remove (peak_display);
+// }
- if (gain_automation_state_button.get_parent()) {
- fader_vbox->remove (gain_automation_state_button);
- }
+// if (gain_automation_state_button.get_parent()) {
+// fader_vbox->remove (gain_automation_state_button);
+// }
GainMeterBase::set_controls (r, meter, amp);
pack some route-dependent stuff.
*/
- gain_display_box.pack_end (peak_display, true, true);
+// gain_display_box.pack_end (peak_display, true, true);
hbox.pack_start (meter_alignment, true, true);
- if (r && !r->is_hidden()) {
- fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
- }
+// if (r && !r->is_hidden()) {
+// fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
+// }
setup_meters ();
hbox.show_all ();
#include "ardour/types.h"
#include "ardour/session_handle.h"
+#include "ardour_button.h"
+
#include "gtkmm2ext/click_box.h"
#include "gtkmm2ext/focus_entry.h"
#include "gtkmm2ext/slider_controller.h"
void set_meter_strip_name (const char * name);
void set_fader_name (const char * name);
+ void set_flat_buttons ();
+
virtual void setup_meters (int len=0);
boost::shared_ptr<PBD::Controllable> get_controllable();
sigc::connection gain_watching;
- Gtk::Button gain_automation_style_button;
- Gtk::ToggleButton gain_automation_state_button;
+ ArdourButton gain_automation_style_button;
+ ArdourButton gain_automation_state_button;
Gtk::Menu gain_astate_menu;
Gtk::Menu gain_astyle_menu;
bottom_button_table.set_spacings (2);
bottom_button_table.set_homogeneous (true);
- bottom_button_table.attach (group_button, 0, 1, 0, 1);
+// bottom_button_table.attach (group_button, 0, 1, 0, 1);
+ bottom_button_table.attach (gpm.gain_automation_state_button, 0, 1, 0, 1);
name_button.set_name ("mixer strip button");
name_button.set_text (" "); /* non empty text, forces creation of the layout */
revert_to_default_display ();
+ if (gpm.gain_display.get_parent()) {
+ middle_button_table.remove (gpm.gain_display);
+ }
+
+ if (gpm.peak_display.get_parent()) {
+ middle_button_table.remove (gpm.peak_display);
+ }
+
if (solo_button->get_parent()) {
middle_button_table.remove (*solo_button);
}
}
gpm.reset_peak_display ();
+ gpm.gain_display.show ();
+ gpm.peak_display.show ();
width_button.show();
width_hide_box.show();
name_button.show();
_comment_button.show();
group_button.show();
+ gpm.gain_automation_state_button.show();
parameter_changed ("mixer-strip-visibility");
switch (w) {
case Wide:
+ if (!gpm.peak_display.get_parent()) {
+ middle_button_table.attach (gpm.peak_display,1,2,1,2);
+ }
+ if (gpm.gain_display.get_parent()) {
+ middle_button_table.remove (gpm.gain_display);
+ }
+ if (!gpm.gain_display.get_parent()) {
+ middle_button_table.attach (gpm.gain_display,0,1,1,2);
+ }
+
if (show_sends_button) {
show_sends_button->set_text (_("Aux\nSends"));
show_sends_button->layout()->set_alignment (Pango::ALIGN_CENTER);
}
- ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
+ gpm.gain_automation_style_button.set_text (
gpm.astyle_string(gain_automation->automation_style()));
- ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
+ gpm.gain_automation_state_button.set_text (
gpm.astate_string(gain_automation->automation_state()));
if (_route->panner()) {
break;
case Narrow:
+ if (gpm.peak_display.get_parent()) {
+ middle_button_table.remove (gpm.peak_display);
+ }
+
+ if (gpm.gain_display.get_parent()) {
+ middle_button_table.remove (gpm.gain_display);
+ }
+ if (!gpm.gain_display.get_parent()) {
+ middle_button_table.attach (gpm.gain_display,0,2,1,2);
+ }
+
if (show_sends_button) {
show_sends_button->set_text (_("Snd"));
}
group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
group_display.get_column (0)->set_expand(true);
group_display.get_column (1)->set_expand(false);
- group_display.set_name ("LHSList");
+ group_display.set_name ("EditGroupList");
group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
group_display.set_reorderable (true);
group_display.set_headers_visible (true);
track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
track_display.get_column (0)->set_expand(true);
track_display.get_column (1)->set_expand(false);
- track_display.set_name (X_("LHSList"));
+ track_display.set_name (X_("EditGroupList"));
track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
track_display.set_reorderable (true);
track_display.set_headers_visible (true);
, playlist_action_menu (0)
, mode_menu (0)
, color_mode_menu (0)
- , gm (sess, slider, slider_desensitised, true, 115)
+ , gm (sess, slider, slider_desensitised, true, 125)
, _ignore_set_layer_display (false)
{
}
}
controls_table.attach (route_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- Gtk::VBox* pad = manage (new Gtk::VBox);
- pad->pack_start (gm.get_gain_slider(), false, false);
- pad->pack_start (*manage (new Gtk::Label), true, true);
- pad->show_all ();
- controls_table.attach (*pad, 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+// Gtk::VBox* pad = manage (new Gtk::VBox);
+// pad->pack_start (gm.get_gain_slider(), false, false);
+// pad->pack_start (*manage (new Gtk::Label), true, true);
+// pad->show_all ();
+ controls_table.attach (gm.get_gain_slider(), 0, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
ARDOUR_UI::instance()->set_tip(*solo_button,_("Solo"));
ARDOUR_UI::instance()->set_tip(*mute_button,_("Mute"));
route_group_menu = new RouteGroupMenu (_session, plist);
gm.get_gain_slider().signal_scroll_event().connect(sigc::mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false);
- gm.get_gain_slider().set_name ("TrackGainFader");
+ gm.get_gain_slider().set_name ("GainFader");
gm.get_level_meter().signal_scroll_event().connect (sigc::mem_fun (*this, &RouteTimeAxisView::controls_ebox_scroll), false);
float rheight = darea.get_height()-2;
cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
- cairo_pattern_add_color_stop_rgba (pat, 0, r*0.3,g*0.3,b*0.3, 1.0);
- cairo_pattern_add_color_stop_rgba (pat, 1, r, g, b, 1.0);
+ cairo_pattern_add_color_stop_rgba (pat, 0, r*0.8,g*0.8,b*0.8, 1.0);
+ cairo_pattern_add_color_stop_rgba (pat, 1, r*0.6,g*0.6,b*0.6, 1.0);
Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (pat, false));
pattern = p;
cairo_pattern_destroy(pat);
w = darea.get_width() - 2;
h = darea.get_height() - 2;
- x2 = (gint) floor (w * (0.1+0.9*fract));
+ x2 = (gint) floor (w * fract);
y2 = h;
radius = 4;
+ if (x2 < 8) x2 = 8;
- /* border */
+ /* border */
- c = get_style()->get_bg (get_state());
- r = c.get_red_p ();
- g = c.get_green_p ();
- b = c.get_blue_p ();
- context->set_source_rgb (0,0,0);
- rounded_rectangle (context, 0, 0, darea.get_width(), darea.get_height() , radius);
- context->fill ();
+ context->set_source_rgb (0,0,0);
+ cairo_rectangle (context->cobj(), 0, 0, darea.get_width(), darea.get_height());
+ context->fill ();
/* draw active box */
- c = get_style()->get_fg (get_state());
- r = c.get_red_p ();
- g = c.get_green_p ();
- b = c.get_blue_p ();
- context->set_source (pattern);
- rounded_rectangle (context, 1, 1, x2, y2, radius-1.5);
- context->fill ();
-
- context->set_source (shine_pattern);
- rounded_rectangle (context, 2, 3, x2-2, y2-8, radius-2);
- context->fill ();
-
- /* draw inactive box */
-
-// c = get_style()->get_fg (STATE_INSENSITIVE);
- // r = c.get_red_p ();
- // g = c.get_green_p ();
- // b = c.get_blue_p ();
- // context->set_source_rgb (r, g, b);
- // rounded_rectangle (context, 1 + x2, 1 + y1, w - x2, y2);
- // context->fill ();
+ context->set_source (pattern);
+ rounded_rectangle (context, 1, 1, x2, y2, radius-1.5);
+ context->fill ();
+// context->set_source (shine_pattern);
+// rounded_rectangle (context, 2, 3, x2-2, y2-8, radius-2);
+// context->fill ();
break;
case RightToLeft:
void set_default_value (float);
- void create_patterns ();
-
protected:
Gtk::Adjustment& adjustment;
void on_size_request (GtkRequisition*);
+ void on_size_allocate (Gtk::Allocation& alloc);
bool on_expose_event (GdkEventExpose*);
bool on_button_press_event (GdkEventButton*);
Cairo::RefPtr<Cairo::ImageSurface> belt_surface[STATES];
Glib::RefPtr<Gdk::Pixbuf> pixbuf[STATES];
- Cairo::RefPtr<Cairo::Pattern> pattern;
- Cairo::RefPtr<Cairo::Pattern> shine_pattern;
-
int span, girth;
int _orien;
float left_r;
GdkRectangle view;
+ void create_patterns();
+ cairo_pattern_t* pattern;
+ cairo_pattern_t* shine_pattern;
+
+ bool _hovering;
+
GdkWindow* grab_window;
double grab_loc;
double grab_start;
#include "gtkmm2ext/pixfader.h"
#include "gtkmm2ext/keyboard.h"
#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/utils.h"
using namespace Gtkmm2ext;
using namespace Gtk;
using namespace std;
+#define CORNER_RADIUS 4
+#define FADER_RESERVE (2*CORNER_RADIUS)
+
PixFader::PixFader (
Glib::RefPtr<Gdk::Pixbuf> belt,
Glib::RefPtr<Gdk::Pixbuf> belt_desensitised,
pixbuf[NORMAL] = belt;
pixbuf[DESENSITISED] = belt_desensitised;
+ pattern = 0;
+ shine_pattern = 0;
+
+ _hovering = false;
dragging = false;
default_value = adjustment.get_value();
last_drawn = -1;
view.y = 0;
if (orientation == VERT) {
- view.width = girth = pixbuf[0]->get_width();
+ view.width = girth = 24;
} else {
- view.height = girth = pixbuf[0]->get_height();
+ view.height = girth = 24;
}
set_fader_length (fader_length);
right_b = b/255.0;
}
+void
+PixFader::create_patterns ()
+{
+ Gdk::Color c = get_style()->get_fg (get_state());
+ float r, g, b;
+ r = c.get_red_p ();
+ g = c.get_green_p ();
+ b = c.get_blue_p ();
+
+ if (_orien == VERT) {
+ pattern = cairo_pattern_create_linear (0.0, 0.0, get_width(), 0);
+ cairo_pattern_add_color_stop_rgba (pattern, 0, r*0.8,g*0.8,b*0.8, 1.0);
+ cairo_pattern_add_color_stop_rgba (pattern, 1, r*0.6,g*0.6,b*0.6, 1.0);
+
+ shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 15, 0);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0.2, 1,1,1,0.3);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.0);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.0);
+ } else {
+ float rheight = get_height();
+
+ pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
+ cairo_pattern_add_color_stop_rgba (pattern, 0, r*0.8,g*0.8,b*0.8, 1.0);
+ cairo_pattern_add_color_stop_rgba (pattern, 1, r*0.6,g*0.6,b*0.6, 1.0);
+
+ shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0.2, 1,1,1,0.3);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.0);
+ cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.0);
+ }
+
+}
+
bool
PixFader::on_expose_event (GdkEventExpose* ev)
{
- int const pi = get_sensitive() ? NORMAL : DESENSITISED;
+ Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
+ cairo_t* cr = context->cobj();
+
+ if (!pattern) {
+ create_patterns();
+ }
+
+// int const pi = get_sensitive() ? NORMAL : DESENSITISED;
- Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
- int srcx, srcy;
- int const ds = display_span ();
- int offset_into_pixbuf = (int) floor (span / ((float) span / ds));
+ int ds = display_span ();
+
+ float w = get_width();
+ float h = get_height();
+ float radius = CORNER_RADIUS;
+
+ /* black border */
+
+ cairo_set_source_rgb (cr, 0,0,0);
+ cairo_rectangle (cr, 0, 0, w, h);
+ cairo_fill (cr);
+
+ /* draw active box */
- /* account for fader lengths that are shorter than the fader pixbuf */
if (_orien == VERT) {
- offset_into_pixbuf += pixbuf[pi]->get_height() / 2 - view.height;
+ if (ds > h - FADER_RESERVE)
+ ds = h - FADER_RESERVE;
+
+ cairo_set_source (cr, pattern);
+ Gtkmm2ext::rounded_rectangle (cr, 1, 1+ds, w-2, h-(1+ds)-1, radius-1.5);
+ cairo_fill (cr);
+
+// cairo_set_source (cr, shine_pattern);
+// Gtkmm2ext::rounded_rectangle (cr, 2, ds, w-4, h-(1+ds)-1, radius-1.5);
+// cairo_fill (cr);
} else {
- offset_into_pixbuf += pixbuf[pi]->get_width() / 2 - view.width;
- }
+ if (ds < FADER_RESERVE)
+ ds = FADER_RESERVE;
- context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- context->clip ();
-
- if (_orien == VERT) {
- srcx = 0;
- srcy = offset_into_pixbuf;
- } else {
- srcx = offset_into_pixbuf;
- srcy = 0;
- }
-
- /* fader */
-
- context->save();
- context->set_source (belt_surface[pi], -srcx, -srcy);
- context->rectangle (0, 0, get_width(), get_height());
- context->clip ();
- context->paint();
- context->restore();
-
- /* bounding box lines (2 colors for nicer visuals) */
-
- /* top and left side */
-
- context->set_line_width (1);
- context->set_source_rgb (left_r, left_g, left_b);
- context->move_to (view.width - 1, 0); /* upper right */
- context->line_to (0, 0); /* upper left */
- context->line_to (0, view.height - 1);/* lower left */
- context->stroke ();
-
- /* bottom & right side */
-
- context->set_line_width (1);
- context->set_source_rgb (right_r, right_g, right_b);
- context->move_to (0, view.height - 0.5); /* lower left */
- context->line_to (view.width - 0.5, view.height - 0.5); /* lower right */
- context->line_to (view.width - 0.5, 0); /* upper right */
- context->stroke ();
+ cairo_set_source (cr, pattern);
+ Gtkmm2ext::rounded_rectangle (cr, 1, 1, ds-1, h-2, radius-1.5);
+ cairo_fill (cr);
+// cairo_set_source (cr, shine_pattern);
+// Gtkmm2ext::rounded_rectangle (cr, 2, 3, ds-1, 15, radius-1.5);
+// cairo_fill (cr);
+ }
+
/* always draw the unity-position line */
-
if (_orien == VERT) {
context->set_line_width (1);
context->set_source_rgb (0.0, 1.0, 0.0);
context->set_line_width (1);
context->set_source_rgb (0.0, 1.0, 0.0);
context->move_to (unity_loc, 1);
- context->line_to (unity_loc, girth - 1);
+ context->line_to (unity_loc, girth);
context->stroke ();
}
+// if (Config->get_widget_prelight()) { //pixfader does not have access to config
+ if (_hovering) {
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3);
+ cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
+ cairo_fill (cr);
+ }
+// }
+
last_drawn = ds;
return true;
req->height = view.height;
}
+void
+PixFader::on_size_allocate (Gtk::Allocation& alloc)
+{
+ DrawingArea::on_size_allocate(alloc);
+ if (_orien == VERT) {
+ view.height = span = alloc.get_height();
+ } else {
+ view.width = span = alloc.get_width();
+ }
+
+ update_unity_position ();
+
+ queue_draw ();
+}
+
bool
PixFader::on_button_press_event (GdkEventButton* ev)
{
PixFader::display_span ()
{
float fract = (adjustment.get_value () - adjustment.get_lower()) / ((adjustment.get_upper() - adjustment.get_lower()));
- return (_orien != VERT) ? (int)floor (span * (1.0 - fract)) : (int)floor (span * fract);
+ int ds;
+ if (_orien == VERT) {
+ ds = (int)floor ( span * (1.0 - fract));
+ } else {
+ ds = (int)floor (span * fract);
+ }
+
+ return ds;
}
void
bool
PixFader::on_enter_notify_event (GdkEventCrossing*)
{
+ _hovering = true;
Keyboard::magic_widget_grab_focus ();
+ queue_draw ();
return false;
}
bool
PixFader::on_leave_notify_event (GdkEventCrossing*)
{
+ _hovering = false;
Keyboard::magic_widget_drop_focus();
+ queue_draw ();
return false;
}