controls: use both "bg" and "base" evas objects

This commit is contained in:
Boris Faure 2018-01-15 22:45:32 +01:00
parent a66225dc87
commit 820a5440fe
9 changed files with 47 additions and 40 deletions

View File

@ -11,7 +11,7 @@ typedef struct _about_ctx {
Evas_Object *layout; Evas_Object *layout;
Evas_Object *over; Evas_Object *over;
Evas_Object *win; Evas_Object *win;
Evas_Object *bg; Evas_Object *base;
Evas_Object *term; Evas_Object *term;
void (*donecb) (void *data); void (*donecb) (void *data);
void *donedata; void *donedata;
@ -40,7 +40,7 @@ _cb_mouse_down(void *data,
evas_object_del(ctx->over); evas_object_del(ctx->over);
} }
elm_object_focus_set(ctx->layout, EINA_FALSE); elm_object_focus_set(ctx->layout, EINA_FALSE);
edje_object_signal_emit(ctx->bg, "about,hide", "terminology"); edje_object_signal_emit(ctx->base, "about,hide", "terminology");
ecore_timer_add(10.0, _cb_del_delay, ctx->layout); ecore_timer_add(10.0, _cb_del_delay, ctx->layout);
ctx->layout = NULL; ctx->layout = NULL;
@ -52,7 +52,7 @@ _cb_mouse_down(void *data,
} }
void void
about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
void (*donecb) (void *data), void *donedata) void (*donecb) (void *data), void *donedata)
{ {
Evas_Object *o; Evas_Object *o;
@ -65,7 +65,7 @@ about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
assert(ctx); assert(ctx);
ctx->win = win; ctx->win = win;
ctx->bg = bg; ctx->base = base;
ctx->term = term; ctx->term = term;
ctx->donecb = donecb; ctx->donecb = donecb;
ctx->donedata = donedata; ctx->donedata = donedata;
@ -183,16 +183,16 @@ about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
elm_object_part_text_set(o, "terminology.text", txt); elm_object_part_text_set(o, "terminology.text", txt);
eina_stringshare_del(txt); eina_stringshare_del(txt);
evas_object_show(o); evas_object_show(o);
edje_object_part_swallow(bg, "terminology.about", ctx->layout); edje_object_part_swallow(base, "terminology.about", ctx->layout);
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win)); ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(o, 0, 0, 0, 0); evas_object_color_set(o, 0, 0, 0, 0);
edje_object_part_swallow(bg, "terminology.dismiss", o); edje_object_part_swallow(base, "terminology.dismiss", o);
evas_object_show(o); evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, ctx); _cb_mouse_down, ctx);
edje_object_signal_emit(bg, "about,show", "terminology"); edje_object_signal_emit(base, "about,show", "terminology");
elm_object_signal_emit(ctx->layout, "begin" ,"terminology"); elm_object_signal_emit(ctx->layout, "begin" ,"terminology");
elm_object_focus_set(ctx->layout, EINA_TRUE); elm_object_focus_set(ctx->layout, EINA_TRUE);
} }

View File

@ -1,7 +1,7 @@
#ifndef _ABOUT_H__ #ifndef _ABOUT_H__
#define _ABOUT_H__ 1 #define _ABOUT_H__ 1
void about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, void about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
void (*donecb) (void *data), void *donedata); void (*donecb) (void *data), void *donedata);
#endif #endif

View File

@ -14,6 +14,7 @@ typedef struct _Controls_Ctx {
Evas_Object *frame; Evas_Object *frame;
Evas_Object *over; Evas_Object *over;
Evas_Object *win; Evas_Object *win;
Evas_Object *base;
Evas_Object *bg; Evas_Object *bg;
Evas_Object *term; Evas_Object *term;
void (*donecb) (void *data); void (*donecb) (void *data);
@ -164,7 +165,7 @@ _cb_ct_options(void *data,
{ {
Controls_Ctx *ctx = data; Controls_Ctx *ctx = data;
options_show(ctx->win, ctx->bg, ctx->term, _on_sub_done, ctx); options_show(ctx->win, ctx->base, ctx->bg, ctx->term, _on_sub_done, ctx);
controls_hide(ctx, EINA_FALSE); controls_hide(ctx, EINA_FALSE);
} }
@ -176,7 +177,7 @@ _cb_ct_about(void *data,
{ {
Controls_Ctx *ctx = data; Controls_Ctx *ctx = data;
about_show(ctx->win, ctx->bg, ctx->term, _on_sub_done, ctx); about_show(ctx->win, ctx->base, ctx->term, _on_sub_done, ctx);
controls_hide(ctx, EINA_FALSE); controls_hide(ctx, EINA_FALSE);
} }
@ -267,7 +268,7 @@ controls_hide(Controls_Ctx *ctx, Eina_Bool call_cb)
if (ctx->term) if (ctx->term)
{ {
evas_object_event_callback_del(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del); evas_object_event_callback_del(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del);
edje_object_signal_emit(ctx->bg, "controls,hide", "terminology"); edje_object_signal_emit(ctx->base, "controls,hide", "terminology");
} }
if (ctx->over) if (ctx->over)
@ -292,8 +293,8 @@ controls_hide(Controls_Ctx *ctx, Eina_Bool call_cb)
void void
controls_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
void (*donecb) (void *data), void *donedata) Evas_Object *term, void (*donecb) (void *data), void *donedata)
{ {
Evas_Object *o; Evas_Object *o;
Evas_Object *ct_boxh, *ct_boxv, *ct_box, *ct_box2, *ct_box3; Evas_Object *ct_boxh, *ct_boxv, *ct_box, *ct_box2, *ct_box3;
@ -309,6 +310,7 @@ controls_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
ctx = malloc(sizeof(*ctx)); ctx = malloc(sizeof(*ctx));
assert(ctx); assert(ctx);
ctx->win = win; ctx->win = win;
ctx->base = base;
ctx->bg = bg; ctx->bg = bg;
ctx->term = term; ctx->term = term;
ctx->donecb = donecb; ctx->donecb = donecb;
@ -406,16 +408,16 @@ controls_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
evas_object_smart_callback_add(win, "selection,off", _cb_sel_off, evas_object_smart_callback_add(win, "selection,off", _cb_sel_off,
ctx); ctx);
edje_object_part_swallow(bg, "terminology.controls", ctx->frame); edje_object_part_swallow(base, "terminology.controls", ctx->frame);
evas_object_show(ctx->frame); evas_object_show(ctx->frame);
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win)); ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(o, 0, 0, 0, 0); evas_object_color_set(o, 0, 0, 0, 0);
edje_object_part_swallow(bg, "terminology.dismiss", o); edje_object_part_swallow(base, "terminology.dismiss", o);
evas_object_show(o); evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, ctx); _cb_mouse_down, ctx);
edje_object_signal_emit(bg, "controls,show", "terminology"); edje_object_signal_emit(base, "controls,show", "terminology");
elm_object_focus_set(ctx->frame, EINA_TRUE); elm_object_focus_set(ctx->frame, EINA_TRUE);
evas_object_event_callback_add(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del, ctx); evas_object_event_callback_add(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
evas_object_event_callback_add(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx); evas_object_event_callback_add(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);

View File

@ -1,7 +1,8 @@
#ifndef _CONTROLS_H__ #ifndef _CONTROLS_H__
#define _CONTROLS_H__ 1 #define _CONTROLS_H__ 1
void controls_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, void controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
Evas_Object *term,
void (*donecb) (void *data), void *donedata); void (*donecb) (void *data), void *donedata);
void controls_init(void); void controls_init(void);

View File

