Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        Etox.h Etox_private.h etox.c etox_context.c etox_line.c 
        etox_obstacle.c etox_selection.c 


Log Message:
More API breakage. This time converting etox to smart objects.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- Etox.h      5 Aug 2003 18:45:36 -0000       1.37
+++ Etox.h      6 Aug 2003 02:45:35 -0000       1.38
@@ -21,37 +21,6 @@
 #define ETOX_ALIGN_MASK 0xF
 
 /*
- * The color struct simply keeps track of the various colors available
- */
-typedef struct _etox_color Etox_Color;
-struct _etox_color
-{
-       int a, r, g, b;
-};
-
-/*
- * Text layout requires knowing the font layout, size, ascent and descent.
- */
-typedef struct _etox_font Etox_Font;
-struct _etox_font
-{
-       char *name;
-       int size, ascent, descent;
-};
-
-/*
- * The info structure keeps the important information about the style, but not
- * the bits used to display the text.
- */
-typedef struct _etox_style_info Etox_Style_Info;
-struct _etox_style_info
-{
-       char *name;
-       E_DB_File *style_db;
-       int references;
-};
-
-/*
  * The context structure holds information relative to the appearance of text
  * that is added to the etox.
  */
@@ -102,167 +71,30 @@
        } marker;
 };
 
-/*
- * The etox keeps track of the display and layout information for all of the
- * text enclosed.
- */
-typedef struct _etox Etox;
-struct _etox
-{
-       /*
-        * Evas for drawing the text
-        */
-       Evas *evas;
-
-       /*
-        * Clip box on evas that bounds the text display and applies an alpha
-        * layer.
-        */
-       Evas_Object *clip;
-
-       /*
-        * The layer in the evas to set the text
-        */
-       int layer;
-
-       /*
-        * Geometry of the etox
-        */
-       int x, y, w, h;
-
-       /*
-        * Geometry the text prefers w/o wraps.
-        */
-       int tw, th;
-
-       /*
-        * The length text in the etox
-        */
-       int length;
-
-       /*
-        * The current context that is used when adding text
-        */
-       Etox_Context *context;
-
-       /*
-        * List of lines in the etox
-        */
-       Evas_List *lines;
-
-       /*
-        * List of obstacles in the etox
-        */
-       Evas_List *obstacles;
-
-       /*
-        * Determine if the etox has been displayed yet.
-        */
-       char visible;
-
-       /*
-        * Alpha level of clip box that is applied to the text
-        */
-       int alpha;
-};
-
-/*
- * Line information helps process the bits layout
- */
-typedef struct _etox_line Etox_Line;
-struct _etox_line
-{
-
-       /*
-        * The etox containing this line, used for getting back to necessary
-        * etox info when drawing bits.
-        */
-       Etox *et;
-
-       /*
-        * This is a pointer to a list of bits
-        */
-       Evas_List *bits;
-
-       /*
-        * The dimensions of this line.
-        */
-       int x, y, w, h;
-
-       /*
-        * Flags indicating alignment, or if this is a "softline", ie. etox
-        * wrapped the line because it was too long to fit within the etox's
-        * bounds.
-        */
-       char flags;
-
-       /*
-        * Keep track of the length of text stored in this bit to avoid
-        * needing to recalculate this often.
-        */
-       int length;
-};
-
-/*
- * Etox obstacles keep track of the lines that they intersect and the bit that
- * represents it.
- */
 typedef struct _etox_obstacle Etox_Obstacle;
-struct _etox_obstacle
-{
-       Etox *et;
-       Evas_Object *bit;
-       int start_line;
-       int end_line;
-};
-
-/*
- * Selection are used to manipulate previously composed etox, it is
- * recommended to keep the number of active selections to a minimum, and if
- * possible, compose using contexts and setup time.
- */
 typedef struct _etox_selection Etox_Selection;
-struct _etox_selection
-{
-       Etox *etox;
-
-       struct
-       {
-               Etox_Line *line;
-               Evas_Object *bit;
-       } start, end;
-
-       Etox_Context *context;
-};
 
 /*
  * Etox creation and deletion functions
  */
-Etox *etox_new(Evas *evas);
-Etox *etox_new_all(Evas *evas, int x, int y, int w, int h, int alpha,
-                  Etox_Alignment align);
-void etox_free(Etox * et);
-
-/*
- * Visibility altering functions
- */
-void etox_show(Etox * et);
-void etox_hide(Etox * et);
+Evas_Object *etox_new(Evas *evas);
+Evas_Object *etox_new_all(Evas *evas, double x, double y, double w, double h,
+               int alpha, Etox_Alignment align);
 
 /*
  * Context management functions
  */
 Etox_Context *etox_context_new();
-Etox_Context *etox_context_save(Etox * et);
-void etox_context_load(Etox * et, Etox_Context * context);
+Etox_Context *etox_context_save(Evas_Object * et);
+void etox_context_load(Evas_Object * et, Etox_Context * context);
 void etox_context_free(Etox_Context * context);
 
 /*
  * Color context management functions
  */
