forked from enlightenment/efl
parent
9e61a142a6
commit
f25731b240
|
@ -35,7 +35,8 @@ edje_cc_mem.c \
|
||||||
edje_cc_handlers.c \
|
edje_cc_handlers.c \
|
||||||
edje_cc_sources.c \
|
edje_cc_sources.c \
|
||||||
edje_prefix.c \
|
edje_prefix.c \
|
||||||
edje_prefix.h
|
edje_prefix.h \
|
||||||
|
edje_main.h
|
||||||
|
|
||||||
edje_cc_LDADD = \
|
edje_cc_LDADD = \
|
||||||
$(top_builddir)/src/lib/libedje.la
|
$(top_builddir)/src/lib/libedje.la
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
#include "Edje.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char *file_out = NULL;
|
|
||||||
char *progname = NULL;
|
|
||||||
Evas_List *collections = NULL;
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_help(void)
|
|
||||||
{
|
|
||||||
printf("Usage: "
|
|
||||||
"%s [OPTIONS] input_file.edj ...\n"
|
|
||||||
"\t-o outfile.txt Output the listing of the collections to a file\n"
|
|
||||||
, progname);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_list(char *file)
|
|
||||||
{
|
|
||||||
Evas_List *entries;
|
|
||||||
|
|
||||||
entries = edje_file_collection_list(file);
|
|
||||||
if (entries)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
|
|
||||||
for (l = entries; l; l = l->next)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
name = l->data;
|
|
||||||
snprintf(buf, 1024, "%s: %s", file, name);
|
|
||||||
collections = evas_list_append(collections, strdup(buf));
|
|
||||||
}
|
|
||||||
edje_file_collection_list_free(entries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FILE *output;
|
|
||||||
|
|
||||||
progname = argv[0];
|
|
||||||
if (argc < 2)
|
|
||||||
{
|
|
||||||
main_help();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
edje_init();
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (!strcmp(argv[i], "-h"))
|
|
||||||
{
|
|
||||||
main_help();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
file_out = argv[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
test_list(argv[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!collections)
|
|
||||||
{
|
|
||||||
main_help();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_out)
|
|
||||||
{
|
|
||||||
output = fopen(file_out, "w");
|
|
||||||
if (!output)
|
|
||||||
{
|
|
||||||
perror("fopen");
|
|
||||||
main_help();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
output = stdout;
|
|
||||||
|
|
||||||
while (collections)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
name = collections->data;
|
|
||||||
collections = evas_list_remove(collections, name);
|
|
||||||
fprintf(output, "%s\n", name);
|
|
||||||
free(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
edje_shutdown();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,900 +0,0 @@
|
||||||
#include "edje_main.h"
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
typedef struct _Demo_Edje Demo_Edje;
|
|
||||||
|
|
||||||
struct _Demo_Edje
|
|
||||||
{
|
|
||||||
Evas_Object *edje;
|
|
||||||
Evas_Object *left;
|
|
||||||
Evas_Object *right;
|
|
||||||
Evas_Object *top;
|
|
||||||
Evas_Object *bottom;
|
|
||||||
Evas_Object *title;
|
|
||||||
Evas_Object *title_clip;
|
|
||||||
Evas_Object *image;
|
|
||||||
Evas_Coord minw, minh;
|
|
||||||
Evas_Coord maxw, maxh;
|
|
||||||
int hdir;
|
|
||||||
int vdir;
|
|
||||||
char down_top : 1;
|
|
||||||
char down_bottom : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _Collection Collection;
|
|
||||||
|
|
||||||
struct _Collection
|
|
||||||
{
|
|
||||||
char header : 1;
|
|
||||||
char clicked : 1;
|
|
||||||
Evas_Coord maxw;
|
|
||||||
char *file;
|
|
||||||
char *part;
|
|
||||||
Evas_Object *text;
|
|
||||||
Evas_Object *bg;
|
|
||||||
Evas_List *entries;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int main_start(int argc, char **argv);
|
|
||||||
static void main_stop(void);
|
|
||||||
static void main_resize(Ecore_Evas *ee);
|
|
||||||
static int main_signal_exit(void *data, int ev_type, void *ev);
|
|
||||||
static void main_delete_request(Ecore_Evas *ee);
|
|
||||||
static void main_pre_rend(Ecore_Evas *ee);
|
|
||||||
static void main_post_rend(Ecore_Evas *ee);
|
|
||||||
|
|
||||||
void bg_setup(void);
|
|
||||||
void bg_resize(Evas_Coord w, Evas_Coord h);
|
|
||||||
static void bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info);
|
|
||||||
|
|
||||||
void test_list_move(Collection *co_head);
|
|
||||||
void test_list(char *file);
|
|
||||||
|
|
||||||
void test_resize(Demo_Edje *de);
|
|
||||||
void test_setup(char *file, char *name);
|
|
||||||
|
|
||||||
static Evas_List *edjes = NULL;
|
|
||||||
static Evas_Object *o_bg = NULL;
|
|
||||||
static Evas_Object *o_shadow = NULL;
|
|
||||||
|
|
||||||
double start_time = 0.0;
|
|
||||||
Ecore_Evas *ecore_evas = NULL;
|
|
||||||
Evas *evas = NULL;
|
|
||||||
int startw = 240;
|
|
||||||
int starth = 320;
|
|
||||||
int mdfill = 0;
|
|
||||||
|
|
||||||
static int
|
|
||||||
main_start(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int mode = 0;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
e_prefix_determine(argv[0]);
|
|
||||||
start_time = ecore_time_get();
|
|
||||||
if (!ecore_init()) return -1;
|
|
||||||
ecore_app_args_set(argc, (const char **)argv);
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, NULL);
|
|
||||||
if (!ecore_evas_init()) return -1;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (((!strcmp(argv[i], "-g")) ||
|
|
||||||
(!strcmp(argv[i], "-geometry")) ||
|
|
||||||
(!strcmp(argv[i], "--geometry"))) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
int n, w, h;
|
|
||||||
char buf[16], buf2[16];
|
|
||||||
|
|
||||||
n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
|
|
||||||
if (n == 2)
|
|
||||||
{
|
|
||||||
w = atoi(buf);
|
|
||||||
h = atoi(buf2);
|
|
||||||
startw = w;
|
|
||||||
starth = h;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-gl"))
|
|
||||||
{
|
|
||||||
mode = 1;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-fb"))
|
|
||||||
{
|
|
||||||
mode = 2;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-xr"))
|
|
||||||
{
|
|
||||||
mode = 3;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-fill"))
|
|
||||||
{
|
|
||||||
mdfill = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == 0)
|
|
||||||
ecore_evas = ecore_evas_software_x11_new(NULL, 0, 0, 0, startw, starth);
|
|
||||||
if ((!ecore_evas) && (mode == 1))
|
|
||||||
ecore_evas = ecore_evas_gl_x11_new(NULL, 0, 0, 0, startw, starth);
|
|
||||||
if ((!ecore_evas) && (mode == 2))
|
|
||||||
ecore_evas = ecore_evas_fb_new(NULL, 270, startw, starth);
|
|
||||||
if ((!ecore_evas) && (mode == 3))
|
|
||||||
ecore_evas = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, startw, starth);
|
|
||||||
|
|
||||||
if (!ecore_evas) return -1;
|
|
||||||
ecore_evas_callback_delete_request_set(ecore_evas, main_delete_request);
|
|
||||||
ecore_evas_callback_resize_set(ecore_evas, main_resize);
|
|
||||||
ecore_evas_callback_pre_render_set(ecore_evas, main_pre_rend);
|
|
||||||
ecore_evas_callback_post_render_set(ecore_evas, main_post_rend);
|
|
||||||
ecore_evas_title_set(ecore_evas, "Edje Test Program");
|
|
||||||
ecore_evas_name_class_set(ecore_evas, "edje", "main");
|
|
||||||
ecore_evas_show(ecore_evas);
|
|
||||||
evas = ecore_evas_get(ecore_evas);
|
|
||||||
evas_image_cache_set(evas, 2 * 1024 * 1024);
|
|
||||||
evas_font_cache_set(evas, 512 * 1024);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/fonts", e_prefix_data_get());
|
|
||||||
evas_font_path_append(evas, buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_stop(void)
|
|
||||||
{
|
|
||||||
edje_shutdown();
|
|
||||||
ecore_evas_shutdown();
|
|
||||||
ecore_shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_resize(Ecore_Evas *ee)
|
|
||||||
{
|
|
||||||
Evas_Coord w, h;
|
|
||||||
|
|
||||||
evas_output_viewport_get(evas, NULL, NULL, &w, &h);
|
|
||||||
bg_resize(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
main_signal_exit(void *data, int ev_type, void *ev)
|
|
||||||
{
|
|
||||||
ecore_main_loop_quit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_delete_request(Ecore_Evas *ee)
|
|
||||||
{
|
|
||||||
ecore_main_loop_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_pre_rend(Ecore_Evas *ee)
|
|
||||||
{
|
|
||||||
// edje_thaw();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
main_post_rend(Ecore_Evas *ee)
|
|
||||||
{
|
|
||||||
// edje_freeze();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
bg_setup(void)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
|
||||||
evas_object_move(o, 0, 0);
|
|
||||||
evas_object_resize(o, startw, starth);
|
|
||||||
evas_object_layer_set(o, -999);
|
|
||||||
evas_object_color_set(o, 255, 255, 255, 255);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/bg.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(o, buf, NULL);
|
|
||||||
evas_object_image_fill_set(o, 0, 0, 128, 128);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_focus_set(o, 1);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, bg_key_down, NULL);
|
|
||||||
o_bg = o;
|
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
|
||||||
evas_object_move(o, 0, 0);
|
|
||||||
evas_object_resize(o, startw, starth);
|
|
||||||
evas_object_layer_set(o, -999);
|
|
||||||
evas_object_color_set(o, 255, 255, 255, 255);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/shadow.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(o, buf, NULL);
|
|
||||||
evas_object_image_smooth_scale_set(o, 0);
|
|
||||||
evas_object_image_fill_set(o, 0, 0, startw, starth);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_show(o);
|
|
||||||
o_shadow = o;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
bg_resize(Evas_Coord w, Evas_Coord h)
|
|
||||||
{
|
|
||||||
evas_object_resize(o_bg, w, h);
|
|
||||||
evas_object_resize(o_shadow, w, h);
|
|
||||||
evas_object_image_fill_set(o_shadow, 0, 0, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
|
||||||
{
|
|
||||||
Evas_Event_Key_Down *ev;
|
|
||||||
|
|
||||||
ev = (Evas_Event_Key_Down *)event_info;
|
|
||||||
|
|
||||||
if (!strcmp(ev->keyname, "q")) ecore_main_loop_quit ();
|
|
||||||
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
|
|
||||||
for (l = edjes; l; l = l->next)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
|
|
||||||
de = l->data;
|
|
||||||
if (!strcmp(ev->keyname, "Return"))
|
|
||||||
edje_object_play_set(de->edje, 1);
|
|
||||||
else if (!strcmp(ev->keyname, "Escape"))
|
|
||||||
edje_object_play_set(de->edje, 0);
|
|
||||||
else if (!strcmp(ev->keyname, "a"))
|
|
||||||
edje_object_animation_set(de->edje, 1);
|
|
||||||
else if (!strcmp(ev->keyname, "s"))
|
|
||||||
edje_object_animation_set(de->edje, 0);
|
|
||||||
else if (!strcmp(ev->keyname, "Left"))
|
|
||||||
edje_object_part_text_set(de->edje, "text", "String 1");
|
|
||||||
else if (!strcmp(ev->keyname, "Up"))
|
|
||||||
edje_object_part_text_set(de->edje, "text", "Buttox");
|
|
||||||
else if (!strcmp(ev->keyname, "Right"))
|
|
||||||
edje_object_part_text_set(de->edje, "text", "You pressed \"U\". Nice one stenchie!");
|
|
||||||
else if (!strcmp(ev->keyname, "F1"))
|
|
||||||
{
|
|
||||||
edje_object_color_class_set(de->edje, "bg",
|
|
||||||
255, 255, 255, 255,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
edje_color_class_set("fg",
|
|
||||||
0, 0, 0, 255,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
edje_text_class_set("plainjane", "Vera", 10);
|
|
||||||
}
|
|
||||||
else if (!strcmp(ev->keyname, "F2"))
|
|
||||||
edje_object_color_class_set(de->edje, "bg",
|
|
||||||
255, 200, 120, 255,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
else if (!strcmp(ev->keyname, "F3"))
|
|
||||||
edje_object_color_class_set(de->edje, "bg",
|
|
||||||
120, 200, 255, 200,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
else if (!strcmp(ev->keyname, "F4"))
|
|
||||||
edje_object_color_class_set(de->edje, "bg",
|
|
||||||
255, 200, 50, 100,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cb (void *data, Evas_Object *o, const char *sig, const char *src);
|
|
||||||
|
|
||||||
static void
|
|
||||||
top_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
de->down_top = 1;
|
|
||||||
evas_object_raise(de->image);
|
|
||||||
evas_object_raise(de->top);
|
|
||||||
evas_object_raise(de->bottom);
|
|
||||||
evas_object_raise(de->left);
|
|
||||||
evas_object_raise(de->right);
|
|
||||||
evas_object_raise(de->title_clip);
|
|
||||||
evas_object_raise(de->title);
|
|
||||||
evas_object_raise(de->edje);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
top_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
de->down_top = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
top_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
Evas_Event_Mouse_Move *ev;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
ev = event_info;
|
|
||||||
if (de->down_top)
|
|
||||||
{
|
|
||||||
Evas_Coord x, y;
|
|
||||||
|
|
||||||
evas_object_geometry_get(de->left, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->left,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->right, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->right,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->top, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->top,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->bottom, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->bottom,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->title_clip, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->title_clip,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->title, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->title,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->image, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->image,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
evas_object_geometry_get(de->edje, &x, &y, NULL, NULL);
|
|
||||||
evas_object_move(de->edje,
|
|
||||||
x + ev->cur.canvas.x - ev->prev.canvas.x,
|
|
||||||
y + ev->cur.canvas.y - ev->prev.canvas.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
bottom_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
Evas_Event_Mouse_Down *ev;
|
|
||||||
Evas_Coord x, y, w, h;
|
|
||||||
int hdir, vdir;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
ev = event_info;
|
|
||||||
de->down_bottom = 1;
|
|
||||||
evas_object_geometry_get(de->edje, &x, &y, &w, &h);
|
|
||||||
hdir = 1;
|
|
||||||
vdir = 1;
|
|
||||||
x -= 10;
|
|
||||||
y -= 20;
|
|
||||||
w += 20;
|
|
||||||
h += 30;
|
|
||||||
if ((ev->canvas.x - x) < (w / 2)) hdir = 0;
|
|
||||||
if ((ev->canvas.y - y) < (h / 2)) vdir = 0;
|
|
||||||
de->hdir = hdir;
|
|
||||||
de->vdir = vdir;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
bottom_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
de->down_bottom = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
bottom_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Demo_Edje *de;
|
|
||||||
Evas_Event_Mouse_Move *ev;
|
|
||||||
|
|
||||||
de = data;
|
|
||||||
ev = event_info;
|
|
||||||
if (de->down_bottom)
|
|
||||||
{
|
|
||||||
Evas_Coord x, y, w, h;
|
|
||||||
Evas_Coord minw, minh;
|
|
||||||
Evas_Coord maxw, maxh;
|
|
||||||
int hdir, vdir;
|
|
||||||
|
|
||||||
evas_object_geometry_get(de->edje, &x, &y, &w, &h);
|
|
||||||
hdir = de->hdir;
|
|
||||||
vdir = de->vdir;
|
|
||||||
x -= 10;
|
|
||||||
y -= 20;
|
|
||||||
w += 20;
|
|
||||||
h += 30;
|
|
||||||
minw = 20 + de->minw;
|
|
||||||
minh = 30 + de->minh;
|
|
||||||
maxw = 20 + de->maxw;
|
|
||||||
maxh = 30 + de->maxh;
|
|
||||||
|
|
||||||
if (hdir > 0)
|
|
||||||
{
|
|
||||||
w += ev->cur.canvas.x - ev->prev.canvas.x;
|
|
||||||
if (w < minw) w = minw;
|
|
||||||
else if (w > maxw) w = maxw;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w -= ev->cur.canvas.x - ev->prev.canvas.x;
|
|
||||||
x += ev->cur.canvas.x - ev->prev.canvas.x;
|
|
||||||
if (w < minw)
|
|
||||||
{
|
|
||||||
x += w - minw;
|
|
||||||
w = minw;
|
|
||||||
}
|
|
||||||
if (w > maxw)
|
|
||||||
{
|
|
||||||
x -= w - maxw;
|
|
||||||
w = maxw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (vdir > 0)
|
|
||||||
{
|
|
||||||
h += ev->cur.canvas.y - ev->prev.canvas.y;
|
|
||||||
if (h < minh) h = minh;
|
|
||||||
if (h > maxh) h = maxh;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h -= ev->cur.canvas.y - ev->prev.canvas.y;
|
|
||||||
y += ev->cur.canvas.y - ev->prev.canvas.y;
|
|
||||||
if (h < minh)
|
|
||||||
{
|
|
||||||
y += h - minh;
|
|
||||||
h = minh;
|
|
||||||
}
|
|
||||||
if (h > maxh)
|
|
||||||
{
|
|
||||||
y -= h - maxh;
|
|
||||||
h = maxh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
evas_object_move(de->edje, x + 10, y + 20);
|
|
||||||
evas_object_resize(de->edje, w - 20, h - 30);
|
|
||||||
test_resize(de);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
list_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
co = data;
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/item_selected.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(co->bg, buf, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
list_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
co = data;
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/item_normal.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(co->bg, buf, NULL);
|
|
||||||
test_setup(co->file, co->part);
|
|
||||||
evas_object_color_set(co->bg, 128, 128, 128, 128);
|
|
||||||
evas_object_color_set(co->text, 0, 0, 0, 128);
|
|
||||||
evas_object_pass_events_set(co->bg, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
list_head_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
|
|
||||||
co = data;
|
|
||||||
co->clicked = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
list_head_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
|
|
||||||
co = data;
|
|
||||||
co->clicked = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
list_head_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
Evas_Coord x, y;
|
|
||||||
Evas_Event_Mouse_Move *ev;
|
|
||||||
|
|
||||||
co = data;
|
|
||||||
if (!co->clicked) return;
|
|
||||||
ev = event_info;
|
|
||||||
evas_object_geometry_get(co->bg, &x, &y, NULL, NULL);
|
|
||||||
x += ev->cur.canvas.x - ev->prev.canvas.x;
|
|
||||||
y += ev->cur.canvas.y - ev->prev.canvas.y;
|
|
||||||
evas_object_move(co->bg, x, y);
|
|
||||||
test_list_move(co);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cb (void *data, Evas_Object *o, const char *sig, const char *src)
|
|
||||||
{
|
|
||||||
printf("CALLBACK for \"%s\" \"%s\"\n", sig, src);
|
|
||||||
if (!strcmp(sig, "drag"))
|
|
||||||
{
|
|
||||||
double x, y;
|
|
||||||
|
|
||||||
edje_object_part_drag_value_get(o, src, &x, &y);
|
|
||||||
printf("Drag %3.3f %3.3f\n", x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_list_move(Collection *co_head)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
Evas_Coord x, y;
|
|
||||||
|
|
||||||
evas_object_geometry_get(co_head->bg, &x, &y, NULL, NULL);
|
|
||||||
for (l = co_head->entries; l; l = l->next)
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
Evas_Coord w, h;
|
|
||||||
|
|
||||||
co = l->data;
|
|
||||||
evas_object_geometry_get(co->text, NULL, NULL, &w, &h);
|
|
||||||
evas_object_resize(co->bg, co_head->maxw + 20, h + 10 + 10);
|
|
||||||
evas_object_image_fill_set(co->bg, 0, 0, co_head->maxw + 20, h + 10 + 10);
|
|
||||||
evas_object_move(co->bg, x, y);
|
|
||||||
evas_object_move(co->text, x + 10, y + ((h + 10 + 10 - h) / 2));
|
|
||||||
evas_object_show(co->bg);
|
|
||||||
evas_object_show(co->text);
|
|
||||||
y += h + 10 + 10 - 4 - 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_list(char *file)
|
|
||||||
{
|
|
||||||
Evas_List *entries;
|
|
||||||
Evas_Coord maxw = 128;
|
|
||||||
Collection *co_head;
|
|
||||||
Evas_List *collections = NULL;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
entries = edje_file_collection_list(file);
|
|
||||||
// printf("%s\n", edje_file_data_get(file, "My Data");
|
|
||||||
// printf("%s\n", edje_file_data_get(file, "The Key");
|
|
||||||
{
|
|
||||||
Collection *co;
|
|
||||||
Evas_Object *o;
|
|
||||||
Evas_Coord w, h;
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
co = calloc(1, sizeof(Collection));
|
|
||||||
collections = evas_list_append(collections, co);
|
|
||||||
co->file = strdup(file);
|
|
||||||
co->part = NULL;
|
|
||||||
co->header = 1;
|
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
|
||||||
evas_object_layer_set(o, 10);
|
|
||||||
evas_object_image_border_set(o, 10, 10, 10, 10);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/item_title.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(o, buf, NULL);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, list_head_down_cb, co);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, list_head_up_cb, co);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, list_head_move_cb, co);
|
|
||||||
co->bg = o;
|
|
||||||
|
|
||||||
o = evas_object_text_add(evas);
|
|
||||||
evas_object_layer_set(o, 10);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 255);
|
|
||||||
snprintf(buf, sizeof(buf), "Collections: %s", file);
|
|
||||||
evas_object_text_text_set(o, buf);
|
|
||||||
evas_object_text_font_set(o, "Vera", 10);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_geometry_get(o, NULL, NULL, &w, &h);
|
|
||||||
if (w > maxw) maxw = w;
|
|
||||||
co->text = o;
|
|
||||||
co_head = co;
|
|
||||||
}
|
|
||||||
if (entries)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
|
|
||||||
for (l = entries; l; l = l->next)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
Collection *co;
|
|
||||||
Evas_Object *o;
|
|
||||||
Evas_Coord w, h;
|
|
||||||
|
|
||||||
name = l->data;
|
|
||||||
co = calloc(1, sizeof(Collection));
|
|
||||||
collections = evas_list_append(collections, co);
|
|
||||||
co->file = strdup(file);
|
|
||||||
co->part = strdup(name);
|
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
|
||||||
evas_object_layer_set(o, 10);
|
|
||||||
evas_object_image_border_set(o, 10, 10, 10, 10);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/item_normal.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(o, buf, NULL);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, list_down_cb, co);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, list_up_cb, co);
|
|
||||||
co->bg = o;
|
|
||||||
|
|
||||||
o = evas_object_text_add(evas);
|
|
||||||
evas_object_layer_set(o, 10);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 255);
|
|
||||||
printf("%s\n", co->part);
|
|
||||||
evas_object_text_text_set(o, co->part);
|
|
||||||
evas_object_text_font_set(o, "Vera", 10);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_geometry_get(o, NULL, NULL, &w, &h);
|
|
||||||
if (w > maxw) maxw = w;
|
|
||||||
co->text = o;
|
|
||||||
}
|
|
||||||
edje_file_collection_list_free(entries);
|
|
||||||
co_head->maxw = maxw;
|
|
||||||
co_head->entries = collections;
|
|
||||||
test_list_move(co_head);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_resize(Demo_Edje *de)
|
|
||||||
{
|
|
||||||
Evas_Coord x, y, w, h, tw, th;
|
|
||||||
Evas_Coord minw, minh;
|
|
||||||
|
|
||||||
evas_object_geometry_get(de->edje, &x, &y, &w, &h);
|
|
||||||
x -= 10;
|
|
||||||
y -= 20;
|
|
||||||
w += 20;
|
|
||||||
h += 30;
|
|
||||||
minw = 20 + de->minw;
|
|
||||||
minh = 30 + de->minh;
|
|
||||||
evas_object_move(de->left, x, y + 20);
|
|
||||||
evas_object_resize(de->left, 10, h - 30);
|
|
||||||
evas_object_move(de->right, x + w - 10, y + 20);
|
|
||||||
evas_object_resize(de->right, 10, h - 30);
|
|
||||||
evas_object_move(de->top, x, y);
|
|
||||||
evas_object_resize(de->top, w, 20);
|
|
||||||
evas_object_move(de->bottom, x, y + (h - 10));
|
|
||||||
evas_object_resize(de->bottom, w, 10);
|
|
||||||
evas_object_move(de->title_clip, x + 20, y);
|
|
||||||
evas_object_resize(de->title_clip, w - 40, 20);
|
|
||||||
evas_object_geometry_get(de->title, NULL, NULL, &tw, &th);
|
|
||||||
evas_object_move(de->title, x + ((w - tw) / 2), y + 4 + ((16 - th) / 2));
|
|
||||||
evas_object_move(de->image, x, y);
|
|
||||||
evas_object_resize(de->image, w, h);
|
|
||||||
evas_object_image_fill_set(de->image, 0, 0, w, h);
|
|
||||||
evas_object_move(de->edje, x + 10, y + 20);
|
|
||||||
evas_object_resize(de->edje, w - 20, h - 30);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
|
|
||||||
{
|
|
||||||
printf("MESSAGE for %p from script type %i id %i\n", obj, type, id);
|
|
||||||
if (type == EDJE_MESSAGE_STRING)
|
|
||||||
{
|
|
||||||
Edje_Message_String *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String *)msg;
|
|
||||||
printf("STWING: \"%s\"\n", emsg->str);
|
|
||||||
}
|
|
||||||
printf("Send msg to script...\n");
|
|
||||||
edje_object_message_send(obj, EDJE_MESSAGE_NONE, 12345, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_setup(char *file, char *name)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
Demo_Edje *de;
|
|
||||||
char buf[4096];
|
|
||||||
Evas_Coord tw, th, w, h;
|
|
||||||
Evas_Coord xx, yy, ww, hh;
|
|
||||||
|
|
||||||
xx = 10;
|
|
||||||
yy = 10;
|
|
||||||
ww = startw - 40;
|
|
||||||
hh = starth - 50;
|
|
||||||
if (mdfill)
|
|
||||||
{
|
|
||||||
xx = -10;
|
|
||||||
yy = -20;
|
|
||||||
ww = startw;
|
|
||||||
hh = starth;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%i %i, %i %i\n", (int)startw, (int)starth, (int)ww, (int)hh);
|
|
||||||
|
|
||||||
de = calloc(1, sizeof(Demo_Edje));
|
|
||||||
edjes = evas_list_append(edjes, de);
|
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/test/images/border.png", e_prefix_data_get());
|
|
||||||
evas_object_image_file_set(o, buf, NULL);
|
|
||||||
evas_object_image_smooth_scale_set(o, 0);
|
|
||||||
evas_object_color_set(o, 255, 255, 255, 255);
|
|
||||||
evas_object_image_border_set(o, 26, 26, 26, 26);
|
|
||||||
evas_object_image_fill_set(o, 0, 0, ww, hh);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_move(o, xx, yy);
|
|
||||||
evas_object_resize(o, ww, hh);
|
|
||||||
de->image = o;
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
evas_object_move(o, xx, yy);
|
|
||||||
evas_object_resize(o, ww, 20);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, top_down_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, top_up_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, top_move_cb, de);
|
|
||||||
de->top = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
evas_object_move(o, xx, yy + hh - 10);
|
|
||||||
evas_object_resize(o, ww, 10);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, bottom_down_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, bottom_up_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, bottom_move_cb, de);
|
|
||||||
de->bottom = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
evas_object_move(o, xx, yy + 20);
|
|
||||||
evas_object_resize(o, 10, hh - 20 - 10);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, bottom_down_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, bottom_up_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, bottom_move_cb, de);
|
|
||||||
de->left = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
evas_object_move(o, xx + ww - 10, yy + 20);
|
|
||||||
evas_object_resize(o, 10, hh - 20 - 10);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, bottom_down_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, bottom_up_cb, de);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, bottom_move_cb, de);
|
|
||||||
de->right = o;
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_color_set(o, 255, 255, 255, 255);
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_move(o, xx + 20, yy);
|
|
||||||
evas_object_resize(o, ww - 20 - 20, 20);
|
|
||||||
evas_object_show(o);
|
|
||||||
de->title_clip = o;
|
|
||||||
|
|
||||||
o = evas_object_text_add(evas);
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 255);
|
|
||||||
snprintf(buf, sizeof(buf), "%s - %s", file, name);
|
|
||||||
evas_object_text_text_set(o, buf);
|
|
||||||
evas_object_text_font_set(o, "Vera", 10);
|
|
||||||
evas_object_geometry_get(o, NULL, NULL, &tw, &th);
|
|
||||||
evas_object_move(o, xx + ((ww - tw) / 2), yy + 4 + ((16 - th) / 2));
|
|
||||||
evas_object_pass_events_set(o, 1);
|
|
||||||
evas_object_clip_set(o, de->title_clip);
|
|
||||||
evas_object_show(o);
|
|
||||||
de->title = o;
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
edje_object_message_handler_set(o, message_cb, NULL);
|
|
||||||
// edje_object_signal_callback_add(o, "do_it", "the_source", cb, NULL);
|
|
||||||
// edje_object_signal_callback_add(o, "mouse,*", "logo", cb, NULL);
|
|
||||||
edje_object_signal_callback_add(o, "*", "*", cb, NULL);
|
|
||||||
edje_object_file_set(o, file, name);
|
|
||||||
edje_object_part_drag_size_set(o, "dragable", 0.01, 0.5);
|
|
||||||
// edje_object_part_drag_value_set(o, "dragable", 0.5, 0.5);
|
|
||||||
edje_object_part_drag_step_set(o, "dragable", 0.1, 0.1);
|
|
||||||
edje_object_part_drag_page_set(o, "dragable", 0.2, 0.2);
|
|
||||||
evas_object_move(o, xx + 10, yy + 20);
|
|
||||||
evas_object_show(o);
|
|
||||||
w = ww;
|
|
||||||
h = hh;
|
|
||||||
edje_object_size_min_get(o, &(de->minw), &(de->minh));
|
|
||||||
if (ww < de->minw) w = de->minw;
|
|
||||||
if (hh < de->minh) h = de->minh;
|
|
||||||
edje_object_size_max_get(o, &(de->maxw), &(de->maxh));
|
|
||||||
if (de->maxw > 0)
|
|
||||||
{
|
|
||||||
if (ww > de->maxw) w = de->maxw;
|
|
||||||
}
|
|
||||||
if (de->maxh > 0)
|
|
||||||
{
|
|
||||||
if (hh > de->maxh) h = de->maxh;
|
|
||||||
}
|
|
||||||
evas_object_resize(o, w, h);
|
|
||||||
de->edje = o;
|
|
||||||
|
|
||||||
test_resize(de);
|
|
||||||
// printf("%s\n", edje_object_data_get(o, "My Data"));
|
|
||||||
// printf("%s\n", edje_object_data_get(o, "The Key"));
|
|
||||||
|
|
||||||
/* test swallowing */
|
|
||||||
/*
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
edje_object_file_set(o, file, name);
|
|
||||||
edje_object_part_swallow(de->edje, "swallow", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (main_start(argc, argv) < 1) return -1;
|
|
||||||
|
|
||||||
edje_init();
|
|
||||||
edje_frametime_set(1.0 / 60.0); /* 60 fps */
|
|
||||||
|
|
||||||
bg_setup();
|
|
||||||
|
|
||||||
if (argc < 2)
|
|
||||||
{
|
|
||||||
printf("Usage:\n");
|
|
||||||
printf(" %s [-gl] [-fb] [-g WxH] [-fill] [edje_file1] [edje_file2] ...\n", argv[0]);
|
|
||||||
printf("\n");
|
|
||||||
printf("Example:\n");
|
|
||||||
printf(" %s data/e_logo.edj\n", argv[0]);
|
|
||||||
printf(" %s -fill -g 800x600 data/e_logo.edj\n", argv[0]);
|
|
||||||
printf(" %s -gl -fill -g 800x600 data/e_logo.edj\n", argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
char *file;
|
|
||||||
int done;
|
|
||||||
|
|
||||||
done = 0;
|
|
||||||
file = argv[i];
|
|
||||||
if (((!strcmp(file, "-g")) ||
|
|
||||||
(!strcmp(file, "-geometry")) ||
|
|
||||||
(!strcmp(file, "--geometry"))) && (i < (argc - 1)))
|
|
||||||
i++;
|
|
||||||
if (file[0] == '-') continue;
|
|
||||||
if (!done) test_list(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_main_loop_begin();
|
|
||||||
|
|
||||||
main_stop();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int main ()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "no workie on win32 yet\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,36 +0,0 @@
|
||||||
#ifndef EDJE_MAIN_H
|
|
||||||
#define EDJE_MAIN_H
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Evas.h>
|
|
||||||
#include <Ecore.h>
|
|
||||||
#ifdef HAVE_ECORE_X_H
|
|
||||||
#include <Ecore_X.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ECORE_FB_H
|
|
||||||
#include <Ecore_Fb.h>
|
|
||||||
#endif
|
|
||||||
#include <Ecore_Evas.h>
|
|
||||||
#include <Eet.h>
|
|
||||||
#include "Edje.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef HAVE_ALLOCA_H
|
|
||||||
#include <alloca.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "edje_private.h"
|
|
||||||
#include "edje_prefix.h"
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,374 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <Ecore.h>
|
|
||||||
#include <Evas.h>
|
|
||||||
#include <Ecore_Evas.h>
|
|
||||||
#include "Edje.h"
|
|
||||||
|
|
||||||
Ecore_Evas *ee;
|
|
||||||
Evas *evas;
|
|
||||||
|
|
||||||
Evas_Object *o_bg;
|
|
||||||
Evas_Object *o_edje;
|
|
||||||
|
|
||||||
void signal_cb(void *data, Evas_Object *o, const char *sig, const char *src);
|
|
||||||
void resize_cb(Ecore_Evas *ee);
|
|
||||||
void key_cb(void *data, Evas *e, Evas_Object *o, void *ei);
|
|
||||||
void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg);
|
|
||||||
|
|
||||||
void
|
|
||||||
signal_cb(void *data, Evas_Object *o, const char *sig, const char *src)
|
|
||||||
{
|
|
||||||
printf("EMIT: \"%s\" \"%s\"\n", sig, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
resize_cb(Ecore_Evas *ee)
|
|
||||||
{
|
|
||||||
Evas_Coord w, h;
|
|
||||||
|
|
||||||
evas_output_viewport_get(evas, NULL, NULL, &w, &h);
|
|
||||||
evas_object_resize(o_bg, w, h);
|
|
||||||
evas_object_resize(o_edje, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
key_cb(void *data, Evas *e, Evas_Object *o, void *ei)
|
|
||||||
{
|
|
||||||
Evas_Event_Key_Down *ev;
|
|
||||||
|
|
||||||
ev = ei;
|
|
||||||
printf("KEY: %s\n", ev->keyname);
|
|
||||||
if (!strcmp(ev->keyname, "Escape")) ecore_main_loop_quit();
|
|
||||||
if (!strcmp(ev->keyname, "space"))
|
|
||||||
{
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_NONE,
|
|
||||||
77, NULL);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "1"))
|
|
||||||
{
|
|
||||||
Edje_Message_String msg;
|
|
||||||
|
|
||||||
msg.str = "A Test String";
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING,
|
|
||||||
101, &msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "2"))
|
|
||||||
{
|
|
||||||
Edje_Message_Int msg;
|
|
||||||
|
|
||||||
msg.val = 42;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_INT,
|
|
||||||
102, &msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "3"))
|
|
||||||
{
|
|
||||||
Edje_Message_Float msg;
|
|
||||||
|
|
||||||
msg.val = 3.14159;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_FLOAT,
|
|
||||||
103, &msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "4"))
|
|
||||||
{
|
|
||||||
Edje_Message_String_Set *msg;
|
|
||||||
|
|
||||||
msg = calloc(1,
|
|
||||||
sizeof(Edje_Message_String_Set) -
|
|
||||||
sizeof(char *) +
|
|
||||||
(7 * sizeof(char *)));
|
|
||||||
msg->count = 7;
|
|
||||||
msg->str[0] = "String 1";
|
|
||||||
msg->str[1] = "String 2";
|
|
||||||
msg->str[2] = "String 3";
|
|
||||||
msg->str[3] = "String 4";
|
|
||||||
msg->str[4] = "String 5";
|
|
||||||
msg->str[5] = "String 6";
|
|
||||||
msg->str[6] = "String 7";
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING_SET,
|
|
||||||
104, msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "5"))
|
|
||||||
{
|
|
||||||
Edje_Message_Int_Set *msg;
|
|
||||||
|
|
||||||
msg = calloc(1,
|
|
||||||
sizeof(Edje_Message_Int_Set) -
|
|
||||||
sizeof(int) +
|
|
||||||
(7 * sizeof(int)));
|
|
||||||
msg->count = 7;
|
|
||||||
msg->val[0] = 42;
|
|
||||||
msg->val[1] = 43;
|
|
||||||
msg->val[2] = 44;
|
|
||||||
msg->val[3] = 45;
|
|
||||||
msg->val[4] = 46;
|
|
||||||
msg->val[5] = 47;
|
|
||||||
msg->val[6] = 48;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_INT_SET,
|
|
||||||
105, msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "6"))
|
|
||||||
{
|
|
||||||
Edje_Message_Float_Set *msg;
|
|
||||||
|
|
||||||
msg = calloc(1,
|
|
||||||
sizeof(Edje_Message_Float_Set) -
|
|
||||||
sizeof(double) +
|
|
||||||
(7 * sizeof(double)));
|
|
||||||
msg->count = 7;
|
|
||||||
msg->val[0] = 1.2345;
|
|
||||||
msg->val[1] = 7.7777;
|
|
||||||
msg->val[2] = 3.1415;
|
|
||||||
msg->val[3] = 9.8765;
|
|
||||||
msg->val[4] = 7.8901;
|
|
||||||
msg->val[5] = 3.4567;
|
|
||||||
msg->val[6] = 6.7890;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_FLOAT_SET,
|
|
||||||
106, msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "7"))
|
|
||||||
{
|
|
||||||
Edje_Message_String_Int msg;
|
|
||||||
|
|
||||||
msg.str = "A Test String and Int";
|
|
||||||
msg.val = 42;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING_INT,
|
|
||||||
107, &msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "8"))
|
|
||||||
{
|
|
||||||
Edje_Message_String_Float msg;
|
|
||||||
|
|
||||||
msg.str = "A Test String and Float";
|
|
||||||
msg.val = 777.777;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING_FLOAT,
|
|
||||||
108, &msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "9"))
|
|
||||||
{
|
|
||||||
Edje_Message_String_Int_Set *msg;
|
|
||||||
|
|
||||||
msg = calloc(1,
|
|
||||||
sizeof(Edje_Message_String_Int_Set) -
|
|
||||||
sizeof(int) +
|
|
||||||
(7 * sizeof(int)));
|
|
||||||
msg->str = "A Test String and Int Set";
|
|
||||||
msg->count = 7;
|
|
||||||
msg->val[0] = 42;
|
|
||||||
msg->val[1] = 43;
|
|
||||||
msg->val[2] = 44;
|
|
||||||
msg->val[3] = 45;
|
|
||||||
msg->val[4] = 46;
|
|
||||||
msg->val[5] = 47;
|
|
||||||
msg->val[6] = 48;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING_INT_SET,
|
|
||||||
109, msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
if (!strcmp(ev->keyname, "0"))
|
|
||||||
{
|
|
||||||
Edje_Message_String_Float_Set *msg;
|
|
||||||
|
|
||||||
msg = calloc(1,
|
|
||||||
sizeof(Edje_Message_String_Float_Set) -
|
|
||||||
sizeof(double) +
|
|
||||||
(7 * sizeof(double)));
|
|
||||||
msg->str = "A Test String and Float Set";
|
|
||||||
msg->count = 7;
|
|
||||||
msg->val[0] = 1.2345;
|
|
||||||
msg->val[1] = 7.7777;
|
|
||||||
msg->val[2] = 3.1415;
|
|
||||||
msg->val[3] = 9.8765;
|
|
||||||
msg->val[4] = 7.8901;
|
|
||||||
msg->val[5] = 3.4567;
|
|
||||||
msg->val[6] = 6.7890;
|
|
||||||
edje_object_message_send(o_edje, EDJE_MESSAGE_STRING_FLOAT_SET,
|
|
||||||
110, msg);
|
|
||||||
free(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
|
|
||||||
{
|
|
||||||
printf("MESSAGE FROM OBJ, TYPE: %i, ID %i\n", type, id);
|
|
||||||
if (type == EDJE_MESSAGE_NONE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING)
|
|
||||||
{
|
|
||||||
Edje_Message_String *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String *)msg;
|
|
||||||
printf(" STRING: \"%s\"\n", emsg->str);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_INT)
|
|
||||||
{
|
|
||||||
Edje_Message_Int *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_Int *)msg;
|
|
||||||
printf(" INT: %i\n", emsg->val);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_FLOAT)
|
|
||||||
{
|
|
||||||
Edje_Message_Float *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_Float *)msg;
|
|
||||||
printf(" FLOAT: %f\n", emsg->val);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING_SET)
|
|
||||||
{
|
|
||||||
Edje_Message_String_Set *emsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String_Set *)msg;
|
|
||||||
for (i = 0; i < emsg->count; i++)
|
|
||||||
printf(" STR: %s\n", emsg->str[i]);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_INT_SET)
|
|
||||||
{
|
|
||||||
Edje_Message_Int_Set *emsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_Int_Set *)msg;
|
|
||||||
for (i = 0; i < emsg->count; i++)
|
|
||||||
printf(" INT: %i\n", emsg->val[i]);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_FLOAT_SET)
|
|
||||||
{
|
|
||||||
Edje_Message_Float_Set *emsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_Float_Set *)msg;
|
|
||||||
for (i = 0; i < emsg->count; i++)
|
|
||||||
printf(" FLOAT: %f\n", emsg->val[i]);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING_INT)
|
|
||||||
{
|
|
||||||
Edje_Message_String_Int *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String_Int *)msg;
|
|
||||||
printf(" STR: %s\n", emsg->str);
|
|
||||||
printf(" INT: %i\n", emsg->val);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING_FLOAT)
|
|
||||||
{
|
|
||||||
Edje_Message_String_Float *emsg;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String_Float *)msg;
|
|
||||||
printf(" STR: %s\n", emsg->str);
|
|
||||||
printf(" FLOAT: %f\n", emsg->val);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING_INT_SET)
|
|
||||||
{
|
|
||||||
Edje_Message_String_Int_Set *emsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String_Int_Set *)msg;
|
|
||||||
printf(" STR: %s\n", emsg->str);
|
|
||||||
for (i = 0; i < emsg->count; i++)
|
|
||||||
printf(" INT: %i\n", emsg->val[i]);
|
|
||||||
}
|
|
||||||
else if (type == EDJE_MESSAGE_STRING_FLOAT_SET)
|
|
||||||
{
|
|
||||||
Edje_Message_String_Float_Set *emsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
emsg = (Edje_Message_String_Float_Set *)msg;
|
|
||||||
printf(" STR: %s\n", emsg->str);
|
|
||||||
for (i = 0; i < emsg->count; i++)
|
|
||||||
printf(" INT: %f\n", emsg->val[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
|
|
||||||
if (argc != 3)
|
|
||||||
{
|
|
||||||
printf("Usage: edje_test edje_file.edj part_to_load\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_init();
|
|
||||||
ecore_app_args_set(argc, (const char **)argv);
|
|
||||||
ecore_evas_init();
|
|
||||||
edje_init();
|
|
||||||
|
|
||||||
if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_X11))
|
|
||||||
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 240, 320);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_FB))
|
|
||||||
ee = ecore_evas_fb_new(NULL, 270, 240, 320);
|
|
||||||
}
|
|
||||||
if (!ee)
|
|
||||||
{
|
|
||||||
if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_FB))
|
|
||||||
ee = ecore_evas_fb_new(NULL, 270, 240, 320);
|
|
||||||
if (!ee)
|
|
||||||
ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 240, 320);
|
|
||||||
if (!ee)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Cannot create Canvas!\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
evas = ecore_evas_get(ee);
|
|
||||||
evas_image_cache_set(evas, 8192 * 1024);
|
|
||||||
evas_font_cache_set(evas, 512 * 1024);
|
|
||||||
|
|
||||||
o = evas_object_rectangle_add(evas);
|
|
||||||
evas_object_move(o, 0, 0);
|
|
||||||
evas_object_resize(o, 240, 320);
|
|
||||||
evas_object_color_set(o, 255, 255, 255, 255);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, key_cb, NULL);
|
|
||||||
evas_object_focus_set(o, 1);
|
|
||||||
evas_object_show(o);
|
|
||||||
o_bg = o;
|
|
||||||
|
|
||||||
o = edje_object_add(evas);
|
|
||||||
edje_object_signal_callback_add(o, "*", "*", signal_cb, NULL);
|
|
||||||
edje_object_message_handler_set(o, message_cb, NULL);
|
|
||||||
edje_object_file_set(o, argv[1], argv[2]);
|
|
||||||
evas_object_move(o, 0, 0);
|
|
||||||
evas_object_resize(o, 240, 320);
|
|
||||||
evas_object_show(o);
|
|
||||||
o_edje = o;
|
|
||||||
|
|
||||||
// edje_object_size_min_calc(o, &mw, &mh);
|
|
||||||
// evas_object_resize(o_edje, mw, mh);
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
Evas_Coord mw, mh;
|
|
||||||
|
|
||||||
printf("---EMIT SIGNALS\n");
|
|
||||||
edje_object_signal_emit(o_edje, "icon_visible", "");
|
|
||||||
printf("---PROCESS SIGNALS\n");
|
|
||||||
edje_object_message_signal_process(o_edje);
|
|
||||||
printf("---MIN CALC\n");
|
|
||||||
edje_object_size_min_calc(o_edje, &mw, &mh);
|
|
||||||
printf("---MIN %ix%i\n", mw, mh);
|
|
||||||
evas_object_resize(o_edje, mw, mh);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
ecore_evas_callback_resize_set(ee, resize_cb);
|
|
||||||
ecore_evas_show(ee);
|
|
||||||
|
|
||||||
ecore_main_loop_begin();
|
|
||||||
|
|
||||||
edje_shutdown();
|
|
||||||
ecore_evas_shutdown();
|
|
||||||
ecore_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,224 +0,0 @@
|
||||||
#include "edje_thumb.h"
|
|
||||||
|
|
||||||
static void args_parse(void);
|
|
||||||
static void help_show(void);
|
|
||||||
static int signal_exit(void *data, int ev_type, void *ev);
|
|
||||||
static int frame_grab(void *data);
|
|
||||||
|
|
||||||
Ecore_Evas *ee = NULL, *ee_im = NULL, *ee_im2 = NULL;
|
|
||||||
Evas *evas = NULL, *evas_im = NULL, *evas_im2 = NULL;
|
|
||||||
Evas_Object *edje = NULL, *im = NULL, *im2 = NULL;
|
|
||||||
char *file = NULL;
|
|
||||||
char *group = NULL;
|
|
||||||
char *outfile = NULL;
|
|
||||||
double fps = 10.0;
|
|
||||||
int frames = 0;
|
|
||||||
int w = 640;
|
|
||||||
int h = 480;
|
|
||||||
int outw = 160;
|
|
||||||
int outh = 120;
|
|
||||||
int frnum = 0;
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (!ecore_init()) return -1;
|
|
||||||
ecore_app_args_set(argc, (const char **)argv);
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, signal_exit, NULL);
|
|
||||||
if (!ecore_evas_init()) return -1;
|
|
||||||
if (!edje_init()) return -1;
|
|
||||||
|
|
||||||
args_parse();
|
|
||||||
|
|
||||||
ee = ecore_evas_buffer_new(outw, outh);
|
|
||||||
if (!ee)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error. cannot create buffer engine canvas for image save.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
evas = ecore_evas_get(ee);
|
|
||||||
|
|
||||||
im = ecore_evas_object_image_new(ee);
|
|
||||||
if (!im)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error. cannot create buffer canvas image object for scaling.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
evas_object_move(im, 0, 0);
|
|
||||||
evas_object_resize(im, outw, outh);
|
|
||||||
evas_object_image_fill_set(im, 0, 0, outw, outh);
|
|
||||||
evas_object_show(im);
|
|
||||||
evas_object_image_size_set(im, outw, outh);
|
|
||||||
ee_im = evas_object_data_get(im, "Ecore_Evas");
|
|
||||||
evas_im = ecore_evas_get(ee_im);
|
|
||||||
|
|
||||||
im2 = ecore_evas_object_image_new(ee_im);
|
|
||||||
if (!im2)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error. cannot create buffer canvas image for scaling.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
evas_object_move(im2, 0, 0);
|
|
||||||
evas_object_resize(im2, outw, outh);
|
|
||||||
evas_object_image_fill_set(im2, 0, 0, outw, outh);
|
|
||||||
evas_object_show(im2);
|
|
||||||
evas_object_image_size_set(im2, w, h);
|
|
||||||
ee_im2 = evas_object_data_get(im2, "Ecore_Evas");
|
|
||||||
evas_im2 = ecore_evas_get(ee_im2);
|
|
||||||
|
|
||||||
edje = edje_object_add(evas_im2);
|
|
||||||
if (!edje_object_file_set(edje, file, group))
|
|
||||||
{
|
|
||||||
printf("Cannot load file %s, group %s\n", file, group);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
evas_object_move(edje, 0, 0);
|
|
||||||
evas_object_resize(edje, w, h);
|
|
||||||
evas_object_show(edje);
|
|
||||||
edje_message_signal_process();
|
|
||||||
|
|
||||||
if (frames > 0)
|
|
||||||
{
|
|
||||||
frame_grab(NULL);
|
|
||||||
ecore_timer_add(1.0 / fps, frame_grab, NULL);
|
|
||||||
ecore_main_loop_begin();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ecore_evas_buffer_pixels_get(ee);
|
|
||||||
evas_object_image_save(im, outfile, NULL, "quality=100 compress=9");
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_object_del(edje);
|
|
||||||
ecore_evas_free(ee);
|
|
||||||
edje_shutdown();
|
|
||||||
ecore_evas_shutdown();
|
|
||||||
ecore_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
args_parse(void)
|
|
||||||
{
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
ecore_app_args_get(&argc, &argv);
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
if ((!strcmp(argv[i], "-h")) ||
|
|
||||||
(!strcmp(argv[i], "-help")) ||
|
|
||||||
(!strcmp(argv[i], "--help")))
|
|
||||||
{
|
|
||||||
help_show();
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
else if (((!strcmp(argv[i], "-g")) ||
|
|
||||||
(!strcmp(argv[i], "-geometry")) ||
|
|
||||||
(!strcmp(argv[i], "--geometry"))) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
char buf[16], buf2[16];
|
|
||||||
|
|
||||||
n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
|
|
||||||
if (n == 2)
|
|
||||||
{
|
|
||||||
w = atoi(buf);
|
|
||||||
h = atoi(buf2);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (((!strcmp(argv[i], "-og")) ||
|
|
||||||
(!strcmp(argv[i], "-out-geometry")) ||
|
|
||||||
(!strcmp(argv[i], "--out-geometry"))) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
char buf[16], buf2[16];
|
|
||||||
|
|
||||||
n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
|
|
||||||
if (n == 2)
|
|
||||||
{
|
|
||||||
outw = atoi(buf);
|
|
||||||
outh = atoi(buf2);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if ((!strcmp(argv[i], "-fps")) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
fps = atof(argv[i + 1]);
|
|
||||||
if (fps < 0.1) fps = 0.1;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if ((!strcmp(argv[i], "-n")) && (i < (argc - 1)))
|
|
||||||
{
|
|
||||||
frames = atoi(argv[i + 1]);
|
|
||||||
if (frames < 1) frames = 1;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (!file)
|
|
||||||
{
|
|
||||||
file = argv[i];
|
|
||||||
}
|
|
||||||
else if (!group)
|
|
||||||
{
|
|
||||||
group = argv[i];
|
|
||||||
}
|
|
||||||
else if (!outfile)
|
|
||||||
{
|
|
||||||
outfile = argv[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!file) || (!group) || (!outfile))
|
|
||||||
{
|
|
||||||
help_show();
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
help_show(void)
|
|
||||||
{
|
|
||||||
printf("Usage: edje_thumb INPUT_EDJE GROUP_TO_LOAD OUT_FILE [OPTIONS]\n"
|
|
||||||
"\n"
|
|
||||||
"Where required parameters are:\n"
|
|
||||||
" INPUT_EDJE the edje file to look at\n"
|
|
||||||
" GROUP_TO_LOAD the group name in the edge\n"
|
|
||||||
" OUT_FILE the output file or format (for multiple frames include a %%i format to accept the number of the frame - same as printf)\n"
|
|
||||||
"\n"
|
|
||||||
"Where optional OPTIONS are:\n"
|
|
||||||
" -h this help\n"
|
|
||||||
" -g WxH rendering geometry\n"
|
|
||||||
" -og WxH output file geometry\n"
|
|
||||||
" -fps N frames per second if capturing an animation\n"
|
|
||||||
" -n NUM number of frames to capture if capturing an animation\n"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
signal_exit(void *data, int ev_type, void *ev)
|
|
||||||
{
|
|
||||||
ecore_main_loop_quit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
frame_grab(void *data)
|
|
||||||
{
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), outfile, frnum);
|
|
||||||
ecore_evas_buffer_pixels_get(ee);
|
|
||||||
if (!evas_object_image_save(im, buf, NULL, "quality=100 compress=9"))
|
|
||||||
{
|
|
||||||
printf("Cannot load file \"%s\". Missing saver moduel for Evas or literally cannto write the file (permissions or directory doesnt exist).\n", buf);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
frnum++;
|
|
||||||
if (frnum == frames)
|
|
||||||
{
|
|
||||||
ecore_main_loop_quit();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef EDJE_THUMB_H
|
|
||||||
#define EDJE_THUMB_H
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <Evas.h>
|
|
||||||
#include <Ecore.h>
|
|
||||||
#include <Ecore_Evas.h>
|
|
||||||
#include <Eet.h>
|
|
||||||
#include "Edje.h"
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue