miniview: close from edj

devs/discomfitor/cc
Boris Faure 9 years ago
parent 8d04ae955e
commit d72a0cbec3
  1. 29
      data/themes/default.edc
  2. 23
      src/bin/main.c
  3. 2
      src/bin/main.h
  4. 13
      src/bin/miniview.c
  5. 11
      src/bin/termio.c
  6. 1
      src/bin/termio.h

@ -8,6 +8,10 @@ color_classes {
collections {
group { name: "terminology/miniview";
images {
image: "icon_close.png" COMP;
image: "fn_shadow.png" COMP;
}
set { name: "bg_shadow";
image { image: "bg_shadow.png" COMP; size: 0 0 200 150; }
image { image: "bg_shadow2.png" COMP; size: 200 150 400 300; }
@ -38,13 +42,15 @@ collections {
rel2 {
to: "miniview.bg";
relative: 1.0 1.0;
offset: 0 0;
offset: -1 -1;
}
}
}
part { name: "miniview.close"; type: RECT;
part { name: "miniview.close_shadow"; type: IMAGE;
description { state: "default" 0.0;
color: 255 0 0 255;
image {
normal: "fn_shadow.png";
};
rel1 {
to: "miniview.bg";
relative: 0.0 0.0;
@ -53,10 +59,25 @@ collections {
rel2 {
to: "miniview.bg";
relative: 0.0 0.0;
offset: 5 5;
offset: 16 16;
}
}
}
part { name: "miniview.close"; type: IMAGE;
description { state: "default" 0.0;
image {
normal: "icon_close.png";
};
rel1.to: "miniview.close_shadow";
rel2.to: "miniview.close_shadow";
}
}
};
programs {
program {
signal: "mouse,clicked,1"; source: "miniview.close";
action: SIGNAL_EMIT "miniview,close" "terminology";
}
};
};

@ -1094,25 +1094,33 @@ _popmedia_show(Term *term, const char *src)
}
}
static void
_cb_miniview_toggle(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Term *term = data;
void
term_miniview_hide(Term *term)
{
EINA_SAFETY_ON_NULL_RETURN(term);
EINA_SAFETY_ON_NULL_RETURN(term->miniview);
ERR("MINIVIEW TOGGLE term:%p", term);
if (term->miniview_shown)
{
edje_object_signal_emit(term->bg, "miniview,off", "terminology");
term->miniview_shown = EINA_FALSE;
}
}
void
term_miniview_toggle(Term *term)
{
EINA_SAFETY_ON_NULL_RETURN(term);
EINA_SAFETY_ON_NULL_RETURN(term->miniview);
if (term->miniview_shown)
{
ERR("OFF bg:%p", term->bg);
edje_object_signal_emit(term->bg, "miniview,off", "terminology");
term->miniview_shown = EINA_FALSE;
}
else
{
ERR("ON bg:%p", term->bg);
edje_object_signal_emit(term->bg, "miniview,on", "terminology");
term->miniview_shown = EINA_TRUE;
}
@ -2285,7 +2293,6 @@ main_term_new(Win *wn, Config *config, const char *cmd,
evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term);
evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term);
evas_object_smart_callback_add(o, "tab,0", _cb_tab_10, term);
evas_object_smart_callback_add(o, "miniview,toggle", _cb_miniview_toggle, term);
evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,

@ -27,5 +27,7 @@ Evas_Object *main_win_evas_object_get(Win *wn);
Eina_List *main_win_terms_get(Win *wn);
Evas_Object *main_term_evas_object_get(Term *term);
Evas_Object *term_miniview_get(Term *term);
void term_miniview_toggle(Term *term);
void term_miniview_hide(Term *term);
#endif

@ -380,6 +380,18 @@ _smart_init(void)
_smart = evas_smart_class_new(&sc);
}
static void
_cb_miniview_close(void *data, Evas_Object *obj EINA_UNUSED,
const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
{
Miniview *mv = data;
EINA_SAFETY_ON_NULL_RETURN(mv);
EINA_SAFETY_ON_NULL_RETURN(mv->termio);
if (mv->is_shown)
term_miniview_hide(termio_term_get(mv->termio));
}
Evas_Object *
miniview_add(Evas_Object *parent, Evas_Object *termio)
{
@ -423,6 +435,7 @@ miniview_add(Evas_Object *parent, Evas_Object *termio)
_smart_cb_mouse_wheel, obj);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_smart_cb_mouse_down, obj);
edje_object_signal_callback_add(mv->base, "miniview,close", "terminology", _cb_miniview_close, mv);
mv->deferred_renderer = ecore_timer_add(0.1, _deferred_renderer, mv);

@ -2197,7 +2197,7 @@ _smart_cb_key_down(void *data, Evas *e EINA_UNUSED,
}
else if (!strcmp(ev->keyname, "h"))
{
evas_object_smart_callback_call(data, "miniview,toggle", NULL);
term_miniview_toggle(sd->term);
goto end;
}
}
@ -5006,3 +5006,12 @@ termio_miniview_get(Evas_Object *obj)
return term_miniview_get(sd->term);
}
Term*
termio_term_get(Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
return sd->term;
}

@ -44,5 +44,6 @@ void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg);
Termpty *termio_pty_get(Evas_Object *obj);
Evas_Object * termio_miniview_get(Evas_Object *obj);
Term* termio_term_get(Evas_Object *obj);
#endif

Loading…
Cancel
Save