-void etox_context_get_color(Etox * et, int *r, int *g, int *b, int *a);
-void etox_context_set_color(Etox * et, int r, int g, int b, int a);
-void etox_context_set_color_db(Etox * et, char *name);
+void etox_context_get_color(Evas_Object * et, int *r, int *g, int *b, int *a);
+void etox_context_set_color(Evas_Object * et, int r, int g, int b, int a);
+void etox_context_set_color_db(Evas_Object * et, char *name);
 
 /*
  * Callback context management functions
@@ -276,107 +108,85 @@
 /*
  * Font context managment functions
  */
-char *etox_context_get_font(Etox * et, int *size);
-void etox_context_set_font(Etox * et, char *fontname, int size);
+char *etox_context_get_font(Evas_Object * et, int *size);
+void etox_context_set_font(Evas_Object * et, char *fontname, int size);
 
 /*
  * Style context management functions
  */
-char *etox_context_get_style(Etox * et);
-void etox_context_set_style(Etox * et, char *stylename);
+char *etox_context_get_style(Evas_Object * et);
+void etox_context_set_style(Evas_Object * et, char *stylename);
 
 /*
  * Alignment context management functions
  */
-int etox_context_get_align(Etox * et);
-void etox_context_set_align(Etox * et, int align);
-void etox_context_set_soft_wrap(Etox * et, int boolean);
+int etox_context_get_align(Evas_Object * et);
+void etox_context_set_align(Evas_Object * et, int align);
+void etox_context_set_soft_wrap(Evas_Object * et, int boolean);
 
 /* 
  * Wrap marker functions
  */
-void etox_context_set_wrap_marker(Etox *et, char *marker, char *style);
-void etox_context_set_wrap_marker_color(Etox *et, int r, int g, int b, int a);
+void etox_context_set_wrap_marker(Evas_Object *et, char *marker, char *style);
+void etox_context_set_wrap_marker_color(Evas_Object *et, int r, int g, int b, int a);
 
 /*
  * Text manipulation functions
  */
-void etox_append_text(Etox * et, char *text);
-void etox_prepend_text(Etox * et, char *text);
-void etox_insert_text(Etox * et, char *text, int index);
-void etox_set_text(Etox * et, char *text);
-char *etox_get_text(Etox * et);
-void etox_clear(Etox * et);
-
-/*
- * Geometry altering functions
- */
-void etox_move(Etox * et, int x, int y);
-void etox_resize(Etox * et, int w, int h);
+void etox_append_text(Evas_Object * et, char *text);
+void etox_prepend_text(Evas_Object * et, char *text);
+void etox_insert_text(Evas_Object * et, char *text, int index);
+void etox_set_text(Evas_Object * et, char *text);
+char *etox_get_text(Evas_Object * et);
+void etox_clear(Evas_Object * et);
 
 /*
  * Geometry retrieval functions
  */
