options_colors: fix selected item showing on multiple rows

makes the selector barely more usable…
terminology-1.2
Boris Faure 5 years ago
parent 8c09ee5c88
commit 527859f4c4
  1. 14
      src/bin/options_colors.c

@ -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);

Loading…
Cancel
Save