aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-20 19:26:50 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-20 19:26:50 +0100
commitf839caf81ac470a9da37491df4ac7c50216dcb30 (patch)
treec681c9dae011caeab36c916f5975cda31747bf66
parent450b0b1aac9c7a880c10652cddd44cc556706748 (diff)
downloadsherlock.lv2-f839caf81ac470a9da37491df4ac7c50216dcb30.tar.xz
fixes for updated nk_pugl.
-rw-r--r--VERSION2
-rw-r--r--atom_inspector_nk.c1
-rw-r--r--encoder.h1
-rw-r--r--midi_inspector_nk.c1
-rw-r--r--osc_inspector_nk.c1
-rw-r--r--sherlock_nk.c36
-rw-r--r--sherlock_nk.h3
7 files changed, 24 insertions, 21 deletions
diff --git a/VERSION b/VERSION
index a703836..7ea1a22 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.13.23
+0.13.45
diff --git a/atom_inspector_nk.c b/atom_inspector_nk.c
index 4631a6b..8c1d8c6 100644
--- a/atom_inspector_nk.c
+++ b/atom_inspector_nk.c
@@ -112,6 +112,7 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
{
plughandle_t *handle = data;
+ handle->dy = 20.f * _get_scale(handle);
const float widget_h = handle->dy;
struct nk_style *style = &ctx->style;
const struct nk_vec2 window_padding = style->window.padding;
diff --git a/encoder.h b/encoder.h
index 8cb0739..43d26c4 100644
--- a/encoder.h
+++ b/encoder.h
@@ -18,6 +18,7 @@
#ifndef ENCODER_H
#define ENCODER_H
+#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
#include "nk_pugl/nk_pugl.h"
extern const struct nk_color white;
diff --git a/midi_inspector_nk.c b/midi_inspector_nk.c
index 9ea5bb6..b1f811b 100644
--- a/midi_inspector_nk.c
+++ b/midi_inspector_nk.c
@@ -221,6 +221,7 @@ _midi_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
{
plughandle_t *handle = data;
+ handle->dy = 20.f * _get_scale(handle);
const float widget_h = handle->dy;
struct nk_style *style = &ctx->style;
const struct nk_vec2 window_padding = style->window.padding;
diff --git a/osc_inspector_nk.c b/osc_inspector_nk.c
index 8a35736..6250b94 100644
--- a/osc_inspector_nk.c
+++ b/osc_inspector_nk.c
@@ -302,6 +302,7 @@ _osc_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *data
{
plughandle_t *handle = data;
+ handle->dy = 20.f * _get_scale(handle);
const float widget_h = handle->dy;
struct nk_style *style = &ctx->style;
const struct nk_vec2 window_padding = style->window.padding;
diff --git a/sherlock_nk.c b/sherlock_nk.c
index a8338ab..311fb41 100644
--- a/sherlock_nk.c
+++ b/sherlock_nk.c
@@ -222,6 +222,12 @@ _post_redisplay(plughandle_t *handle)
nk_pugl_post_redisplay(&handle->win);
}
+float
+_get_scale (plughandle_t *handle)
+{
+ return nk_pugl_get_scale(&handle->win);
+}
+
static LV2UI_Handle
instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
const char *bundle_path, LV2UI_Write_Function write_function,
@@ -282,53 +288,41 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
handle->urid.block = props_map(&handle->props, defs[1].property);;
handle->urid.follow = props_map(&handle->props, defs[2].property);;
- const char *NK_SCALE = getenv("NK_SCALE");
- const float scale = NK_SCALE ? atof(NK_SCALE) : 1.f;
- handle->dy = 20.f * scale;
-
nk_pugl_config_t *cfg = &handle->win.cfg;
- cfg->height = 700 * scale;
+ cfg->height = 700;
cfg->resizable = true;
cfg->ignore = false;
cfg->class = "sherlock_inspector";
cfg->title = "Sherlock Inspector";
cfg->parent = (intptr_t)parent;
+ cfg->host_resize = host_resize;
cfg->data = handle;
if(!strcmp(plugin_uri, SHERLOCK_MIDI_INSPECTOR_URI))
{
handle->type = SHERLOCK_MIDI_INSPECTOR,
- cfg->width = 600 * scale;
+ cfg->width = 600;
cfg->expose = _midi_inspector_expose;
}
else if(!strcmp(plugin_uri, SHERLOCK_ATOM_INSPECTOR_URI))
{
handle->type = SHERLOCK_ATOM_INSPECTOR,
- cfg->width = 1200 * scale;
+ cfg->width = 1200;
cfg->expose = _atom_inspector_expose;
}
else if(!strcmp(plugin_uri, SHERLOCK_OSC_INSPECTOR_URI))
{
handle->type = SHERLOCK_OSC_INSPECTOR,
- cfg->width = 600 * scale;
+ cfg->width = 600;
cfg->expose = _osc_inspector_expose;
}
- char *path;
- if(asprintf(&path, "%sCousine-Regular.ttf", bundle_path) == -1)
- path = NULL;
-
- cfg->font.face = path;
- cfg->font.size = 13 * scale;
+ if(asprintf(&cfg->font.face, "%sCousine-Regular.ttf", bundle_path) == -1)
+ cfg->font.face= NULL;
+ cfg->font.size = 13;
*(intptr_t *)widget = nk_pugl_init(&handle->win);
nk_pugl_show(&handle->win);
- if(path)
- free(path);
-
- if(host_resize)
- host_resize->ui_resize(host_resize->handle, cfg->width, cfg->height);
-
_clear(handle);
_discover(handle);
@@ -356,6 +350,8 @@ cleanup(LV2UI_Handle instance)
if(handle->editor.lexer.tokens)
free(handle->editor.lexer.tokens);
+ if(handle->win.cfg.font.face)
+ free(handle->win.cfg.font.face);
nk_pugl_hide(&handle->win);
nk_pugl_shutdown(&handle->win);
diff --git a/sherlock_nk.h b/sherlock_nk.h
index 4d16417..10c9d7f 100644
--- a/sherlock_nk.h
+++ b/sherlock_nk.h
@@ -136,4 +136,7 @@ _ruler(struct nk_context *ctx, float line_thickness, struct nk_color color);
void
_post_redisplay(plughandle_t *handle);
+float
+_get_scale(plughandle_t *handle);
+
#endif // _SHERLOCK_NK_H