aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-10-13 14:37:48 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-10-13 14:37:48 +0200
commitaf70986609e37985cd9cb880324c883474ffb5d6 (patch)
treee61a2e8eac56e1677291245aa69df7f31338c70e
parent37f037ccb06b101aa5290d2b83804587188f38d6 (diff)
downloadmoony.lv2-af70986609e37985cd9cb880324c883474ffb5d6.tar.xz
nk: show canvas in 1:1 aspect, for now.
-rw-r--r--VERSION2
-rw-r--r--plugin/nk_ui.c33
-rw-r--r--plugin/presets.ttl13
3 files changed, 32 insertions, 16 deletions
diff --git a/VERSION b/VERSION
index db54aac..c370acc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.29.25
+0.29.27
diff --git a/plugin/nk_ui.c b/plugin/nk_ui.c
index 7e21b39..ca6c9ef 100644
--- a/plugin/nk_ui.c
+++ b/plugin/nk_ui.c
@@ -2032,7 +2032,34 @@ _parameter_widget_tuple(plughandle_t *handle, struct nk_context *ctx, prop_t *pr
if(prop->key == handle->canvas_idisp.canvas.urid.Canvas_graph)
{
nk_layout_row_dynamic(ctx, dy*(ndy-1), 1);
- nk_image(ctx, prop->value.tuple.img);
+ const struct nk_rect bnd = nk_widget_bounds(ctx);
+ nk_spacing(ctx, 1);
+
+ //FIXME implement aspect ratio
+ float w = bnd.w;
+ float h = bnd.h;
+
+ if(w < h)
+ {
+ h = w;
+ }
+ else
+ {
+ w = h;
+ }
+
+ const struct nk_rect bnd2 = {
+ .x = bnd.x + bnd.w/2 - w/2,
+ .y = bnd.y + bnd.h/2 - h/2,
+ .w = w,
+ .h = h
+ };
+
+ struct nk_command_buffer *canvas = nk_window_get_canvas(ctx);
+ struct nk_style_button *style = &ctx->style.button;
+
+ nk_draw_image(canvas, bnd2, &prop->value.tuple.img, nk_rgb(0xff, 0xff, 0xff));
+ nk_stroke_rect(canvas, bnd2, style->rounding, style->border, style->border_color);
}
else
#endif
@@ -3227,8 +3254,8 @@ _patch_set_parameter_value(plughandle_t *handle, LV2_URID property,
else if(prop->range == handle->forge.Tuple)
{
#if defined(BUILD_INLINE_DISP)
- const int w = 200; //FIXME
- const int h = 200; //FIXME
+ const int w = 512; //FIXME
+ const int h = 512; //FIXME
const float aspect_ratio = 1.f; //FIXME
LV2_Inline_Display_Image_Surface *surf =
diff --git a/plugin/presets.ttl b/plugin/presets.ttl
index 70084cf..d52eaf2 100644
--- a/plugin/presets.ttl
+++ b/plugin/presets.ttl
@@ -717,21 +717,10 @@ local graph = Parameter({
end
})
--- define canvas aspect ratio parameter
-local aspect = Parameter({
- [RDFS.label] = 'AspectRatio',
- [RDFS.comment] = 'Aspect ratio of canvas graph',
- [RDFS.range] = Atom.Float,
- [LV2.minimum] = 1.0,
- [LV2.maximum] = 1.0,
- [RDF.value] = 1.0
-})
-
-- define a StateResponder object
local stateR = StateResponder({
[Patch.readable] = {
- [Canvas.graph] = graph,
- [Canvas.aspectRatio] = aspect
+ [Canvas.graph] = graph
}
})