diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2021-04-14 09:48:35 +0200 |
---|---|---|
committer | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2021-04-14 09:48:35 +0200 |
commit | af765b9d0801e53e01d1a658cdd3f88b750d3b2a (patch) | |
tree | d90b18057e0ac337aea3c863b4e10731307c09f5 | |
parent | 6201a016fca7507db848899c71431377f7ea068b (diff) | |
download | sherlock.lv2-af765b9d0801e53e01d1a658cdd3f88b750d3b2a.tar.xz |
nk: use new scale API.
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | sherlock_nk.c | 46 |
2 files changed, 24 insertions, 24 deletions
@@ -1 +1 @@ -0.27.3 +0.27.13 diff --git a/sherlock_nk.c b/sherlock_nk.c index 8e0dcf4..dac47c1 100644 --- a/sherlock_nk.c +++ b/sherlock_nk.c @@ -344,8 +344,26 @@ instantiate(const LV2UI_Descriptor *descriptor __attribute__((unused)), handle->urid.filter = props_map(&handle->props, SHERLOCK_URI"#filter"); handle->urid.negate = props_map(&handle->props, SHERLOCK_URI"#negate"); + const LV2_URID ui_scaleFactor = handle->map->map(handle->map->handle, + LV2_UI__scaleFactor); + + for(LV2_Options_Option *opt = opts; + opt && (opt->key != 0) && (opt->value != NULL); + opt++) + { + if( (opt->key == ui_scaleFactor) && (opt->type == handle->forge.Float) ) + { + handle->scale = *(float*)opt->value; + } + } + + if(handle->scale == 0.f) + { + handle->scale = nk_pugl_get_scale(); + } + nk_pugl_config_t *cfg = &handle->win.cfg; - cfg->height = 700; + cfg->height = 700 * handle->scale; cfg->resizable = true; cfg->ignore = false; cfg->class = "sherlock_inspector"; @@ -356,46 +374,28 @@ instantiate(const LV2UI_Descriptor *descriptor __attribute__((unused)), if(!strcmp(plugin_uri, SHERLOCK_MIDI_INSPECTOR_URI)) { handle->type = SHERLOCK_MIDI_INSPECTOR, - cfg->width = 600; + cfg->width = 600 * handle->scale; cfg->expose = _midi_inspector_expose; } else if(!strcmp(plugin_uri, SHERLOCK_ATOM_INSPECTOR_URI)) { handle->type = SHERLOCK_ATOM_INSPECTOR, - cfg->width = 1200; + cfg->width = 1200 * handle->scale; cfg->expose = _atom_inspector_expose; } else if(!strcmp(plugin_uri, SHERLOCK_OSC_INSPECTOR_URI)) { handle->type = SHERLOCK_OSC_INSPECTOR, - cfg->width = 600; + cfg->width = 600 * handle->scale; cfg->expose = _osc_inspector_expose; } if(asprintf(&cfg->font.face, "%sCousine-Regular.ttf", bundle_path) == -1) cfg->font.face= NULL; - cfg->font.size = 13; + cfg->font.size = 13 * handle->scale; *(intptr_t *)widget = nk_pugl_init(&handle->win); - const LV2_URID ui_scaleFactor = handle->map->map(handle->map->handle, - LV2_UI__scaleFactor); - - for(LV2_Options_Option *opt = opts; - opt && (opt->key != 0) && (opt->value != NULL); - opt++) - { - if( (opt->key == ui_scaleFactor) && (opt->type == handle->forge.Float) ) - { - handle->scale = *(float*)opt->value; - } - } - - if(handle->scale == 0.f) - { - handle->scale = nk_pugl_get_scale(&handle->win); - } - nk_pugl_show(&handle->win); _clear(handle); |