aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-10-09 22:23:47 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-10-09 22:23:47 +0200
commit92a1a1974394bd1f9187639184d08eb649a6b382 (patch)
treea0e482e78ee0b4a4876cbb2d90365ce4519c4ff2
parent78b7c262a19044d886ff38cd941450b4043d7070 (diff)
downloadsherlock.lv2-92a1a1974394bd1f9187639184d08eb649a6b382.zip
sherlock.lv2-92a1a1974394bd1f9187639184d08eb649a6b382.tar.gz
sherlock.lv2-92a1a1974394bd1f9187639184d08eb649a6b382.tar.bz2
sherlock.lv2-92a1a1974394bd1f9187639184d08eb649a6b382.tar.xz
fix filter logic and add sherlock:matchAll URI.
-rw-r--r--VERSION2
-rw-r--r--atom_inspector.c16
-rw-r--r--atom_inspector_nk.c71
-rw-r--r--sherlock.ttl6
4 files changed, 67 insertions, 28 deletions
diff --git a/VERSION b/VERSION
index 41915c7..b72b05e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.19.1
+0.19.3
diff --git a/atom_inspector.c b/atom_inspector.c
index 227e398..575707e 100644
--- a/atom_inspector.c
+++ b/atom_inspector.c
@@ -34,6 +34,7 @@ struct _handle_t {
LV2_URID time_position;
LV2_URID time_frame;
+ LV2_URID sherlock_matchAll;
int64_t frame;
@@ -73,6 +74,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
handle->time_position = handle->map->map(handle->map->handle, LV2_TIME__Position);
handle->time_frame = handle->map->map(handle->map->handle, LV2_TIME__frame);
+ handle->sherlock_matchAll = handle->map->map(handle->map->handle, SHERLOCK_URI"#matchAll");
lv2_atom_forge_init(&handle->through.forge, handle->map);
lv2_atom_forge_init(&handle->notify.forge, handle->map);
@@ -240,10 +242,18 @@ run(LV2_Handle instance, uint32_t nsamples)
LV2_ATOM_SEQUENCE_FOREACH(handle->control, ev)
{
const LV2_Atom_Object *obj = (const LV2_Atom_Object *)&ev->body;
+ bool type_matches;
- const bool type_matches = lv2_atom_forge_is_object_type(&notify->forge, obj->atom.type)
- ? (obj->body.otype == handle->state.filter)
- : (obj->atom.type == handle->state.filter);
+ if(handle->state.filter == handle->sherlock_matchAll)
+ {
+ type_matches = true;
+ }
+ else
+ {
+ type_matches = lv2_atom_forge_is_object_type(&notify->forge, obj->atom.type)
+ ? (obj->body.otype == handle->state.filter)
+ : (obj->atom.type == handle->state.filter);
+ }
if( (!handle->state.negate && type_matches)
|| (handle->state.negate && !type_matches) )
diff --git a/atom_inspector_nk.c b/atom_inspector_nk.c
index 857a77c..63b688f 100644
--- a/atom_inspector_nk.c
+++ b/atom_inspector_nk.c
@@ -172,26 +172,63 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
handle->filter = handle->state.filter;
}
- nk_layout_row_dynamic(ctx, widget_h, 1);
- const nk_flags flags = NK_EDIT_FIELD
- | NK_EDIT_AUTO_SELECT
- | NK_EDIT_SIG_ENTER;
- //nk_edit_focus(ctx, flags);
- nk_flags mode = nk_edit_string_zero_terminated(ctx, flags, handle->filter_uri, sizeof(handle->filter_uri) - 1, nk_filter_ascii);
- if(mode & NK_EDIT_COMMITED)
+ bool dirty = false;
+
+ const float n = 4;
+ const float r0 = 1.f / n;
+ const float r1 = 0.1f / 3;
+ const float r2 = r0 - r1;
+ const float footer [5] = {r1+r2, r1+r2, r1+r2, r1, r2};
+ nk_layout_row(ctx, NK_DYNAMIC, widget_h, 5, footer);
{
- if(strlen(handle->filter_uri) == 0)
+ nk_label(ctx, "match:", NK_TEXT_LEFT);
+
+ if(nk_button_label(ctx, "time"))
{
strncpy(handle->filter_uri, LV2_TIME__Position, sizeof(handle->filter_uri) - 1);
+ dirty = true;
}
- handle->state.filter = handle->map->map(handle->map->handle, handle->filter_uri);
+ if(nk_button_label(ctx, "all"))
+ {
+ strncpy(handle->filter_uri, SHERLOCK_URI"#matchAll", sizeof(handle->filter_uri) - 1);
+ dirty = true;
+ }
+ const int32_t state_negate = _check(ctx, handle->state.negate);
+ if(state_negate != handle->state.negate)
+ {
+ handle->state.negate = state_negate;
+ _set_bool(handle, handle->urid.negate, handle->state.negate);
+ }
+ nk_label(ctx, "negate", NK_TEXT_LEFT);
+ }
+
+ nk_layout_row_dynamic(ctx, widget_h, 1);
+ {
+ const nk_flags flags = NK_EDIT_FIELD
+ | NK_EDIT_AUTO_SELECT
+ | NK_EDIT_SIG_ENTER;
+ //nk_edit_focus(ctx, flags);
+ nk_flags mode = nk_edit_string_zero_terminated(ctx, flags, handle->filter_uri, sizeof(handle->filter_uri) - 1, nk_filter_ascii);
+ if(mode & NK_EDIT_COMMITED)
+ {
+ if(strlen(handle->filter_uri) == 0)
+ {
+ strncpy(handle->filter_uri, SHERLOCK_URI"#matchAll", sizeof(handle->filter_uri) - 1);
+ }
+ dirty = true;
+ }
+ }
+
+ if(dirty)
+ {
+ handle->state.filter = handle->map->map(handle->map->handle, handle->filter_uri);
_set_urid(handle, handle->urid.filter, handle->state.filter);
}
}
- const float content_h = nk_window_get_height(ctx) - 2*window_padding.y - 5*group_padding.y - 3*widget_h;
+ const float content_h = nk_window_get_height(ctx) - 3*window_padding.y - 7*group_padding.y - 4*widget_h;
nk_layout_row_dynamic(ctx, content_h, 1);
nk_flags flags = NK_WINDOW_BORDER;
if(handle->state.follow)
@@ -336,12 +373,12 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
nk_list_view_end(&lview);
}
- const float n = 5;
+ const float n = 4;
const float r0 = 1.f / n;
const float r1 = 0.1f / 3;
const float r2 = r0 - r1;
- const float footer [10] = {r1, r2, r1, r2, r1, r2, r1, r2, r1, r2};
- nk_layout_row(ctx, NK_DYNAMIC, widget_h, 10, footer);
+ const float footer [8] = {r1, r2, r1, r2, r1, r2, r1, r2};
+ nk_layout_row(ctx, NK_DYNAMIC, widget_h, 8, footer);
{
const int32_t state_overwrite = _check(ctx, handle->state.overwrite);
if(state_overwrite != handle->state.overwrite)
@@ -376,14 +413,6 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
handle->ttl_dirty = true;
}
nk_label(ctx, "pretty", NK_TEXT_LEFT);
-
- const int32_t state_negate = _check(ctx, handle->state.negate);
- if(state_negate != handle->state.negate)
- {
- handle->state.negate = state_negate;
- _set_bool(handle, handle->urid.negate, handle->state.negate);
- }
- nk_label(ctx, "negate", NK_TEXT_LEFT);
}
const bool max_reached = handle->n_item >= MAX_LINES;
diff --git a/sherlock.ttl b/sherlock.ttl
index 09935fc..cba1942 100644
--- a/sherlock.ttl
+++ b/sherlock.ttl
@@ -88,8 +88,8 @@ sherlock:trace
sherlock:filter
a lv2:Parameter ;
- rdfs:label "Filter" ;
- rdfs:comment "Filter events according to type or object type" ;
+ rdfs:label "Match" ;
+ rdfs:comment "Match events according to type or object type" ;
rdfs:range atom:URI .
sherlock:negate
@@ -164,7 +164,7 @@ sherlock:atom_inspector
sherlock:follow true ;
sherlock:pretty true ;
sherlock:trace false ;
- sherlock:filter time:Position ;
+ sherlock:filter sherlock:matchAll ;
sherlock:negate true ;
] .