Commit d734f363 authored by Hanspeter Portner's avatar Hanspeter Portner

Implement log auto-clear upon code send.

parent 743e77e9
Pipeline #18074027 passed with stages
in 5 minutes and 12 seconds
......@@ -687,6 +687,16 @@ _state_save(LV2_Handle instance,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
(void)status; //TODO check status
i32 = atomic_load_explicit(&moony->log_reset, memory_order_acquire);
status = store(
state,
moony->uris.moony_logReset,
&i32,
sizeof(int32_t),
moony->forge.Bool,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
(void)status; //TODO check status
i32 = atomic_load_explicit(&moony->param_hidden, memory_order_acquire);
status = store(
state,
......@@ -884,6 +894,18 @@ _state_restore(LV2_Handle instance,
atomic_store_explicit(&moony->log_follow, *i32, memory_order_release);
}
// get moony:logReset
i32 = retrieve(
state,
moony->uris.moony_logReset,
&size,
&type,
&flags2);
if(i32 && (size == sizeof(int32_t)) && (type == moony->forge.Bool) )
{
atomic_store_explicit(&moony->log_reset, *i32, memory_order_release);
}
// get moony:paramHidden
i32 = retrieve(
state,
......@@ -1238,6 +1260,7 @@ moony_init(moony_t *moony, const char *subject, double sample_rate,
moony->uris.moony_editorHidden = moony->map->map(moony->map->handle, MOONY_EDITOR_HIDDEN_URI);
moony->uris.moony_logHidden = moony->map->map(moony->map->handle, MOONY_LOG_HIDDEN_URI);
moony->uris.moony_logFollow = moony->map->map(moony->map->handle, MOONY_LOG_FOLLOW_URI);
moony->uris.moony_logReset = moony->map->map(moony->map->handle, MOONY_LOG_RESET_URI);
moony->uris.moony_paramHidden = moony->map->map(moony->map->handle, MOONY_PARAM_HIDDEN_URI);
moony->uris.moony_paramCols = moony->map->map(moony->map->handle, MOONY_PARAM_COLS_URI);
moony->uris.moony_paramRows = moony->map->map(moony->map->handle, MOONY_PARAM_ROWS_URI);
......@@ -1368,6 +1391,7 @@ moony_init(moony_t *moony, const char *subject, double sample_rate,
moony->editor_hidden = ATOMIC_VAR_INIT(0);
moony->log_hidden = ATOMIC_VAR_INIT(1);
moony->log_follow = ATOMIC_VAR_INIT(1);
moony->log_reset = ATOMIC_VAR_INIT(0);
moony->param_hidden = ATOMIC_VAR_INIT(1);
moony->param_cols = ATOMIC_VAR_INIT(3);
moony->param_rows = ATOMIC_VAR_INIT(4);
......@@ -2295,6 +2319,14 @@ moony_in(moony_t *moony, const LV2_Atom_Sequence *control, LV2_Atom_Sequence *no
if(ref)
ref = _patch_set(&moony->uris.patch, forge, property->body, sizeof(int32_t), forge->Bool, &i32);
}
else if(property->body == moony->uris.moony_logReset)
{
const int32_t i32 = atomic_load_explicit(&moony->log_reset, memory_order_acquire);
if(ref)
ref = lv2_atom_forge_frame_time(forge, 0); //FIXME
if(ref)
ref = _patch_set(&moony->uris.patch, forge, property->body, sizeof(int32_t), forge->Bool, &i32);
}
else if(property->body == moony->uris.moony_paramHidden)
{
const int32_t i32 = atomic_load_explicit(&moony->param_hidden, memory_order_acquire);
......@@ -2380,6 +2412,10 @@ moony_in(moony_t *moony, const LV2_Atom_Sequence *control, LV2_Atom_Sequence *no
{
atomic_store_explicit(&moony->log_follow, ((const LV2_Atom_Bool *)value)->body, memory_order_release);
}
else if( (property->body == moony->uris.moony_logReset) && (value->type == forge->Bool) )
{
atomic_store_explicit(&moony->log_reset, ((const LV2_Atom_Bool *)value)->body, memory_order_release);
}
else if( (property->body == moony->uris.moony_paramHidden) && (value->type == forge->Bool) )
{
atomic_store_explicit(&moony->param_hidden, ((const LV2_Atom_Bool *)value)->body, memory_order_release);
......
......@@ -87,6 +87,7 @@
#define MOONY_EDITOR_HIDDEN_URI MOONY_URI"#editorHidden"
#define MOONY_LOG_HIDDEN_URI MOONY_URI"#logHidden"
#define MOONY_LOG_FOLLOW_URI MOONY_URI"#logFollow"
#define MOONY_LOG_RESET_URI MOONY_URI"#logReset"
#define MOONY_PARAM_HIDDEN_URI MOONY_URI"#paramHidden"
#define MOONY_PARAM_COLS_URI MOONY_URI"#paramCols"
......@@ -216,6 +217,7 @@ struct _moony_t {
LV2_URID moony_editorHidden;
LV2_URID moony_logHidden;
LV2_URID moony_logFollow;
LV2_URID moony_logReset;
LV2_URID moony_paramHidden;
LV2_URID moony_paramCols;
LV2_URID moony_paramRows;
......@@ -299,6 +301,7 @@ struct _moony_t {
atomic_int editor_hidden;
atomic_int log_hidden;
atomic_int log_follow;
atomic_int log_reset;
atomic_int param_hidden;
atomic_int param_cols;
atomic_int param_rows;
......
......@@ -88,6 +88,12 @@ moony:logFollow
rdfs:comment "follow state of log tab" ;
rdfs:range atom:Bool .
moony:logReset
a lv2:Parameter ;
rdfs:label "Log reset" ;
rdfs:comment "reset log upon code send" ;
rdfs:range atom:Bool .
moony:paramHidden
a lv2:Parameter ;
rdfs:label "Parameter hidden" ;
......@@ -182,6 +188,7 @@ moony:c1xc1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -271,6 +278,7 @@ moony:c2xc2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -390,6 +398,7 @@ moony:c4xc4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -469,6 +478,7 @@ moony:a1xa1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -570,6 +580,7 @@ moony:a2xa2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -715,6 +726,7 @@ moony:a4xa4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -825,6 +837,7 @@ moony:c1a1xc1a1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -940,6 +953,7 @@ moony:c2a1xc2a1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1085,6 +1099,7 @@ moony:c4a1xc4a1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......
......@@ -215,6 +215,7 @@ struct _plughandle_t {
LV2_URID moony_editorHidden;
LV2_URID moony_logHidden;
LV2_URID moony_logFollow;
LV2_URID moony_logReset;
LV2_URID moony_paramHidden;
LV2_URID moony_paramCols;
LV2_URID moony_paramRows;
......@@ -290,6 +291,7 @@ struct _plughandle_t {
int32_t editor_hidden;
int32_t log_hidden;
int32_t log_follow;
int32_t log_reset;
int32_t param_hidden;
int32_t param_rows;
int32_t param_cols;
......@@ -1000,18 +1002,6 @@ _clear_error(plughandle_t *handle)
handle->error[0] = '\0';
}
static void
_submit_all(plughandle_t *handle)
{
_clear_error(handle);
struct nk_str *str = &handle->editor.string;
_patch_set(handle, handle->moony_code,
nk_str_len_char(str), handle->forge.String, nk_str_get_const(str));
handle->dirty = false;
}
static void
_clear_log(plughandle_t *handle)
{
......@@ -1025,6 +1015,21 @@ _clear_log(plughandle_t *handle)
nk_pugl_post_redisplay(&handle->win);
}
static void
_submit_all(plughandle_t *handle)
{
_clear_error(handle);
struct nk_str *str = &handle->editor.string;
_patch_set(handle, handle->moony_code,
nk_str_len_char(str), handle->forge.String, nk_str_get_const(str));
handle->dirty = false;
if(handle->log_reset)
_clear_log(handle);
}
static void
_text_image_colored(struct nk_context *ctx, struct nk_image *img,
const char *str, nk_flags alignment, struct nk_color color)
......@@ -2329,7 +2334,7 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
nk_list_view_end(&lview);
}
nk_layout_row_dynamic(ctx, dy, 2);
nk_layout_row_dynamic(ctx, dy, 3);
if(_tooltip_visible(ctx))
nk_tooltip(ctx, "Ctrl-D");
nk_style_push_style_item(ctx, &ctx->style.button.normal, has_control_d
......@@ -2344,6 +2349,11 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
if(log_follow != handle->log_follow)
_patch_set(handle, handle->moony_logFollow, sizeof(int32_t), handle->forge.Bool, &handle->log_follow);
const int log_reset = handle->log_reset;
handle->log_reset = nk_check_label(ctx, "Reset", handle->log_reset);
if(log_reset != handle->log_reset)
_patch_set(handle, handle->moony_logReset, sizeof(int32_t), handle->forge.Bool, &handle->log_reset);
nk_group_end(ctx);
}
}
......@@ -2756,6 +2766,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
handle->moony_editorHidden = handle->map->map(handle->map->handle, MOONY_EDITOR_HIDDEN_URI);
handle->moony_logHidden = handle->map->map(handle->map->handle, MOONY_LOG_HIDDEN_URI);
handle->moony_logFollow = handle->map->map(handle->map->handle, MOONY_LOG_FOLLOW_URI);
handle->moony_logReset = handle->map->map(handle->map->handle, MOONY_LOG_RESET_URI);
handle->moony_paramHidden = handle->map->map(handle->map->handle, MOONY_PARAM_HIDDEN_URI);
handle->moony_paramCols = handle->map->map(handle->map->handle, MOONY_PARAM_COLS_URI);
handle->moony_paramRows = handle->map->map(handle->map->handle, MOONY_PARAM_ROWS_URI);
......@@ -2881,6 +2892,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
_patch_get(handle, handle->moony_editorHidden);
_patch_get(handle, handle->moony_logHidden);
_patch_get(handle, handle->moony_logFollow);
_patch_get(handle, handle->moony_logReset);
_patch_get(handle, handle->moony_paramHidden);
_patch_get(handle, handle->moony_paramCols);
_patch_get(handle, handle->moony_paramRows);
......@@ -3318,6 +3330,7 @@ _patch_set_self(plughandle_t *handle, LV2_URID property, const LV2_Atom *value)
_patch_get(handle, handle->moony_editorHidden);
_patch_get(handle, handle->moony_logHidden);
_patch_get(handle, handle->moony_logFollow);
_patch_get(handle, handle->moony_logReset);
_patch_get(handle, handle->moony_paramHidden);
_patch_get(handle, handle->moony_paramCols);
_patch_get(handle, handle->moony_paramRows);
......@@ -3389,6 +3402,15 @@ _patch_set_self(plughandle_t *handle, LV2_URID property, const LV2_Atom *value)
nk_pugl_post_redisplay(&handle->win);
}
}
else if(property == handle->moony_logReset)
{
if(value->type == handle->forge.Bool)
{
handle->log_reset = ((const LV2_Atom_Bool *)value)->body;
nk_pugl_post_redisplay(&handle->win);
}
}
else if(property == handle->moony_paramHidden)
{
if(value->type == handle->forge.Bool)
......
......@@ -48,6 +48,10 @@ moony:logFollow
a lv2:Parameter ;
rdfs:range atom:Bool ;
rdfs:label "Log follow state" .
moony:logReset
a lv2:Parameter ;
rdfs:range atom:Bool ;
rdfs:label "Log reset state" .
moony:paramHidden
a lv2:Parameter ;
rdfs:range atom:Bool ;
......@@ -97,6 +101,7 @@ moony:bank-through_control-through
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -112,6 +117,7 @@ moony:bank-through_atom-through
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -131,6 +137,7 @@ moony:bank-through_atom-through2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -152,6 +159,7 @@ moony:bank-through_atom-through4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -181,6 +189,7 @@ moony:bank-multiplex_atom-multiplex2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -199,6 +208,7 @@ moony:bank-multiplex_atom-multiplex4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -219,6 +229,7 @@ moony:bank-midi_midi-responder
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -245,6 +256,7 @@ moony:bank-time_midi-sequencer
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -295,6 +307,7 @@ moony:bank-time_lindenmayer-system
moony:editorHidden false ;
moony:logHidden false ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -395,6 +408,7 @@ moony:bank-osc_osc-responder
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -421,6 +435,7 @@ moony:bank-state_state-responder
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden false ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -590,6 +605,7 @@ moony:bank-canvas_lv2-logo
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -662,6 +678,7 @@ moony:bank-tutorial_part-1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -704,6 +721,7 @@ moony:bank-tutorial_part-2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -746,6 +764,7 @@ moony:bank-tutorial_part-3
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -839,6 +858,7 @@ moony:bank-tutorial_part-4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -927,6 +947,7 @@ moony:bank-tutorial_part-5
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -986,6 +1007,7 @@ moony:bank-tutorial_part-6
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1086,6 +1108,7 @@ moony:bank-template_part-1
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1168,6 +1191,7 @@ moony:bank-template_part-2
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1231,6 +1255,7 @@ moony:bank-template_part-3
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden true ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1260,6 +1285,7 @@ moony:bank-template_part-4
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden false ;
moony:paramCols 3 ;
moony:paramRows 4 ;
......@@ -1318,6 +1344,7 @@ moony:bank-template_part-5
moony:editorHidden false ;
moony:logHidden true ;
moony:logFollow true ;
moony:logReset false ;
moony:paramHidden false ;
moony:paramCols 1 ;
moony:paramRows 1 ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment