commit 60679ce1ce49bd388aa4f7577ea6f91fabb859db
parent b656980e4944e2a39623963d898af900bee54577
Author: fundamental <[email protected]>
Date: Mon, 20 Apr 2015 20:42:52 -0400
Add Midi Unlearn
Diffstat:
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
@@ -193,6 +193,10 @@ static Ports master_ports = {
Master *M = (Master*)d.obj;
printf("learning '%s'\n", rtosc_argument(m,0).s);
M->midi.learn(rtosc_argument(m,0).s);}},
+ {"unlearn:s", rDoc("Remove Learning for specified address"), 0,
+ [](const char *m, RtData &d){
+ Master *M = (Master*)d.obj;
+ M->midi.clear_entry(rtosc_argument(m,0).s);}},
{"close-ui", rDoc("Request to close any connection named \"GUI\""), 0, [](const char *, RtData &d) {
d.reply("/close-ui", "");}},
{"add-rt-memory:bi", rProp(internal) rDoc("Add Additional Memory To RT MemPool"), 0,
diff --git a/src/UI/Fl_Osc_Dial.cpp b/src/UI/Fl_Osc_Dial.cpp
@@ -62,12 +62,16 @@ void Fl_Osc_Dial::callback(Fl_Callback *cb, void *p)
int Fl_Osc_Dial::handle(int ev)
{
- bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2));
+ bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && !Fl::event_shift());
bool ctl_click = (ev == FL_PUSH && Fl::event_state(FL_BUTTON1) && Fl::event_ctrl());
+ bool shift_middle = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && Fl::event_shift());
if(middle_mouse || ctl_click) {
printf("Trying to learn...\n");
osc->write("/learn", "s", (loc+ext).c_str());
return 1;
+ } else if(shift_middle) {
+ osc->write("/unlearn", "s", (loc+ext).c_str());
+ return 1;
}
return WidgetPDial::handle(ev);
}
diff --git a/src/UI/Fl_Osc_Slider.cpp b/src/UI/Fl_Osc_Slider.cpp
@@ -74,12 +74,16 @@ void Fl_Osc_Slider::callback(Fl_Callback *cb, void *p)
int Fl_Osc_Slider::handle(int ev)
{
- bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2));
+ bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && !Fl::event_shift());
bool ctl_click = (ev == FL_PUSH && Fl::event_state(FL_BUTTON1) && Fl::event_ctrl());
+ bool shift_middle = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && Fl::event_shift());
if(middle_mouse || ctl_click) {
printf("Trying to learn...\n");
osc->write("/learn", "s", (loc+ext).c_str());
return 1;
+ } else if(shift_middle) {
+ osc->write("/unlearn", "s", (loc+ext).c_str());
+ return 1;
}
return Fl_Slider::handle(ev);
}
diff --git a/src/UI/Fl_Osc_VSlider.cpp b/src/UI/Fl_Osc_VSlider.cpp
@@ -65,12 +65,16 @@ void Fl_Osc_VSlider::callback(Fl_Callback *cb, void *p)
int Fl_Osc_VSlider::handle(int ev)
{
- bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2));
+ bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && !Fl::event_shift());
bool ctl_click = (ev == FL_PUSH && Fl::event_state(FL_BUTTON1) && Fl::event_ctrl());
+ bool shift_middle = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && Fl::event_shift());
if(middle_mouse || ctl_click) {
printf("Trying to learn...\n");
osc->write("/learn", "s", (loc+ext).c_str());
return 1;
+ } else if(shift_middle) {
+ osc->write("/unlearn", "s", (loc+ext).c_str());
+ return 1;
}
return Fl_Value_Slider::handle(ev);
}