13
0

update slider rendering & set style for faders

* render background -- outside of rounded corners
* visually align unity-location with fader at 0.
* sharp lines (no more AA blur) x/y offset, radius
This commit is contained in:
Robin Gareus 2014-01-05 13:07:31 +01:00
parent f3d858f9df
commit d89573f8e7
8 changed files with 74 additions and 32 deletions

View File

@ -731,6 +731,19 @@ style "midi_track_base" = "default"
bg[SELECTED] = @@COLPREFIX@_bg
}
style "audio_track_fader" = "gain_fader"
{
bg[PRELIGHT] = @@COLPREFIX@_audio_track
}
style "audio_bus_fader" = "gain_fader"
{
bg[PRELIGHT] = @@COLPREFIX@_audio_bus
}
style "midi_track_fader" = "gain_fader"
{
bg[PRELIGHT] = @@COLPREFIX@_midi_track
}
style "audio_track_metrics" = "audio_track_base"
{
font_name = "@FONT_TINY@"
@ -815,7 +828,9 @@ style "plugin_slider"
bg[ACTIVE] = shade (0.6, @@COLPREFIX@_lightest)
bg[INSENSITIVE] = shade (0.6, @@COLPREFIX@_lightest)
bg[SELECTED] = shade (0.6, @@COLPREFIX@_lightest)
bg[PRELIGHT] = shade (0.6, @@COLPREFIX@_lightest)
# outer round-corner-background (pixslider does its own hover prelight)
bg[PRELIGHT] = @@COLPREFIX@_bg
# the numeric display
@ -826,6 +841,12 @@ style "plugin_slider"
text[PRELIGHT] = @@COLPREFIX@_text
}
style "processor_control_slider" = "plugin_slider"
{
bg[PRELIGHT] = @@COLPREFIX@_darkest
bg[NORMAL] = @@COLPREFIX@_bg
}
style "track_list_display" = "small_bold_text"
{
text[NORMAL] = @@COLPREFIX@_text

View File

@ -186,9 +186,13 @@ widget "*AudioMidiTrackMetricsInactive" style:highest "midi_track_metrics_inacti
widget "*TimeAxisViewControlsBaseUnselected" style:highest "audio_track_base"
widget "*AudioTrackControlsBaseUnselected" style:highest "audio_track_base"
widget "*MidiTrackControlsBaseUnselected" style:highest "midi_track_base"
widget "*AudioTrackFader" style:highest "gain_fader"
widget "*MidiTrackFader" style:highest "gain_fader"
widget "*AudioBusFader" style:highest "gain_fader"
widget "*SendUIFader" style:highest "plugin_slider"
widget "*ReturnUIFader" style:highest "plugin_slider"
widget "*AudioTrackFader" style:highest "audio_track_fader"
widget "*MidiTrackFader" style:highest "midi_track_fader"
widget "*AudioBusFader" style:highest "audio_bus_fader"
widget "*BusControlsBaseUnselected" style:highest "audio_bus_base"
widget "*TrackSeparator" style:highest "track_separator"
@ -234,6 +238,7 @@ widget "*MotionControllerValue*" style:highest "small_entry"
widget "*ParameterValueDisplay" style:highest "medium_bold_entry"
widget "*PluginUIClickBox" style:highest "medium_bold_entry"
widget "*PluginUIClickBox*" style:highest "medium_bold_entry"
widget "*ProcessorControlSlider" style:highest "processor_control_slider"
widget "*PluginSlider" style:highest "plugin_slider"
widget "*GainFader" style:highest "plugin_slider"
widget "*MixerTrackCommentArea" style:highest "option_entry"

View File

@ -464,7 +464,7 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
} else {
_slider.set_name ("PluginSlider");
_slider.set_name ("ProcessorControlSlider");
_slider.set_text (_name);
box.add (_slider);

View File

@ -42,7 +42,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session* s
_gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp());
_hbox.pack_start (_gpm, true, true);
set_name ("ReturnUIFrame");
set_name (X_("ReturnUIFrame"));
_vbox.set_spacing (5);
_vbox.set_border_width (5);
@ -61,7 +61,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session* s
_return->input()->changed.connect (input_change_connection, invalidator (*this), boost::bind (&ReturnUI::ins_changed, this, _1, _2), gui_context());
_gpm.setup_meters ();
_gpm.set_fader_name ("ReturnUIFrame");
_gpm.set_fader_name (X_("ReturnUIFader"));
// screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (sigc::mem_fun (*this, &ReturnUI::update));
fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun (*this, &ReturnUI::fast_update));

View File

@ -46,7 +46,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session
_gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp());
_hbox.pack_start (_gpm, true, true);
set_name ("SendUIFrame");
set_name (X_("SendUIFrame"));
_vbox.set_spacing (5);
_vbox.set_border_width (5);
@ -77,7 +77,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session
_panners.setup_pan ();
_gpm.setup_meters ();
_gpm.set_fader_name ("SendUIFrame");
_gpm.set_fader_name (X_("SendUIFader"));
// screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (
// sigc::mem_fun (*this, &SendUI::update));

View File

@ -707,7 +707,7 @@ SoundFileBrowser::add_gain_meter ()
boost::shared_ptr<Route> r = _session->the_auditioner ();
gm->set_controls (r, r->shared_peak_meter(), r->amp());
gm->set_fader_name (X_("AudioTrackFader"));
gm->set_fader_name (X_("GainFader"));
meter_packer.set_border_width (12);
meter_packer.pack_start (*gm, false, true);

