diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2015-07-01 22:53:23 +0200 |
---|---|---|
committer | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2015-07-01 23:02:40 +0200 |
commit | c5a3568eb4936db53fd3a958e74da58214012c17 (patch) | |
tree | a90f4e9fa6230c91160c57d03965ef25f3d488ef /lib | |
parent | a80c28fd11ab6eadfae05a4f266dfdb87e11aac3 (diff) | |
download | synthpod-c5a3568eb4936db53fd3a958e74da58214012c17.tar.xz |
add check for continuous ports with scale points.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smart_slider.c | 14 | ||||
-rw-r--r-- | lib/smart_spinner.c | 18 | ||||
-rw-r--r-- | lib/smart_toggle.c | 14 | ||||
-rw-r--r-- | lib/synthpod_private.h | 3 | ||||
-rw-r--r-- | lib/synthpod_ui.c | 31 |
5 files changed, 46 insertions, 34 deletions
diff --git a/lib/smart_slider.c b/lib/smart_slider.c index 30492fb7..23eea19e 100644 --- a/lib/smart_slider.c +++ b/lib/smart_slider.c @@ -22,8 +22,8 @@ #define SMART_SLIDER_TYPE "Smart Slider" #define SMART_SLIDER_CHANGED "changed" -#define SMART_SLIDER_MOUSE_IN "mouse,in" -#define SMART_SLIDER_MOUSE_OUT "mouse,out" +#define SMART_SLIDER_MOUSE_IN "cat,in" +#define SMART_SLIDER_MOUSE_OUT "cat,out" #define SMART_SLIDER_MODIFIER "Control" //TODO make configurable @@ -47,9 +47,9 @@ struct _smart_slider_t { }; static const Evas_Smart_Cb_Description _smart_callbacks [] = { - {SMART_SLIDER_CHANGED, NULL}, - {SMART_SLIDER_MOUSE_IN, NULL}, - {SMART_SLIDER_MOUSE_OUT, NULL}, + {SMART_SLIDER_CHANGED, ""}, + {SMART_SLIDER_MOUSE_IN, ""}, + {SMART_SLIDER_MOUSE_OUT, ""}, {NULL, NULL} }; @@ -125,7 +125,7 @@ _mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_slider_t *priv = data; - evas_object_smart_callback_call(obj, SMART_SLIDER_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_SLIDER_MOUSE_IN, NULL); } static void @@ -133,7 +133,7 @@ _mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_slider_t *priv = data; - evas_object_smart_callback_call(obj, SMART_SLIDER_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_SLIDER_MOUSE_OUT, NULL); } static void diff --git a/lib/smart_spinner.c b/lib/smart_spinner.c index 3a073d2c..3a2094c6 100644 --- a/lib/smart_spinner.c +++ b/lib/smart_spinner.c @@ -22,8 +22,8 @@ #define SMART_SPINNER_TYPE "Smart Slider" #define SMART_SPINNER_CHANGED "changed" -#define SMART_SPINNER_MOUSE_IN "mouse,in" -#define SMART_SPINNER_MOUSE_OUT "mouse,out" +#define SMART_SPINNER_MOUSE_IN "cat,in" +#define SMART_SPINNER_MOUSE_OUT "cat,out" #define SMART_SPINNER_MODIFIER "Control" //TODO make configurable @@ -48,9 +48,9 @@ struct _smart_spinner_t { }; static const Evas_Smart_Cb_Description _smart_callbacks [] = { - {SMART_SPINNER_CHANGED, NULL}, - {SMART_SPINNER_MOUSE_IN, NULL}, - {SMART_SPINNER_MOUSE_OUT, NULL}, + {SMART_SPINNER_CHANGED, ""}, + {SMART_SPINNER_MOUSE_IN, ""}, + {SMART_SPINNER_MOUSE_OUT, ""}, {NULL, NULL} }; @@ -121,7 +121,7 @@ _mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_spinner_t *priv = data; - evas_object_smart_callback_call(obj, SMART_SPINNER_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_SPINNER_MOUSE_IN, NULL); } static void @@ -129,7 +129,7 @@ _mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_spinner_t *priv = data; - evas_object_smart_callback_call(obj, SMART_SPINNER_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_SPINNER_MOUSE_OUT, NULL); } static void @@ -363,7 +363,9 @@ smart_spinner_value_get(Evas_Object *o) elmnt_t *elmnt = eina_list_nth(priv->elmnts, priv->value); - return elmnt->value; + return elmnt + ? elmnt->value + : 0.f; } void diff --git a/lib/smart_toggle.c b/lib/smart_toggle.c index a09213c5..ce8bacce 100644 --- a/lib/smart_toggle.c +++ b/lib/smart_toggle.c @@ -22,8 +22,8 @@ #define SMART_TOGGLE_TYPE "Smart Slider" #define SMART_TOGGLE_CHANGED "changed" -#define SMART_TOGGLE_MOUSE_IN "mouse,in" -#define SMART_TOGGLE_MOUSE_OUT "mouse,out" +#define SMART_TOGGLE_MOUSE_IN "cat,in" +#define SMART_TOGGLE_MOUSE_OUT "cat,out" #define SMART_TOGGLE_MODIFIER "Control" //TODO make configurable @@ -37,9 +37,9 @@ struct _smart_toggle_t { }; static const Evas_Smart_Cb_Description _smart_callbacks [] = { - {SMART_TOGGLE_CHANGED, NULL}, - {SMART_TOGGLE_MOUSE_IN, NULL}, - {SMART_TOGGLE_MOUSE_OUT, NULL}, + {SMART_TOGGLE_CHANGED, ""}, + {SMART_TOGGLE_MOUSE_IN, ""}, + {SMART_TOGGLE_MOUSE_OUT, ""}, {NULL, NULL} }; @@ -84,7 +84,7 @@ _mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_toggle_t *priv = data; - evas_object_smart_callback_call(obj, SMART_TOGGLE_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_TOGGLE_MOUSE_IN, NULL); } static void @@ -92,7 +92,7 @@ _mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) { smart_toggle_t *priv = data; - evas_object_smart_callback_call(obj, SMART_TOGGLE_CHANGED, NULL); + evas_object_smart_callback_call(obj, SMART_TOGGLE_MOUSE_OUT, NULL); } static void diff --git a/lib/synthpod_private.h b/lib/synthpod_private.h index 3dec2cb7..5ff9fba4 100644 --- a/lib/synthpod_private.h +++ b/lib/synthpod_private.h @@ -103,6 +103,7 @@ struct _reg_t { // control port property reg_item_t integer; + reg_item_t enumeration; reg_item_t toggled; // port protocols @@ -264,6 +265,7 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map) _register(®s->port.midi, world, map, LV2_MIDI__MidiEvent); _register(®s->port.integer, world, map, LV2_CORE__integer); + _register(®s->port.enumeration, world, map, LV2_CORE__enumeration); _register(®s->port.toggled, world, map, LV2_CORE__toggled); _register(®s->port.float_protocol, world, map, LV2_UI_PREFIX"floatProtocol"); @@ -378,6 +380,7 @@ sp_regs_deinit(reg_t *regs) _unregister(®s->port.midi); _unregister(®s->port.integer); + _unregister(®s->port.enumeration); _unregister(®s->port.toggled); _unregister(®s->port.float_protocol); diff --git a/lib/synthpod_ui.c b/lib/synthpod_ui.c index dc49c6b1..61a7de83 100644 --- a/lib/synthpod_ui.c +++ b/lib/synthpod_ui.c @@ -28,7 +28,7 @@ #include <lv2_external_ui.h> // kxstudio kx-ui extension #include <zero_writer.h> -#define NUM_UI_FEATURES 15 +#define NUM_UI_FEATURES 16 #define MODLIST_UI "/synthpod/modlist/ui" #define MODGRID_UI "/synthpod/modgrid/ui" @@ -1542,6 +1542,10 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst, mod->feature_list[nfeatures].URI = LV2_UI_PREFIX"makeSONameResident"; mod->feature_list[nfeatures++].data = NULL; } + { + mod->feature_list[nfeatures].URI = LV2_UI_PREFIX"makeResident"; + mod->feature_list[nfeatures++].data = NULL; + } mod->feature_list[nfeatures].URI = SYNTHPOD_WORLD; mod->feature_list[nfeatures++].data = ui->world; @@ -1610,7 +1614,10 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst, lilv_node_free(min_node); lilv_node_free(max_node); - tar->points = lilv_port_get_scale_points(plug, port); + int enumeration = lilv_port_has_property(plug, port, ui->regs.port.enumeration.node); + tar->points = enumeration + ? lilv_port_get_scale_points(plug, port) + : NULL; } else if(lilv_port_is_a(plug, port, ui->regs.port.atom.node)) { @@ -3215,8 +3222,8 @@ _property_content_get(void *data, Evas_Object *obj, const char *part) // smart_slider_unit_set(child, port->unit); if(prop->editable) evas_object_smart_callback_add(child, "changed", _property_sldr_changed, prop); - evas_object_smart_callback_add(child, "mouse,in", _smart_mouse_in, ui); - evas_object_smart_callback_add(child, "mouse,out", _smart_mouse_out, ui); + evas_object_smart_callback_add(child, "cat,in", _smart_mouse_in, ui); + evas_object_smart_callback_add(child, "cat,out", _smart_mouse_out, ui); } } else if(prop->type_urid == ui->forge.Bool) @@ -3228,8 +3235,8 @@ _property_content_get(void *data, Evas_Object *obj, const char *part) smart_toggle_disabled_set(child, !prop->editable); if(prop->editable) evas_object_smart_callback_add(child, "changed", _property_check_changed, prop); - evas_object_smart_callback_add(child, "mouse,in", _smart_mouse_in, ui); - evas_object_smart_callback_add(child, "mouse,out", _smart_mouse_out, ui); + evas_object_smart_callback_add(child, "cat,in", _smart_mouse_in, ui); + evas_object_smart_callback_add(child, "cat,out", _smart_mouse_out, ui); } } else @@ -3542,8 +3549,8 @@ _modlist_std_content_get(void *data, Evas_Object *obj, const char *part) smart_toggle_disabled_set(check, port->direction == PORT_DIRECTION_OUTPUT); if(port->direction == PORT_DIRECTION_INPUT) evas_object_smart_callback_add(check, "changed", _check_changed, port); - evas_object_smart_callback_add(check, "mouse,in", _smart_mouse_in, ui); - evas_object_smart_callback_add(check, "mouse,out", _smart_mouse_out, ui); + evas_object_smart_callback_add(check, "cat,in", _smart_mouse_in, ui); + evas_object_smart_callback_add(check, "cat,out", _smart_mouse_out, ui); } child = check; @@ -3566,8 +3573,8 @@ _modlist_std_content_get(void *data, Evas_Object *obj, const char *part) } if(port->direction == PORT_DIRECTION_INPUT) evas_object_smart_callback_add(spin, "changed", _spinner_changed, port); - evas_object_smart_callback_add(spin, "mouse,in", _smart_mouse_in, ui); - evas_object_smart_callback_add(spin, "mouse,out", _smart_mouse_out, ui); + evas_object_smart_callback_add(spin, "cat,in", _smart_mouse_in, ui); + evas_object_smart_callback_add(spin, "cat,out", _smart_mouse_out, ui); } child = spin; @@ -3586,8 +3593,8 @@ _modlist_std_content_get(void *data, Evas_Object *obj, const char *part) smart_slider_disabled_set(sldr, port->direction == PORT_DIRECTION_OUTPUT); if(port->direction == PORT_DIRECTION_INPUT) evas_object_smart_callback_add(sldr, "changed", _sldr_changed, port); - evas_object_smart_callback_add(sldr, "mouse,in", _smart_mouse_in, ui); - evas_object_smart_callback_add(sldr, "mouse,out", _smart_mouse_out, ui); + evas_object_smart_callback_add(sldr, "cat,in", _smart_mouse_in, ui); + evas_object_smart_callback_add(sldr, "cat,out", _smart_mouse_out, ui); } child = sldr; |