aboutsummaryrefslogtreecommitdiff
path: root/vm_ui.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-22 16:31:50 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-22 16:31:50 +0100
commitf2c2b7f892bf7ec8b74e891bd3468e1429c6d749 (patch)
treea62960df78938ec595d2064e418b9a94af79f0be /vm_ui.c
parent60c4e7231f76536e6111e4cf61c324e537c26846 (diff)
downloadvm.lv2-f2c2b7f892bf7ec8b74e891bd3468e1429c6d749.tar.xz
add pop operation. prototype keyboard shortcuts.
Diffstat (limited to 'vm_ui.c')
-rw-r--r--vm_ui.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/vm_ui.c b/vm_ui.c
index 041681e..50b213a 100644
--- a/vm_ui.c
+++ b/vm_ui.c
@@ -376,7 +376,60 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
} break;
case COMMAND_NOP:
{
- terminate = true;
+ struct nk_keyboard *keybd = &ctx->input.keyboard;
+
+ if(keybd->text_len == 1)
+ {
+ const char key = keybd->text[0];
+
+ switch(key)
+ {
+ case 'o':
+ {
+ cmd->type = COMMAND_OPCODE;
+ cmd->op = OP_NOP;
+ } break;
+ case 'b':
+ {
+ cmd->type = COMMAND_BOOL;
+ cmd->i32 = 0;
+ } break;
+ case 'i':
+ {
+ cmd->type = COMMAND_INT;
+ cmd->i32 = 0;
+ } break;
+ case 'f':
+ {
+ cmd->type = COMMAND_FLOAT;
+ cmd->f32= 0;
+ } break;
+
+ default:
+ {
+ terminate = true;
+
+ for(unsigned op = 0; op < OP_MAX; op++)
+ {
+ if(vm_api_def[op].key == key)
+ {
+ cmd->type = COMMAND_OPCODE;
+ cmd->op = op;
+ terminate = false;
+ break;
+ }
+ }
+ } break;
+ }
+
+ if(!terminate)
+ {
+ keybd->text_len = 0;
+ sync = true;
+ }
+ }
+ else
+ terminate = true;
} break;
case COMMAND_MAX:
break;