miniview: have ctrl-shift-h toggle the miniview

This commit is contained in:
Boris Faure 2014-04-20 18:45:21 +02:00
parent cc23a7e896
commit eddec5e387
4 changed files with 68 additions and 58 deletions

View File

@ -379,7 +379,27 @@ collections {
// miniview
part { name: "terminology.miniview"; type: SWALLOW;
description { state: "default" 0.0;
//color: 255 255 255 0;
visible: 0;
}
description { state: "on" 0.0;
inherit: "default" 0.0;
visible: 1;
//color: 255 255 255 255;
}
}
program {
signal: "miniview,off"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "terminology.miniview";
}
program {
signal: "miniview,on"; source: "terminology";
action: STATE_SET "on" 0.0;
transition: DECELERATE 0.5;
target: "terminology.miniview";
}
program {

View File

@ -1106,12 +1106,12 @@ _cb_miniview_toggle(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSE
if (term->miniview_shown)
{
evas_object_hide(term->miniview);
edje_object_signal_emit(term->bg, "miniview,off", "terminology");
term->miniview_shown = EINA_FALSE;
}
else
{
evas_object_show(term->miniview);
edje_object_signal_emit(term->bg, "miniview,on", "terminology");
term->miniview_shown = EINA_TRUE;
}
}

View File

@ -1,5 +1,7 @@
#include <Elementary.h>
#include <stdio.h>
#include <assert.h>
#include "col.h"
#include "termpty.h"
#include "termio.h"
@ -28,15 +30,12 @@ miniview_init(void)
_miniview_log_dom = eina_log_domain_register("miniview", NULL);
if (_miniview_log_dom < 0)
EINA_LOG_CRIT("could not create log domain 'miniview'.");
ERR("INIT");
}
void
miniview_shutdown(void)
{
if (_miniview_log_dom < 0) return;
ERR("SHUTDOWN");
eina_log_domain_unregister(_miniview_log_dom);
_miniview_log_dom = -1;
}
@ -72,11 +71,9 @@ _smart_add(Evas_Object *obj)
/* miniview output widget */
o = evas_object_image_add(canvas);
evas_object_image_alpha_set(o, EINA_TRUE);
evas_object_color_set(o, 128, 0, 0, 128);
evas_object_smart_member_add(o, obj);
mv->image_obj = o;
evas_object_show(o);
}
static void
@ -102,46 +99,18 @@ _smart_move(Evas_Object *obj, Evas_Coord x EINA_UNUSED, Evas_Coord y EINA_UNUSED
}
static void
_smart_show(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
Evas_Coord ox, oy, ow, oh;
evas_object_geometry_get(mv->image_obj, &ox, &oy, &ow, &oh);
DBG("ox:%d oy:%d ow:%d oh:%d visible:%d|%d %d %d %d",
ox, oy, ow, oh,
evas_object_visible_get(obj),
evas_object_visible_get(mv->image_obj),
evas_object_layer_get(mv->image_obj),
evas_object_layer_get(obj),
evas_object_layer_get(mv->termio));
evas_object_show(mv->image_obj);
}
static void
_smart_hide(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
evas_object_hide(mv->image_obj);
}
static void
_miniview_draw(Miniview *mv, int columns, int oh)
_miniview_draw(Miniview *mv)
{
Evas_Coord columns, oh;
unsigned int *pixels;
int x, y;
pixels = evas_object_image_data_get(mv->image_obj, EINA_TRUE);
memset(pixels, 0, sizeof(*pixels) * columns * oh);
evas_object_geometry_get(mv->image_obj, NULL, NULL, &columns, &oh);
if (!columns || !oh) return;
pixels = evas_object_image_data_get(mv->image_obj, EINA_TRUE);
assert (pixels != NULL);
memset(pixels, 0, sizeof(*pixels) * columns * oh);
DBG("DRAW");
for (y = 0; y < oh; y++)
@ -187,12 +156,46 @@ _miniview_draw(Miniview *mv, int columns, int oh)
default:
r = 180; g = 180; b = 180;
}
pixels[x + y * columns] = (r << 16) | (g << 8) | (b);
pixels[x + y * columns] = (0xff << 24) | (r << 16) | (g << 8) | b;
}
}
}
}
static void
_smart_show(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
Evas_Coord ox, oy, ow, oh;
evas_object_geometry_get(mv->image_obj, &ox, &oy, &ow, &oh);
DBG("ox:%d oy:%d ow:%d oh:%d visible:%d|%d %d %d %d",
ox, oy, ow, oh,
evas_object_visible_get(obj),
evas_object_visible_get(mv->image_obj),
evas_object_layer_get(mv->image_obj),
evas_object_layer_get(obj),
evas_object_layer_get(mv->termio));
_miniview_draw(mv);
evas_object_show(mv->image_obj);
}
static void
_smart_hide(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
evas_object_hide(mv->image_obj);
}
static void
_smart_size(Evas_Object *obj)
{
@ -222,8 +225,7 @@ _smart_size(Evas_Object *obj)
evas_object_image_fill_set(mv->image_obj, 0, 0, columns,
oh);
_miniview_draw(mv, columns, oh);
evas_object_show(mv->image_obj);
_miniview_draw(mv);
}

View File

@ -16,7 +16,6 @@
#include "utils.h"
#include "media.h"
#include "dbus.h"
#include "miniview.h"
#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
# include <sys/proc_info.h>
@ -63,7 +62,6 @@ struct _Termio
Eina_Bool dndobjdel : 1;
} down;
} link;
Evas_Object *miniview;
int zoom_fontsize_start;
int scroll;
Eina_List *mirrors;
@ -1255,7 +1253,6 @@ _block_edje_activate(Evas_Object *obj, Termblock *blk)
if (ok)
{
_block_edje_cmds(sd->pty, blk, blk->cmds, EINA_TRUE);
//scrolio_pty_update(sd->miniview, sd->pty);
}
}
@ -1687,8 +1684,6 @@ _smart_cb_change(void *data)
sd->anim = NULL;
_smart_apply(obj);
evas_object_smart_callback_call(obj, "changed", NULL);
if (sd->miniview)
miniview_update_scroll(sd->miniview, termio_scroll_get(obj));
return EINA_FALSE;
}
@ -1697,8 +1692,6 @@ _smart_update_queue(Evas_Object *obj, Termio *sd)
{
if (sd->anim) return;
sd->anim = ecore_animator_add(_smart_cb_change, obj);
if (sd->miniview)
miniview_update_scroll(sd->miniview, termio_scroll_get(obj));
}
static void
@ -2199,7 +2192,7 @@ _smart_cb_key_down(void *data, Evas *e EINA_UNUSED,
_paste_selection(data, ELM_SEL_TYPE_CLIPBOARD);
goto end;
}
else if (!strcmp(ev->keyname, "f"))
else if (!strcmp(ev->keyname, "h"))
{
evas_object_smart_callback_call(data, "miniview,toggle", NULL);
goto end;
@ -3536,8 +3529,6 @@ _smart_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
default:
break;
}
if (sd->miniview)
miniview_update_scroll(sd->miniview, termio_scroll_get(obj));
}
}
@ -4773,9 +4764,6 @@ termio_config_update(Evas_Object *obj)
evas_object_textgrid_font_set(sd->grid.obj, sd->font.name, sd->font.size);
evas_object_textgrid_cell_size_get(sd->grid.obj, &w, &h);
//evas_object_scale_set(sd->miniview.grid.obj, elm_config_scale_get());
//evas_object_textgrid_font_set(sd->miniview.grid.obj, sd->font.name, sd->font.size);
//evas_object_textgrid_cell_size_get(sd->miniview.grid.obj, &w, &h);
if (w < 1) w = 1;
if (h < 1) h = 1;
sd->font.chw = w;