Enlightenment CVS committal
Author : rephorm
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
Etox.h etox.c etox_context.c
Log Message:
API change.
etox_context_set/get functions now take an Etox_Context instead of the parent etox.
This allows contexts to be modified independent of an etox (e.g. to be applied to a
selection).
added etox_get_context() and etox_set_context().
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- Etox.h 19 Aug 2003 18:08:12 -0000 1.39
+++ Etox.h 20 Aug 2003 17:37:10 -0000 1.40
@@ -85,6 +85,8 @@
* Context management functions
*/
Etox_Context *etox_context_new();
+Etox_Context *etox_get_context(Evas_Object * et);
+void etox_set_context(Evas_Object * 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);
@@ -92,9 +94,9 @@
/*
* Color context management functions
*/
-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);
+void etox_context_get_color(Etox_Context * context, int *r, int *g, int *b, int *a);
+void etox_context_set_color(Etox_Context * context, int r, int g, int b, int a);
+void etox_context_set_color_db(Etox_Context * context, char *name);
/*
* Callback context management functions
@@ -108,27 +110,27 @@
/*
* Font context managment functions
*/
-char *etox_context_get_font(Evas_Object * et, int *size);
-void etox_context_set_font(Evas_Object * et, char *fontname, int size);
+char *etox_context_get_font(Etox_Context * context, int *size);
+void etox_context_set_font(Etox_Context * context, char *fontname, int size);
/*
* Style context management functions
*/
-char *etox_context_get_style(Evas_Object * et);
-void etox_context_set_style(Evas_Object * et, char *stylename);
+char *etox_context_get_style(Etox_Context * context);
+void etox_context_set_style(Etox_Context * context, char *stylename);
/*
* Alignment context management functions
*/
-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);
+int etox_context_get_align(Etox_Context * context);
+void etox_context_set_align(Etox_Context * context, int align);
+void etox_context_set_soft_wrap(Etox_Context * context, int boolean);
/*
* Wrap marker functions
*/
-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);
+void etox_context_set_wrap_marker(Etox_Context * context, char *marker, char *style);
+void etox_context_set_wrap_marker_color(Etox_Context * context, int r, int g, int b,
int a);
/*
* Text manipulation functions
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- etox.c 19 Aug 2003 05:49:26 -0000 1.58
+++ etox.c 20 Aug 2003 17:37:10 -0000 1.59
@@ -65,6 +65,7 @@
Etox_Alignment align)
{
Evas_Object *et;
+ Etox_Context *ec;
CHECK_PARAM_POINTER_RETURN("evas", evas, NULL);
@@ -73,7 +74,8 @@
* passed in to etox_new_all.
*/
et = etox_new(evas);
- etox_context_set_align(et, align);
+ ec = etox_get_context(et);
+ etox_context_set_align(ec, align);
etox_set_alpha(et, alpha);
evas_object_move(et, x, y);
evas_object_resize(et, w, h);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_context.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etox_context.c 20 Aug 2003 03:25:40 -0000 1.13
+++ etox_context.c 20 Aug 2003 17:37:10 -0000 1.14
@@ -130,6 +130,42 @@
}
/**
+ * etox_context_get - get a pointer to the current context of an etox
+ * @et: the etox to retrieve the current context
+ *
+ * Returns a pointer to the current context.
+ */
+Etox_Context *etox_get_context(Evas_Object * obj)
+{
+ Etox *et;
+
+ CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
+
+ et = evas_object_smart_data_get(obj);
+
+ return et->context;
+}
+
+/**
+ * etox_context_set - set the current context of an etox
+ * @et: the etox
+ * @context: the context
+ *
+ * Set the current context of an etox.
+ */
+void etox_set_context(Evas_Object * obj, Etox_Context *context)
+{
+ Etox *et;
+
+ CHECK_PARAM_POINTER("obj", obj);
+ CHECK_PARAM_POINTER("context", context);
+
+ et = evas_object_smart_data_get(obj);
+
+ et->context = context;
+}
+
+/**
* etox_context_free - free the memory used by the context
* @context: the context to be freed
*
@@ -159,18 +195,14 @@
* 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(Evas_Object * obj, int *r, int *g, int *b, int *a)
+void etox_context_get_color(Etox_Context * context, int *r, int *g, int *b, int *a)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- *a = et->context->a;
- *r = et->context->r;
- *b = et->context->b;
- *g = et->context->g;
+ *a = context->a;
+ *r = context->r;
+ *b = context->b;
+ *g = context->g;
}
/**
@@ -183,18 +215,14 @@
*
* Returns no value. Sets the color context for the etox @et.
*/
-void etox_context_set_color(Evas_Object * obj, int r, int g, int b, int a)
+void etox_context_set_color(Etox_Context * context, int r, int g, int b, int a)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- et->context->a = a;
- et->context->r = r;
- et->context->g = g;
- et->context->b = b;
+ context->a = a;
+ context->r = r;
+ context->g = g;
+ context->b = b;
}
/**
@@ -206,16 +234,12 @@
* from the color databases based on @name, and then assigned as the current
* context's color.
*/
-void etox_context_set_color_db(Evas_Object *obj, char *name)
+void etox_context_set_color_db(Etox_Context * context, char *name)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- estyle_lookup_color_db(name, &et->context->r, &et->context->g,
- &et->context->b, &et->context->a);
+ estyle_lookup_color_db(name, &context->r, &context->g,
+ &context->b, &context->a);
}
/**
@@ -297,18 +321,14 @@
* Returns no value. Sets the default font for the etox @et to @name with size
* @size.
*/
-void etox_context_set_font(Evas_Object * obj, char *name, int size)
+void etox_context_set_font(Etox_Context * context, char *name, int size)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
+ CHECK_PARAM_POINTER("context", context);
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;
+ IF_FREE(context->font);
+ context->font = strdup(name);
+ context->font_size = size;
}
/*
@@ -317,18 +337,14 @@
*
* Returns a pointer to the style name on success, NULL on failure.
*/
-char *etox_context_get_style(Evas_Object * obj)
+char *etox_context_get_style(Etox_Context * context)
{
- Etox *et;
-
- CHECK_PARAM_POINTER_RETURN("obj", obj, NULL);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER_RETURN("context", context, NULL);
- if (!et->context->style)
+ if (!context->style)
return NULL;
- return strdup(et->context->style);
+ return strdup(context->style);
}
/**
@@ -339,24 +355,20 @@
* Returns no value. Changes the default style used by the etox to the one
* represented by @name.
*/
-void etox_context_set_style(Evas_Object * obj, char *name)
+void etox_context_set_style(Etox_Context * context, char *name)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
/*
* Release this instance of the old style, and then get an instance of
* the new style.
*/
- IF_FREE(et->context->style);
+ IF_FREE(context->style);
if (name && *name)
- et->context->style = strdup(name);
+ context->style = strdup(name);
else
- et->context->style = NULL;
+ context->style = NULL;
}
/*
@@ -365,15 +377,11 @@
*
* Returns the alignment value for @et on success, NULL on failure.
*/
-int etox_context_get_align(Evas_Object * obj)
+int etox_context_get_align(Etox_Context * context)
{
- Etox *et;
-
- CHECK_PARAM_POINTER_RETURN("obj", obj, FALSE);
+ CHECK_PARAM_POINTER_RETURN("context", context, FALSE);
- et = evas_object_smart_data_get(obj);
-
- return et->context->flags & ETOX_ALIGN_MASK;
+ return context->flags & ETOX_ALIGN_MASK;
}
/*
@@ -383,15 +391,11 @@
* Returns no value. Changes @et's current context's alignment value to
* @align.
*/
-void etox_context_set_align(Evas_Object * obj, int align)
+void etox_context_set_align(Etox_Context * context, int align)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- et->context->flags = align | (et->context->flags & ~ETOX_ALIGN_MASK);
+ context->flags = align | (context->flags & ~ETOX_ALIGN_MASK);
}
/**
@@ -402,18 +406,14 @@
*
* Returns no value. changes current context alignment value.
*/
-void etox_context_set_soft_wrap(Evas_Object *obj, int boolean)
+void etox_context_set_soft_wrap(Etox_Context * context, int boolean)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
if (boolean)
- et->context->flags |= ETOX_SOFT_WRAP;
+ context->flags |= ETOX_SOFT_WRAP;
else
- et->context->flags &= ~ETOX_SOFT_WRAP;
+ context->flags &= ~ETOX_SOFT_WRAP;
}
/**
@@ -424,18 +424,14 @@
*
* Returns nothing, changes context
*/
-void etox_context_set_wrap_marker(Evas_Object *obj, char *marker, char *style)
+void etox_context_set_wrap_marker(Etox_Context * context, char *marker, char *style)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- IF_FREE(et->context->marker.text);
- IF_FREE(et->context->marker.style);
- et->context->marker.text = strdup(marker);
- et->context->marker.style = strdup(style);
+ IF_FREE(context->marker.text);
+ IF_FREE(context->marker.style);
+ context->marker.text = strdup(marker);
+ context->marker.style = strdup(style);
}
/*
@@ -449,16 +445,12 @@
* Returns nothing, changes context
*/
void
-etox_context_set_wrap_marker_color(Evas_Object *obj, int r, int g, int b, int a)
+etox_context_set_wrap_marker_color(Etox_Context * context, int r, int g, int b, int a)
{
- Etox *et;
-
- CHECK_PARAM_POINTER("obj", obj);
-
- et = evas_object_smart_data_get(obj);
+ CHECK_PARAM_POINTER("context", context);
- et->context->marker.r = r;
- et->context->marker.g = g;
- et->context->marker.b = b;
- et->context->marker.a = a;
+ context->marker.r = r;
+ context->marker.g = g;
+ context->marker.b = b;
+ context->marker.a = a;
}
-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs