aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2021-04-14 09:52:17 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2021-04-14 09:52:17 +0200
commit73e3c79b4246e1d8fd371485237387b5ebdcdd2f (patch)
tree6672a2a1eab73550b61e67861342b9fecc583170
parenta15f69c87a219c3a1c4a2cb6e03c3e9b50e8675b (diff)
downloadsynthpod-73e3c79b4246e1d8fd371485237387b5ebdcdd2f.tar.xz
nk: use new scale API.
-rw-r--r--VERSION2
-rw-r--r--plugins/synthpod_common_nk.c24
-rw-r--r--plugins/synthpod_ui.ttl8
3 files changed, 23 insertions, 11 deletions
diff --git a/VERSION b/VERSION
index a33b135e..48d1d62c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.6429
+0.1.6447
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 14ef4952..8664a179 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -8338,7 +8338,6 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
const struct nk_user_font *font = ctx->style.font;
const struct nk_style *style = &handle->win.ctx.style;
- handle->scale = nk_pugl_get_scale(&handle->win);
handle->dy = 20.f * handle->scale;
handle->dy2 = font->height + 2 * style->window.header.label_padding.y;
@@ -8484,6 +8483,8 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
LV2_PARAMETERS__sampleRate);
const LV2_URID ui_update_rate= handle->map->map(handle->map->handle,
LV2_UI__updateRate);
+ const LV2_URID ui_scaleFactor = handle->map->map(handle->map->handle,
+ LV2_UI__scaleFactor);
handle->sample_rate = 48000.f; // fall-back
handle->update_rate = 60.f; // fall-back
@@ -8493,18 +8494,31 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
opt++)
{
if( (opt->key == params_sample_rate) && (opt->type == atom_float) )
+ {
handle->sample_rate = *(float*)opt->value;
+ }
else if( (opt->key == ui_update_rate) && (opt->type == atom_float) )
+ {
handle->update_rate = *(float*)opt->value;
+ }
+ if( (opt->key == ui_scaleFactor) && (opt->type == handle->forge.Float) )
+ {
+ handle->scale = *(float*)opt->value;
+ }
//TODO handle more options
}
handle->controller = controller;
handle->writer = write_function;
+ if(handle->scale == 0.f)
+ {
+ handle->scale = nk_pugl_get_scale();
+ }
+
nk_pugl_config_t *cfg = &handle->win.cfg;
- cfg->width = 1280;
- cfg->height = 720;
+ cfg->width = 1280 * handle->scale;
+ cfg->height = 720 * handle->scale;
cfg->resizable = true;
cfg->ignore = false;
cfg->class = "synthpod";
@@ -8516,7 +8530,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
if(asprintf(&cfg->font.face, "%sAbel-Regular.ttf", bundle_path) == -1)
cfg->font.face = NULL;
- cfg->font.size = 15;
+ cfg->font.size = 15 * handle->scale;
*(intptr_t *)widget = nk_pugl_init(&handle->win);
nk_pugl_show(&handle->win);
@@ -8543,8 +8557,6 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
bst->text_hover = nk_rgb(0xff, 0xff, 0xff);
bst->text_active = nk_rgb(0xff, 0xff, 0xff);
- handle->scale = nk_pugl_get_scale(&handle->win);
-
handle->scrolling = nk_vec2(0.f, 0.f);
handle->plugin_collapse_states = NK_MAXIMIZED;
diff --git a/plugins/synthpod_ui.ttl b/plugins/synthpod_ui.ttl
index 32f11788..3b1b07d4 100644
--- a/plugins/synthpod_ui.ttl
+++ b/plugins/synthpod_ui.ttl
@@ -35,7 +35,7 @@ synthpod:common_4_nk
lv2:optionalFeature ui:resize, log:log, ui:portSubscribe, opts:options, ui:requestValue, instacc: ;
lv2:requiredFeature ui:portMap, urid:map, urid:unmap, ui:idleInterface, ui:parent ;
lv2:extensionData ui:idleInterface, ui:resize ;
- opts:supportedOption param:sampleRate, ui:updateRate .
+ opts:supportedOption param:sampleRate, ui:updateRate, ui:scaleFactor .
synthpod:root_4_nk
ui:portNotification [
ui:plugin synthpod:stereo ;
@@ -45,7 +45,7 @@ synthpod:root_4_nk
lv2:optionalFeature ui:resize, log:log, ui:portSubscribe, opts:options, ui:requestValue, instacc: ;
lv2:requiredFeature ui:portMap, urid:map, urid:unmap, ui:idleInterface, ui:parent ;
lv2:extensionData ui:idleInterface, ui:resize ;
- opts:supportedOption param:sampleRate, ui:updateRate .
+ opts:supportedOption param:sampleRate, ui:updateRate, ui:scaleFactor .
# D2TK UIs
synthpod:common_5_d2tk
@@ -57,7 +57,7 @@ synthpod:common_5_d2tk
lv2:optionalFeature ui:resize, log:log, ui:portSubscribe, opts:options, ui:requestValue, instacc: ;
lv2:requiredFeature ui:portMap, urid:map, urid:unmap, ui:idleInterface, ui:parent ;
lv2:extensionData ui:idleInterface, ui:resize ;
- opts:supportedOption param:sampleRate, ui:updateRate .
+ opts:supportedOption param:sampleRate, ui:updateRate, ui:scaleFactor .
synthpod:root_5_d2tk
ui:portNotification [
ui:plugin synthpod:stereo ;
@@ -67,7 +67,7 @@ synthpod:root_5_d2tk
lv2:optionalFeature ui:resize, log:log, ui:portSubscribe, opts:options, ui:requestValue, instacc: ;
lv2:requiredFeature ui:portMap, urid:map, urid:unmap, ui:idleInterface, ui:parent ;
lv2:extensionData ui:idleInterface, ui:resize ;
- opts:supportedOption param:sampleRate, ui:updateRate .
+ opts:supportedOption param:sampleRate, ui:updateRate, ui:scaleFactor .
# Keyboard UIs
synthpod:keyboard_4_nk