View File

@ -1022,8 +1022,10 @@ LV2Plugin::load_preset(PresetRecord r)
LilvWorld* world = _world.world;
LilvNode* pset = lilv_new_uri(world, r.uri.c_str());
LilvState* state = lilv_state_new_from_world(world, _uri_map.urid_map(), pset);
printf("LV2Plugin::load_preset %s\n", r.uri.c_str());
if (state) {
printf("found state\n");
lilv_state_restore(state, _impl->instance, set_port_value, this, 0, NULL);
lilv_state_free(state);
}
@ -1093,7 +1095,13 @@ LV2Plugin::do_save_preset(string name)
lilv_state_free(state);
return Glib::filename_to_uri(Glib::build_filename(bundle, file_name));
std::string uri = Glib::filename_to_uri(Glib::build_filename(bundle, file_name));
LilvNode *node = lilv_new_uri(_world.world, uri.c_str());
lilv_world_load_bundle(_world.world, node);
lilv_node_free(node);
printf("LV2Plugin::do_save_preset %s\n", uri.c_str());
return uri;
}
void

View File

@ -33,7 +33,9 @@ using namespace Gtk;
using namespace std;
#define CORNER_RADIUS 4
#define FADER_RESERVE (2*CORNER_RADIUS)
#define CORNER_SIZE 2
#define CORNER_OFFSET 1
#define FADER_RESERVE 5
std::list<PixFader::FaderImage*> PixFader::_patterns;
@ -111,11 +113,8 @@ PixFader::create_patterns ()
cairo_surface_t* surface;
cairo_t* tc = 0;
float radius = CORNER_RADIUS;
double w = get_width();
if (w <= 1 || get_height() <= 1) {
if (get_width() <= 1 || get_height() <= 1) {
return;
}
@ -142,13 +141,12 @@ PixFader::create_patterns ()
/* paint lower shade */
w -= 2.0;
shade_pattern = cairo_pattern_create_linear (0.0, 0.0, w, 0);
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, 1.0, get_height(), w, get_height(), radius-1.5);
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);
@ -175,7 +173,8 @@ PixFader::create_patterns ()
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, 0, 1, get_width(), get_height() - 2.0, radius-1.5);
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);
@ -218,7 +217,6 @@ PixFader::on_expose_event (GdkEventExpose* ev)
cairo_set_source_rgb (cr, br, bg, bb);
cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
cairo_fill (cr);
return true;
}
@ -229,18 +227,27 @@ PixFader::on_expose_event (GdkEventExpose* ev)
float w = get_width();
float h = get_height();
Gdk::Color c = get_style()->get_bg (Gtk::STATE_PRELIGHT);
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill(cr);
cairo_set_line_width (cr, 1);
cairo_set_source_rgba (cr, 0, 0, 0, 1.0);
cairo_matrix_t matrix;
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
cairo_stroke_preserve(cr);
if (_orien == VERT) {
if (ds > h - FADER_RESERVE) {
ds = h - FADER_RESERVE;
if (ds > h - FADER_RESERVE - CORNER_OFFSET) {
ds = h - FADER_RESERVE - CORNER_OFFSET;
}
cairo_set_source (cr, pattern);
cairo_matrix_init_translate (&matrix, 0, (h - ds));
cairo_pattern_set_matrix (pattern, &matrix);
Gtkmm2ext::rounded_rectangle (cr, 0, 0, w, h, CORNER_RADIUS-1.5);
cairo_fill (cr);
} else {
@ -264,7 +271,6 @@ PixFader::on_expose_event (GdkEventExpose* ev)
cairo_set_source (cr, pattern);
cairo_matrix_init_translate (&matrix, w - ds, 0);
cairo_pattern_set_matrix (pattern, &matrix);
Gtkmm2ext::rounded_rectangle (cr, 0, 0, w, h, CORNER_RADIUS-1.5);
cairo_fill (cr);
}
@ -276,14 +282,14 @@ PixFader::on_expose_event (GdkEventExpose* ev)
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 ) {
context->move_to (1.5, unity_loc + .5);
context->line_to (girth - 1.5, unity_loc + .5);
context->move_to (1.5, unity_loc + CORNER_OFFSET + .5);
context->line_to (girth - 1.5, unity_loc + CORNER_OFFSET + .5);
context->stroke ();
}
} else {
if ( unity_loc < w ){
context->move_to (unity_loc + .5, 1.5);
context->line_to (unity_loc + .5, girth - 1.5);
context->move_to (unity_loc - CORNER_OFFSET + .5, 1.5);
context->line_to (unity_loc - CORNER_OFFSET + .5, girth - 1.5);
context->stroke ();
}
}
@ -299,11 +305,11 @@ PixFader::on_expose_event (GdkEventExpose* ev)
}
if (!get_sensitive()) {
Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3);
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
cairo_set_source_rgba (cr, 0.505, 0.517, 0.525, 0.4);
cairo_fill (cr);
} else if (_hovering) {
Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3);
Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS);
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.1);
cairo_fill (cr);
}
@ -620,6 +626,7 @@ PixFader::on_state_changed (Gtk::StateType old_state)
{
Widget::on_state_changed (old_state);
create_patterns ();
queue_draw ();
}
void
@ -636,4 +643,5 @@ PixFader::on_style_changed (const Glib::RefPtr<Gtk::Style>&)
*/
pattern = 0;
queue_draw ();
}