options_colors: be able to select color scheme
This commit is contained in:
parent
17246e5d84
commit
7bb1639260
|
@ -16,6 +16,7 @@ typedef struct _Color_Scheme_Ctx
|
||||||
Evas_Coord pv_width;
|
Evas_Coord pv_width;
|
||||||
Evas_Coord pv_height;
|
Evas_Coord pv_height;
|
||||||
Eina_List *cs_infos;
|
Eina_List *cs_infos;
|
||||||
|
Ecore_Timer *seltimer;
|
||||||
} Color_Scheme_Ctx;
|
} Color_Scheme_Ctx;
|
||||||
|
|
||||||
typedef struct _Color_Scheme_Info
|
typedef struct _Color_Scheme_Info
|
||||||
|
@ -67,17 +68,33 @@ _cb_op_color_scheme_sel(void *data,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Color_Scheme_Info *csi = data;
|
Color_Scheme_Info *csi = data;
|
||||||
|
Color_Scheme *cs = csi->cs;
|
||||||
Config *config = csi->ctx->config;
|
Config *config = csi->ctx->config;
|
||||||
|
|
||||||
ERR("TODO: csi sel %p cfg:%p", csi, config);
|
if ((config->color_scheme_name) &&
|
||||||
#if 0
|
(!strcmp(cs->md.name, config->color_scheme_name)))
|
||||||
if ((config->theme) && (!strcmp(t->name, config->theme)))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
eina_stringshare_replace(&(config->theme), t->name);
|
eina_stringshare_replace(&(config->color_scheme_name), cs->md.name);
|
||||||
|
free((void*)config->color_scheme);
|
||||||
|
config->color_scheme = color_scheme_dup(cs);
|
||||||
|
|
||||||
config_save(config);
|
config_save(config);
|
||||||
change_theme(termio_win_get(t->ctx->term), config);
|
change_theme(termio_win_get(csi->ctx->term), config);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_cb_sel_item(void *data)
|
||||||
|
{
|
||||||
|
Color_Scheme_Info *csi = data;
|
||||||
|
|
||||||
|
if (csi)
|
||||||
|
{
|
||||||
|
elm_gengrid_item_selected_set(csi->item, EINA_TRUE);
|
||||||
|
elm_gengrid_item_bring_in(csi->item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
|
||||||
|
csi->ctx->seltimer = NULL;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -94,6 +111,7 @@ _parent_del_cb(void *data,
|
||||||
free(csi->cs);
|
free(csi->cs);
|
||||||
free(csi);
|
free(csi);
|
||||||
}
|
}
|
||||||
|
ecore_timer_del(ctx->seltimer);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +134,6 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
ctx->term = term;
|
ctx->term = term;
|
||||||
ctx->pv_width = (COLOR_MODE_PREVIEW_WIDTH+0) * chw;
|
ctx->pv_width = (COLOR_MODE_PREVIEW_WIDTH+0) * chw;
|
||||||
ctx->pv_height = (COLOR_MODE_PREVIEW_HEIGHT+0) * chh;
|
ctx->pv_height = (COLOR_MODE_PREVIEW_HEIGHT+0) * chh;
|
||||||
ERR("w:%d, h:%d", ctx->pv_width, ctx->pv_height);
|
|
||||||
if (ctx->pv_width >= ctx->pv_height)
|
if (ctx->pv_width >= ctx->pv_height)
|
||||||
ctx->pv_height = ctx->pv_width;
|
ctx->pv_height = ctx->pv_width;
|
||||||
else
|
else
|
||||||
|
@ -147,7 +164,6 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
o = elm_gengrid_add(opbox);
|
o = elm_gengrid_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
//elm_gengrid_item_size_set(o, ctx->pv_width + 10, ctx->pv_height + 10);
|
|
||||||
|
|
||||||
schemes = color_scheme_list();
|
schemes = color_scheme_list();
|
||||||
|
|
||||||
|
@ -166,15 +182,13 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
ctx->cs_infos = eina_list_append(ctx->cs_infos, csi);
|
ctx->cs_infos = eina_list_append(ctx->cs_infos, csi);
|
||||||
|
|
||||||
#if 0
|
if ((config) && (config->color_scheme_name) &&
|
||||||
if ((config) && (config->theme) &&
|
(!strcmp(config->color_scheme_name, cs->md.name)))
|
||||||
(!strcmp(config->theme, t->name)))
|
|
||||||
{
|
{
|
||||||
if (ctx->seltimer)
|
if (ctx->seltimer)
|
||||||
ecore_timer_del(ctx->seltimer);
|
ecore_timer_del(ctx->seltimer);
|
||||||
ctx->seltimer = ecore_timer_add(0.2, _cb_sel_item, t);
|
ctx->seltimer = ecore_timer_add(0.2, _cb_sel_item, csi);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue