terminology: use edje for selection.

NOTE: I am ot really able to use GIMP/Inkscape, so plain
rectangle for the moment. Patch welcome.


SVN revision: 73570
devs/lucas/wip
Cedric BAIL 11 years ago
parent 9ef6a138c5
commit 187443ad74
  1. 2
      TODO
  2. 239
      data/themes/default.edc
  3. 32
      data/themes/mild.edc
  4. 99
      src/bin/termio.c

@ -19,7 +19,7 @@ make it a first-class terminal:
on_hold flags, etc.)
[ ] selection off edge scrolls in that direction (as per selection
mode too if it gets NEAR an edge)
[ ] selection should become single edje object so it can be styled nicely
[ ] make selection theme nice
[ ] selection should have handles on the start/end so u can drag and
change its size once there
[ ] improve selection text extraction logic so its reliable

@ -769,6 +769,245 @@ collections {
}
}
}
//////////////////////////////////////////////////////////////////////////////
group { name: "terminology/selection";
parts {
// This 3 parts should have the same nice image background
part {
name: "terminology.background_top"; type: RECT;
mouse_events: 0;
clip_to: "terminology.top_clip";
description { state: "default" 0.0;
color: 128 128 128 128;
}
}
part {
name: "terminology.background_middle";
mouse_events: 0; type: RECT;
clip_to: "terminology.middle_clip";
description { state: "default" 0.0;
color: 128 128 128 128;
}
}
part {
name: "terminology.background_bottom";
mouse_events: 0; type: RECT;
clip_to: "terminology.bottom_clip";
description { state: "default" 0.0;
color: 128 128 128 128;
}
}
part { name: "terminology.top_left"; type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
align: 0.0 0.0;
visible: 0;
}
}
part { name: "terminology.top_clip"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.top_left";
rel1.relative: 1.0 0.0;
rel2.to_y: "terminology.top_left";
rel2.relative: 1.0 1.0;
}
description { state: "oneline" 0.0;
visible: 0;
}
}
part { name: "terminology.cursor.top_left"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.top_left";
rel1.relative: 1.0 0.0;
rel2.to: "terminology.top_left";
rel2.relative: 1.0 1.0;
rel2.offset: 0 -1;
color: 255 0 0 128;
}
}
part { name: "terminology.cursor_blink.top_left"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.cursor.top_left";
rel2.to: "terminology.cursor.top_left";
visible: 0;
}
description { state: "fading" 0.0;
inherit: "default" 0.0;
color: 255 0 0 255;
visible: 1;
}
description { state: "fading" 1.0;
inherit: "fading" 0.0;
color: 255 0 0 64;
rel1.offset: -5 0;
}
}
part { name: "terminology.zone.top_left"; type: RECT;
description { state: "default" 0.0;
rel1.to: "terminology.cursor.top_left";
rel1.offset: -5 0;
rel2.to: "terminology.cursor.top_left";
rel2.offset: +5 0;
color: 0 0 0 0;
}
program {
name: "top_left.blink";
signal: "mouse,in";
source: "terminology.zone.top_left";
action: STATE_SET fading 0.0;
target: terminology.cursor_blink.top_left;
after: "top_left.fade";
}
program {
name: "top_left.fade";
action: STATE_SET fading 1.0;
transition: LINEAR 0.3;
target: terminology.cursor_blink.top_left;
after: "top_left.blink";
}
program {
name: "top_left.stop";
signal: "mouse,out";
source: "terminology.zone.top_left";
action: STATE_SET default 0.0;
target: terminology.cursor_blink.top_left;
}
}
part { name: "terminology.middle_clip"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.top_left";
rel1.relative: 0.0 1.0;
rel2.to: "terminology.bottom_right";
rel2.relative: 1.0 0.0;
}
description { state: "oneline" 0.0;
rel1.to: "terminology.top_left";
rel1.relative: 1.0 0.0;
rel2.to: "terminology.bottom_right";
rel2.relative: 0.0 1.0;
}
}
part { name: "terminology.track"; type: SPACER;
description { state: "default" 0.0;
rel1.to: "terminology.top_left";
rel1.relative: 0.0 0.0;
rel2.to: "terminology.bottom_right";
rel2.relative: 0.0 0.0;
limit: HEIGHT;
}
}
part { name: "terminology.bottom_clip"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to_y: "terminology.bottom_right";
rel1.relative: 0.0 0.0;
rel2.to_x: "terminology.bottom_right";
rel2.relative: 0.0 1.0;
}
description { state: "oneline" 0.0;
visible: 0;
}
}
part { name: "terminology.bottom_right"; type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
align: 1.0 1.0;
visible: 0;
}
}
part { name: "terminology.cursor.bottom_right"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.bottom_right";
rel1.relative: 0.0 0.0;
rel2.to: "terminology.bottom_right";
rel2.relative: 0.0 1.0;
rel2.offset: 0 -1;
color: 255 0 0 128;
}
}
part { name: "terminology.cursor_blink.bottom_right"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "terminology.cursor.bottom_right";
rel2.to: "terminology.cursor.bottom_right";
visible: 0;
}
description { state: "fading" 0.0;
inherit: "default" 0.0;
color: 255 0 0 255;
visible: 1;
}
description { state: "fading" 1.0;
inherit: "fading" 0.0;
color: 255 0 0 64;
rel2.offset: +5 0;
}
}
part { name: "terminology.zone.bottom_right"; type: RECT;
description { state: "default" 0.0;
rel1.to: "terminology.cursor.bottom_right";
rel1.offset: -5 0;
rel2.to: "terminology.cursor.bottom_right";
rel2.offset: +5 0;
color: 0 0 0 0;
}
program {
name: "bottom_right.blink";
signal: "mouse,in";
source: "terminology.zone.bottom_right";
action: STATE_SET fading 0.0;
target: terminology.cursor_blink.bottom_right;
after: "bottom_right.fade";
}
program {
name: "bottom_right.fade";
action: STATE_SET fading 1.0;
transition: LINEAR 0.3;
target: terminology.cursor_blink.bottom_right;
after: "bottom_right.blink";
}
program {
name: "bottom_right.stop";
signal: "mouse,out";
source: "terminology.zone.bottom_right";
action: STATE_SET default 0.0;
target: terminology.cursor_blink.bottom_right;
}
}
}
programs {
program {
name: "oneline";
signal: "limit,height,zero";
source: "terminology.track";
action: STATE_SET oneline 0.0;
target: "terminology.top_clip";
target: "terminology.middle_clip";
target: "terminology.bottom_clip";
}
program {
name: "multiline";
signal: "limit,height,over";
source: "terminology.track";
action: STATE_SET default 0.0;
target: "terminology.top_clip";
target: "terminology.middle_clip";
target: "terminology.bottom_clip";
}
}
}
//////////////////////////////////////////////////////////////////////////////

@ -4,7 +4,7 @@ collections {
part { name: "base"; type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 48 48 48 255;
color: 0 0 0 255;
}
description { state: "translucent" 0.0;
inherit: "default" 0.0;
@ -141,30 +141,43 @@ collections {
description { state: "default" 0.0;
color: 170 170 170 32;
}
}
part { name: "effect"; type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
color: 255 255 255 180;
visible: 0;
rel1.relative: 0.0 1.0;
rel1.offset: 0 -1;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
}
description { state: "focused" 0.0;
color: 170 170 170 128;
}
description { state: "end" 0.0;
inherit: "focused" 0.0;
color: 255 255 255 90;
}
}
programs {
program { name: "focus_in";
signal: "focus,in";
source: "terminology";
action: STATE_SET "focused" 0.0;
target: "base";
target: "effect";
after: "focus2";
}
program { name: "focus2";
in: 0.2 0.0;
transition: DECELERATE 0.1;
action: STATE_SET "default" 0.0;
target: "base";
in: 0.2 0.5;
transition: DECELERATE 0.5;
action: STATE_SET "end" 0.0;
target: "effect";
after: "focus3";
}
program { name: "focus3";
in: 0.2 0.0;
transition: ACCELERATE 0.1;
action: STATE_SET "focused" 0.0;
target: "base";
target: "effect";
after: "focus2";
}
program { name: "focus_out";
@ -179,6 +192,7 @@ collections {
program { name: "focus_out2";
action: STATE_SET "default" 0.0;
target: "base";
target: "effect";
}
}
}

@ -27,7 +27,7 @@ struct _Termio
Evas_Object *obj;
} grid;
struct {
Evas_Object *obj, *selo1, *selo2, *selo3;
Evas_Object *obj, *selo_top, *selo_bottom, *selo_theme;
int x, y;
struct {
int x, y;
@ -722,51 +722,29 @@ _smart_apply(Evas_Object *obj)
t = start_y; start_y = end_y; end_y = t;
}
if (end_y > start_y)
{
evas_object_move(sd->cur.selo1,
ox + (start_x * sd->font.chw),
oy + ((start_y + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo1,
(sd->grid.w - start_x) * sd->font.chw,
sd->font.chh);
evas_object_show(sd->cur.selo1);
evas_object_move(sd->cur.selo3,
ox, oy + ((end_y + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo3,
(end_x + 1) * sd->font.chw,
sd->font.chh);
evas_object_show(sd->cur.selo3);
}
else
{
evas_object_move(sd->cur.selo1,
ox + (start_x * sd->font.chw),
oy + ((start_y + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo1,
(end_x - start_x + 1) * sd->font.chw,
sd->font.chh);
evas_object_show(sd->cur.selo1);
evas_object_hide(sd->cur.selo3);
}
if (end_y > (start_y + 1))
{
evas_object_move(sd->cur.selo2,
ox, oy + ((start_y + 1 + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo2,
sd->grid.w * sd->font.chw,
(end_y - start_y - 1) * sd->font.chh);
evas_object_show(sd->cur.selo2);
}
else
evas_object_hide(sd->cur.selo2);
evas_object_size_hint_min_set(sd->cur.selo_top,
start_x * sd->font.chw,
sd->font.chh);
evas_object_size_hint_max_set(sd->cur.selo_top,
start_x * sd->font.chw,
sd->font.chh);
evas_object_size_hint_min_set(sd->cur.selo_bottom,
(sd->grid.w - end_x) * sd->font.chw,
sd->font.chh);
evas_object_size_hint_max_set(sd->cur.selo_bottom,
(sd->grid.w - end_x) * sd->font.chw,
sd->font.chh);
evas_object_move(sd->cur.selo_theme,
ox,
oy + ((start_y + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo_theme,
(sd->grid.w + 1) * sd->font.chw,
(end_y + 1 - start_y + sd->scroll) * sd->font.chh);
evas_object_show(sd->cur.selo_theme);
}
else
{
evas_object_hide(sd->cur.selo1);
evas_object_hide(sd->cur.selo2);
evas_object_hide(sd->cur.selo3);
evas_object_hide(sd->cur.selo_theme);
}
_smart_mouseover_apply(obj);
}
@ -1794,6 +1772,11 @@ _termio_config_set(Evas_Object *obj, Config *config)
theme_auto_reload_enable(sd->cur.obj);
evas_object_resize(sd->cur.obj, sd->font.chw, sd->font.chh);
evas_object_show(sd->cur.obj);
theme_apply(sd->cur.selo_theme, config, "terminology/selection");
theme_auto_reload_enable(sd->cur.selo_theme);
edje_object_part_swallow(sd->cur.selo_theme, "terminology.top_left", sd->cur.selo_top);
edje_object_part_swallow(sd->cur.selo_theme, "terminology.bottom_right", sd->cur.selo_bottom);
}
static void
@ -1946,22 +1929,15 @@ _smart_add(Evas_Object *obj)
o = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE);
evas_object_smart_member_add(o, obj);
sd->cur.selo1 = o;
evas_object_color_set(o, 64, 64, 64, 64);
o = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE);
evas_object_smart_member_add(o, obj);
sd->cur.selo2 = o;
evas_object_color_set(o, 64, 64, 64, 64);
sd->cur.selo_top = o;
o = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE);
sd->cur.selo_bottom = o;
o = edje_object_add(evas_object_evas_get(obj));
evas_object_smart_member_add(o, obj);
sd->cur.selo3 = o;
evas_object_color_set(o, 64, 64, 64, 64);
sd->cur.selo_theme = o;
o = edje_object_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE);
@ -1971,6 +1947,7 @@ _smart_add(Evas_Object *obj)
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _cursor_cb_move, obj);
o = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_repeat_events_set(o, EINA_TRUE);
evas_object_smart_member_add(o, obj);
sd->event = o;
evas_object_color_set(o, 0, 0, 0, 0);
@ -2068,9 +2045,9 @@ _smart_del(Evas_Object *obj)
}
if (sd->cur.obj) evas_object_del(sd->cur.obj);
if (sd->event) evas_object_del(sd->event);
if (sd->cur.selo1) evas_object_del(sd->cur.selo1);
if (sd->cur.selo2) evas_object_del(sd->cur.selo2);
if (sd->cur.selo3) evas_object_del(sd->cur.selo3);
if (sd->cur.selo_top) evas_object_del(sd->cur.selo_top);
if (sd->cur.selo_bottom) evas_object_del(sd->cur.selo_bottom);
if (sd->cur.selo_theme) evas_object_del(sd->cur.selo_theme);
if (sd->anim) ecore_animator_del(sd->anim);
if (sd->delayed_size_timer) ecore_timer_del(sd->delayed_size_timer);
if (sd->link_do_timer) ecore_timer_del(sd->link_do_timer);
@ -2082,9 +2059,9 @@ _smart_del(Evas_Object *obj)
EINA_LIST_FREE(sd->seq, str) eina_stringshare_del(str);
sd->cur.obj = NULL;
sd->event = NULL;
sd->cur.selo1 = NULL;
sd->cur.selo2 = NULL;
sd->cur.selo3 = NULL;
sd->cur.selo_top = NULL;
sd->cur.selo_bottom = NULL;
sd->cur.selo_theme = NULL;
sd->anim = NULL;
sd->delayed_size_timer = NULL;
sd->font.name = NULL;

Loading…
Cancel
Save