Hey,
Here is my first step with the textgrid object. I have never written an
evas object before so the code is not perfect, even not good in some
places, I think.
To test it, put evas_object_textgrid.c in evas/src/lib/canvas, then patch
evas with evas_textgrid.diff and compile and run ecore_evas_textgrid.c for
the test.
Feel free to send remarks, corrections, etc...
Vincent
Index: src/lib/include/evas_private.h
===================================================================
--- src/lib/include/evas_private.h (revision 51486)
+++ src/lib/include/evas_private.h (working copy)
@@ -62,6 +62,7 @@
#define MAGIC_OBJ_TEXT 0x71777776
#define MAGIC_OBJ_SMART 0x71777777
#define MAGIC_OBJ_TEXTBLOCK 0x71777778
+#define MAGIC_OBJ_TEXTGRID 0x71777779
#define MAGIC_SMART 0x72777770
#define MAGIC_OBJ_SHAPE 0x72777773
#define MAGIC_OBJ_CONTAINER 0x72777774
Index: src/lib/Evas.h
===================================================================
--- src/lib/Evas.h (revision 51486)
+++ src/lib/Evas.h (working copy)
@@ -1405,6 +1405,17 @@
EAPI void evas_object_textblock_size_native_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) EINA_ARG_NONNULL(1);
EAPI void evas_object_textblock_style_insets_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b) EINA_ARG_NONNULL(1);
+EAPI Evas_Object *evas_object_textgrid_add(Evas *e);
+EAPI void evas_object_textgrid_size_set(Evas_Object *obj, int nbr_lines, int nbr_columns);
+EAPI void evas_object_textgrid_size_get(Evas_Object *obj, int *nbr_lines, int *nbr_columns);
+EAPI void evas_object_textgrid_font_source_set(Evas_Object *obj, const char *font_source);
+EAPI const char *evas_object_textgrid_font_source_get(const Evas_Object *obj);
+
+EAPI void evas_object_textgrid_font_set(Evas_Object *obj, const char *font_name, Evas_Font_Size font_size);
+EAPI void evas_object_textgrid_font_get(const Evas_Object *obj, const char **font_name, Evas_Font_Size *font_size);
+EAPI void evas_object_textgrid_cell_set(Evas_Object *obj, const char c, int x, int y, int fr, int fg, int fb, int fa /*, Evas_Object_Textgrid_Style style*/);
+EAPI void evas_object_textgrid_string_set(Evas_Object *obj, const char *text, int line, int start_column, int fr, int fg, int fb, int fa /*, Evas_Object_Textgrid_Style style*/);
+
/**
* @defgroup Evas_Line_Group Line Object Functions
*
Index: src/lib/canvas/Makefile.am
===================================================================
--- src/lib/canvas/Makefile.am (revision 51486)
+++ src/lib/canvas/Makefile.am (working copy)
@@ -40,6 +40,7 @@
evas_object_table.c \
evas_object_text.c \
evas_object_textblock.c \
+evas_object_textgrid.c \
evas_font_dir.c \
evas_rectangle.c \
evas_render.c \
#include "evas_common.h"
#include "evas_private.h"
/* private magic number for textgrid objects */
static const char o_type[] = "textgrid";
/* private struct for line object internal data */
typedef struct _Evas_Object_Textgrid Evas_Object_Textgrid;
typedef struct _Evas_Object_Textgrid_Cell Evas_Object_Textgrid_Cell;
struct _Evas_Object_Textgrid
{
DATA32 magic;
struct {
int nbr_lines;
int nbr_columns;
int char_width;
int char_height;
Evas_Object_Textgrid_Cell **cells;
const char *font_source;
const char *font_name;
int font_size;
Evas_BiDi_Props intl_props;
Evas_BiDi_Paragraph_Props paragraph_bidi_props;
} cur, prev;
float max_ascent;
void *engine_data;
char changed_size : 1;
char changed : 1;
};
struct _Evas_Object_Textgrid_Cell
{
char c;
Eina_Unicode us[2];
unsigned char fr;
unsigned char fg;
unsigned char fb;
unsigned char fa;
unsigned int bold : 1;
unsigned int underline : 1;
};
/* private methods for textgrid objects */
static void evas_object_textgrid_init(Evas_Object *obj);
static void *evas_object_textgrid_new(void);
static void evas_object_textgrid_render(Evas_Object *obj, void *output, void
*context, void *surface, int x, int y);
static void evas_object_textgrid_free(Evas_Object *obj);
static void evas_object_textgrid_render_pre(Evas_Object *obj);
static void evas_object_textgrid_render_post(Evas_Object *obj);
static unsigned int evas_object_textgrid_id_get(Evas_Object *obj);
static unsigned int evas_object_textgrid_visual_id_get(Evas_Object *obj);
static void *evas_object_textgrid_engine_data_get(Evas_Object *obj);
static int evas_object_textgrid_is_opaque(Evas_Object *obj);
static int evas_object_textgrid_was_opaque(Evas_Object *obj);
static void evas_object_textgrid_scale_update(Evas_Object *obj);
static const Evas_Object_Func object_func =
{
/* methods (compulsory) */
evas_object_textgrid_free,
evas_object_textgrid_render,
evas_object_textgrid_render_pre,
evas_object_textgrid_render_post,
evas_object_textgrid_id_get,
evas_object_textgrid_visual_id_get,
evas_object_textgrid_engine_data_get,
/* these are optional. NULL = nothing */
NULL,
NULL,
NULL,
NULL,
evas_object_textgrid_is_opaque,
evas_object_textgrid_was_opaque,
NULL,
NULL,
NULL,
evas_object_textgrid_scale_update,
NULL,
NULL,
NULL
};
/* the actual api call to add a textgrid */
/**
* Adds a textgrid to the given evas.
* @param e The given evas.
* @return The new textgrid object.
*/
EAPI Evas_Object *
evas_object_textgrid_add(Evas *e)
{
Evas_Object *obj;
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
obj = evas_object_new(e);
evas_object_textgrid_init(obj);
evas_object_inject(obj, e);
return obj;
}
EAPI void
evas_object_textgrid_size_set(Evas_Object *obj, int nbr_lines, int nbr_columns)
{
Evas_Object_Textgrid *o;
int i;
if ((nbr_lines <= 0) || (nbr_columns <= 0))
return;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
o->cur.cells = (Evas_Object_Textgrid_Cell **)calloc(nbr_lines,
sizeof(Evas_Object_Textgrid_Cell *));
if (!o->cur.cells) return;
for (i = 0; i < nbr_lines; i++)
{
o->cur.cells[i] = (Evas_Object_Textgrid_Cell *)calloc(nbr_columns,
sizeof(Evas_Object_Textgrid_Cell));
if (!o->cur.cells[i])
{
int j;
for (j = 0; j < i; j++)
free(o->cur.cells[j]);
free(o->cur.cells);
return;
}
}
o->cur.nbr_lines = nbr_lines;
o->cur.nbr_columns = nbr_columns;
o->changed_size = 1;
o->changed = 1;
}
EAPI void
evas_object_textgrid_size_get(Evas_Object *obj, int *nbr_lines, int
*nbr_columns)
{
Evas_Object_Textgrid *o;
if (nbr_lines) *nbr_lines = 0;
if (nbr_columns) *nbr_columns = 0;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
if (nbr_lines) *nbr_lines = o->cur.nbr_lines;
if (nbr_columns) *nbr_columns = o->cur.nbr_columns;
}
EAPI void
evas_object_textgrid_font_source_set(Evas_Object *obj, const char *font_source)
{
Evas_Object_Textgrid *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
if ((o->cur.font_source) && (font_source) &&
(!strcmp(o->cur.font_source, font_source)))
return;
eina_stringshare_replace(&o->cur.font_source, font_source);
}
EAPI const char *
evas_object_textgrid_font_source_get(const Evas_Object *obj)
{
Evas_Object_Textgrid *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return NULL;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return NULL;
MAGIC_CHECK_END();
return o->cur.font_source;
}
EAPI void
evas_object_textgrid_font_set(Evas_Object *obj, const char *font_name,
Evas_Font_Size font_size)
{
Evas_Object_Textgrid *o;
int l = 0, r = 0, t = 0, b = 0;
int is, was = 0, pass = 0;
int same_font = 0;
if ((!font_name) || (font_size <= 0)) return;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
if ((o->cur.font_name) && (!strcmp(o->cur.font_name, font_name)))
{
same_font = 1;
if (o->cur.font_size == font_size) return;
}
if (obj->layer->evas->events_frozen <= 0)
{
pass = evas_event_passes_through(obj);
if (!pass)
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1,
1);
}
#ifdef EVAS_FRAME_QUEUING
if (o->engine_data)
evas_common_pipe_op_text_flush(o->engine_data);
#endif
if (o->engine_data)
{
evas_font_free(obj->layer->evas, o->engine_data);
o->engine_data = NULL;
}
if (!same_font)
{
eina_stringshare_replace(&o->cur.font_name, font_name);
o->prev.font_name = NULL;
}
o->cur.font_size = font_size;
o->engine_data = evas_font_load(obj->layer->evas,
o->cur.font_name,
o->cur.font_source,
(int)(((double)o->cur.font_size) *
obj->cur.scale));
if (o->engine_data)
{
Eina_Unicode W[2] = { 'W', 0 };
obj->layer->evas->engine.func->font_string_size_get(obj->layer->evas->engine.data.output,
o->engine_data,
W,
&o->cur.intl_props,
&o->cur.char_width,
&o->cur.char_height);
o->max_ascent =
obj->layer->evas->engine.func->font_max_ascent_get(obj->layer->evas->engine.data.output,
o->engine_data);
printf ("max_ascent : %f\n", o->max_ascent);
printf ("char size: w=%d h=%d\n", o->cur.char_width, o->cur.char_height);
obj->cur.geometry.w = o->cur.char_width * o->cur.nbr_columns;
obj->cur.geometry.h = o->cur.char_height * o->cur.nbr_lines;
printf ("object size: w=%d h=%d\n", obj->cur.geometry.w,
obj->cur.geometry.h);
}
else
{
printf ("no font\n");
obj->cur.geometry.w = 0;
obj->cur.geometry.h = 0;
}
o->changed = 1;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_coords_recalc(obj);
if (obj->layer->evas->events_frozen <= 0)
{
if (!pass)
{
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1,
1);
if ((is ^ was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
}
}
evas_object_inform_call_resize(obj);
}
EAPI void
evas_object_textgrid_font_get(const Evas_Object *obj, const char **font_name,
Evas_Font_Size *font_size)
{
Evas_Object_Textgrid *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
if (font_name) *font_name = "";
if (font_size) *font_size = 0;
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
if (font_name) *font_name = "";
if (font_size) *font_size = 0;
return;
MAGIC_CHECK_END();
if (font_name) *font_name = o->cur.font_name;
if (font_size) *font_size = o->cur.font_size;
}
EAPI void
evas_object_textgrid_cell_set(Evas_Object *obj, const char c, int line, int
column, int fr, int fg, int fb, int fa /*, Evas_Object_Textgrid_Style style*/)
{
Evas_Object_Textgrid *o;
int is, was;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
if ((line < 0) || (column < 0) ||
(line >= o->cur.nbr_lines) || (column >= o->cur.nbr_columns))
return;
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if (o->cur.cells[line][column].c == c)
return;
o->cur.cells[line][column].c = c;
o->cur.cells[line][column].us[0] = c;
o->cur.cells[line][column].us[1] = 0;
o->cur.cells[line][column].fr = fr;
o->cur.cells[line][column].fg = fg;
o->cur.cells[line][column].fb = fb;
o->cur.cells[line][column].fa = fa;
o->cur.cells[line][column].bold = 0;
o->cur.cells[line][column].underline = 0;
/* FIXME: doing something for o->prev ?? */
/* o->prev.cells[line][column].c = 0; */
/* o->prev.cells[line][column].us[0] = 0; */
/* o->prev.cells[line][column].us[1] = 0; */
/* o->prev.cells[line][column].bold = 0; */
/* o->prev.cells[line][column].underline = 0; */
o->changed = 1;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_coords_recalc(obj);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is || was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
evas_object_inform_call_resize(obj);
}
EAPI void
evas_object_textgrid_string_set(Evas_Object *obj, const char *text, int line,
int start_column, int fr, int fg, int fb, int fa /*, Evas_Object_Textgrid_Style
style*/)
{
Evas_Object_Textgrid *o;
int i;
int l;
int is, was;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
if ((line < 0) || (line >= o->cur.nbr_lines))
return;
was = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
l = strlen(text);
for (i = 0; i <= l; i++, text++)
{
if ((((start_column + i) >= 0) && ((start_column + i) <
o->cur.nbr_columns)) &&
(o->cur.cells[line][start_column + i].c != *text))
{
o->cur.cells[line][start_column + i].c = *text;
o->cur.cells[line][start_column + i].us[0] = *text;
o->cur.cells[line][start_column + i].us[1] = 0;
o->cur.cells[line][start_column + i].fr = fr;
o->cur.cells[line][start_column + i].fg = fg;
o->cur.cells[line][start_column + i].fb = fb;
o->cur.cells[line][start_column + i].fa = fa;
o->cur.cells[line][start_column + i].bold = 0;
o->cur.cells[line][start_column + i].underline = 0;
}
}
/* FIXME: doing something for o->prev ?? */
/* o->prev.cells[line][column].c = 0; */
/* o->prev.cells[line][column].us[0] = 0; */
/* o->prev.cells[line][column].us[1] = 0; */
/* o->prev.cells[line][column].bold = 0; */
/* o->prev.cells[line][column].underline = 0; */
o->changed = 1;
evas_object_change(obj);
evas_object_clip_dirty(obj);
evas_object_coords_recalc(obj);
is = evas_object_is_in_output_rect(obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1);
if ((is || was) && obj->cur.visible)
evas_event_feed_mouse_move(obj->layer->evas,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y,
obj->layer->evas->last_timestamp,
NULL);
evas_object_inform_call_resize(obj);
}
/* all nice and private */
static void
evas_object_textgrid_init(Evas_Object *obj)
{
/* alloc textgrid ob, setup methods and default values */
obj->object_data = evas_object_textgrid_new();
/* set up default settings for this kind of object */
obj->cur.color.r = 255;
obj->cur.color.g = 255;
obj->cur.color.b = 255;
obj->cur.color.a = 255;
obj->cur.geometry.x = 0;
obj->cur.geometry.y = 0;
obj->cur.geometry.w = 0;
obj->cur.geometry.h = 0;
obj->cur.layer = 0;
/* set up object-specific settings */
obj->prev = obj->cur;
/* set up methods (compulsory) */
obj->func = &object_func;
obj->type = o_type;
}
static void *
evas_object_textgrid_new(void)
{
Evas_Object_Textgrid *o;
/* alloc obj private data */
o = calloc(1, sizeof(Evas_Object_Textgrid));
o->magic = MAGIC_OBJ_TEXTGRID;
o->prev = o->cur;
o->cur.intl_props.props = &o->cur.paragraph_bidi_props;
return o;
}
static void
evas_object_textgrid_free(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
/* frees private object data. very simple here */
o = (Evas_Object_Textgrid *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Textgrid, MAGIC_OBJ_TEXTGRID);
return;
MAGIC_CHECK_END();
/* free obj */
if (o->cur.font_name) eina_stringshare_del(o->cur.font_name);
if (o->cur.font_source) eina_stringshare_del(o->cur.font_source);
if (o->engine_data) evas_font_free(obj->layer->evas, o->engine_data);
if (o->cur.intl_props.props->embedding_levels)
free(o->cur.intl_props.props->embedding_levels);
if (o->cur.intl_props.props->char_types)
free(o->cur.intl_props.props->char_types);
o->magic = 0;
free(o);
}
static void
evas_object_textgrid_render(Evas_Object *obj, void *output, void *context, void
*surface, int x, int y)
{
Evas_Object_Textgrid *o;
/* render object to surface with context, and offxet by x,y */
o = (Evas_Object_Textgrid *)(obj->object_data);
obj->layer->evas->engine.func->context_multiplier_unset(output, context);
obj->layer->evas->engine.func->context_render_op_set(output, context,
obj->cur.render_op);
if (o->engine_data && o->cur.cells)
{
int i;
int j;
for (i = 0; i < o->cur.nbr_lines; i++)
for (j = 0; j < o->cur.nbr_columns; j++)
{
if (!o->cur.cells[i][j].c) continue;
obj->layer->evas->engine.func->context_color_set(output, context,
o->cur.cells[i][j].fr,
o->cur.cells[i][j].fg,
o->cur.cells[i][j].fb,
o->cur.cells[i][j].fa);
obj->layer->evas->engine.func->font_draw(output,
context,
surface,
o->engine_data,
obj->cur.geometry.x + x
+ j * o->cur.char_width,
obj->cur.geometry.y + y
+ i * o->cur.char_height + (int)o->max_ascent,
obj->cur.geometry.w,
obj->cur.geometry.h,
obj->cur.geometry.w,
obj->cur.geometry.h,
o->cur.cells[i][j].us,
&o->cur.intl_props);
}
}
}
static void
evas_object_textgrid_render_pre(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
int is_v, was_v;
/* dont pre-render the obj twice! */
if (obj->pre_render_done) return;
obj->pre_render_done = 1;
/* pre-render phase. this does anything an object needs to do just before */
/* rendering. this could mean loading the image data, retrieving it from */
/* elsewhere, decoding video etc. */
/* then when this is done the object needs to figure if it changed and */
/* if so what and where and add thr appropriate redraw rectangles */
o = (Evas_Object_Textgrid *)(obj->object_data);
/* if someone is clipping this obj - go calculate the clipper */
if (obj->cur.clipper)
{
if (obj->cur.cache.clip.dirty)
evas_object_clip_recalc(obj->cur.clipper);
obj->cur.clipper->func->render_pre(obj->cur.clipper);
}
/* now figure what changed and add draw rects */
/* if it just became visible or invisible */
is_v = evas_object_is_visible(obj);
was_v = evas_object_was_visible(obj);
if (is_v != was_v)
{
evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes,
obj, is_v, was_v);
goto done;
}
if ((obj->cur.map != obj->prev.map) ||
(obj->cur.usemap != obj->prev.usemap))
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
/* its not visible - we accounted for it appearing or not so just abort */
if (!is_v) goto done;
/* clipper changed this is in addition to anything else for obj */
evas_object_render_pre_clipper_change(&obj->layer->evas->clip_changes, obj);
/* if we restacked (layer or just within a layer) and dont clip anyone */
if (obj->restack)
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
/* if it changed color */
if ((obj->cur.color.r != obj->prev.color.r) ||
(obj->cur.color.g != obj->prev.color.g) ||
(obj->cur.color.b != obj->prev.color.b) ||
(obj->cur.color.a != obj->prev.color.a))
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
/* if it changed geometry - and obviously not visibility or color */
/* caluclate differences since we have a constant color fill */
/* we really only need to update the differences */
if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
(obj->cur.geometry.y != obj->prev.geometry.y) ||
(obj->cur.geometry.w != obj->prev.geometry.w) ||
(obj->cur.geometry.h != obj->prev.geometry.h))
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
if (obj->cur.render_op != obj->prev.render_op)
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
if (obj->cur.scale != obj->prev.scale)
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
if (o->changed)
{
if ((o->cur.font_size != o->prev.font_size) ||
((o->cur.font_name) && (o->prev.font_name) &&
(strcmp(o->cur.font_name, o->prev.font_name))) ||
((o->cur.font_name) && (!o->prev.font_name)) ||
((!o->cur.font_name) && (o->prev.font_name))/* || */
/* ((o->cur.text) && (o->prev.text) && */
/* (eina_unicode_strcmp(o->cur.text, o->prev.text))) || */
/* ((o->cur.text) && (!o->prev.text)) || */
/* ((!o->cur.text) && (o->prev.text)) || */
/* ((o->cur.style != o->prev.style)) || */
/* ((o->cur.shadow.r != o->prev.shadow.r)) || */
/* ((o->cur.shadow.g != o->prev.shadow.g)) || */
/* ((o->cur.shadow.b != o->prev.shadow.b)) || */
/* ((o->cur.shadow.a != o->prev.shadow.a)) || */
/* ((o->cur.outline.r != o->prev.outline.r)) || */
/* ((o->cur.outline.g != o->prev.outline.g)) || */
/* ((o->cur.outline.b != o->prev.outline.b)) || */
/* ((o->cur.outline.a != o->prev.outline.a)) || */
/* ((o->cur.glow.r != o->prev.glow.r)) || */
/* ((o->cur.glow.g != o->prev.glow.g)) || */
/* ((o->cur.glow.b != o->prev.glow.b)) || */
/* ((o->cur.glow.a != o->prev.glow.a)) || */
/* ((o->cur.glow2.r != o->prev.glow2.r)) || */
/* ((o->cur.glow2.g != o->prev.glow2.g)) || */
/* ((o->cur.glow2.b != o->prev.glow2.b)) || */
/* ((o->cur.glow2.a != o->prev.glow2.a))) */
)
{
evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
obj);
goto done;
}
}
done:
evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, obj,
is_v, was_v);
}
static void
evas_object_textgrid_render_post(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
o = (Evas_Object_Textgrid *)(obj->object_data);
/* remove those pesky changes */
evas_object_clip_changes_clean(obj);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
o->prev = o->cur;
o->changed = 0;
}
static unsigned int evas_object_textgrid_id_get(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
o = (Evas_Object_Textgrid *)(obj->object_data);
if (!o) return 0;
return MAGIC_OBJ_TEXTGRID;
}
static unsigned int evas_object_textgrid_visual_id_get(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
o = (Evas_Object_Textgrid *)(obj->object_data);
if (!o) return 0;
return MAGIC_OBJ_SHAPE;
}
static void *evas_object_textgrid_engine_data_get(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
o = (Evas_Object_Textgrid *)(obj->object_data);
if (!o) return NULL;
return o->engine_data;
}
static int
evas_object_textgrid_is_opaque(Evas_Object *obj __UNUSED__)
{
/* this returns 1 if the internal object data implies that the object is
currently fully opaque over the entire gradient it occupies */
return 0;
}
static int
evas_object_textgrid_was_opaque(Evas_Object *obj __UNUSED__)
{
/* this returns 1 if the internal object data implies that the object was
currently fully opaque over the entire gradient it occupies */
return 0;
}
static void
evas_object_textgrid_scale_update(Evas_Object *obj)
{
Evas_Object_Textgrid *o;
int font_size;
const char *font_name;
o = (Evas_Object_Textgrid *)(obj->object_data);
font_name = eina_stringshare_add(o->cur.font_name);
font_size = o->cur.font_size;
if (o->cur.font_name) eina_stringshare_del(o->cur.font_name);
o->cur.font_name = NULL;
o->prev.font_name = NULL;
o->cur.font_size = 0;
o->prev.font_size = 0;
evas_object_textgrid_font_set(obj, font_name, font_size);
}
/* gcc -g -Wall -o ecore_evas_textgrid ecore_evas_textgrid.c `pkg-config
--cflags --libs ecore-evas ecore evas` */
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
int main()
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *o;
int w, h;
ecore_evas_init();
ee = ecore_evas_new ("software_x11", 10, 10, 200, 200, NULL);
if (!ee) return 0;
ecore_evas_show (ee);
evas = ecore_evas_get(ee);
o = evas_object_textgrid_add (evas);
evas_object_textgrid_size_set(o, 4, 3);
evas_object_textgrid_font_set(o, "DejaVu Sans Mono", 14);
evas_object_textgrid_cell_set(o, 'X', 0, 0, 255, 255, 255, 255);
evas_object_textgrid_cell_set(o, 'O', 0, 2, 255, 0, 0, 255);
evas_object_textgrid_cell_set(o, 'X', 1, 0, 255, 255, 255, 255);
evas_object_textgrid_cell_set(o, 'O', 1, 1, 255, 0, 0, 255);
evas_object_textgrid_cell_set(o, 'O', 2, 0, 255, 0, 0, 255);
evas_object_textgrid_cell_set(o, 'X', 2, 2, 255, 255, 255, 255);
evas_object_textgrid_string_set(o, "vis", 3, 0, 0, 255, 0, 255);
evas_object_geometry_get(o, NULL, NULL, &w, &h);
evas_object_move (o, 0, 0);
evas_object_show (o);
ecore_evas_resize(ee, w, h);
ecore_main_loop_begin ();
return 0;
}
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel