options_colors: fix selected item showing on multiple rows

makes the selector barely more usable…
This commit is contained in:
Boris Faure 2018-01-15 23:49:03 +01:00
parent 8c09ee5c88
commit 527859f4c4
1 changed files with 11 additions and 3 deletions

View File

@ -45,6 +45,10 @@ _cb_op_color_item_sel(void *data,
int r = 0, g = 0, b = 0, a = 0;
int i, j;
if (ctx->curitem == it)
return;
if (ctx->curitem)
elm_colorselector_palette_item_selected_set(ctx->curitem, EINA_FALSE);
ctx->curitem = it;
elm_colorselector_palette_item_color_get(it, &r, &g, &b, &a);
elm_colorselector_color_set(ctx->colorsel, r, g, b, a);
@ -147,6 +151,7 @@ _reset_config_colors(Colors_Ctx *ctx)
}
}
static void
_cb_op_reset(void *data,
Evas_Object *_obj EINA_UNUSED,
@ -292,6 +297,11 @@ options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg)
config->colors[(j * 12) + i].b,
config->colors[(j * 12) + i].a);
ctx->colitem[j][i] = it;
if (i == 0 && j == 0)
{
ctx->curitem = ctx->colitem[0][0];
elm_colorselector_palette_item_selected_set(ctx->curitem, EINA_TRUE);
}
}
elm_box_pack_end(bx3, o);
evas_object_show(o);
@ -308,8 +318,6 @@ options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg)
}
}
ctx->curitem = ctx->colitem[0][0];
bx2 = o = elm_box_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
@ -330,7 +338,7 @@ options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg)
evas_object_show(o);
ctx->colorsel = o = elm_colorselector_add(opbox);
elm_colorselector_palette_item_color_get(ctx->colitem[0][0], &r, &g, &b, &a);
elm_colorselector_palette_item_color_get(ctx->curitem, &r, &g, &b, &a);
elm_colorselector_color_set(o, r, g, b, a);
elm_colorselector_mode_set(o, ELM_COLORSELECTOR_COMPONENTS);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);