Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_textarea.c ewl_textarea.h
Log Message:
Added a utility function for navigating the operations and outlined the
font_get function.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_textarea.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_textarea.c 18 May 2004 20:49:00 -0000 1.27
+++ ewl_textarea.c 19 May 2004 05:43:13 -0000 1.28
@@ -2,6 +2,8 @@
static void ewl_text_ops_apply(Ewl_Text *ta);
static void ewl_text_op_free(void *data);
+static Ewl_Text_Op *ewl_text_op_relevant_find(Ewl_Text *ta,
+ Ewl_Text_Op_Type type);
static void ewl_text_update_size(Ewl_Text * ta);
/*
@@ -74,11 +76,11 @@
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
ewl_text_configure_cb, NULL);
- ta->ops = ecore_list_new();
- ta->applied = ecore_list_new();
+ ta->ops = ecore_dlist_new();
+ ta->applied = ecore_dlist_new();
- ecore_list_set_free_cb(ta->ops, ewl_text_op_free);
- ecore_list_set_free_cb(ta->applied, ewl_text_op_free);
+ ecore_dlist_set_free_cb(ta->ops, ewl_text_op_free);
+ ecore_dlist_set_free_cb(ta->applied, ewl_text_op_free);
if (text)
ewl_text_text_set(ta, text);
@@ -175,7 +177,7 @@
DCHECK_PARAM_PTR("ta", ta);
op = ewl_text_op_color_new(ta, r, g, b, a);
- ecore_list_append(ta->ops, op);
+ ecore_dlist_append(ta->ops, op);
if (REALIZED(ta))
ewl_text_ops_apply(ta);
@@ -197,7 +199,7 @@
DCHECK_PARAM_PTR("ta", ta);
op = ewl_text_op_font_new(ta, font, size);
- ecore_list_append(ta->ops, op);
+ ecore_dlist_append(ta->ops, op);
if (REALIZED(ta))
ewl_text_ops_apply(ta);
@@ -205,6 +207,58 @@
}
/**
+ * @param ta: the text widget to change font
+ * @param font: the name of the font
+ * @param size: the size of the font
+ * @brief Changes the currently applied font of the text to specified values
+ * @return Returns no value.
+ */
+char *ewl_text_font_get(Ewl_Text *ta)
+{
+ Ewl_Text_Op *op;
+ Ewl_Text_Op_Font *opf;
+ char *font = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET("ta", ta, NULL);
+
+ op = ewl_text_op_relevant_find(ta, EWL_TEXT_OP_TYPE_FONT_SET);
+ opf = (Ewl_Text_Op_Font *)op;
+ if (opf && opf->font) {
+ font = strdup(opf->font);
+ }
+
+ DRETURN_PTR(font, DLEVEL_STABLE);
+}
+
+static Ewl_Text_Op *
+ewl_text_op_relevant_find(Ewl_Text *ta, Ewl_Text_Op_Type type)
+{
+ Ecore_DList *l;
+ void *(*traverse)(Ecore_DList *l);
+ Ewl_Text_Op *op = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (REALIZED(ta)) {
+ l = ta->applied;
+ ecore_dlist_goto_first(l);
+ traverse = ecore_dlist_next;
+ }
+ else {
+ l = ta->ops;
+ ecore_dlist_goto_last(l);
+ traverse = ecore_dlist_previous;
+ }
+
+ while ((op = traverse(ta->ops)))
+ if (op->type == type)
+ break;
+
+ DRETURN_PTR(op, DLEVEL_STABLE);
+}
+
+/**
* @param ta: the text widget to map a coordinate to a character index
* @param x: the x coordinate over the desired character
* @param y: the y coordinate over the desired character
@@ -322,9 +376,9 @@
{
Ewl_Text_Op *op;
- while ((op = ecore_list_remove(ta->ops))) {
+ while ((op = ecore_dlist_remove(ta->ops))) {
op->apply(ta, op);
- ecore_list_append(ta->applied, op);
+ ecore_dlist_append(ta->applied, op);
}
}
@@ -360,10 +414,10 @@
DCHECK_PARAM_PTR("w", w);
ta = EWL_TEXT(w);
- ecore_list_destroy(ta->ops);
+ ecore_dlist_destroy(ta->ops);
ta->ops = NULL;
- ecore_list_destroy(ta->applied);
+ ecore_dlist_destroy(ta->applied);
ta->applied = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_textarea.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_textarea.h 13 May 2004 06:03:01 -0000 1.11
+++ ewl_textarea.h 19 May 2004 05:43:13 -0000 1.12
@@ -37,8 +37,8 @@
char *text; /**< The initial text in the text */
Evas_Object *etox; /**< Etox does the actual layout work */
Etox_Context *context; /**< Contains various format settings */
- Ecore_List *ops; /**< Series of operations to apply */
- Ecore_List *applied; /**< Applied set of operations */
+ Ecore_DList *ops; /**< Series of operations to apply */
+ Ecore_DList *applied; /**< Applied set of operations */
};
typedef enum
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs