Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_text.c ewl_text.h
Log Message:
More work on the text widget, filled in some docs and moved some of the text
setting functionality around. Also fixed prepending text.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_text.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- ewl_text.c 10 Jul 2004 19:25:50 -0000 1.68
+++ ewl_text.c 19 Jul 2004 05:59:41 -0000 1.69
@@ -24,6 +24,7 @@
static Ewl_Text_Op *ewl_text_op_align_new(Ewl_Text *ta, unsigned int align);
static void ewl_text_op_align_apply(Ewl_Text *ta, Ewl_Text_Op *op);
+static Ewl_Text_Op * ewl_text_op_text_set_new(Ewl_Text *ta, char *text);
static Ewl_Text_Op *ewl_text_op_text_append_new(Ewl_Text *ta, char *text);
static Ewl_Text_Op *ewl_text_op_text_prepend_new(Ewl_Text *ta, char *text);
static Ewl_Text_Op *ewl_text_op_text_insert_new(Ewl_Text *ta, char *text,
@@ -36,7 +37,10 @@
* @return Returns a pointer to a new text on success, NULL on failure.
* @brief Allocate a new text area widget
*
- * Sets the text initially to @a text if not NULL.
+ * Sets the text initially to @a text if not NULL. This initial text will use
+ * the default formatting information from the theme. Pass @a text as NULL and
+ * use ewl_text_text_set after changing the settings to change attributes the
+ * text.
*/
Ewl_Widget *ewl_text_new(char *text)
{
@@ -107,29 +111,15 @@
*/
void ewl_text_text_set(Ewl_Text * ta, char *text)
{
+ Ewl_Text_Op *op;
+
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("ta", ta);
- if (text) {
- /*
- * Keep a copy of the text for quick access and for creating
- * the etox when needed.
- */
- ta->text = strdup(text);
- ta->length = strlen(text);
- }
- else {
- ta->text = NULL;
- ta->length = 0;
- }
-
- /*
- * Update the etox and the sizing of the text widget.
- */
- if (ta->etox) {
- etox_set_text(ta->etox, text);
- ewl_text_update_size(ta);
- }
+ op = ewl_text_op_text_set_new(ta, text);
+ ecore_dlist_append(ta->ops, op);
+ if (REALIZED(ta))
+ ewl_text_ops_apply(ta);
text = (text ? strdup(text) : NULL);
ewl_callback_call_with_event_data(EWL_WIDGET(ta),
@@ -178,7 +168,7 @@
DCHECK_PARAM_PTR("ta", ta);
op = ewl_text_op_text_prepend_new(ta, text);
- ecore_dlist_prepend(ta->ops, op);
+ ecore_dlist_append(ta->ops, op);
if (REALIZED(ta))
ewl_text_ops_apply(ta);
@@ -528,7 +518,8 @@
/*
* Now set the text and display it.
*/
- etox_set_text(ta->etox, ta->text);
+ if (ta->text)
+ etox_set_text(ta->etox, ta->text);
evas_object_show(ta->etox);
ewl_text_ops_apply(ta);
@@ -833,6 +824,26 @@
}
static Ewl_Text_Op *
+ewl_text_op_text_set_new(Ewl_Text *ta, char *text)
+{
+ Ewl_Text_Op *op;
+ Ewl_Text_Op_Text *ops;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ op = NEW(Ewl_Text_Op_Text, 1);
+ if (op) {
+ ops = (Ewl_Text_Op_Text *)op;
+ op->type = EWL_TEXT_OP_TYPE_TEXT_SET;
+ op->apply = ewl_text_op_text_apply;
+ op->free = ewl_text_op_text_free;
+ ops->text = strdup(text);
+ }
+
+ DRETURN_PTR(op, DLEVEL_STABLE);
+}
+
+static Ewl_Text_Op *
ewl_text_op_text_append_new(Ewl_Text *ta, char *text)
{
Ewl_Text_Op *op;
@@ -900,7 +911,9 @@
DENTER_FUNCTION(DLEVEL_STABLE);
- if (op->type == EWL_TEXT_OP_TYPE_TEXT_APPEND)
+ if (op->type == EWL_TEXT_OP_TYPE_TEXT_SET)
+ etox_set_text(ta->etox, opt->text);
+ else if (op->type == EWL_TEXT_OP_TYPE_TEXT_APPEND)
etox_append_text(ta->etox, opt->text);
else if (op->type == EWL_TEXT_OP_TYPE_TEXT_PREPEND)
etox_prepend_text(ta->etox, opt->text);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_text.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ewl_text.h 27 May 2004 20:15:17 -0000 1.30
+++ ewl_text.h 19 Jul 2004 05:59:41 -0000 1.31
@@ -61,6 +61,7 @@
EWL_TEXT_OP_TYPE_STYLE_SET,
EWL_TEXT_OP_TYPE_ALIGN_SET,
EWL_TEXT_OP_TYPE_SELECT,
+ EWL_TEXT_OP_TYPE_TEXT_SET,
EWL_TEXT_OP_TYPE_TEXT_PREPEND,
EWL_TEXT_OP_TYPE_TEXT_APPEND,
EWL_TEXT_OP_TYPE_TEXT_INSERT,
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs