forked from enlightenment/terminology
parent
2e2fb45271
commit
c5ee45929b
|
@ -28,6 +28,19 @@ collections {
|
||||||
visible: 0;
|
visible: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part { name: "fade"; type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
}
|
||||||
|
description { state: "translucent" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 255 255 255 128;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "terminology.background"; type: SWALLOW;
|
||||||
|
clip_to: "fade";
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
part { name: "terminology.content"; type: SWALLOW;
|
part { name: "terminology.content"; type: SWALLOW;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
rel1.offset: 1 2;
|
rel1.offset: 1 2;
|
||||||
|
@ -99,6 +112,7 @@ collections {
|
||||||
action: STATE_SET "translucent" 0.0;
|
action: STATE_SET "translucent" 0.0;
|
||||||
target: "base";
|
target: "base";
|
||||||
target: "shadow";
|
target: "shadow";
|
||||||
|
target: "fade";
|
||||||
}
|
}
|
||||||
program { name: "trans_off";
|
program { name: "trans_off";
|
||||||
signal: "translucent,off";
|
signal: "translucent,off";
|
||||||
|
@ -106,6 +120,7 @@ collections {
|
||||||
action: STATE_SET "default" 0.0;
|
action: STATE_SET "default" 0.0;
|
||||||
target: "base";
|
target: "base";
|
||||||
target: "shadow";
|
target: "shadow";
|
||||||
|
target: "fade";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,10 @@ col.c col.h \
|
||||||
config.c config.h \
|
config.c config.h \
|
||||||
keyin.c keyin.h \
|
keyin.c keyin.h \
|
||||||
main.c main.h \
|
main.c main.h \
|
||||||
|
media.c media.h \
|
||||||
options.c options.h \
|
options.c options.h \
|
||||||
options_font.c options_font.h \
|
|
||||||
options_behavior.c options_behavior.h \
|
options_behavior.c options_behavior.h \
|
||||||
|
options_font.c options_font.h \
|
||||||
termio.c termio.h \
|
termio.c termio.h \
|
||||||
termpty.c termpty.h \
|
termpty.c termpty.h \
|
||||||
utf8.c utf8.h \
|
utf8.c utf8.h \
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "media.h"
|
||||||
|
|
||||||
const char *cmd = NULL;
|
const char *cmd = NULL;
|
||||||
static Evas_Object *win = NULL, *bg = NULL, *term = NULL;
|
static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL;
|
||||||
static Ecore_Timer *flush_timer = NULL;
|
static Ecore_Timer *flush_timer = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -79,12 +80,34 @@ main_trans_update(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
main_media_update(void)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
if (config->background)
|
||||||
|
{
|
||||||
|
if (media) evas_object_del(media);
|
||||||
|
o = media = media_add(win, config->background, MEDIA_BG);
|
||||||
|
edje_object_part_swallow(bg, "terminology.background", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (media)
|
||||||
|
{
|
||||||
|
evas_object_del(media);
|
||||||
|
media = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI_MAIN int
|
EAPI_MAIN int
|
||||||
elm_main(int argc, char **argv)
|
elm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char buf[4096];
|
char buf[4096], *p;
|
||||||
|
|
||||||
config_init();
|
config_init();
|
||||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||||
|
@ -99,6 +122,25 @@ elm_main(int argc, char **argv)
|
||||||
i++;
|
i++;
|
||||||
cmd = argv[i];
|
cmd = argv[i];
|
||||||
}
|
}
|
||||||
|
else if ((!strcmp(argv[i], "-t")) && (i < (argc - 1)))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (config->theme) eina_stringshare_del(config->theme);
|
||||||
|
p = strchr(argv[i], '.');
|
||||||
|
if ((!p) || (strcasecmp(p, ".edj")))
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s.edj", argv[i]);
|
||||||
|
config->theme = eina_stringshare_add(buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config->theme = eina_stringshare_add(argv[i]);
|
||||||
|
}
|
||||||
|
else if ((!strcmp(argv[i], "-b")) && (i < (argc - 1)))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (config->background) eina_stringshare_del(config->background);
|
||||||
|
config->background = eina_stringshare_add(argv[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
win = tg_win_add();
|
win = tg_win_add();
|
||||||
|
@ -106,9 +148,14 @@ elm_main(int argc, char **argv)
|
||||||
bg = o = edje_object_add(evas_object_evas_get(win));
|
bg = o = edje_object_add(evas_object_evas_get(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_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
snprintf(buf, sizeof(buf), "%s/themes/%s",
|
if (strchr(config->theme, '/'))
|
||||||
elm_app_data_dir_get(), config->theme);
|
edje_object_file_set(o, config->theme, "terminology/background");
|
||||||
edje_object_file_set(o, buf, "terminology/background");
|
else
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/themes/%s",
|
||||||
|
elm_app_data_dir_get(), config->theme);
|
||||||
|
edje_object_file_set(o, buf, "terminology/background");
|
||||||
|
}
|
||||||
elm_win_resize_object_add(win, o);
|
elm_win_resize_object_add(win, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
@ -120,10 +167,11 @@ elm_main(int argc, char **argv)
|
||||||
_cb_size_hint, win);
|
_cb_size_hint, win);
|
||||||
edje_object_part_swallow(bg, "terminology.content", o);
|
edje_object_part_swallow(bg, "terminology.content", o);
|
||||||
evas_object_smart_callback_add(o, "options", _cb_options, NULL);
|
evas_object_smart_callback_add(o, "options", _cb_options, NULL);
|
||||||
evas_object_smart_callback_add(o, "options", _cb_change, NULL);
|
evas_object_smart_callback_add(o, "change", _cb_change, NULL);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
main_trans_update();
|
main_trans_update();
|
||||||
|
main_media_update();
|
||||||
|
|
||||||
evas_object_smart_callback_add(win, "focus,in", _cb_focus_in, term);
|
evas_object_smart_callback_add(win, "focus,in", _cb_focus_in, term);
|
||||||
evas_object_smart_callback_add(win, "focus,out", _cb_focus_out, term);
|
evas_object_smart_callback_add(win, "focus,out", _cb_focus_out, term);
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
typedef struct _Media Media;
|
||||||
|
|
||||||
|
struct _Media
|
||||||
|
{
|
||||||
|
Evas_Object_Smart_Clipped_Data __clipped_data;
|
||||||
|
Evas_Object *event;
|
||||||
|
};
|
||||||
|
|
||||||
|
static Evas_Smart *_smart = NULL;
|
||||||
|
static Evas_Smart_Class _meida_sc = EVAS_SMART_CLASS_INIT_NULL;
|
||||||
|
|
||||||
|
static void _smart_calculate(Evas_Object *obj);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_add(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Media *sd;
|
||||||
|
Evas_Object_Smart_Clipped_Data *cd;
|
||||||
|
Evas_Object *o;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
_meida_sc.add(obj);
|
||||||
|
cd = evas_object_smart_data_get(obj);
|
||||||
|
if (!cd) return;
|
||||||
|
sd = calloc(1, sizeof(Media));
|
||||||
|
if (!sd) return;
|
||||||
|
sd->__clipped_data = *cd;
|
||||||
|
free(cd);
|
||||||
|
evas_object_smart_data_set(obj, sd);
|
||||||
|
|
||||||
|
o = evas_object_rectangle_add(evas_object_evas_get(obj));
|
||||||
|
evas_object_smart_member_add(o, obj);
|
||||||
|
sd->event = o;
|
||||||
|
evas_object_color_set(o, 128, 0, 0, 128);
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_del(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
if (sd->event) evas_object_del(sd->event);
|
||||||
|
_meida_sc.del(obj);
|
||||||
|
evas_object_smart_data_set(obj, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
Evas_Coord ow, oh;
|
||||||
|
if (!sd) return;
|
||||||
|
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
|
||||||
|
if ((ow == w) && (oh == h)) return;
|
||||||
|
evas_object_smart_changed(obj);
|
||||||
|
evas_object_resize(sd->event, ow, oh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_calculate(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
Evas_Coord ox, oy, ow, oh;
|
||||||
|
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
||||||
|
evas_object_move(sd->event, ox, oy);
|
||||||
|
evas_object_resize(sd->event, ow, oh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
evas_object_smart_changed(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_init(void)
|
||||||
|
{
|
||||||
|
static Evas_Smart_Class sc;
|
||||||
|
|
||||||
|
evas_object_smart_clipped_smart_set(&_meida_sc);
|
||||||
|
sc = _meida_sc;
|
||||||
|
sc.name = "media";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
media_add(Evas_Object *parent, const char *src, int mode)
|
||||||
|
{
|
||||||
|
Evas *e;
|
||||||
|
Evas_Object *obj;
|
||||||
|
Media *sd;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||||
|
e = evas_object_evas_get(parent);
|
||||||
|
if (!e) return NULL;
|
||||||
|
|
||||||
|
if (!_smart) _smart_init();
|
||||||
|
obj = evas_object_smart_add(e, _smart);
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return obj;
|
||||||
|
return obj;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
#define MEDIA_BG 0
|
||||||
|
|
||||||
|
Evas_Object *media_add(Evas_Object *parent, const char *src, int mode);
|
Loading…
Reference in New Issue