From 933bfe882ab88973930a26e3c3875aae30609854 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 6 Sep 2013 23:08:46 -0700 Subject: [PATCH] Mixer: Work around some quirks in hints of some plugins. --- FL/Fl_DialX.C | 9 ++++++--- mixer/src/Module_Parameter_Editor.C | 10 ++++++++++ mixer/src/Plugin_Module.C | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/FL/Fl_DialX.C b/FL/Fl_DialX.C index e9b96df..64973b5 100644 --- a/FL/Fl_DialX.C +++ b/FL/Fl_DialX.C @@ -109,11 +109,14 @@ Fl_DialX::draw ( void ) if ( Fl::belowmouse() == this ) { - char s[10]; + char s[128]; - fl_font( FL_HELVETICA, 10 ); + fl_font( FL_HELVETICA, 9 ); - snprintf( s, sizeof( s ), "%.1f", value() ); + char buf[128]; + format(buf); + + snprintf( s, sizeof( s ), buf, value() ); fl_color( FL_FOREGROUND_COLOR ); fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER ); diff --git a/mixer/src/Module_Parameter_Editor.C b/mixer/src/Module_Parameter_Editor.C index 88d6bec..ffe7dbe 100644 --- a/mixer/src/Module_Parameter_Editor.C +++ b/mixer/src/Module_Parameter_Editor.C @@ -231,6 +231,11 @@ Module_Parameter_Editor::make_controls ( void ) o->selection_color( fc ); o->value( p->control_value() ); + o->precision( 2 ); + /* a couple of plugins have ridiculously small units */ + if ( p->hints.maximum < 0.5f ) + o->precision( 5 ); + // o->step( fabs( ( o->maximum() - o->minimum() ) ) / 32.0f ); } else @@ -259,6 +264,11 @@ Module_Parameter_Editor::make_controls ( void ) o->maximum( p->hints.minimum ); o->minimum( p->hints.maximum ); } + + o->precision( 2 ); + /* a couple of plugins have ridiculously small units */ + if ( p->hints.maximum < 0.5f ) + o->precision( 5 ); o->textsize( 8 ); o->box( FL_NO_BOX ); diff --git a/mixer/src/Plugin_Module.C b/mixer/src/Plugin_Module.C index dd57d97..4104912 100644 --- a/mixer/src/Plugin_Module.C +++ b/mixer/src/Plugin_Module.C @@ -625,8 +625,8 @@ Plugin_Module::load ( unsigned long id ) if (LADSPA_IS_HINT_INTEGER(HintDesc)) { if ( p.hints.ranged && - 0 == p.hints.minimum && - 1 == p.hints.maximum ) + 0 == (int)p.hints.minimum && + 1 == (int)p.hints.maximum ) p.hints.type = Port::Hints::BOOLEAN; else p.hints.type = Port::Hints::INTEGER;