aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-11-15 11:24:38 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-11-15 11:24:38 +0100
commit26ac34c803be2b7808cb8172f4e16f491c8154a3 (patch)
tree5ac62b14173fc59c7b99f9c3f8c67653082adf2e
parentefafd15669088308f554939265a5d3879b2d0750 (diff)
downloadsherlock.lv2-26ac34c803be2b7808cb8172f4e16f491c8154a3.tar.xz
fix padding.
-rw-r--r--VERSION2
-rw-r--r--atom_inspector_nk.c26
-rw-r--r--midi_inspector_nk.c10
-rw-r--r--osc_inspector_nk.c10
-rw-r--r--sherlock_nk.c6
-rw-r--r--sherlock_nk.h2
6 files changed, 37 insertions, 19 deletions
diff --git a/VERSION b/VERSION
index 43aedd0..b1e2591 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.11.2663
+0.11.2665
diff --git a/atom_inspector_nk.c b/atom_inspector_nk.c
index 35f585c..f66d999 100644
--- a/atom_inspector_nk.c
+++ b/atom_inspector_nk.c
@@ -94,13 +94,18 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
plughandle_t *handle = data;
const float widget_h = handle->dy;
+ struct nk_style *style = &ctx->style;
+ const struct nk_vec2 window_padding = style->window.padding;
+ const struct nk_vec2 group_padding = style->window.group_padding;
bool ttl_dirty = false;
if(nk_begin(ctx, "Window", wbounds, NK_WINDOW_NO_SCROLLBAR))
{
nk_window_set_bounds(ctx, wbounds);
+ struct nk_panel *panel= nk_window_get_panel(ctx);
- nk_layout_row_dynamic(ctx, wbounds.h, 2);
+ const float body_h = panel->bounds.h - 2*window_padding.y;
+ nk_layout_row_dynamic(ctx, body_h, 2);
if(nk_group_begin(ctx, "Left", NK_WINDOW_NO_SCROLLBAR))
{
nk_layout_row_dynamic(ctx, widget_h, 3);
@@ -137,8 +142,9 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
}
}
- nk_layout_row_dynamic(ctx, wbounds.h - 2*widget_h, 1);
- if(nk_group_begin(ctx, "Events", 0))
+ const float content_h = nk_window_get_height(ctx) - 2*window_padding.y - 4*group_padding.y - 2*widget_h;
+ nk_layout_row_dynamic(ctx, content_h, 1);
+ if(nk_group_begin(ctx, "Events", NK_WINDOW_BORDER))
{
uint32_t counter = 0;
const LV2_Atom *selected = NULL;
@@ -198,9 +204,9 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
handle->count = counter;
- const struct nk_panel *panel = nk_window_get_panel(ctx);
if(handle->bottom)
{
+ panel= nk_window_get_panel(ctx);
panel->offset->y = panel->at_y;
handle->bottom = false;
@@ -216,7 +222,6 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
if(nk_group_begin(ctx, "Right", NK_WINDOW_NO_SCROLLBAR))
{
const LV2_Atom *atom = handle->selected;
-
if(ttl_dirty && atom)
{
char *ttl = _sratom_to_turtle(handle->sratom, handle->unmap,
@@ -224,7 +229,7 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
atom->type, atom->size, LV2_ATOM_BODY_CONST(atom));
if(ttl)
{
- struct nk_str *str = &handle->edit.string;
+ struct nk_str *str = &handle->str;
const size_t len = strlen(ttl);
nk_str_clear(str);
@@ -243,9 +248,14 @@ _atom_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
}
}
- nk_layout_row_dynamic(ctx, wbounds.h, 1);
const nk_flags flags = NK_EDIT_EDITOR;
- const nk_flags mode = nk_edit_buffer(ctx, flags, &handle->edit, nk_filter_default);
+ char *str = nk_str_get(&handle->str);
+ int len = nk_str_len(&handle->str);
+
+ const float content_h = nk_window_get_height(ctx) - 2*window_padding.y - 2*group_padding.y;
+ nk_layout_row_dynamic(ctx, content_h, 1);
+ nk_edit_focus(ctx, flags);
+ const nk_flags mode = nk_edit_string(ctx, flags, str, &len, len, nk_filter_default);
(void)mode;
nk_group_end(ctx);
diff --git a/midi_inspector_nk.c b/midi_inspector_nk.c
index 077ad53..92a4c69 100644
--- a/midi_inspector_nk.c
+++ b/midi_inspector_nk.c
@@ -202,10 +202,13 @@ _midi_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
plughandle_t *handle = data;
const float widget_h = handle->dy;
+ struct nk_style *style = &ctx->style;
+ const struct nk_vec2 window_padding = style->window.padding;
if(nk_begin(ctx, "Window", wbounds, NK_WINDOW_NO_SCROLLBAR))
{
nk_window_set_bounds(ctx, wbounds);
+ struct nk_panel *panel= nk_window_get_panel(ctx);
nk_layout_row_dynamic(ctx, widget_h, 3);
{
@@ -241,8 +244,9 @@ _midi_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
}
}
- nk_layout_row_dynamic(ctx, wbounds.h - 2*widget_h, 1);
- if(nk_group_begin(ctx, "Events", 0))
+ const float body_h = panel->bounds.h - 4*window_padding.y - 2*widget_h;
+ nk_layout_row_dynamic(ctx, body_h, 1);
+ if(nk_group_begin(ctx, "Events", NK_WINDOW_BORDER))
{
uint32_t counter = 0;
@@ -470,9 +474,9 @@ _midi_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *dat
handle->count = counter;
- const struct nk_panel *panel = nk_window_get_panel(ctx);
if(handle->bottom)
{
+ panel= nk_window_get_panel(ctx);
panel->offset->y = panel->at_y;
handle->bottom = false;
diff --git a/osc_inspector_nk.c b/osc_inspector_nk.c
index 990ada0..b6966d2 100644
--- a/osc_inspector_nk.c
+++ b/osc_inspector_nk.c
@@ -282,10 +282,13 @@ _osc_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *data
plughandle_t *handle = data;
const float widget_h = handle->dy;
+ struct nk_style *style = &ctx->style;
+ const struct nk_vec2 window_padding = style->window.padding;
if(nk_begin(ctx, "Window", wbounds, NK_WINDOW_NO_SCROLLBAR))
{
nk_window_set_bounds(ctx, wbounds);
+ struct nk_panel *panel= nk_window_get_panel(ctx);
nk_layout_row_dynamic(ctx, widget_h, 3);
{
@@ -321,8 +324,9 @@ _osc_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *data
}
}
- nk_layout_row_dynamic(ctx, wbounds.h - 2*widget_h, 1);
- if(nk_group_begin(ctx, "Events", 0))
+ const float body_h = panel->bounds.h - 4*window_padding.y - 2*widget_h;
+ nk_layout_row_dynamic(ctx, body_h, 1);
+ if(nk_group_begin(ctx, "Events", NK_WINDOW_BORDER))
{
uint32_t counter = 0;
@@ -363,9 +367,9 @@ _osc_inspector_expose(struct nk_context *ctx, struct nk_rect wbounds, void *data
handle->count = counter;
- const struct nk_panel *panel = nk_window_get_panel(ctx);
if(handle->bottom)
{
+ panel= nk_window_get_panel(ctx);
panel->offset->y = panel->at_y;
handle->bottom = false;
diff --git a/sherlock_nk.c b/sherlock_nk.c
index 952e09d..ae7bd11 100644
--- a/sherlock_nk.c
+++ b/sherlock_nk.c
@@ -187,7 +187,7 @@ void
_clear(plughandle_t *handle)
{
atom_ser_t *ser = &handle->ser;
- struct nk_str *str = &handle->edit.string;
+ struct nk_str *str = &handle->str;
if(_ser_realloc(ser, 1024))
{
@@ -313,7 +313,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
_clear(handle);
_discover(handle);
- nk_textedit_init_default(&handle->edit);
+ nk_str_init_default(&handle->str);
handle->sratom = sratom_new(handle->map);
sratom_set_pretty_numbers(handle->sratom, false);
@@ -329,7 +329,7 @@ cleanup(LV2UI_Handle instance)
sratom_free(handle->sratom);
- nk_textedit_free(&handle->edit);
+ nk_str_free(&handle->str);
atom_ser_t *ser = &handle->ser;
_ser_free(ser);
diff --git a/sherlock_nk.h b/sherlock_nk.h
index 136a5b9..62b63b2 100644
--- a/sherlock_nk.h
+++ b/sherlock_nk.h
@@ -63,7 +63,7 @@ struct _plughandle_t {
atom_ser_t ser;
const LV2_Atom *selected;
- struct nk_text_edit edit;
+ struct nk_str str;
Sratom *sratom;
const char *base_uri;