Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ebits
Dir : e17/libs/ebits/src
Modified Files:
Ebits.h Ebits_private.h Makefile.am ebits_main.c
Log Message:
More SPLIT merging fun. This time ebits is the lucky candidate.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ebits/src/Ebits.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Ebits.h 13 Apr 2002 04:31:38 -0000 1.14
+++ Ebits.h 14 Jan 2003 19:12:04 -0000 1.15
@@ -19,7 +19,7 @@
void ebits_set_cache(int count);
int ebits_get_cache(void);
void ebits_flush(void);
- void ebits_add_to_evas(Ebits_Object o, Evas e);
+ void ebits_add_to_evas(Ebits_Object o, Evas * e);
void ebits_show(Ebits_Object o);
void ebits_hide(Ebits_Object o);
void ebits_set_layer(Ebits_Object o, int l);
@@ -27,7 +27,7 @@
void ebits_lower(Ebits_Object o);
void ebits_move(Ebits_Object o, double x, double y);
void ebits_resize(Ebits_Object o, double w, double h);
- void ebits_set_clip(Ebits_Object o, Evas_Object clip);
+ void ebits_set_clip(Ebits_Object o, Evas_Object * clip);
void ebits_unset_clip(Ebits_Object o);
void ebits_get_padding(Ebits_Object o, int *l, int *r,
int *t, int *b);
@@ -83,7 +83,7 @@
l),
void (*func_set_clip) (void
*_data,
- Evas_Object
+ Evas_Object *
clip),
void (*func_set_color_class)
(void *_data, char *cc,
@@ -97,9 +97,14 @@
double *h), void *data);
void ebits_set_named_bit_state(Ebits_Object o, char *c,
char *state);
- Evas_List ebits_get_bit_names(Ebits_Object o);
- Evas_List ebits_get_state_names(Ebits_Object o);
+
+ void ebits_set_named_bit_selected(Ebits_Object o, char *c,
+ unsigned int s);
+
+ Evas_List * ebits_get_bit_names(Ebits_Object o);
+ Evas_List * ebits_get_state_names(Ebits_Object o);
void ebits_get_preferred_size(Ebits_Object o, int *w, int *h);
+ int ebits_is_shaped(Ebits_Object o);
#ifdef __cplusplus
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ebits/src/Ebits_private.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- Ebits_private.h 13 Apr 2002 04:31:38 -0000 1.16
+++ Ebits_private.h 14 Jan 2003 19:12:07 -0000 1.17
@@ -1,6 +1,20 @@
#ifndef EBITS_PRIVATE_H
#define EBITS_PRIVATE_H 1
+/* Ebits */
+#if 1
+/* Nothing */
+
+/* Etcher */
+#else
+#define EDITOR 1
+#define _EBITS_INTERNAL
+#include <Ebits.h>
+#include <X11/Xlib.h>
+#include <Imlib2.h>
+#endif
+/* End */
+
#include <Edb.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
@@ -78,7 +92,7 @@
int l, r, t, b;
}
padding , inset;
- Evas_List bits;
+ Evas_List * bits;
struct
{
int caculated;
@@ -87,7 +101,7 @@
}
real_min_size;
- Evas_List state_names;
+ Evas_List * state_names;
};
struct _Ebits_Object_Bit_Description
@@ -95,12 +109,13 @@
char *name;
char *class;
char *color_class;
+ unsigned int is_selected;
struct
{
char *image;
}
- normal , hilited, clicked, disabled;
- Evas_List state_description;
+ normal , hilited, clicked, selected, disabled;
+ Evas_List * state_description;
struct
{
int l, r, t, b;
@@ -134,7 +149,7 @@
int w, h;
}
min , max;
- Evas_List sync;
+ Evas_List * sync;
};
struct _Ebits_Object_State
@@ -142,8 +157,8 @@
double x, y, w, h;
int layer;
int visible;
- Evas_Object clip;
- Evas evas;
+ Evas_Object * clip;
+ Evas * evas;
};
struct _Ebits_Callback
@@ -158,7 +173,8 @@
struct _Ebits_Object_Bit_State
{
Ebits_Object o;
- Evas_Object object;
+ Evas_Object * object;
+ int image_status;
Ebits_Object_Bit_Description description;
int r, g, b, a;
int recalc;
@@ -167,9 +183,10 @@
int x, y, w, h;
int mouse_in;
char *state;
+ unsigned int is_selected;
int syncing;
int want_w, want_h;
- Evas_List callbacks;
+ Evas_List * callbacks;
/* callbacks for when you embed an object in a bit */
void *func_data;
@@ -181,7 +198,7 @@
void (*func_raise) (void *_data);
void (*func_lower) (void *_data);
void (*func_set_layer) (void *_data, int l);
- void (*func_set_clip) (void *_data, Evas_Object clip);
+ void (*func_set_clip) (void *_data, Evas_Object * clip);
void (*func_get_min_size) (void *_data, double *w, double *h);
void (*func_get_max_size) (void *_data, double *w, double *h);
void (*func_set_color_class) (void *_data, char *cc, int r,
@@ -193,9 +210,9 @@
int saved;
Imlib_Image image;
}
- normal , hilited, clicked, disabled;
+ normal , hilited, clicked, selected, disabled;
- Evas_List state_source_description;
+ Evas_List * state_source_description;
#endif
};
@@ -203,7 +220,7 @@
{
Ebits_Object_Description description;
Ebits_Object_State state;
- Evas_List bits;
+ Evas_List * bits;
};
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ebits/src/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 28 Oct 2001 01:38:29 -0000 1.4
+++ Makefile.am 14 Jan 2003 19:12:21 -0000 1.5
@@ -31,4 +31,4 @@
libebits_la_LIBADD = $(LIBS_ALL)
libebits_la_DEPENDENCIES = $(top_builddir)/config.h
-libebits_la_LDFLAGS = -version-info 0:2:0
+libebits_la_LDFLAGS = -version-info 1:1:0
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ebits/src/ebits_main.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- ebits_main.c 13 Apr 2002 04:31:38 -0000 1.32
+++ ebits_main.c 14 Jan 2003 19:12:26 -0000 1.33
@@ -1,6 +1,15 @@
+/* Ebits */
+#if 1
#define _EBITS_INTERNAL 1
#include "Ebits.h"
#include "Ebits_private.h"
+
+/* Etcher */
+#else
+#include "bits.h"
+#endif
+/* End */
+
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -11,7 +20,7 @@
static int __ebits_cache_zero = 0;
static int __ebits_cache_size = 8;
-static Evas_List __bit_descriptions = NULL;
+static Evas_List * __bit_descriptions = NULL;
Ebits_Object_Bit_State _ebits_get_bit_class(Ebits_Object o, char *name);
static Ebits_Object_Description _ebits_find_description(char *file);
@@ -29,6 +38,7 @@
static void _ebits_calculate_min_size(Ebits_Object o);
#define EBITS_FILE_REDIRECT "%s:/images/%s"
+#define EBITS_EVAS_KEY_PREFIX "/images/"
#define FREE(ptr) \
{ \
free(ptr); \
@@ -36,12 +46,12 @@
}
#define IF_FREE(ptr) { if (ptr) FREE(ptr); }
-/* #define LENIENT 1 */
+#define LENIENT 1
Ebits_Object_Bit_State
ebits_get_bit_name(Ebits_Object o, char *name)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -60,7 +70,7 @@
Ebits_Object_Bit_State
_ebits_get_bit_class(Ebits_Object o, char *class)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -81,7 +91,12 @@
{
double fill_w, fill_h;
- evas_set_image_border(state->o->state.evas, state->object,
+ if(state->object)
+ {
+ /* only images */
+ if( !strcmp(evas_object_type_get(state->object),"image"))
+ {
+ evas_object_image_border_set(state->object,
state->description->border.l,
state->description->border.r,
state->description->border.t,
@@ -91,7 +106,7 @@
{
int im_w;
- evas_get_image_size(state->o->state.evas, state->object, &im_w, NULL);
+ evas_object_image_size_get(state->object, &im_w, NULL);
if (im_w > 0)
fill_w = im_w;
}
@@ -99,7 +114,7 @@
{
int im_w;
- evas_get_image_size(state->o->state.evas, state->object, &im_w, NULL);
+ evas_object_image_size_get(state->object, &im_w, NULL);
if (im_w > 0)
{
int num;
@@ -115,7 +130,7 @@
{
int im_h;
- evas_get_image_size(state->o->state.evas, state->object, NULL, &im_h);
+ evas_object_image_size_get(state->object, NULL, &im_h);
if (im_h > 0)
fill_h = im_h;
}
@@ -123,7 +138,7 @@
{
int im_h;
- evas_get_image_size(state->o->state.evas, state->object, NULL, &im_h);
+ evas_object_image_size_get(state->object, NULL, &im_h);
if (im_h > 0)
{
int num;
@@ -134,15 +149,20 @@
fill_h = state->h / (double)num;
}
}
- evas_set_image_fill(state->o->state.evas, state->object,
+ evas_object_image_fill_set(state->object,
0, 0, fill_w, fill_h);
- evas_resize(state->o->state.evas, state->object, state->w, state->h);
+ }
+ evas_event_freeze(evas_object_evas_get(state->object));
+ evas_object_resize(state->object, state->w, state->h);
+ evas_event_thaw(evas_object_evas_get(state->object));
+ }
+
}
static void
_ebits_object_calculate(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -156,11 +176,20 @@
Ebits_Object_Bit_State state;
state = l->data;
+
_ebits_calculate(state);
- _ebits_evaluate_fill(state);
- evas_move(state->o->state.evas, state->object,
- o->state.x + state->x, o->state.y + state->y);
- evas_resize(state->o->state.evas, state->object, state->w, state->h);
+ if(state->object)
+ {
+
+ /* only images */
+ _ebits_evaluate_fill(state);
+
+ evas_event_freeze(evas_object_evas_get(state->object));
+ evas_object_move(state->object,
+ o->state.x + state->x, o->state.y + state->y);
+ evas_object_resize(state->object, state->w, state->h);
+ evas_event_thaw(evas_object_evas_get(state->object));
+ }
if (state->func_move)
state->func_move(state->func_data,
o->state.x + state->x, o->state.y + state->y);
@@ -337,12 +366,12 @@
static void
_ebits_sync_bits(Ebits_Object_Bit_State state)
{
- Evas_List l;
+ Evas_List * l;
state->syncing = 1;
if (state->object)
{
- char buf[4096];
+ char buf[4096], key[4096];
char *st = NULL;
#ifdef EDITOR
@@ -353,16 +382,87 @@
#endif
st = _ebits_get_file(state->description, state->state);
if (st && strlen(st) > 2)
- snprintf(buf, sizeof(buf), EBITS_FILE_REDIRECT,
- state->o->description->file, st);
+ {
+ strcpy(buf,state->o->description->file);
+ snprintf(key, sizeof(key), EBITS_EVAS_KEY_PREFIX "%s", st);
+ }
#ifndef EDITOR
else
- strcpy(buf, "");
+ {
+ strcpy(buf, "");
+ strcpy(key, "");
+ }
#endif
- evas_set_image_file(state->o->state.evas, state->object, buf);
+ /* if not an image at present */
+ if( strcmp(evas_object_type_get(state->object),"image"))
+ {
+ Evas * st_e;
+ st_e = evas_object_evas_get(state->object);
+
+ evas_object_del(state->object);
+ state->object = evas_object_image_add(st_e);
+ }
+
+ /* only images */
+ if( !strcmp(evas_object_type_get(state->object),"image"))
+ {
+ int iw,ih;
+ evas_object_image_file_set(state->object, buf, key);
+
+#if 1
+
+ state->image_status =
+ evas_object_image_load_error_get(state->object);
+ if(state->image_status)
+ {
+ Evas * st_e;
+ st_e = evas_object_evas_get(state->object);
+ evas_object_del(state->object);
+#if 1
+
+ state->object = NULL;
+#else
+ /* todo - event rects? */
+ state->object = evas_object_rectangle_add(st_e);
+ if ((state->description->class) &&
+ (!strcmp(state->description->class, "Decoration")))
+ evas_object_pass_events_set(state->object, 1);
+ /*evas_object_color_set(state->object, 255, 255, 255, 0);*/
+ evas_object_color_set(state->object, 255, 0, 0, 255);
+ state->image_status = -1;
+
+#endif
+ }
+ else
+ {
+ int iw,ih;
+
+ if ((state->description->class) &&
+ (!strcmp(state->description->class, "Decoration")))
+ evas_object_pass_events_set(state->object, 1);
+
+ /* Not needed */
+ /*
+ evas_object_image_size_get(state->object, &iw, &ih);
+ evas_object_resize(state->object, iw, ih);
+ evas_object_image_fill_set(state->object,
+ 0, 0, iw, ih);
+ */
+ }
+
+#endif
+
+ /* Not needed */
+ /*
+ evas_object_image_size_get(state->object, &iw, &ih);
+ evas_object_resize(state->object, iw, ih);
+ evas_object_image_fill_set(state->object,
+ 0, 0, iw, ih);
+ */
- _ebits_evaluate_fill(state);
+ _ebits_evaluate_fill(state);
+ }
}
for (l = state->description->sync; l; l = l->next)
{
@@ -373,6 +473,9 @@
{
IF_FREE(state2->state);
state2->state = strdup(state->state);
+
+ state2->is_selected = state->is_selected;
+ state2->description->is_selected = state->description->is_selected;
_ebits_sync_bits(state2);
}
}
@@ -380,10 +483,11 @@
}
static void
-_ebits_handle_mouse_down(void *_data, Evas _e, Evas_Object _o, int _b,
- int _x, int _y)
+_ebits_handle_mouse_down(void *_data, Evas * _e, Evas_Object * _o,
+ void *ev_info)
{
Ebits_Object_Bit_State state;
+ Evas_Event_Mouse_Down *event_info = ev_info;
state = _data;
if (!strncasecmp(state->state, "disabled", 8))
@@ -393,16 +497,18 @@
_ebits_sync_bits(state);
if (state->callbacks)
{
- Evas_List l;
+ Evas_List * l;
for (l = state->callbacks; l; l = l->next)
{
Ebits_Callback cb;
cb = l->data;
- if (cb->type == CALLBACK_MOUSE_DOWN)
+ if (cb->type == EVAS_CALLBACK_MOUSE_DOWN)
cb->func(cb->data, state->o,
- state->description->class, _b, _x, _y,
+ state->description->class,
+ event_info->button,
+ event_info->output.x, event_info->output.y,
state->o->state.x + state->x,
state->o->state.y + state->y, state->w, state->h);
}
@@ -414,10 +520,11 @@
}
static void
-_ebits_handle_mouse_up(void *_data, Evas _e, Evas_Object _o, int _b, int _x,
- int _y)
+_ebits_handle_mouse_up(void *_data, Evas * _e, Evas_Object * _o,
+ void *ev_info)
{
Ebits_Object_Bit_State state;
+ Evas_Event_Mouse_Up *event_info = ev_info;
state = _data;
if (!strncasecmp(state->state, "disabled", 8))
@@ -430,16 +537,18 @@
_ebits_sync_bits(state);
if (state->callbacks)
{
- Evas_List l;
+ Evas_List * l;
for (l = state->callbacks; l; l = l->next)
{
Ebits_Callback cb;
cb = l->data;
- if (cb->type == CALLBACK_MOUSE_UP)
+ if (cb->type == EVAS_CALLBACK_MOUSE_UP)
cb->func(cb->data, state->o,
- state->description->class, _b, _x, _y,
+ state->description->class,
+ event_info->button,
+ event_info->output.x, event_info->output.y,
state->o->state.x + state->x,
state->o->state.y + state->y, state->w, state->h);
}
@@ -451,28 +560,33 @@
}
static void
-_ebits_handle_mouse_move(void *_data, Evas _e, Evas_Object _o, int _b,
- int _x, int _y)
+_ebits_handle_mouse_move(void *_data, Evas * _e, Evas_Object * _o,
+ void *ev_info)
{
Ebits_Object_Bit_State state;
+ Evas_Event_Mouse_Move *event_info = ev_info;
state = _data;
if (!strncasecmp(state->state, "disabled", 8))
return;
if (state->callbacks)
{
- Evas_List l;
+ Evas_List * l;
for (l = state->callbacks; l; l = l->next)
{
Ebits_Callback cb;
cb = l->data;
- if (cb->type == CALLBACK_MOUSE_MOVE)
+ if (cb->type == EVAS_CALLBACK_MOUSE_MOVE)
+ {
cb->func(cb->data, state->o,
- state->description->class, _b, _x, _y,
+ state->description->class,
+ event_info->buttons,
+ event_info->cur.output.x, event_info->cur.output.y,
state->o->state.x + state->x,
state->o->state.y + state->y, state->w, state->h);
+ }
}
}
@@ -482,10 +596,11 @@
}
static void
-_ebits_handle_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x,
- int _y)
+_ebits_handle_mouse_in(void *_data, Evas * _e, Evas_Object * _o,
+ void *ev_info)
{
Ebits_Object_Bit_State state;
+ Evas_Event_Mouse_In *event_info = ev_info;
state = _data;
if (!strncasecmp(state->state, "disabled", 8))
@@ -499,18 +614,22 @@
_ebits_sync_bits(state);
if (state->callbacks)
{
- Evas_List l;
+ Evas_List * l;
for (l = state->callbacks; l; l = l->next)
{
Ebits_Callback cb;
cb = l->data;
- if (cb->type == CALLBACK_MOUSE_IN)
- cb->func(cb->data, state->o,
- state->description->class, _b, _x, _y,
- state->o->state.x + state->x,
- state->o->state.y + state->y, state->w, state->h);
+ if (cb->type == EVAS_CALLBACK_MOUSE_IN)
+ {
+ cb->func(cb->data, state->o,
+ state->description->class,
+ event_info->buttons,
+ event_info->output.x, event_info->output.y,
+ state->o->state.x + state->x,
+ state->o->state.y + state->y, state->w, state->h);
+ }
}
}
@@ -520,10 +639,11 @@
}
static void
-_ebits_handle_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x,
- int _y)
+_ebits_handle_mouse_out(void *_data, Evas * _e, Evas_Object * _o,
+ void *ev_info)
{
Ebits_Object_Bit_State state;
+ Evas_Event_Mouse_Out *event_info = ev_info;
state = _data;
if (!strncasecmp(state->state, "disabled", 8))
@@ -537,16 +657,18 @@
_ebits_sync_bits(state);
if (state->callbacks)
{
- Evas_List l;
+ Evas_List * l;
for (l = state->callbacks; l; l = l->next)
{
Ebits_Callback cb;
cb = l->data;
- if (cb->type == CALLBACK_MOUSE_OUT)
+ if (cb->type == EVAS_CALLBACK_MOUSE_OUT)
cb->func(cb->data, state->o,
- state->description->class, _b, _x, _y,
+ state->description->class,
+ event_info->buttons,
+ event_info->output.x, event_info->output.y,
state->o->state.x + state->x,
state->o->state.y + state->y, state->w, state->h);
}
@@ -563,7 +685,7 @@
static int
_ebits_image_state_saved(Ebits_Object_Bit_State state, char *s)
{
- Evas_List l;
+ Evas_List * l;
int len;
if (!s)
@@ -574,6 +696,9 @@
if (!len)
return 0;
+ if (state->is_selected && state->description->selected.image)
+ return state->selected.saved;
+
if (!strncasecmp(s, "normal", len))
{
if (state->description->normal.image)
@@ -698,9 +823,12 @@
if (!len)
return "";
+ if (d->is_selected && d->selected.image)
+ return d->selected.image;
+
if (!strncasecmp(state, "normal", len))
{
- Evas_List l;
+ Evas_List * l;
if (d->normal.image)
return d->normal.image;
@@ -728,7 +856,7 @@
}
else if (!strncasecmp(state, "hilited", len))
{
- Evas_List l;
+ Evas_List * l;
if (d->hilited.image)
return d->hilited.image;
@@ -756,7 +884,7 @@
}
else if (!strncasecmp(state, "clicked", len))
{
- Evas_List l;
+ Evas_List * l;
if (d->clicked.image)
return d->clicked.image;
@@ -784,7 +912,7 @@
}
else if (!strncasecmp(state, "disabled", len))
{
- Evas_List l;
+ Evas_List * l;
if (d->disabled.image)
return d->disabled.image;
@@ -812,7 +940,7 @@
}
else
{
- Evas_List l;
+ Evas_List * l;
for (l = d->state_description; l; l = l->next)
{
@@ -846,7 +974,7 @@
_ebits_find_description(char *file)
{
Ebits_Object_Description d = NULL;
- Evas_List l;
+ Evas_List * l;
E_DB_File *db;
int version;
@@ -973,6 +1101,8 @@
bit->hilited.image = e_db_str_get(db, key);
snprintf(key, sizeof(key), "/bits/bit/%i/clicked/image", i);
bit->clicked.image = e_db_str_get(db, key);
+ snprintf(key, sizeof(key), "/bits/bit/%i/selected/image", i);
+ bit->selected.image = e_db_str_get(db, key);
snprintf(key, sizeof(key), "/bits/bit/%i/disabled/image", i);
bit->disabled.image = e_db_str_get(db, key);
@@ -1110,19 +1240,38 @@
void
ebits_set_state(Ebits_Object o, char *st)
{
- Evas_List l;
+ Evas_List * l;
- for (l = o->bits; l; l = l->next)
+ if (strncasecmp(st, "selected", strlen(st)))
{
- Ebits_Object_Bit_State state;
+ for (l = o->bits; l; l = l->next)
+ {
+ Ebits_Object_Bit_State state;
- state = l->data;
+ state = l->data;
- IF_FREE(state->state);
+ IF_FREE(state->state);
- state->state = strdup(st);
+ state->state = strdup(st);
+ state->is_selected = 0;
+ state->description->is_selected = 0;
- _ebits_sync_bits(state);
+ _ebits_sync_bits(state);
+ }
+ }
+ else
+ {
+ for (l = o->bits; l; l = l->next)
+ {
+ Ebits_Object_Bit_State state;
+
+ state = l->data;
+
+ state->is_selected = 1;
+ state->description->is_selected = 1;
+
+ _ebits_sync_bits(state);
+ }
}
}
@@ -1149,7 +1298,7 @@
void
_ebits_evaluate(Ebits_Object_Bit_State state)
{
- Evas_List l;
+ Evas_List * l;
if (state->description->normal.image && !state->normal.image)
state->normal.image = imlib_load_image(state->description->normal.image);
@@ -1159,6 +1308,9 @@
if (state->description->clicked.image && !state->clicked.image)
state->clicked.image =
imlib_load_image(state->description->clicked.image);
+ if (state->description->selected.image && !state->selected.image)
+ state->selected.image =
+ imlib_load_image(state->description->selected.image);
if (state->description->disabled.image && !state->disabled.image)
state->disabled.image =
imlib_load_image(state->description->disabled.image);
@@ -1198,10 +1350,10 @@
void
ebits_del_bit(Ebits_Object o, Ebits_Object_Bit_State state)
{
- Evas_List l;
+ Evas_List * l;
if (state->object)
- evas_del_object(o->state.evas, state->object);
+ evas_object_del(state->object);
if (state->normal.image)
{
imlib_context_set_image(state->normal.image);
@@ -1217,6 +1369,11 @@
imlib_context_set_image(state->clicked.image);
imlib_free_image_and_decache();
}
+ if (state->selected.image)
+ {
+ imlib_context_set_image(state->selected.image);
+ imlib_free_image_and_decache();
+ }
if (state->disabled.image)
{
imlib_context_set_image(state->disabled.image);
@@ -1244,6 +1401,7 @@
IF_FREE(state->description->normal.image);
IF_FREE(state->description->hilited.image);
IF_FREE(state->description->clicked.image);
+ IF_FREE(state->description->selected.image);
IF_FREE(state->description->disabled.image);
/* XXX */
@@ -1297,34 +1455,43 @@
bit->normal.image = malloc(strlen(file) + 1);
strcpy(bit->normal.image, file);
- state->object =
- evas_add_image_from_file(o->state.evas,
- _ebits_get_file(state->description,
- state->state));
+ state->object = evas_object_image_add(o->state.evas);
+ /* todo */
+ evas_object_image_file_set(state->object,
+ _ebits_get_file(state->description, state->state),
+ NULL );
+ state->image_status = evas_object_image_load_error_get(state->object);
+
+ if(state->image_status)
+ {
+ evas_object_del(state->object);
+ state->object = NULL;
+ }
+ else
+ {
+ }
+ if(state->object)
{
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_DOWN, _ebits_handle_mouse_down, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_UP, _ebits_handle_mouse_up, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_MOVE, _ebits_handle_mouse_move, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_IN, _ebits_handle_mouse_in, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_OUT, _ebits_handle_mouse_out, state);
- }
- if ((o->state.evas) && (state->object))
- evas_set_color(o->state.evas, state->object,
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_DOWN, _ebits_handle_mouse_down, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_UP, _ebits_handle_mouse_up, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_MOVE, _ebits_handle_mouse_move, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_IN, _ebits_handle_mouse_in, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_OUT, _ebits_handle_mouse_out, state);
+ if ((o->state.evas) && (state->object) && (!state->image_status))
+ evas_object_color_set(state->object,
state->r, state->g, state->b, state->a);
- evas_set_layer(o->state.evas, state->object, o->state.layer);
+ evas_object_layer_set(state->object, o->state.layer);
if (o->state.visible)
- evas_show(o->state.evas, state->object);
+ evas_object_show(state->object);
+ }
{
- int w, h;
-
- evas_get_image_size(o->state.evas, state->object, &w, &h);
bit->rel1.x = 0;
bit->rel1.y = 0;
bit->rel1.rx = 0.0;
@@ -1359,7 +1526,7 @@
{
while (__ebits_cache_zero > __ebits_cache_size)
{
- Evas_List l;
+ Evas_List * l;
Ebits_Object_Description d, del;
del = NULL;
@@ -1380,7 +1547,7 @@
for (l = d->bits; l; l = l->next)
{
Ebits_Object_Bit_Description bit;
- Evas_List ll;
+ Evas_List * ll;
bit = l->data;
IF_FREE(bit->name);
@@ -1389,6 +1556,7 @@
IF_FREE(bit->normal.image);
IF_FREE(bit->hilited.image);
IF_FREE(bit->clicked.image);
+ IF_FREE(bit->selected.image);
IF_FREE(bit->disabled.image);
/* XXX */
@@ -1421,7 +1589,7 @@
_ebits_calculate_min_size(Ebits_Object o)
{
int pw, ph;
- Evas_List l;
+ Evas_List * l;
Ebits_Object_Bit_State state;
int maxw, maxh, mw, mh;
@@ -1504,7 +1672,7 @@
{
Ebits_Object o;
Ebits_Object_Description d;
- Evas_List l;
+ Evas_List * l;
char realf[PATH_MAX];
if (!realpath(file, realf))
@@ -1522,7 +1690,7 @@
Ebits_Object_Bit_State state;
#ifdef EDITOR
- Evas_List ll;
+ Evas_List * ll;
char image[4096];
#endif
@@ -1571,6 +1739,16 @@
state->clicked.image = imlib_load_image(bit->clicked.image);
#endif
}
+ if (bit->selected.image)
+ {
+ snprintf(image, sizeof(image), EBITS_FILE_REDIRECT,
+ realf, bit->selected.image);
+ state->selected.image = imlib_load_image(image);
+#ifdef LENIENT
+ if (!state->selected.image)
+ state->selected.image = imlib_load_image(bit->selected.image);
+#endif
+ }
if (bit->disabled.image)
{
snprintf(image, sizeof(image), EBITS_FILE_REDIRECT,
@@ -1629,16 +1807,20 @@
_ebits_cache_flush();
if (o->bits)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
Ebits_Object_Bit_State state;
- Evas_List ll;
+ Evas_List * ll;
state = l->data;
if ((state->object) && (o->state.evas))
- evas_del_object(o->state.evas, state->object);
+ {
+ evas_event_freeze(evas_object_evas_get(state->object));
+ evas_object_del(state->object);
+ evas_event_thaw(evas_object_evas_get(state->object));
+ }
if (state->callbacks)
{
for (ll = state->callbacks; ll; ll = ll->next)
@@ -1661,6 +1843,11 @@
imlib_context_set_image(state->clicked.image);
imlib_free_image_and_decache();
}
+ if (state->selected.image)
+ {
+ imlib_context_set_image(state->selected.image);
+ imlib_free_image_and_decache();
+ }
if (state->disabled.image)
{
imlib_context_set_image(state->disabled.image);
@@ -1682,6 +1869,7 @@
evas_list_free(state->state_source_description);
#endif
+ IF_FREE(state->state);
FREE(state);
}
evas_list_free(o->bits);
@@ -1690,45 +1878,84 @@
}
void
-ebits_add_to_evas(Ebits_Object o, Evas e)
+ebits_add_to_evas(Ebits_Object o, Evas * e)
{
- Evas_List l;
+ Evas_List * l;
o->state.evas = e;
for (l = o->bits; l; l = l->next)
{
Ebits_Object_Bit_State state;
- Evas_List ll;
- char buf[4096];
+ Evas_List * ll;
+ char buf[4096], key[4096];
char *st;
state = l->data;
st = _ebits_get_file(state->description, state->state);
if (strlen(st) > 0)
{
- snprintf(buf, sizeof(buf), EBITS_FILE_REDIRECT,
- state->o->description->file, st);
+ strcpy(buf,state->o->description->file);
+ snprintf(key, sizeof(key), EBITS_EVAS_KEY_PREFIX "%s", st);
}
else
- strcpy(buf, "");
+ {
+ strcpy(buf, "");
+ strcpy(key, "");
+ }
if ((state->description->normal.image) &&
(!strcmp(state->description->normal.image, "-")))
{
- state->object = evas_add_rectangle(o->state.evas);
+
+ state->object = evas_object_rectangle_add(o->state.evas);
if ((state->description->class) &&
(!strcmp(state->description->class, "Decoration")))
- evas_set_pass_events(o->state.evas, state->object, 1);
- evas_set_color(o->state.evas, state->object, 255, 255, 255, 0);
+ evas_object_pass_events_set(state->object, 1);
+ evas_object_color_set(state->object, 255, 255, 255, 0);
+ state->image_status = -1;
}
else
{
- state->object = evas_add_image_from_file(o->state.evas, buf);
- if ((state->description->class) &&
- (!strcmp(state->description->class, "Decoration")))
- evas_set_pass_events(o->state.evas, state->object, 1);
+ state->object = evas_object_image_add(o->state.evas);
+ evas_object_image_file_set(state->object, buf, key);
+ state->image_status =
+ evas_object_image_load_error_get(state->object);
+
+ if(state->image_status)
+ {
+ evas_object_del(state->object);
+#if 1
+ state->object = NULL;
+#else
+ /* todo - event rects? */
+ state->object = evas_object_rectangle_add(o->state.evas);
+ if ((state->description->class) &&
+ (!strcmp(state->description->class, "Decoration")))
+ evas_object_pass_events_set(state->object, 1);
+ /*evas_object_color_set(state->object, 255, 255, 255, 0);*/
+ evas_object_color_set(state->object, 255, 0, 0, 255);
+ state->image_status = -1;
+
+#endif
+ }
+ else
+ {
+ int iw,ih;
+
+ if ((state->description->class) &&
+ (!strcmp(state->description->class, "Decoration")))
+ evas_object_pass_events_set(state->object, 1);
+
+ /* Not needed */
+ /*
+ evas_object_image_size_get(state->object, &iw, &ih);
+ evas_object_resize(state->object, iw, ih);
+ evas_object_image_fill_set(state->object,
+ 0, 0, iw, ih);
+ */
+ }
}
- if ((state->o->state.evas) && (state->object))
- evas_set_color(state->o->state.evas, state->object,
+ if ((state->o->state.evas) && (state->object) && (!state->image_status))
+ evas_object_color_set(state->object,
state->r, state->g, state->b, state->a);
#ifdef EDITOR
if (state->normal.image)
@@ -1737,6 +1964,8 @@
state->hilited.saved = 1;
if (state->clicked.image)
state->clicked.saved = 1;
+ if (state->selected.image)
+ state->selected.saved = 1;
if (state->disabled.image)
state->disabled.saved = 1;
for (ll = state->state_source_description; ll; ll = ll->next)
@@ -1748,23 +1977,26 @@
ss_d->saved = 1;
}
#endif
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_DOWN, _ebits_handle_mouse_down, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_UP, _ebits_handle_mouse_up, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_MOVE, _ebits_handle_mouse_move, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_IN, _ebits_handle_mouse_in, state);
- evas_callback_add(o->state.evas, state->object,
- CALLBACK_MOUSE_OUT, _ebits_handle_mouse_out, state);
+ if(state->object)
+ {
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_DOWN, _ebits_handle_mouse_down, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_UP, _ebits_handle_mouse_up, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_MOVE, _ebits_handle_mouse_move, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_IN, _ebits_handle_mouse_in, state);
+ evas_object_event_callback_add(state->object,
+ EVAS_CALLBACK_MOUSE_OUT, _ebits_handle_mouse_out, state);
+ }
}
}
void
ebits_show(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
if (o->state.visible)
return;
@@ -1775,16 +2007,18 @@
state = l->data;
_ebits_sync_bits(state);
- evas_show(state->o->state.evas, state->object);
+
+ if(state->object)
+ evas_object_show(state->object);
if (state->func_show)
- state->func_show(state->func_data);
+ state->func_show(state->func_data);
}
}
void
ebits_hide(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
if (!o->state.visible)
return;
@@ -1794,7 +2028,8 @@
Ebits_Object_Bit_State state;
state = l->data;
- evas_hide(state->o->state.evas, state->object);
+ if(state->object)
+ evas_object_hide(state->object);
if (state->func_hide)
state->func_hide(state->func_data);
}
@@ -1803,7 +2038,7 @@
void
ebits_set_layer(Ebits_Object o, int layer)
{
- Evas_List l;
+ Evas_List * l;
if (layer == o->state.layer)
return;
@@ -1813,7 +2048,8 @@
Ebits_Object_Bit_State state;
state = l->data;
- evas_set_layer(state->o->state.evas, state->object, layer);
+ if(state->object)
+ evas_object_layer_set(state->object, layer);
if (state->func_set_layer)
state->func_set_layer(state->func_data, layer);
}
@@ -1822,23 +2058,24 @@
void
ebits_raise(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
Ebits_Object_Bit_State state;
state = l->data;
- evas_raise(state->o->state.evas, state->object);
+ if(state->object)
+ evas_object_raise(state->object);
if (state->func_raise)
- state->func_raise(state->func_data);
+ state->func_raise(state->func_data);
}
}
void
ebits_lower(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l->next; l = l->next);
for (; l; l = l->prev)
@@ -1846,16 +2083,17 @@
Ebits_Object_Bit_State state;
state = l->data;
- evas_lower(state->o->state.evas, state->object);
+ if(state->object)
+ evas_object_lower(state->object);
if (state->func_lower)
- state->func_lower(state->func_data);
+ state->func_lower(state->func_data);
}
}
void
ebits_move(Ebits_Object o, double x, double y)
{
- Evas_List l;
+ Evas_List * l;
o->state.x = x;
o->state.y = y;
@@ -1865,17 +2103,18 @@
state = l->data;
if (state->func_move)
- state->func_move(state->func_data,
- o->state.x + state->x, o->state.y + state->y);
- evas_move(state->o->state.evas, state->object,
- o->state.x + state->x, o->state.y + state->y);
+ state->func_move(state->func_data,
+ o->state.x + state->x, o->state.y + state->y);
+ if(state->object)
+ evas_object_move(state->object,
+ o->state.x + state->x, o->state.y + state->y);
}
}
void
-ebits_set_clip(Ebits_Object o, Evas_Object clip)
+ebits_set_clip(Ebits_Object o, Evas_Object * clip)
{
- Evas_List l;
+ Evas_List * l;
o->state.clip = clip;
for (l = o->bits; l; l = l->next)
@@ -1883,16 +2122,17 @@
Ebits_Object_Bit_State state;
state = l->data;
- evas_set_clip(state->o->state.evas, state->object, clip);
+ if(state->object)
+ evas_object_clip_set(state->object, clip);
if (state->func_set_clip)
- state->func_set_clip(state->func_data, clip);
+ state->func_set_clip(state->func_data, clip);
}
}
void
ebits_unset_clip(Ebits_Object o)
{
- Evas_List l;
+ Evas_List * l;
o->state.clip = NULL;
for (l = o->bits; l; l = l->next)
@@ -1900,9 +2140,10 @@
Ebits_Object_Bit_State state;
state = l->data;
- evas_unset_clip(state->o->state.evas, state->object);
+ if(state->object)
+ evas_object_clip_unset(state->object);
if (state->func_set_clip)
- state->func_set_clip(state->func_data, NULL);
+ state->func_set_clip(state->func_data, NULL);
}
}
@@ -2035,7 +2276,7 @@
int _y, int _ox, int _oy,
int _ow, int _oh), void *data)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -2062,7 +2303,7 @@
void
ebits_set_color_class(Ebits_Object o, char *cc, int r, int g, int b, int a)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -2077,8 +2318,8 @@
state->g = g;
state->b = b;
state->a = a;
- if ((state->o->state.evas) && (state->object))
- evas_set_color(state->o->state.evas,
+ if ((state->o->state.evas) && (state->object) &&
+(!state->image_status))
+ evas_object_color_set(
state->object, state->r,
state->g, state->b, state->a);
}
@@ -2108,7 +2349,7 @@
ebits_save(Ebits_Object o, char *file)
{
Ebits_Object_Description d;
- Evas_List l;
+ Evas_List * l;
E_DB_File *db;
int i, count;
@@ -2165,7 +2406,7 @@
{
Ebits_Object_Bit_Description bit;
Ebits_Object_Bit_State state;
- Evas_List ll;
+ Evas_List * ll;
char image[4096];
state = l->data;
@@ -2198,6 +2439,15 @@
imlib_save_image(image);
state->clicked.saved = 1;
}
+ if ((state->selected.image) && (bit->selected.image))
+ {
+ snprintf(image, sizeof(image), EBITS_FILE_REDIRECT,
+ file, bit->selected.image);
+ imlib_context_set_image(state->selected.image);
+ imlib_image_set_format("db");
+ imlib_save_image(image);
+ state->selected.saved = 1;
+ }
if ((state->disabled.image) && (bit->disabled.image))
{
snprintf(image, sizeof(image), EBITS_FILE_REDIRECT,
@@ -2226,7 +2476,7 @@
for (i = 0, l = d->bits; l; l = l->next, i++)
{
Ebits_Object_Bit_Description bit;
- Evas_List ll;
+ Evas_List * ll;
char key[4096];
int j, sync_count;
@@ -2235,21 +2485,31 @@
snprintf(key, sizeof(key), "/bits/bit/%i/name", i);
if (bit->name)
e_db_str_set(db, key, bit->name);
+
snprintf(key, sizeof(key), "/bits/bit/%i/class", i);
if (bit->class)
e_db_str_set(db, key, bit->class);
+
snprintf(key, sizeof(key), "/bits/bit/%i/color_class", i);
if (bit->color_class)
e_db_str_set(db, key, bit->color_class);
+
snprintf(key, sizeof(key), "/bits/bit/%i/normal/image", i);
if (bit->normal.image)
e_db_str_set(db, key, bit->normal.image);
+
snprintf(key, sizeof(key), "/bits/bit/%i/hilited/image", i);
if (bit->hilited.image)
e_db_str_set(db, key, bit->hilited.image);
+
snprintf(key, sizeof(key), "/bits/bit/%i/clicked/image", i);
if (bit->clicked.image)
e_db_str_set(db, key, bit->clicked.image);
+
+ snprintf(key, sizeof(key), "/bits/bit/%i/selected/image", i);
+ if (bit->selected.image)
+ e_db_str_set(db, key, bit->selected.image);
+
snprintf(key, sizeof(key), "/bits/bit/%i/disabled/image", i);
if (bit->disabled.image)
e_db_str_set(db, key, bit->disabled.image);
@@ -2361,7 +2621,7 @@
void (*func_lower) (void *_data),
void (*func_set_layer) (void *_data, int l),
void (*func_set_clip) (void *_data,
- Evas_Object clip),
+ Evas_Object * clip),
void (*func_set_color_class) (void *_data,
char *cc, int r,
int g, int b,
@@ -2372,7 +2632,7 @@
double *w, double *h),
void *data)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -2396,22 +2656,25 @@
if (state->func_set_clip)
{
state->func_set_clip(state->func_data, state->object);
- evas_set_color(o->state.evas, state->object,
- 255, 255, 255, 255);
+ if(state->object)
+ {
+ evas_object_color_set(state->object,
+ 255, 255, 255, 255);
+ }
}
if ((o->state.visible) && (func_show))
- func_show(data);
+ func_show(data);
else if ((!o->state.visible) && (func_hide))
- func_hide(data);
+ func_hide(data);
if ((state->description->color_class) && (func_set_color_class))
- func_set_color_class(data,
+ func_set_color_class(data,
state->description->
color_class, state->r,
state->g, state->b, state->a);
if (func_set_layer)
- func_set_layer(data, o->state.layer);
+ func_set_layer(data, o->state.layer);
if (func_set_clip)
- func_set_clip(data, o->state.clip);
+ func_set_clip(data, o->state.clip);
_ebits_object_calculate(o);
ebits_raise(o);
return;
@@ -2422,7 +2685,7 @@
void
ebits_set_named_bit_state(Ebits_Object o, char *c, char *state)
{
- Evas_List l;
+ Evas_List * l;
for (l = o->bits; l; l = l->next)
{
@@ -2439,10 +2702,30 @@
}
}
-Evas_List
+void
+ebits_set_named_bit_selected(Ebits_Object o, char *c, unsigned int s)
+{
+ Evas_List * l;
+
+ for (l = o->bits; l; l = l->next)
+ {
+ Ebits_Object_Bit_State st;
+
+ st = l->data;
+ if (!strcmp(st->description->name, c))
+ {
+ st->is_selected = s;
+ st->description->is_selected = s;
+
+ _ebits_sync_bits(st);
+ }
+ }
+}
+
+Evas_List *
ebits_get_bit_names(Ebits_Object o)
{
- Evas_List l, name_list;
+ Evas_List *l, *name_list;
name_list = NULL;
@@ -2457,7 +2740,7 @@
return name_list;
}
-Evas_List
+Evas_List *
ebits_get_state_names(Ebits_Object o)
{
if (!o)
@@ -2466,11 +2749,17 @@
return o->description->state_names;
}
+int
+ebits_is_shaped(Ebits_Object o)
+{
+ return 1;
+}
+
#ifdef EDITOR
void
ebits_add_state_name(Ebits_Object o, char *name)
{
- Evas_List l;
+ Evas_List * l;
int i, len;
if (!o || !name || !(len = strlen(name)))
@@ -2490,7 +2779,7 @@
void
ebits_del_state_name(Ebits_Object o, char *name)
{
- Evas_List l;
+ Evas_List * l;
int len;
if (!o || !name || !(len = strlen(name)))
@@ -2502,9 +2791,9 @@
{
if (!strncasecmp(l->data, name, len))
{
- FREE(l->data);
o->description->state_names =
evas_list_remove(o->description->state_names, l->data);
+ FREE(l->data);
break;
}
}
@@ -2513,7 +2802,7 @@
void
ebits_add_bit_state(Ebits_Object_Bit_State bit, char *state, char *image)
{
- Evas_List l;
+ Evas_List * l;
int found = 0, len, len2;
if (!bit || !state)
-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs