aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-04 17:53:15 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-04 17:53:15 +0100
commita57ab9c07f49dd358f9843cbe25d0a2826d7e597 (patch)
tree84c4cae022f5d3b2078f5f113c2a714a5cea274f
parentf26779047c8e2e4f86258b32c0b83c9cdd0918e2 (diff)
downloadsherlock.lv2-a57ab9c07f49dd358f9843cbe25d0a2826d7e597.tar.xz
implment overwrite and block.
-rw-r--r--atom_inspector_ui.c43
-rw-r--r--midi_inspector_ui.c44
-rw-r--r--osc_inspector_ui.c48
3 files changed, 122 insertions, 13 deletions
diff --git a/atom_inspector_ui.c b/atom_inspector_ui.c
index 37b2d26..50c7bcc 100644
--- a/atom_inspector_ui.c
+++ b/atom_inspector_ui.c
@@ -69,6 +69,8 @@ struct _UI {
Evas_Object *table;
Evas_Object *list;
Evas_Object *clear;
+ Evas_Object *autoclear;
+ Evas_Object *autoblock;
Evas_Object *popup;
Elm_Genlist_Item_Class *itc_sherlock;
@@ -793,7 +795,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(ui->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ui->list);
- elm_table_pack(ui->table, ui->list, 0, 0, 2, 1);
+ elm_table_pack(ui->table, ui->list, 0, 0, 4, 1);
}
ui->clear = elm_button_add(ui->table);
@@ -807,6 +809,26 @@ _content_get(eo_ui_t *eoui)
elm_table_pack(ui->table, ui->clear, 0, 1, 1, 1);
}
+ ui->autoclear = elm_check_add(ui->table);
+ if(ui->autoclear)
+ {
+ elm_object_text_set(ui->autoclear, "overwrite");
+ evas_object_size_hint_weight_set(ui->autoclear, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoclear, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoclear);
+ elm_table_pack(ui->table, ui->autoclear, 1, 1, 1, 1);
+ }
+
+ ui->autoblock = elm_check_add(ui->table);
+ if(ui->autoblock)
+ {
+ elm_object_text_set(ui->autoblock, "block");
+ evas_object_size_hint_weight_set(ui->autoblock, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoblock);
+ elm_table_pack(ui->table, ui->autoblock, 2, 1, 1, 1);
+ }
+
Evas_Object *info = elm_button_add(ui->table);
if(info)
{
@@ -814,7 +836,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(info, 0.f, 0.f);
evas_object_size_hint_align_set(info, 1.f, EVAS_HINT_FILL);
evas_object_show(info);
- elm_table_pack(ui->table, info, 1, 1, 1, 1);
+ elm_table_pack(ui->table, info, 3, 1, 1, 1);
Evas_Object *icon = elm_icon_add(info);
if(icon)
@@ -1091,8 +1113,22 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
memcpy(ev, elmnt, len);
// check item count
- if(n++ >= COUNT_MAX)
+ if(n + 1 > COUNT_MAX)
+ {
+ if(elm_check_state_get(ui->autoclear))
+ {
+ elm_genlist_clear(ui->list);
+ n = 0;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if(elm_check_state_get(ui->autoblock))
+ {
break;
+ }
const LV2_Atom *atom = &elmnt->body;
Elm_Genlist_Item_Type type = _is_expandable(ui, atom->type)
@@ -1103,6 +1139,7 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
ev, NULL, type, NULL, NULL);
elm_genlist_item_select_mode_set(itm2, ELM_OBJECT_SELECT_MODE_DEFAULT);
elm_genlist_item_expanded_set(itm2, EINA_FALSE);
+ n++;
// scroll to last item
//elm_genlist_item_show(itm, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
diff --git a/midi_inspector_ui.c b/midi_inspector_ui.c
index 13578af..4598847 100644
--- a/midi_inspector_ui.c
+++ b/midi_inspector_ui.c
@@ -41,6 +41,8 @@ struct _UI {
Evas_Object *table;
Evas_Object *list;
Evas_Object *clear;
+ Evas_Object *autoclear;
+ Evas_Object *autoblock;
Evas_Object *popup;
Elm_Genlist_Item_Class *itc_midi;
@@ -528,7 +530,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(ui->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ui->list);
- elm_table_pack(ui->table, ui->list, 0, 0, 2, 1);
+ elm_table_pack(ui->table, ui->list, 0, 0, 4, 1);
}
ui->clear = elm_button_add(ui->table);
@@ -542,6 +544,26 @@ _content_get(eo_ui_t *eoui)
elm_table_pack(ui->table, ui->clear, 0, 1, 1, 1);
}
+ ui->autoclear = elm_check_add(ui->table);
+ if(ui->autoclear)
+ {
+ elm_object_text_set(ui->autoclear, "overwrite");
+ evas_object_size_hint_weight_set(ui->autoclear, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoclear, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoclear);
+ elm_table_pack(ui->table, ui->autoclear, 1, 1, 1, 1);
+ }
+
+ ui->autoblock = elm_check_add(ui->table);
+ if(ui->autoblock)
+ {
+ elm_object_text_set(ui->autoblock, "block");
+ evas_object_size_hint_weight_set(ui->autoblock, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoblock);
+ elm_table_pack(ui->table, ui->autoblock, 2, 1, 1, 1);
+ }
+
Evas_Object *info = elm_button_add(ui->table);
if(info)
{
@@ -549,7 +571,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(info, 0.f, 0.f);
evas_object_size_hint_align_set(info, 1.f, EVAS_HINT_FILL);
evas_object_show(info);
- elm_table_pack(ui->table, info, 1, 1, 1, 1);
+ elm_table_pack(ui->table, info, 3, 1, 1, 1);
Evas_Object *icon = elm_icon_add(info);
if(icon)
@@ -725,12 +747,28 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
memcpy(ev, elmnt, len);
// check item count
- if(n++ >= COUNT_MAX)
+ if(n + 1 > COUNT_MAX)
+ {
+ if(elm_check_state_get(ui->autoclear))
+ {
+ elm_genlist_clear(ui->list);
+ n = 0;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if(elm_check_state_get(ui->autoblock))
+ {
break;
+ }
Elm_Object_Item *itm2 = elm_genlist_item_append(ui->list, ui->itc_midi,
ev, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
elm_genlist_item_select_mode_set(itm2, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ elm_genlist_item_expanded_set(itm2, EINA_FALSE);
+ n++;
// scroll to last item
//elm_genlist_item_show(itm, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
diff --git a/osc_inspector_ui.c b/osc_inspector_ui.c
index b7d2188..85d6c6c 100644
--- a/osc_inspector_ui.c
+++ b/osc_inspector_ui.c
@@ -46,6 +46,8 @@ struct _UI {
Evas_Object *table;
Evas_Object *list;
Evas_Object *clear;
+ Evas_Object *autoclear;
+ Evas_Object *autoblock;
Evas_Object *popup;
Elm_Genlist_Item_Class *itc_packet;
@@ -580,7 +582,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(ui->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ui->list);
- elm_table_pack(ui->table, ui->list, 0, 0, 2, 1);
+ elm_table_pack(ui->table, ui->list, 0, 0, 4, 1);
}
ui->clear = elm_button_add(ui->table);
@@ -594,6 +596,26 @@ _content_get(eo_ui_t *eoui)
elm_table_pack(ui->table, ui->clear, 0, 1, 1, 1);
}
+ ui->autoclear = elm_check_add(ui->table);
+ if(ui->autoclear)
+ {
+ elm_object_text_set(ui->autoclear, "overwrite");
+ evas_object_size_hint_weight_set(ui->autoclear, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoclear, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoclear);
+ elm_table_pack(ui->table, ui->autoclear, 1, 1, 1, 1);
+ }
+
+ ui->autoblock = elm_check_add(ui->table);
+ if(ui->autoblock)
+ {
+ elm_object_text_set(ui->autoblock, "block");
+ evas_object_size_hint_weight_set(ui->autoblock, 0.f, 0.f);
+ evas_object_size_hint_align_set(ui->autoblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ui->autoblock);
+ elm_table_pack(ui->table, ui->autoblock, 2, 1, 1, 1);
+ }
+
Evas_Object *info = elm_button_add(ui->table);
if(info)
{
@@ -601,7 +623,7 @@ _content_get(eo_ui_t *eoui)
evas_object_size_hint_weight_set(info, 0.f, 0.f);
evas_object_size_hint_align_set(info, 1.f, EVAS_HINT_FILL);
evas_object_show(info);
- elm_table_pack(ui->table, info, 1, 1, 1, 1);
+ elm_table_pack(ui->table, info, 3, 1, 1, 1);
Evas_Object *icon = elm_icon_add(info);
if(icon)
@@ -791,17 +813,29 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
memcpy(ev, elmnt, len);
// check item count
- if(n++ >= COUNT_MAX)
+ if(n + 1 > COUNT_MAX)
+ {
+ if(elm_check_state_get(ui->autoclear))
+ {
+ elm_genlist_clear(ui->list);
+ n = 0;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if(elm_check_state_get(ui->autoblock))
+ {
break;
+ }
const LV2_Atom_Object *obj = (const LV2_Atom_Object *)&ev->body;
Elm_Object_Item *itm2 = elm_genlist_item_append(ui->list, ui->itc_packet,
ev, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
elm_genlist_item_select_mode_set(itm2, ELM_OBJECT_SELECT_MODE_DEFAULT);
- /*
- if(osc_atom_is_bundle(&ui->oforge, obj))
- elm_genlist_item_expanded_set(itm2, EINA_TRUE);
- */
+ elm_genlist_item_expanded_set(itm2, EINA_FALSE);
+ n++;
// scroll to last item
//elm_genlist_item_show(itm, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);