miniview: use an image ftm

devs/discomfitor/cc
Boris Faure 9 years ago
parent b8cd00dadd
commit d4ce1166c6
  1. 68
      data/themes/default.edc
  2. 71
      src/bin/main.c
  3. 370
      src/bin/miniview.c
  4. 6
      src/bin/miniview.h
  5. 40
      src/bin/termio.c
  6. 3
      src/bin/termio.h

@ -6,8 +6,8 @@ color_classes {
#endif
collections {
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// the background and general container for the terminal
group { name: "terminology/core";
parts {
@ -82,6 +82,7 @@ collections {
rel2.offset: -2 -2;
}
}
}
}
@ -148,7 +149,7 @@ collections {
target: "base";
target: "shadow";
}
////////////////////////////////////////////////////////////////////
// actual text grid for chars, cursors, selectiond etc. goes here
// and has a background layered behind it inside the swallowed
@ -157,7 +158,7 @@ collections {
description { state: "default" 0.0;
}
}
////////////////////////////////////////////////////////////////////
// indicator of other tabs and control
part { name: "tabcount_clip"; type: RECT;
@ -373,6 +374,14 @@ collections {
color: 0 0 0 0;
}
}
////////////////////////////////////////////////////////////////////
// miniview
part { name: "terminology.miniview"; type: SWALLOW;
description { state: "default" 0.0;
}
}
program {
signal: "mouse,in"; source: "tabcount_ev";
action: STATE_SET "over" 0.0;
@ -1275,8 +1284,8 @@ collections {
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// the selection
// selections come in 5 modes:
//
@ -2228,9 +2237,8 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// the cursor to show where text is typed
group { name: "terminology/cursor";
images {
@ -2401,7 +2409,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// an object to contain the selection tool used for selecting tabs (with
//// a glow grid of terms
group { name: "terminology/sel/base";
@ -2847,8 +2855,8 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// an object overlayd on text that is a link
group { name: "terminology/link";
images {
@ -2958,31 +2966,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
group { name: "terminology/miniview";
parts {
part { name: "miniview"; type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
color: 25 50 30 100;
rel1.relative: 0.85 0.0;
}
}
part { name: "miniview_screen"; type: RECT;
mouse_events: 1;
dragable {
confine: "miniview";
x: 0 0 0;
y: 1 1 0;
}
description { state: "default" 0.0;
color: 255 255 255 30;
fixed:1 1;
}
}
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// the multimedia controls
group { name: "terminology/mediabusy";
images {
@ -3106,7 +3090,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// the multimedia controls
group { name: "terminology/mediactrl";
images {
@ -3304,9 +3288,9 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
ICON("paste", "icon_paste.png");
ICON("settings", "icon_settings.png");
ICON("about", "icon_about.png");
#undef ICON
#undef ICON
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// the about box content image
group { name: "terminology/about";
images {
@ -3404,8 +3388,8 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
//// used in the font selection dialog to give a base for black text
//// previews so they are always visible
group { name: "terminology/fontpreview";

@ -64,6 +64,7 @@ struct _Term
Eina_Bool hold : 1;
Eina_Bool unswallowed : 1;
Eina_Bool missed_bell : 1;
Eina_Bool miniview_shown : 1;
};
struct _Split
@ -1097,28 +1098,21 @@ static void
_cb_miniview_toggle(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Term *term = data;
Config *config = termio_config_get(term->term);
if (!config->miniview)
{
Evas_Coord ox, oy, ow, oh;
config->miniview = EINA_TRUE;
config_save(config, NULL);
evas_object_geometry_get(term->term, &ox, &oy, &ow, &oh);
EINA_SAFETY_ON_NULL_RETURN(term);
EINA_SAFETY_ON_NULL_RETURN(term->miniview);
term->miniview = termio_miniview_show(term->term, ox, oy, ow, oh);
//edje_object_part_swallow(term->term, "terminology.content", term->miniview);
evas_object_show(term->miniview);
ERR("MINIVIEW TOGGLE");
if (term->miniview_shown)
{
evas_object_hide(term->miniview);
term->miniview_shown = EINA_FALSE;
}
else
{
evas_object_hide(term->miniview);
//edje_object_part_unswallow(term->term, term->miniview);
termio_miniview_hide(term->term);
term->miniview = NULL;
config->miniview = EINA_FALSE;
config_save(config, NULL);
evas_object_show(term->miniview);
term->miniview_shown = EINA_TRUE;
}
}
@ -2024,9 +2018,7 @@ main_term_free(Term *term)
if (term->popmedia) evas_object_del(term->popmedia);
if (term->miniview)
{
evas_object_hide(term->miniview);
//edje_object_part_unswallow(term->term, term->miniview);
termio_miniview_hide(term->term);
evas_object_del(term->miniview);
term->miniview = NULL;
}
term->popmedia = NULL;
@ -2170,6 +2162,7 @@ main_term_new(Win *wn, Config *config, const char *cmd,
{
Term *term;
Evas_Object *o;
Evas *canvas = evas_object_evas_get(wn->win);
term = calloc(1, sizeof(Term));
if (!term) return NULL;
@ -2177,12 +2170,13 @@ main_term_new(Win *wn, Config *config, const char *cmd,
if (!config) abort();
termpty_init();
miniview_init();
term->wn = wn;
term->hold = hold;
term->config = config;
term->base = o = edje_object_add(evas_object_evas_get(term->wn->win));
term->base = o = edje_object_add(canvas);
theme_apply(o, term->config, "terminology/core");
theme_auto_reload_enable(o);
@ -2190,7 +2184,7 @@ main_term_new(Win *wn, Config *config, const char *cmd,
evas_object_data_set(o, "theme_reload_func_data", term);
evas_object_show(o);
term->bg = o = edje_object_add(evas_object_evas_get(wn->win));
term->bg = o = edje_object_add(canvas);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
if (!theme_apply(o, config, "terminology/background"))
@ -2223,7 +2217,14 @@ main_term_new(Win *wn, Config *config, const char *cmd,
termio_win_set(o, wn->win);
termio_theme_set(o, term->bg);
term->miniview = o = miniview_add(wn->win, term->term);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
o = term->term;
edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology",
_cb_popmedia_done, term);
edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology",
@ -2233,12 +2234,13 @@ main_term_new(Win *wn, Config *config, const char *cmd,
edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology",
_cb_tabcount_next, term);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(o, 0, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, 0, EVAS_HINT_FILL);
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_cb_size_hint, term);
edje_object_part_swallow(term->base, "terminology.content", o);
edje_object_part_swallow(term->bg, "terminology.content", term->base);
edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview);
evas_object_smart_callback_add(o, "options", _cb_options, term);
evas_object_smart_callback_add(o, "exited", _cb_exited, term);
evas_object_smart_callback_add(o, "bell", _cb_bell, term);
@ -2279,18 +2281,6 @@ main_term_new(Win *wn, Config *config, const char *cmd,
wn->terms = eina_list_append(wn->terms, term);
app_server_term_add(term);
if (term->config->miniview && !term->miniview)
{
Evas_Coord ox, oy, ow, oh;
evas_object_geometry_get(term->term, &ox, &oy, &ow, &oh);
//term->miniview = (Evas_Object *) termio_miniview_show(term->term,
// ox, oy, ow, oh);
edje_object_part_swallow(term->term, "terminology.content",
term->miniview);
evas_object_show(term->miniview);
}
return term;
}
@ -3109,13 +3099,8 @@ remote:
ty_dbus_init();
miniview_init();
elm_run();
miniview_shutdown();
app_server_shutdown();
ty_dbus_shutdown();
@ -3133,6 +3118,8 @@ remote:
}
termpty_shutdown();
miniview_shutdown();
config_del(main_config);
config_shutdown();

@ -45,386 +45,202 @@ typedef struct _Miniview Miniview;
struct _Miniview
{
Evas_Object_Smart_Clipped_Data __clipped_data;
Evas_Object *obj, *image_obj, *edje_obj, *screen_obj;
struct {
int size;
const char *name;
int chw, chh;
} font;
struct {
int w, h;
Evas_Object *obj;
} grid;
Evas_Object *self;
Evas_Object *image_obj;
Evas_Object *termio;
Termpty *pty;
int parent_x, parent_y, parent_w, parent_h;
int scroll;
int scrollback;
double miniview_screen_size, miniview_screen_step, miniview_screen_default_pos,
lines_drawn, screen_obj_scroll_val, screen_obj_custom_pos;
};
static Evas_Smart *_smart = NULL;
static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL;
static void
_smart_add(Evas_Object *obj)
{
Miniview *mv;
Evas_Object *o;
Evas *canvas = evas_object_evas_get(obj);
DBG("%p", obj);
mv = calloc(1, sizeof(Miniview));
EINA_SAFETY_ON_NULL_RETURN(mv);
evas_object_smart_data_set(obj, mv);
_parent_sc.add(obj);
mv->self = obj;
/* miniview output widget */
o = evas_object_image_add(evas_object_evas_get(obj));
//evas_object_image_file_set(o, "data/themes/images/miniview_white_bg.png", NULL);
//err = evas_object_image_load_error_get(o);
//if (err != EVAS_LOAD_ERROR_NONE)
// printf("error\n");
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
_smart_del()
{
}
static void
_smart_move()
{
}
static void
_smart_calculate(Evas_Object *obj)
_smart_del(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
if (!mv) return;
//evas_object_geometry_get(mv->obj, &ox, &oy, &ow, &oh);
//evas_object_move(mv->grid.obj, ox+(mv->grid.w*0.8), oy);
//evas_object_resize(mv->grid.obj,
// mv->grid.w * mv->font.chw,
// mv->grid.h * mv->font.chh);
evas_object_image_size_set(mv->image_obj, mv->parent_w / mv->font.chw,
(mv->parent_h / mv->font.chh) + mv->scrollback);
evas_object_image_fill_set(mv->image_obj, 0, 0, mv->parent_w * 0.15,
mv->parent_h);
evas_object_resize(mv->image_obj, mv->parent_w * 0.15, mv->parent_h);
evas_object_move(mv->image_obj, mv->parent_x + (mv->parent_w * 0.85),
mv->parent_y);
DBG("%p", obj);
if (!mv) return;
/* TODO */
DBG("%p", obj);
}
static void
_smart_apply(Evas_Object *obj)
_smart_move(Evas_Object *obj, Evas_Coord x EINA_UNUSED, Evas_Coord y EINA_UNUSED)
{
Miniview *mv = evas_object_smart_data_get(obj);
evas_object_show(mv->image_obj);
evas_object_show(mv->edje_obj);
evas_object_show(mv->screen_obj);
if (!mv) return;
/* TODO */
DBG("%p x:%d y:%d", obj, x, y);
evas_object_move(mv->image_obj, x, y);
}
static void
_smart_size(Evas_Object *obj)
_smart_show(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
mv->miniview_screen_size = (double) mv->parent_h /
(double) (mv->scrollback * mv->font.chh);
mv->miniview_screen_step = (double) mv->parent_h / (double) mv->scrollback;
mv->miniview_screen_default_pos = (((double) mv->parent_h/(double) mv->scrollback)
* (mv->lines_drawn - mv->scroll))
/ (double) mv->parent_h
- mv->miniview_screen_size;
evas_object_image_size_set(mv->image_obj, (mv->parent_w / mv->font.chw),
mv->parent_h);
evas_object_move(mv->edje_obj, mv->parent_x, mv->parent_y);
evas_object_resize(mv->edje_obj, mv->parent_w, mv->parent_h);
edje_object_part_drag_size_set(mv->screen_obj, "miniview_screen", 1.0,
mv->miniview_screen_size);
if (!edje_object_part_drag_step_set(mv->screen_obj, "miniview_screen", 0.0,
mv->miniview_screen_step))
printf("error when setting drag step size.\n");
evas_object_move(mv->screen_obj, mv->parent_x, mv->parent_y);
evas_object_resize(mv->screen_obj, mv->parent_w, mv->parent_h);
_smart_calculate(obj);
_smart_apply(obj);
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_resize()
_smart_hide(Evas_Object *obj)
{
/*
Miniview *mv = evas_object_smart_data_get(obj);
DBG("%p", obj);
if (!mv) return;
_smart_size(obj);
_miniview_draw(obj, mv->grid.obj, mv->parent_w, mv->parent_h);
*/
evas_object_hide(mv->image_obj);
}
static void
_smart_init(void)
_smart_size(Evas_Object *obj)
{
static Evas_Smart_Class sc;
Miniview *mv = evas_object_smart_data_get(obj);
Evas_Coord ox, oy, ow, oh, font_w;
int columns, x, y;
unsigned int *pixels;
evas_object_smart_clipped_smart_set(&_parent_sc);
sc = _parent_sc;
sc.name = "miniview";
sc.version = EVAS_SMART_CLASS_VERSION;
sc.add = _smart_add;
sc.del = _smart_del;
sc.resize = _smart_resize;
sc.move = _smart_move;
sc.calculate = _smart_calculate;
_smart = evas_smart_class_new(&sc);
}
if (!mv) return;
static void
_on_knob_moved(void *data, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
Miniview *mv = evas_object_smart_data_get(data);
double val;
DBG("smart size %p", obj);
edje_object_part_drag_value_get(o, "miniview_screen", NULL, &val);
mv->scroll = mv->lines_drawn -
((mv->lines_drawn - (mv->parent_h / mv->font.chh)) *
(val + mv->miniview_screen_size));
evas_object_geometry_get(mv->termio, &ox, &oy, &ow, &oh);
if (ow == 0 || oh == 0) return;
evas_object_size_hint_min_get(mv->termio, &font_w, NULL);
// if miniview lines are less than scrollback lines
// (miniview obj isn't fully drawn from top to bottom)
if (mv->lines_drawn < mv->scrollback + (mv->parent_h / mv->font.chh) - 1)
{
if (val > mv->miniview_screen_default_pos)
{
val = mv->miniview_screen_default_pos;
mv->scroll = 0;
}
else
{
mv->scroll = mv->lines_drawn -
((mv->lines_drawn - (mv->parent_h / mv->font.chh)) *
((val / mv->miniview_screen_default_pos))) -
mv->parent_h / mv->font.chh;
if (font_w <= 0) return;
}
}
if (mv->scroll < 0) mv->scroll = 0;
printf("mv->scroll is:: %d and lines are: %f\n", mv->scroll, mv->lines_drawn);
termio_scroll_set(mv->termio, mv->scroll);
}
columns = ow / font_w;
static void
_miniview_draw(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
Termcell *cells;
DBG("ox:%d oy:%d ow:%d oh:%d font_w:%d columns:%d",
ox, oy, ow, oh, font_w, columns);
unsigned int *pixels, *p;
int x=0, y=0, r, g, b, i;
int wret=0;
int pty_scan_width = 0;
Eina_Bool pty_compact_w = EINA_FALSE;
evas_object_resize(mv->image_obj, columns, oh);
evas_object_image_size_set(mv->image_obj, columns, oh);
evas_object_move(mv->image_obj, ox + ow - columns, oy);
mv->lines_drawn = 0;
evas_object_image_fill_set(mv->image_obj, 0, 0, columns,
oh);
pixels = evas_object_image_data_get(mv->image_obj, EINA_TRUE);
p = pixels;
for (y = 0 - mv->pty->backscroll_num; y < mv->parent_h / mv->font.chh; y++)
for (y = 0; y < oh; y++)
{
cells = termpty_cellrow_get(mv->pty, y, &wret);
if (wret < mv->parent_w / mv->font.chw)
for (x = 0; x < columns; x++)
{
pty_scan_width = wret;
pty_compact_w = EINA_TRUE;
*pixels = (128 << 24 ) |(128 << 16) | (1 << 8) | (1);
pixels++;
}
else
{
pty_scan_width = mv->parent_w / mv->font.chw;
pty_compact_w = EINA_FALSE;
}
for (x=0; x < pty_scan_width; x++)
{
if (cells[x].codepoint == 0 || cells[x].codepoint == ' ' ||
cells[x].att.newline || cells[x].att.tab ||
cells[x].codepoint == '\0' || cells[x].codepoint <= 0)
{
r=0; g = 0; b = 0;
*p = (r << 16) | (g << 8) | (b);
p++;
}
else
{
switch (cells[x].att.fg)
{
// TODO: get pixel colors from current themee...
case 0:
r = 180; g = 180; b = 180;
break;
case 2:
r = 204; g = 51; b = 51;
break;
case 3:
r = 51; g = 204; b = 51;
break;
case 4:
r = 204; g = 136; b = 51;
break;
case 5:
r = 51; g = 51; b = 204;
break;
case 6:
r = 204; g = 51; b = 204;
break;
case 7:
r = 51; g = 204; b = 204;
break;
default:
r = 180; g = 180; b = 180;
}
*p = (r << 16) | (g << 8) | (b);
p++;
}
}
if (pty_compact_w)
for (i=0; i < (mv->parent_w / mv->font.chw) - wret; i++)
{
r=0; g = 0; b = 0;
*p = (r << 16) | (g << 8) | (b);
p++;
}
mv->lines_drawn++;
}
evas_object_image_data_set(mv->image_obj, pixels);
evas_object_image_data_update_add(mv->image_obj, 0, 0, mv->parent_w * 0.85, mv->parent_h * mv->parent_h);
evas_object_show(mv->image_obj);
}
void
miniview_resize(Evas_Object *obj, Termpty *pty, int w, int h)
static void
_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
Miniview *mv = evas_object_smart_data_get(obj);
if (!mv) return;
mv->parent_w = w;
mv->parent_h = h;
mv->pty = pty;
DBG("smart resize %p w:%d h:%d", obj, w, h);
evas_object_resize(mv->image_obj, w, h);
_smart_size(obj);
}
void
miniview_move(Evas_Object *obj, int x, int y)
static void
_smart_init(void)
{
Miniview *mv = evas_object_smart_data_get(obj);
if (!mv) return;
static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NULL;
mv->parent_x = x;
mv->parent_y = y;
_smart_size(obj);
DBG("smart init");
sc.name = "miniview";
sc.version = EVAS_SMART_CLASS_VERSION;
sc.add = _smart_add;
sc.del = _smart_del;
sc.resize = _smart_resize;
sc.move = _smart_move;
//sc.calculate = _smart_calculate;
sc.show = _smart_show;
sc.hide = _smart_hide;
_smart = evas_smart_class_new(&sc);
}
void
miniview_update_scroll(Evas_Object *obj, int scroll_position)
{
Miniview *mv = evas_object_smart_data_get(obj);
if (!mv) return;
mv->scroll = scroll_position;
_smart_size(obj);
edje_object_part_drag_value_set(mv->screen_obj, "miniview_screen", 0.0, mv->miniview_screen_default_pos);
_miniview_draw(obj);
DBG("obj:%p mv:%p scroll_position:%d", obj, mv, scroll_position);
}
Evas_Object *
miniview_add(Evas_Object *parent, int fontw, int fonth, Termpty *pty,
int scroll_position, int x, int y, int w, int h)
miniview_add(Evas_Object *parent, Evas_Object *termio)
{
Evas *e;
Evas_Object *obj, *edje_obj;
Config *config = termio_config_get(parent);
Evas_Object *obj;
Miniview *mv;
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
e = evas_object_evas_get(parent);
if (!e) return NULL;
DBG("ADD parent:%p", parent);
if (!_smart) _smart_init();
obj = evas_object_smart_add(e, _smart);
mv = evas_object_smart_data_get(obj);
if (!mv) return obj;
mv->parent_x = x;
mv->parent_y = y;
mv->parent_w = w;
mv->parent_h = h;
mv->font.chw = fontw;
mv->font.chh = fonth;
mv->pty = pty;
mv->scrollback = config->scrollback;
mv->scroll = scroll_position;
mv->miniview_screen_size = (double) mv->parent_h
/ mv->font.chh * mv->scrollback;
mv->miniview_screen_step = (double) mv->parent_h / (double) mv->scrollback;
mv->miniview_screen_default_pos =
(((double) mv->parent_h/(double) mv->scrollback)// pixels for each line drawn
* (mv->lines_drawn - mv->scroll)) // number of lines drawn
/ (double) mv->parent_h // Divided by height to find the percentage
- mv->miniview_screen_size;
mv->termio = parent;
edje_obj = edje_object_add(e);
edje_object_file_set(edje_obj, config_theme_path_get(config),
"terminology/miniview");
edje_object_part_swallow(edje_obj, "miniview", obj);
evas_object_move(edje_obj, x, y);
evas_object_resize(edje_obj, w, h);
mv->edje_obj = edje_obj;
edje_obj = edje_object_add(e);
edje_object_file_set(edje_obj, config_theme_path_get(config),
"terminology/miniview");
edje_object_part_drag_size_set(edje_obj, "miniview_screen", 1.0,
mv->miniview_screen_size);
if (!edje_object_part_drag_step_set(edje_obj, "miniview_screen", 0.0, mv->miniview_screen_step))
printf("error when setting drag step size.\n");
edje_object_signal_callback_add(edje_obj, "drag", "miniview_screen", _on_knob_moved, obj);
evas_object_move(edje_obj, x, y);
evas_object_resize(edje_obj, w, h);
mv->screen_obj = edje_obj;
mv->termio = termio;
mv->pty = termio_pty_get(termio);
_smart_size(obj);
_miniview_draw(obj);
mv->scroll = 0;
miniview_update_scroll(obj, mv->scroll);
_smart_size(obj);
return obj;
}
void
miniview_hide(Evas_Object *obj)
{
Miniview *mv = evas_object_smart_data_get(obj);
if (!mv) return;
evas_object_hide(mv->image_obj);
evas_object_hide(mv->edje_obj);
evas_object_hide(mv->screen_obj);
mv->image_obj = NULL;
mv->edje_obj = NULL;
mv->screen_obj = NULL;
}

@ -1,12 +1,8 @@
#ifndef _MINIVIEW_H__
#define _MINIVIEW_H__ 1
void miniview_resize(Evas_Object *obj, Termpty *pty, int w, int h);
void miniview_move(Evas_Object *obj, int x, int y);
void miniview_update_scroll(Evas_Object *obj, int scroll_position);
Evas_Object * miniview_add(Evas_Object *parent, int fontw, int fonth, Termpty *pty,
int scroll_position, int x, int y, int w, int h);
void miniview_hide(Evas_Object *obj);
Evas_Object * miniview_add(Evas_Object *parent, Evas_Object *termio);
void miniview_init(void);
void miniview_shutdown(void);

@ -1655,12 +1655,6 @@ _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force)
_smart_calculate(obj);
_smart_apply(obj);
if (sd->miniview)
{
miniview_resize(sd->miniview, sd->pty,
w * sd->font.chw, h * sd->font.chh);
evas_object_smart_callback_call(obj, "miniview,show", NULL);
}
evas_event_thaw(evas_object_evas_get(obj));
}
@ -2080,27 +2074,6 @@ _handle_shift(Evas_Event_Key_Down *ev, int by, Evas_Object *term, Termio *sd)
return EINA_TRUE;
}
void
termio_miniview_hide(Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN(sd);
miniview_hide(sd->miniview);
sd->miniview = NULL;
}
Evas_Object *
termio_miniview_show(Evas_Object *obj, int x, int y, int w, int h)
{
Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
sd->miniview = miniview_add(obj, sd->font.chw, sd->font.chh,
sd->pty, termio_scroll_get(obj), x, y, w, h);
return sd->miniview;
}
static void
_smart_cb_key_down(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event)
@ -3962,17 +3935,6 @@ _smart_calculate(Evas_Object *obj)
ox + (sd->cursor.x * sd->font.chw),
oy + (sd->cursor.y * sd->font.chh));
//evas_object_move(sd->miniview.grid.obj, ox, oy);
//evas_object_resize(sd->miniview.grid.obj,
// sd->grid.w * sd->font.chw,
// sd->grid.h * sd->font.chh);
//scr_obj = scrolio_grid_object_get(sd->miniview);
//evas_object_move(scr_obj, ox, oy);
//evas_object_resize(scr_obj,
// sd->grid.w * sd->font.chw,
// sd->grid.h * sd->font.chh);
evas_object_move(sd->event, ox, oy);
evas_object_resize(sd->event, ow, oh);
}
@ -3984,8 +3946,6 @@ _smart_move(Evas_Object *obj, Evas_Coord x EINA_UNUSED, Evas_Coord y EINA_UNUSED
EINA_SAFETY_ON_NULL_RETURN(sd);
evas_object_smart_changed(obj);
if (sd->miniview)
miniview_move(sd->miniview, x, y);
}
static void

@ -41,9 +41,6 @@ Config *termio_config_get(const Evas_Object *obj);
void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg);
void termio_miniview_hide(Evas_Object *obj);
Evas_Object *termio_miniview_show(Evas_Object *obj, int x, int y, int w, int h);
Termpty *termio_pty_get(Evas_Object *obj);
#endif

Loading…
Cancel
Save