zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 892a27ed4628f5a3ad40dfba5a994c1c2f207eb6
parent 2c4e122b82b00dcba7b21a31b41bdb67f206fbe2
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Wed, 18 Feb 2015 22:48:09 -0500

UI: Fix Offset Keyshift Widgets

Diffstat:
Msrc/UI/Fl_Osc_Counter.H | 3++-
Msrc/UI/Fl_Osc_Counter.cpp | 15++++++++-------
Msrc/UI/MasterUI.fl | 6+++---
Msrc/UI/PartUI.fl | 2+-
4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/UI/Fl_Osc_Counter.H b/src/UI/Fl_Osc_Counter.H @@ -7,7 +7,7 @@ class Fl_Osc_Counter: public Fl_Counter, public Fl_Osc_Widget { public: Fl_Osc_Counter(int x, int y, int w, int h, const char *label=0); - void init(const char *path_, char type_ = 'i'); + void init(const char *path_, char type_ = 'i', int display_off = 0); void OSC_value(char); void OSC_value(int); using Fl_Osc_Widget::OSC_value; @@ -19,5 +19,6 @@ class Fl_Osc_Counter: public Fl_Counter, public Fl_Osc_Widget void cb(void); char cb_type; private: + int offset; std::pair<Fl_Callback*, void*> cb_data; }; diff --git a/src/UI/Fl_Osc_Counter.cpp b/src/UI/Fl_Osc_Counter.cpp @@ -6,7 +6,7 @@ static void callback_fn(Fl_Widget *w, void *) } Fl_Osc_Counter::Fl_Osc_Counter(int x, int y, int w, int h, const char *label) - :Fl_Counter(x,y,w,h,label), Fl_Osc_Widget(this) + :Fl_Counter(x,y,w,h,label), Fl_Osc_Widget(this), offset(0) { Fl_Counter::callback(callback_fn); } @@ -16,8 +16,9 @@ void Fl_Osc_Counter::update(void) oscWrite(ext); } -void Fl_Osc_Counter::init(const char *path_, char type_) +void Fl_Osc_Counter::init(const char *path_, char type_, int display_off) { + offset = display_off; oscRegister(path_); ext = path_; cb_type = type_; @@ -31,12 +32,12 @@ void Fl_Osc_Counter::callback(Fl_Callback *cb, void *p) void Fl_Osc_Counter::OSC_value(int v) { - value(v); + value(v+offset); } void Fl_Osc_Counter::OSC_value(char v) { - value(v); + value(v+offset); } void Fl_Osc_Counter::cb(void) @@ -44,11 +45,11 @@ void Fl_Osc_Counter::cb(void) assert(osc); if(cb_type == 'c') { - fprintf(stderr, "invalid `c' from counter %s%s, using `i'\n", loc.c_str(), ext.c_str()); - oscWrite(ext, "i", (int)(value())); + fprintf(stderr, "invalid `c' from counter %s%s, using `i'\n", loc.c_str(), ext.c_str()); + oscWrite(ext, "i", (int)(value()-offset)); } else - oscWrite(ext, "i", (int)value()); + oscWrite(ext, "i", (int)(value()-offset)); if(cb_data.first) cb_data.first(this, cb_data.second); diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl @@ -452,7 +452,7 @@ if (fl_choice("The file *might* exist. \\nOverwrite it?","No","Yes",NULL)) { label {Master KeyShift} xywh {155 102 120 23} type Simple labelsize 9 minimum -64 maximum 64 step 1 code0 {o->lstep(12);} - code1 {o->init("Pkeyshift");} + code1 {o->init("Pkeyshift",'i',-64);} class Fl_Osc_Counter } Fl_Button {} { @@ -1096,7 +1096,7 @@ simplemaxkcounter->do_callback();} label KeyShift xywh {280 120 50 20} type Simple labelsize 11 minimum -64 maximum 64 step 1 code0 {o->lstep(12);} - code1 {o->init("Pkeyshift");} + code1 {o->init("Pkeyshift", 'i', -64);} class Fl_Osc_Counter } Fl_Dial simplesyseffsend { @@ -1360,7 +1360,7 @@ pthread_mutex_unlock(&master->mutex);*/} label {Master KeyShift} xywh {15 110 90 20} labelsize 11 minimum -64 maximum 64 step 1 code0 {o->lstep(12);} - code1 {o->init("Pkeyshift");} + code1 {o->init("Pkeyshift",'i',-64);} class Fl_Osc_Counter } Fl_Button {} { diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -263,7 +263,7 @@ class PartUI {open : {public Fl_Osc_Group} label KeyShift xywh {195 45 90 20} labelsize 11 align 1 minimum -64 maximum 64 step 1 code0 {o->lstep(12);} - code1 {o->init("Pkeyshift");} + code1 {o->init("Pkeyshift", 'i', -64);} class Fl_Osc_Counter } Fl_Scroll {} {open