-int etox_coord_to_index(Etox * et, double x, double y);
-void etox_index_to_geometry(Etox * et, int index, double *x, double *y,
+int etox_coord_to_index(Evas_Object * et, double x, double y);
+void etox_index_to_geometry(Evas_Object * et, int index, double *x, double *y,
                            double *w, double *h);
-int etox_coord_to_geometry(Etox * et, double xc, double yc, double *x,
+int etox_coord_to_geometry(Evas_Object * et, double xc, double yc, double *x,
                double *y, double *w, double *h);
 
 /*
  * Appearance altering functions
  */
-void etox_set_layer(Etox * et, int layer);
-void etox_set_clip(Etox * et, Evas_Object *clip);
-void etox_set_alpha(Etox * et, int alpha);
-
-/*
- * Region selection and release
- */
-Evas_List *etox_region_select(Etox * et, int start, int end);
-Evas_List *etox_region_select_str(Etox * et, char *search, char *last);
-void etox_region_release(Evas_List *region);
-
-/*
- * Region altering appearance modifiers
- */
-void etox_region_set_font(Evas_List *region, char *name, int size);
-void etox_region_set_color(Evas_List *region, int r, int g, int b, int a);
-void etox_region_set_style(Evas_List *region, char *stylename);
+void etox_set_alpha(Evas_Object * et, int alpha);
 
 /*
  * Obstacle manipulation functions
  */
-Etox_Obstacle *etox_obstacle_add(Etox * et, int x, int y, int w, int h);
+Etox_Obstacle *etox_obstacle_add(Evas_Object * et, double x, double y, double w,
+               double h);
 void etox_obstacle_remove(Etox_Obstacle * obstacle);
-void etox_obstacle_move(Etox_Obstacle * obstacle, int x, int y);
-void etox_obstacle_resize(Etox_Obstacle * obstacle, int w, int h);
+void etox_obstacle_move(Etox_Obstacle * obstacle, double x, double y);
+void etox_obstacle_resize(Etox_Obstacle * obstacle, double w, double h);
 
 /*
  * These functions select regions of the etox.
  */
-Etox_Selection *etox_select_coords(Etox * et, int sx, int sy, int ex,
-                                  int ey);
-Etox_Selection *etox_select_index(Etox * et, int si, int ei);
-Etox_Selection *etox_select_str(Etox * et, char *match, char **last);
+Etox_Selection *etox_select_coords(Evas_Object * et, double sx, double sy,
+               double ex, double ey);
+Etox_Selection *etox_select_index(Evas_Object * et, int si, int ei);
+Etox_Selection *etox_select_str(Evas_Object * et, char *match, char **last);
 
 /*
  * Release a selection that is no longer needed.
  */
 void etox_selection_free(Etox_Selection * selected);
-void etox_selection_free_by_etox(Etox *etox);
+void etox_selection_free_by_etox(Evas_Object *etox);
 
 /*
  * This function gets a rectangular bound on the selection.
  */
-void etox_selection_bounds(Etox_Selection * selected, int *x, int *y,
-                          int *w, int *h);
+void etox_selection_bounds(Etox_Selection * selected, double *x, double *y,
+                          double *w, double *h);
 
 /*
  * These methods alter the appearance of the selected region.
  */
-void etox_selection_set_font(Etox_Selection * selected, char *font,
-                            int size);
+void etox_selection_set_font(Etox_Selection * selected, char *font, int size);
 void etox_selection_set_style(Etox_Selection * selected, char *style);
 void etox_selection_set_color(Etox_Selection *selected, int r, int g, int b,
                int a);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox_private.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- Etox_private.h      5 Aug 2003 18:45:36 -0000       1.18
+++ Etox_private.h      6 Aug 2003 02:45:35 -0000       1.19
@@ -5,6 +5,94 @@
 #include <Edb.h>
 
 /*
+ * The color struct simply keeps track of the various colors available
+ */
+typedef struct _etox_color Etox_Color;
+struct _etox_color
+{
+       int a, r, g, b;
+};
+
+/*
+ * Text layout requires knowing the font layout, size, ascent and descent.
+ */
+typedef struct _etox_font Etox_Font;
+struct _etox_font
+{
+       char *name;
+       int size, ascent, descent;
+};
+
+/*
+ * The etox keeps track of the display and layout information for all of the
+ * text enclosed.
+ */
+typedef struct _etox Etox;
+struct _etox
+{
+       /*
+        * Evas for drawing the text
+        */
+       Evas *evas;
+
+       /*
+        * The smart object that refers to this etox.
+        */
+       Evas_Object *smart_obj;
+
+       /*
+        * Clip box on evas that bounds the text display and applies an alpha
+        * layer.
+        */
+       Evas_Object *clip;
+
+       /*
+        * The layer in the evas to set the text
+        */
+       int layer;
+
+       /*
+        * Geometry of the etox
+        */
+       double x, y, w, h;
+
+       /*
+        * Geometry the text prefers w/o wraps.
+        */
+       double tw, th;
+
+       /*
+        * The length text in the etox
+        */
+       int length;
+
+       /*
+        * The current context that is used when adding text
+        */
+       Etox_Context *context;
+
+       /*
+        * List of lines in the etox
+        */
+       Evas_List *lines;
+
+       /*
+        * List of obstacles in the etox
+        */
+       Evas_List *obstacles;
+
+       /*
+        * Determine if the etox has been displayed yet.
+        */
+       char visible;
+
+       /*
+        * Alpha level of clip box that is applied to the text
+        */
+       int alpha;
+};
+
+/*
  * There is some subtelty to this enum. It leaves the bits used by alignment
  * untouched so that a single char can hold all of the necessary information.
  */
@@ -16,21 +104,80 @@
 };
 
 /*
- * The bit holds all information necessary for display and layout of the text
+ * Line information helps process the bits layout
  */
-typedef struct _etox_bit Etox_Bit;
-struct _etox_bit
+typedef struct _etox_line Etox_Line;
+struct _etox_line
 {
+
+       /*
+        * The etox containing this line, used for getting back to necessary
+        * etox info when drawing bits.
+        */
+       Etox *et;
+
+       /*
+        * This is a pointer to a list of bits
+        */
+       Evas_List *bits;
+
+       /*
+        * The dimensions of this line.
+        */
+       double x, y, w, h;
+
        /*
-        * This is the estyle that displays the bit.
+        * Flags indicating alignment, or if this is a "softline", ie. etox
+        * wrapped the line because it was too long to fit within the etox's
+        * bounds.
         */
-       Evas_List *estyles;
+       char flags;
 
        /*
-        * Regions that reference this bit.
+        * Keep track of the length of text stored in this bit to avoid
+        * needing to recalculate this often.
         */
-       Evas_List *regions;
+       int length;
+};
+
+/*
+ * Etox obstacles keep track of the lines that they intersect and the bit that
+ * represents it.
+ */
+struct _etox_obstacle
+{
+       Etox *et;
+       Evas_Object *bit;
+       int start_line;
+       int end_line;
 };
+
+/*
+ * Selection are used to manipulate previously composed etox, it is
+ * recommended to keep the number of active selections to a minimum, and if
+ * possible, compose using contexts and setup time.
+ */
+struct _etox_selection
+{
+       Etox *etox;
+
+       struct
+       {
+               Etox_Line *line;
+               Evas_Object *bit;
+       } start, end;
+
+       Etox_Context *context;
+};
+
+void etox_free(Evas_Object * et);
+void etox_show(Evas_Object * et);
+void etox_hide(Evas_Object * et);
+void etox_move(Evas_Object * et, double x, double y);
+void etox_resize(Evas_Object * et, double w, double h);
+void etox_set_layer(Evas_Object * et, int layer);
+void etox_set_clip(Evas_Object * et, Evas_Object *clip);
+void etox_unset_clip(Evas_Object * et);
 
 void etox_layout(Etox * et);
 Evas_Object * etox_split_bit(Etox_Line *line, Evas_Object *bit, int index);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- etox.c      5 Aug 2003 18:45:36 -0000       1.53
+++ etox.c      6 Aug 2003 02:45:35 -0000       1.54
@@ -3,18 +3,27 @@
 
 static Evas_List *_etox_break_text(Etox * et, char *text);
 
+Evas_Smart *etox_smart = NULL;
+
 /**
  * etox_new - create a new etox with default settings
  * @evas: the evas for rendering text
  *
  * Returns a pointer to a newly allocated etox on success, NULL on failure.
  */
-Etox *etox_new(Evas *evas)
+Evas_Object *etox_new(Evas *evas)
 {
        Etox *et;
 
        CHECK_PARAM_POINTER_RETURN("evas", evas, NULL);
 
+       if (!etox_smart)
+               etox_smart = evas_smart_new("etox_smart", NULL, etox_free,
+                               etox_set_layer, NULL, NULL, NULL, NULL,
+                               etox_move, etox_resize, etox_show, etox_hide,
+                               NULL, etox_set_clip, etox_unset_clip,
+                               NULL);
+
        /*
         * Create the etox and assign it's evas to draw on.
         */
@@ -22,6 +31,8 @@
 
        et->evas = evas;
        evas_font_path_append(evas, PACKAGE_DATA_DIR "/fonts");
+       et->smart_obj = evas_object_smart_add(evas, etox_smart);
+       evas_object_smart_data_set(et->smart_obj, et);
 
        /*
         * Allocate the default context
@@ -34,7 +45,7 @@
        et->clip = evas_object_rectangle_add(evas);
        evas_object_color_set(et->clip, 255, 255, 255, 255);
 
-       return et;
+       return et->smart_obj;
 }
 
 /**
@@ -49,10 +60,11 @@
  *
  * Returns a pointer to a newly allocated etox on success, NULL on failure.
  */
-Etox *etox_new_all(Evas *evas, int x, int y, int w, int h, int alpha,
+Evas_Object *
+etox_new_all(Evas *evas, double x, double y, double w, double h, int alpha,
                   Etox_Alignment align)
 {
-       Etox *et;
+       Evas_Object *et;
 
        CHECK_PARAM_POINTER_RETURN("evas", evas, NULL);
 
@@ -61,13 +73,10 @@
         * passed in to etox_new_all.
         */
        et = etox_new(evas);
-       et->context->flags = align | ETOX_SOFT_WRAP;
-       et->x = x;
-       et->y = y;
-       et->w = w;
-       et->h = h;
-
-       et->alpha = alpha;
+       etox_context_set_align(et, align);
+       etox_set_alpha(et, alpha);
+       evas_object_move(et, x, y);
+       evas_object_resize(et, w, h);
 
        return et;
 }
@@ -79,16 +88,19 @@
  * Returns no value. Removes the etox @et from the evas it is drawn on, and
  * then deallocates the memory that it was using.
  */
-void etox_free(Etox * et)
+void etox_free(Evas_Object * obj)
 {
+       Etox *et;
        Etox_Obstacle *obst;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
-       etox_clear(et);
+       etox_clear(obj);
        etox_context_free(et->context);
-       etox_selection_free_by_etox(et);
+       etox_selection_free_by_etox(obj);
 
        l = et->obstacles;
        while (l) {
@@ -104,12 +116,15 @@
  *
  * Returns no value. Adds the text from @et to it's evas.
  */
-void etox_show(Etox * et)
+void etox_show(Evas_Object * obj)
 {
+       Etox *et;
        Etox_Line *line;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        et->visible = TRUE;
 
@@ -135,9 +150,13 @@
  *
  * Returns no value. Hides the text from @et from it's evas
  */
-void etox_hide(Etox * et)
+void etox_hide(Evas_Object * obj)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        et->visible = FALSE;
 
@@ -152,14 +171,17 @@
  * Returns no value. Appends @text to the text already existing in @et, and
  * updates the layout and display of the etox.
  */
-void etox_append_text(Etox * et, char *text)
+void etox_append_text(Evas_Object * obj, char *text)
 {
+       Etox *et;
        Evas_List *lines;
        Etox_Line *end = NULL, *start;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
        CHECK_PARAM_POINTER("text", text);
 
+       et = evas_object_smart_data_get(obj);
+
        /*
         * Break the incoming text into lines, and merge the first line of the
         * new text with the last line of the old text.
@@ -225,14 +247,17 @@
  * Returns no value. Prepends @text to the text already existing in @et, and
  * updates the layout and display of the etox.
  */
-void etox_prepend_text(Etox * et, char *text)
+void etox_prepend_text(Evas_Object * obj, char *text)
 {
+       Etox *et;
        Evas_List *lines;
        Etox_Line *end = NULL, *start;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
        CHECK_PARAM_POINTER("text", text);
 
+       et = evas_object_smart_data_get(obj);
+
        /*
         * Break the incoming text into lines, and merge the first line of the
         * new text with the last line of the old text.
@@ -302,21 +327,24 @@
  * Returns no value. Places @text into the etox @et at position @index and
  * updates the layout and display of the etox.
  */
-void etox_insert_text(Etox * et, char *text, int index)
+void etox_insert_text(Evas_Object * obj, char *text, int index)
 {
+       Etox *et;
        Evas_Object *bit;
        Evas_List *lines, *ll;
        Etox_Line *start, *end, *temp;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
        CHECK_PARAM_POINTER("text", text);
 
+       et = evas_object_smart_data_get(obj);
+
        if (!index) {
-               etox_prepend_text(et, text);
+               etox_prepend_text(obj, text);
                return;
        }
        else if (index >= et->length) {
-               etox_append_text(et, text);
+               etox_append_text(obj, text);
                return;
        }
 
@@ -379,14 +407,17 @@
  *
  * Returns no value. Changes the text displayed by @et to itext.
  */
-void etox_set_text(Etox * et, char *text)
+void etox_set_text(Evas_Object * obj, char *text)
 {
+       Etox *et;
        Etox_Line *line;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
-       etox_clear(et);
+       etox_clear(obj);
 
        /*
         * Layout the text and add to the display. Duplicate text to avoid
@@ -426,13 +457,16 @@
  *
  * Returns the text in the etox @et on success, NULL on failure.
  */
-char *etox_get_text(Etox * et)
+char *etox_get_text(Evas_Object * obj)
 {
+       Etox *et;
        char *ret, *temp;
        Etox_Line *line;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER_RETURN("et", et, NULL);
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
 
        /*
         * Return NULL on an empty etox.
@@ -462,12 +496,15 @@
  *
  * Returns no value. Removes all text from the etox.
  */
-void etox_clear(Etox * et)
+void etox_clear(Evas_Object * obj)
 {
+       Etox *et;
        Etox_Line *line;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        /*
         * If there aren't any lines currently available, then return
@@ -493,13 +530,16 @@
  * Returns no value. Moves all bits of the etox onto the @layer layer of the
  * evas. All further text added will be drawn on this layer.
  */
-void etox_set_layer(Etox * et, int layer)
+void etox_set_layer(Evas_Object * obj, int layer)
 {
+       Etox *et;
        Evas_Object *bit;
        Etox_Line *line;
        Evas_List *l, *ll;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        et->layer = layer;
 
@@ -532,11 +572,14 @@
  *
  * Returns no value. Sets the alpha value of the etox @et to @alpha.
  */
-void etox_set_alpha(Etox * et, int alpha)
+void etox_set_alpha(Evas_Object * obj, int alpha)
 {
+       Etox *et;
        int r, g, b, a;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        if (et->alpha == alpha)
                return;
@@ -554,9 +597,13 @@
  * Returns no value. Changes the position of the etox @et to the specified
  * position.
  */
-void etox_move(Etox * et, int x, int y)
+void etox_move(Evas_Object * obj, double x, double y)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        if (et->x == x && et->y == y)
                return;
@@ -564,6 +611,8 @@
        et->x = x;
        et->y = y;
 
+       evas_object_move(obj, et->x, et->y);
+
        /*
         * Layout lines if appropriate.
         */
@@ -588,9 +637,13 @@
  * Returns no value. Changes the dimensions of the etox to match the specified
  * dimensions.
  */
-void etox_resize(Etox * et, int w, int h)
+void etox_resize(Evas_Object * obj, double w, double h)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        if (et->w == w && et->h == h)
                return;
@@ -610,6 +663,7 @@
         */
        evas_object_move(et->clip, (double) (et->x), (double) (et->y));
        evas_object_resize(et->clip, (double) (et->w), (double) (et->h));
+       evas_object_resize(obj, et->w, et->h);
 }
 
 /**
@@ -651,15 +705,18 @@
  * Returns no value. Stores the current geometry of the letter at index @index
  * in @et into the integers pointed to by @x, @y, @w, and @h.
  */
-void etox_index_to_geometry(Etox * et, int index, double *x, double *y,
+void etox_index_to_geometry(Evas_Object * obj, int index, double *x, double *y,
                            double *w, double *h)
 {
+       Etox *et;
        int sum;
        Evas_Object *bit = NULL;
        Etox_Line *line = NULL;
        Evas_List *l, *ll, *lll;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        if (index > et->length) {
                sum = et->length;
@@ -723,16 +780,19 @@
  * of the letter at coordinates @xc, @yc in @et into the integers pointed to by
  * @x, @y, @w, and @h.
  */
-int etox_coord_to_geometry(Etox * et, double xc, double yc, double *x,
+int etox_coord_to_geometry(Evas_Object * obj, double xc, double yc, double *x,
                double *y, double *w, double *h)
 {
+       Etox *et;
        int sum;
        Evas_Object *bit;
        Etox_Line *line = NULL;
        double tx, ty, tw, th;
        Evas_List *l;
 
-       CHECK_PARAM_POINTER_RETURN("et", et, 0);
+       CHECK_PARAM_POINTER_RETURN("obj", obj, 0);
+
+       et = evas_object_smart_data_get(obj);
 
        /*
         * Put the click within the bounds of the etox.
@@ -820,14 +880,31 @@
  * Returns no value. Changes the clip rectangle for the etox @et to the clip
  * rectangle @clip and updates the display.
  */
-void etox_set_clip(Etox * et, Evas_Object *clip)
+void etox_set_clip(Evas_Object * obj, Evas_Object *clip)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+
+       evas_object_clip_set(et->clip, clip);
+}
+
+/**
+ * etox_unset_clip - unset the evas rectangle that will clip the etox
+ * @et: the etox to unset the clip rectangle
+ *
+ * Returns no value. Removes the clip rectangle for the etox @et.
+ */
+void etox_unset_clip(Evas_Object * obj)
+{
+       Etox *et;
 
-       if (clip == NULL)
-               evas_object_clip_unset(et->clip);
-       else
-               evas_object_clip_set(et->clip, clip);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+       evas_object_clip_unset(et->clip);
 }
 
 /**
@@ -841,11 +918,15 @@
  * Returns a pointer to the new obstacle object on success, NULL on failure.
  * Adds an obstacle to the etox @et that the text will wrap around.
  */
-Etox_Obstacle *etox_obstacle_add(Etox * et, int x, int y, int w, int h)
+Etox_Obstacle *
+etox_obstacle_add(Evas_Object * obj, double x, double y, double w, double h)
 {
+       Etox *et;
        Etox_Obstacle *obst;
 
-       CHECK_PARAM_POINTER_RETURN("et", et, NULL);
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
 
        obst = etox_obstacle_new(et, x, y, w, h);
 
@@ -885,7 +966,7 @@
  * Returns no value. Changes the position information for @obst and updates the
  * etox to work around the new position.
  */
-void etox_obstacle_move(Etox_Obstacle * obst, int x, int y)
+void etox_obstacle_move(Etox_Obstacle * obst, double x, double y)
 {
        CHECK_PARAM_POINTER("obst", obst);
 
@@ -904,7 +985,7 @@
  * Returns no value. Changes the size information for @obst and updates the
  * etox to work around the new position.
  */
-void etox_obstacle_resize(Etox_Obstacle * obst, int x, int y)
+void etox_obstacle_resize(Etox_Obstacle * obst, double x, double y)
 {
        CHECK_PARAM_POINTER("obst", obst);
 
@@ -957,6 +1038,7 @@
                         */
                        bit =
                            estyle_new(et->evas, text, et->context->style);
+                       evas_object_smart_member_add(et->smart_obj, bit);
                        evas_object_clip_set(bit, et->clip);
                        evas_object_color_set(bit, et->context->r,
                                         et->context->g, et->context->b,
@@ -975,6 +1057,7 @@
                        *text = '\0';
                        bit =
                            estyle_new(et->evas, walk, et->context->style);
+                       evas_object_smart_member_add(et->smart_obj, bit);
                        evas_object_color_set(bit, et->context->r,
                                         et->context->g, et->context->b,
                                         et->context->a);
@@ -999,6 +1082,7 @@
                         */
                        bit =
                            estyle_new(et->evas, text, et->context->style);
+                       evas_object_smart_member_add(et->smart_obj, bit);
                        evas_object_color_set(bit, et->context->r,
                                         et->context->g, et->context->b,
                                         et->context->a);
@@ -1030,6 +1114,7 @@
         */
        if (*text) {
                bit = estyle_new(et->evas, text, et->context->style);
+               evas_object_smart_member_add(et->smart_obj, bit);
                evas_object_color_set(bit, et->context->r, et->context->g,
                                 et->context->b, et->context->a);
                evas_object_clip_set(bit, et->clip);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- etox_context.c      1 Aug 2003 21:12:13 -0000       1.9
+++ etox_context.c      6 Aug 2003 02:45:36 -0000       1.10
@@ -57,11 +57,14 @@
  * Returns a copy of the current context on success, NULL on failure. The
  * returned context can later be restored with a call to etox_context_load.
  */
-Etox_Context *etox_context_save(Etox * et)
+Etox_Context *etox_context_save(Evas_Object * obj)
 {
+       Etox *et;
        Etox_Context *ret;
 
-       CHECK_PARAM_POINTER_RETURN("et", et, NULL);
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
 
        ret = (Etox_Context *) malloc(sizeof(Etox_Context));
 
@@ -91,11 +94,15 @@
  * Returns no value. The context pointed to by @context is loaded into the etox
  * @et as the current context.
  */
-void etox_context_load(Etox * et, Etox_Context * context)
+void etox_context_load(Evas_Object * obj, Etox_Context * context)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
        CHECK_PARAM_POINTER("context", context);
 
+       et = evas_object_smart_data_get(obj);
+
        /*
         * Dereference the style before overwriting
         */
@@ -148,9 +155,13 @@
  * Returns no value. The color of the current context for the etox @et are
  * stored into any non-NULL parameters @r, @g, @b, and @a.
  */
-void etox_context_get_color(Etox * et, int *r, int *g, int *b, int *a)
+void etox_context_get_color(Evas_Object * obj, int *r, int *g, int *b, int *a)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        *a = et->context->a;
        *r = et->context->r;
@@ -168,9 +179,13 @@
  *
  * Returns no value. Sets the color context for the etox @et.
  */
-void etox_context_set_color(Etox * et, int r, int g, int b, int a)
+void etox_context_set_color(Evas_Object * obj, int r, int g, int b, int a)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        et->context->a = a;
        et->context->r = r;
@@ -187,9 +202,13 @@
  * from the color databases based on @name, and then assigned as the current
  * context's color.
  */
-void etox_context_set_color_db(Etox * et, char *name)
+void etox_context_set_color_db(Evas_Object *obj, char *name)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        estyle_lookup_color_db(name, &et->context->r, &et->context->g,
                               &et->context->b, &et->context->a);
@@ -274,11 +293,15 @@
  * Returns no value. Sets the default font for the etox @et to @name with size
  * @size.
  */
-void etox_context_set_font(Etox * et, char *name, int size)
+void etox_context_set_font(Evas_Object * obj, char *name, int size)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
        CHECK_PARAM_POINTER("name", name);
 
+       et = evas_object_smart_data_get(obj);
+
        IF_FREE(et->context->font);
        et->context->font = strdup(name);
        et->context->font_size = size;
@@ -290,9 +313,13 @@
  *
  * Returns a pointer to the style name on success, NULL on failure.
  */
-char *etox_context_get_style(Etox * et)
+char *etox_context_get_style(Evas_Object * obj)
 {
-       CHECK_PARAM_POINTER_RETURN("et", et, NULL);
+       Etox *et;
+
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
 
        if (!et->context->style)
                return NULL;
@@ -308,10 +335,13 @@
  * Returns no value. Changes the default style used by the etox to the one
  * represented by @name.
  */
-void etox_context_set_style(Etox * et, char *name)
+void etox_context_set_style(Evas_Object * obj, char *name)
 {
+       Etox *et;
 
-       CHECK_PARAM_POINTER("et", et);
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        /*
         * Release this instance of the old style, and then get an instance of
@@ -331,9 +361,13 @@
  *
  * Returns the alignment value for @et on success, NULL on failure.
  */
-int etox_context_get_align(Etox * et)
+int etox_context_get_align(Evas_Object * obj)
 {
-       CHECK_PARAM_POINTER_RETURN("et", et, FALSE);
+       Etox *et;
+
+       CHECK_PARAM_POINTER_RETURN("obj", obj, FALSE);
+
+       et = evas_object_smart_data_get(obj);
 
        return et->context->flags & ETOX_ALIGN_MASK;
 }
@@ -345,9 +379,13 @@
  * Returns no value. Changes @et's current context's alignment value to
  * @align.
  */
-void etox_context_set_align(Etox * et, int align)
+void etox_context_set_align(Evas_Object * obj, int align)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        et->context->flags = align | (et->context->flags & ~ETOX_ALIGN_MASK);
 }
@@ -360,9 +398,13 @@
  * 
  * Returns no value. changes current context alignment value.
  */
-void etox_context_set_soft_wrap(Etox *et, int boolean)
+void etox_context_set_soft_wrap(Evas_Object *obj, int boolean)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
 
        if (boolean)
                et->context->flags |= ETOX_SOFT_WRAP;
@@ -378,9 +420,14 @@
  *
  * Returns nothing, changes context
  */
-void etox_context_set_wrap_marker(Etox *et, char *marker, char *style)
+void etox_context_set_wrap_marker(Evas_Object *obj, char *marker, char *style)
 {
-       CHECK_PARAM_POINTER("et", et);
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+
        IF_FREE(et->context->marker.text);
        IF_FREE(et->context->marker.style);
        et->context->marker.text = strdup(marker);
@@ -397,10 +444,17 @@
  *
  * Returns nothing, changes context
  */
-void etox_context_set_wrap_marker_color(Etox *et, int r, int g, int b, int a)
+void
+etox_context_set_wrap_marker_color(Evas_Object *obj, int r, int g, int b, int a)
 {
-  et->context->marker.r = r;
-  et->context->marker.g = g;
-  et->context->marker.b = b;
-  et->context->marker.a = a;
+       Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+
+       et->context->marker.r = r;
+       et->context->marker.g = g;
+       et->context->marker.b = b;
+       et->context->marker.a = a;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- etox_line.c 5 Aug 2003 18:45:36 -0000       1.19
+++ etox_line.c 6 Aug 2003 02:45:36 -0000       1.20
@@ -413,6 +413,7 @@
                /* create a marker bit. */
                marker = estyle_new(et->evas, et->context->marker.text,
                                et->context->marker.style);
+               evas_object_smart_member_add(et->smart_obj, marker);
                evas_object_color_set(marker, et->context->marker.r,
                                et->context->marker.g,
                                et->context->marker.b,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_obstacle.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etox_obstacle.c     5 Aug 2003 18:45:36 -0000       1.13
+++ etox_obstacle.c     6 Aug 2003 02:45:36 -0000       1.14
@@ -28,6 +28,7 @@
        if (obst) {
                obst->et = et;
                obst->bit = estyle_new(et->evas, "", NULL);
+               evas_object_smart_member_add(et->smart_obj, obst->bit);
                estyle_fix_geometry(obst->bit, x, y, w, h);
        }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_selection.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etox_selection.c    5 Aug 2003 18:45:36 -0000       1.5
+++ etox_selection.c    6 Aug 2003 02:45:36 -0000       1.6
@@ -46,6 +46,7 @@
         */
        if (index && index < estyle_length(bit)) {
                point = estyle_split(bit, index);
+               evas_object_smart_member_add(line->et->smart_obj, point);
                line->bits = evas_list_append_relative(line->bits, point, bit);
 
                l = active_selections;
@@ -95,7 +96,7 @@
        selected->end.line = l2;
        selected->end.bit = s2;
 
-       selected->context = etox_context_save(etox);
+       selected->context = etox_context_save(etox->smart_obj);
 
        active_selections = evas_list_prepend(active_selections, selected);
 
@@ -117,11 +118,16 @@
 /**
  */
 void
-etox_selection_free_by_etox(Etox *etox)
+etox_selection_free_by_etox(Evas_Object *obj)
 {
+       Etox *etox;
        Evas_List *l;
        Etox_Selection *selected;
 
+       CHECK_PARAM_POINTER("obj", obj);
+
+       etox = evas_object_smart_data_get(obj);
+
        l = active_selections;
        while (l) {
                selected = l->data;
@@ -136,13 +142,18 @@
 /**
  */
 Etox_Selection *
-etox_select_coords(Etox * et, int sx, int sy, int ex, int ey)
+etox_select_coords(Evas_Object *obj, double sx, double sy, double ex, double ey)
 {
        int i1, i2;
+       Etox *et;
        Etox_Line *sl, *el = NULL;
        Evas_Object *sb, *eb = NULL;
        Etox_Selection *selected = NULL;
 
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
+
        sl = etox_coord_to_line(et, sy);
        if (!sl)
                goto out;
@@ -177,12 +188,17 @@
  * Returns a newly allocated selection on success, NULL on failure.
  */
 Etox_Selection *
-etox_select_index(Etox * et, int si, int ei)
+etox_select_index(Evas_Object * obj, int si, int ei)
 {
+       Etox *et;
        Etox_Line *sl = NULL, *el = NULL;
        Evas_Object *sb = NULL, *eb = NULL;
        Etox_Selection *selected = NULL;
 
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
+
        /*
         * First determine the lines containing the indices.
         */
@@ -214,16 +230,22 @@
 /**
  */
 Etox_Selection *
-etox_select_str(Etox * et, char *match, char **last)
+etox_select_str(Evas_Object * obj, char *match, char **last)
 {
+       Etox *et;
+
+       CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+       et = evas_object_smart_data_get(obj);
+
        return NULL;
 }
 
 /**
  */
 void
-etox_selection_bounds(Etox_Selection *selected, int *sx, int *sy,
-               int *ex, int *ey)
+etox_selection_bounds(Etox_Selection *selected, double *sx, double *sy,
+               double *ex, double *ey)
 {
 }
 




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to