@ -38,6 +38,7 @@ typedef struct _Options_Ctx {
Evas_Object *opbox; Evas_Object *opbox;
Evas_Object *over; Evas_Object *over;
Evas_Object *win; Evas_Object *win;
Evas_Object *base;
Evas_Object *bg; Evas_Object *bg;
Evas_Object *term; Evas_Object *term;
Config *config; Config *config;
@ -60,7 +61,7 @@ _cb_op(void *data,
ctx->mode = mode; ctx->mode = mode;
edje_object_signal_emit(ctx->bg, "optdetails,hide", "terminology"); edje_object_signal_emit(ctx->base, "optdetails,hide", "terminology");
} }
static void static void
@ -100,7 +101,7 @@ _cb_opdt_hide_done(void *data,
case OPTION_FONT: options_font(ctx->opbox, ctx->term); break; case OPTION_FONT: options_font(ctx->opbox, ctx->term); break;
case OPTION_THEME: options_theme(ctx->opbox, ctx->term); break; case OPTION_THEME: options_theme(ctx->opbox, ctx->term); break;
case OPTION_BACKGROUND: options_background(ctx->opbox, ctx->term); break; case OPTION_BACKGROUND: options_background(ctx->opbox, ctx->term); break;
case OPTION_COLORS: options_colors(ctx->opbox, ctx->term); break; case OPTION_COLORS: options_colors(ctx->opbox, ctx->term, ctx->bg); break;
case OPTION_VIDEO: options_video(ctx->opbox, ctx->term); break; case OPTION_VIDEO: options_video(ctx->opbox, ctx->term); break;
case OPTION_BEHAVIOR: options_behavior(ctx->opbox, ctx->term); break; case OPTION_BEHAVIOR: options_behavior(ctx->opbox, ctx->term); break;
case OPTION_KEYS: options_keys(ctx->opbox, ctx->term); break; case OPTION_KEYS: options_keys(ctx->opbox, ctx->term); break;
@ -108,7 +109,7 @@ _cb_opdt_hide_done(void *data,
case OPTION_ELM: options_elm(ctx->opbox, ctx->term); break; case OPTION_ELM: options_elm(ctx->opbox, ctx->term); break;
case OPTIONS_MODE_NB: assert(0 && "should not occur"); case OPTIONS_MODE_NB: assert(0 && "should not occur");
} }
edje_object_signal_emit(ctx->bg, "optdetails,show", "terminology"); edje_object_signal_emit(ctx->base, "optdetails,show", "terminology");
} }
static void static void
@ -119,7 +120,7 @@ _cb_opdt_hide_done2(void *data,
{ {
Options_Ctx *ctx = data; Options_Ctx *ctx = data;
edje_object_signal_callback_del(ctx->bg, "optdetails,hide,done", edje_object_signal_callback_del(ctx->base, "optdetails,hide,done",
"terminology", "terminology",
_cb_opdt_hide_done2); _cb_opdt_hide_done2);
ecore_timer_add(10.0, _cb_op_del_delay, ctx); ecore_timer_add(10.0, _cb_op_del_delay, ctx);
@ -128,15 +129,15 @@ _cb_opdt_hide_done2(void *data,
static void static void
options_hide(Options_Ctx *ctx) options_hide(Options_Ctx *ctx)
{ {
edje_object_part_swallow(ctx->bg, "terminology.optdetails", ctx->opbox); edje_object_part_swallow(ctx->base, "terminology.optdetails", ctx->opbox);
edje_object_part_swallow(ctx->bg, "terminology.options", ctx->frame); edje_object_part_swallow(ctx->base, "terminology.options", ctx->frame);
edje_object_signal_emit(ctx->bg, "optdetails,show", "terminology"); edje_object_signal_emit(ctx->base, "optdetails,show", "terminology");
edje_object_signal_emit(ctx->bg, "options,show", "terminology"); edje_object_signal_emit(ctx->base, "options,show", "terminology");
edje_object_signal_callback_del(ctx->bg, "optdetails,hide,done", edje_object_signal_callback_del(ctx->base, "optdetails,hide,done",
"terminology", "terminology",
_cb_opdt_hide_done); _cb_opdt_hide_done);
edje_object_signal_callback_add(ctx->bg, "optdetails,hide,done", edje_object_signal_callback_add(ctx->base, "optdetails,hide,done",
"terminology", "terminology",
_cb_opdt_hide_done2, ctx); _cb_opdt_hide_done2, ctx);
elm_object_focus_set(ctx->frame, EINA_FALSE); elm_object_focus_set(ctx->frame, EINA_FALSE);
@ -146,8 +147,8 @@ options_hide(Options_Ctx *ctx)
evas_object_del(ctx->over); evas_object_del(ctx->over);
ctx->over = NULL; ctx->over = NULL;
edje_object_signal_emit(ctx->bg, "options,hide", "terminology"); edje_object_signal_emit(ctx->base, "options,hide", "terminology");
edje_object_signal_emit(ctx->bg, "optdetails,hide", "terminology"); edje_object_signal_emit(ctx->base, "optdetails,hide", "terminology");
if (ctx->donecb) if (ctx->donecb)
ctx->donecb(ctx->donedata); ctx->donecb(ctx->donedata);
@ -166,7 +167,7 @@ _cb_mouse_down(void *data,
void void
options_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, options_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg, Evas_Object *term,
void (*donecb) (void *data), void *donedata) void (*donecb) (void *data), void *donedata)
{ {
Evas_Object *o, *op_box, *op_tbox; Evas_Object *o, *op_box, *op_tbox;
@ -182,6 +183,7 @@ options_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
assert(ctx); assert(ctx);
ctx->mode = OPTION_NONE; ctx->mode = OPTION_NONE;
ctx->win = win; ctx->win = win;
ctx->base = base;
ctx->bg = bg; ctx->bg = bg;
ctx->term = term; ctx->term = term;
ctx->donecb = donecb; ctx->donecb = donecb;
@ -194,7 +196,7 @@ options_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
ctx->opbox = o = elm_box_add(win); ctx->opbox = o = elm_box_add(win);
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);
edje_object_part_swallow(ctx->bg, "terminology.optdetails", o); edje_object_part_swallow(ctx->base, "terminology.optdetails", o);
evas_object_show(o); evas_object_show(o);
ctx->frame = o = elm_frame_add(win); ctx->frame = o = elm_frame_add(win);
@ -254,19 +256,19 @@ options_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "changed", _cb_op_tmp_chg, ctx); evas_object_smart_callback_add(o, "changed", _cb_op_tmp_chg, ctx);
edje_object_part_swallow(bg, "terminology.options", ctx->frame); edje_object_part_swallow(base, "terminology.options", ctx->frame);
evas_object_show(ctx->frame); evas_object_show(ctx->frame);
edje_object_signal_callback_add(ctx->bg, "optdetails,hide,done", edje_object_signal_callback_add(ctx->base, "optdetails,hide,done",
"terminology", "terminology",
_cb_opdt_hide_done, ctx); _cb_opdt_hide_done, ctx);
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win)); ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(o, 0, 0, 0, 0); evas_object_color_set(o, 0, 0, 0, 0);
edje_object_part_swallow(ctx->bg, "terminology.dismiss", o); edje_object_part_swallow(ctx->base, "terminology.dismiss", o);
evas_object_show(o); evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, ctx); _cb_mouse_down, ctx);
edje_object_signal_emit(ctx->bg, "options,show", "terminology"); edje_object_signal_emit(ctx->base, "options,show", "terminology");
elm_object_focus_set(ctx->toolbar, EINA_TRUE); elm_object_focus_set(ctx->toolbar, EINA_TRUE);
} }

View File

@ -1,7 +1,8 @@
#ifndef _TERMINOLOGY_OPTIONS_H__ #ifndef _TERMINOLOGY_OPTIONS_H__
#define _TERMINOLOGY_OPTIONS_H__ 1 #define _TERMINOLOGY_OPTIONS_H__ 1
void options_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, void options_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
void (*donecb) (void *data), void *donedata); Evas_Object *term,
void (*donecb) (void *data), void *donedata);
#endif #endif

View File

@ -189,7 +189,7 @@ _parent_del_cb(void *data,
} }
void void
options_colors(Evas_Object *opbox, Evas_Object *term) options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg)
{ {
Config *config = termio_config_get(term); Config *config = termio_config_get(term);
Evas_Object *o, *fr, *bx, *sc, *bx2, *bx3, *bx4; Evas_Object *o, *fr, *bx, *sc, *bx2, *bx3, *bx4;
@ -202,6 +202,7 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
ctx->config = config; ctx->config = config;
ctx->term = term; ctx->term = term;
ctx->bg = bg;
fr = o = elm_frame_add(opbox); fr = o = elm_frame_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);

View File

@ -1,6 +1,6 @@
#ifndef _OPTIONS_COLORS_H__ #ifndef _OPTIONS_COLORS_H__
#define _OPTIONS_COLORS_H__ 1 #define _OPTIONS_COLORS_H__ 1
void options_colors(Evas_Object *opbox, Evas_Object *term); void options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg);
#endif #endif

View File

@ -5009,7 +5009,7 @@ _cb_options(void *data,
{ {
Term *term = data; Term *term = data;
controls_show(term->wn->win, term->wn->base, term->termio, controls_show(term->wn->win, term->wn->base, term->bg, term->termio,
_cb_options_done, term->wn); _cb_options_done, term->wn);
} }