Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_text.c
Log Message:
- if we try to get a formatting value from the text and there is either no
formatting node, or no context on that node (happens when no text has been
entered so there is no formatting nodes) we get the data from the default
context
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -3 -r1.151 -r1.152
--- ewl_text.c 6 Jan 2007 12:00:17 -0000 1.151
+++ ewl_text.c 6 Jan 2007 12:16:54 -0000 1.152
@@ -1180,8 +1180,19 @@
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, NULL);
fmt = ewl_text_fmt_get(t, char_idx);
- if (fmt && fmt->tx && fmt->tx->font)
- font = strdup(fmt->tx->font);
+ if (fmt && fmt->tx)
+ {
+ if (fmt->tx->font)
+ font = strdup(fmt->tx->font);
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (tx->font) font = strdup(tx->font);
+ ewl_text_context_release(tx);
+ }
DRETURN_PTR(font, DLEVEL_STABLE);
}
@@ -1273,8 +1284,19 @@
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, NULL);
fmt = ewl_text_fmt_get(t, char_idx);
- if (fmt && fmt->tx && fmt->tx->font_source)
- source = strdup(fmt->tx->font_source);
+ if (fmt && fmt->tx)
+ {
+ if (fmt->tx->font_source)
+ source = strdup(fmt->tx->font_source);
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (tx->font_source) source = strdup(tx->font_source);
+ ewl_text_context_release(tx);
+ }
DRETURN_PTR(source, DLEVEL_STABLE);
}
@@ -1345,14 +1367,26 @@
ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx)
{
Ewl_Text_Fmt *fmt;
+ int size = 0;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET("t", t, 0);
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, 0);
fmt = ewl_text_fmt_get(t, char_idx);
+ if (fmt && fmt->tx)
+ size = fmt->tx->size;
+
+ else
+ {
+ Ewl_Text_Context *tx;
- DRETURN_INT(((fmt && fmt->tx) ? fmt->tx->size : 0), DLEVEL_STABLE);
+ tx = ewl_text_context_default_create(t);
+ size = tx->size;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(size, DLEVEL_STABLE);
}
/**
@@ -1456,6 +1490,17 @@
if (b) *b = fmt->tx->color.b;
if (a) *a = fmt->tx->color.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->color.r;
+ if (g) *g = tx->color.g;
+ if (b) *b = tx->color.b;
+ if (a) *a = tx->color.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1526,14 +1571,26 @@
ewl_text_align_get(Ewl_Text *t, unsigned int char_idx)
{
Ewl_Text_Fmt *fmt;
+ int align = 0;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET("t", t, 0);
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, 0);
fmt = ewl_text_fmt_get(t, char_idx);
+ if (fmt && fmt->tx)
+ align = fmt->tx->align;
- DRETURN_INT(((fmt && fmt->tx) ? fmt->tx->align : 0), DLEVEL_STABLE);
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ align = tx->align;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(align, DLEVEL_STABLE);
}
/**
@@ -1712,14 +1769,26 @@
ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx)
{
Ewl_Text_Fmt *fmt;
+ int styles = 0;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET("t", t, 0);
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, 0);
fmt = ewl_text_fmt_get(t, char_idx);
+ if (fmt && fmt->tx)
+ styles = fmt->tx->styles;
+
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ styles = tx->styles;
+ ewl_text_context_release(tx);
+ }
- DRETURN_INT(((fmt && fmt->tx) ? fmt->tx->styles : 0), DLEVEL_STABLE);
+ DRETURN_INT(styles, DLEVEL_STABLE);
}
/**
@@ -1796,14 +1865,26 @@
ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx)
{
Ewl_Text_Fmt *fmt;
+ int wrap = 0;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET("t", t, 0);
DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, 0);
fmt = ewl_text_fmt_get(t, char_idx);
+ if (fmt && fmt->tx)
+ wrap = fmt->tx->wrap;
+
+ else
+ {
+ Ewl_Text_Context *tx;
- DRETURN_INT(((fmt && fmt->tx) ? fmt->tx->wrap : 0), DLEVEL_STABLE);
+ tx = ewl_text_context_default_create(t);
+ wrap = tx->wrap;
+ ewl_text_context_release(tx);
+ }
+
+ DRETURN_INT(wrap, DLEVEL_STABLE);
}
/**
@@ -1907,6 +1988,17 @@
if (b) *b = fmt->tx->style_colors.bg.b;
if (a) *a = fmt->tx->style_colors.bg.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.bg.r;
+ if (g) *g = tx->style_colors.bg.g;
+ if (b) *b = tx->style_colors.bg.b;
+ if (a) *a = tx->style_colors.bg.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2012,6 +2104,17 @@
if (b) *b = fmt->tx->style_colors.glow.b;
if (a) *a = fmt->tx->style_colors.glow.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.glow.r;
+ if (g) *g = tx->style_colors.glow.g;
+ if (b) *b = tx->style_colors.glow.b;
+ if (a) *a = tx->style_colors.glow.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2117,6 +2220,17 @@
if (b) *b = fmt->tx->style_colors.outline.b;
if (a) *a = fmt->tx->style_colors.outline.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.outline.r;
+ if (g) *g = tx->style_colors.outline.g;
+ if (b) *b = tx->style_colors.outline.b;
+ if (a) *a = tx->style_colors.outline.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2222,6 +2336,17 @@
if (b) *b = fmt->tx->style_colors.shadow.b;
if (a) *a = fmt->tx->style_colors.shadow.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.shadow.r;
+ if (g) *g = tx->style_colors.shadow.g;
+ if (b) *b = tx->style_colors.shadow.b;
+ if (a) *a = tx->style_colors.shadow.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2327,6 +2452,17 @@
if (b) *b = fmt->tx->style_colors.strikethrough.b;
if (a) *a = fmt->tx->style_colors.strikethrough.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.strikethrough.r;
+ if (g) *g = tx->style_colors.strikethrough.g;
+ if (b) *b = tx->style_colors.strikethrough.b;
+ if (a) *a = tx->style_colors.strikethrough.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2432,6 +2568,17 @@
if (b) *b = fmt->tx->style_colors.outline.b;
if (a) *a = fmt->tx->style_colors.outline.a;
}
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.outline.r;
+ if (g) *g = tx->style_colors.outline.g;
+ if (b) *b = tx->style_colors.outline.b;
+ if (a) *a = tx->style_colors.outline.a;
+ ewl_text_context_release(tx);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2536,6 +2683,17 @@
if (g) *g = fmt->tx->style_colors.double_underline.g;
if (b) *b = fmt->tx->style_colors.double_underline.b;
if (a) *a = fmt->tx->style_colors.double_underline.a;
+ }
+ else
+ {
+ Ewl_Text_Context *tx;
+
+ tx = ewl_text_context_default_create(t);
+ if (r) *r = tx->style_colors.double_underline.r;
+ if (g) *g = tx->style_colors.double_underline.g;
+ if (b) *b = tx->style_colors.double_underline.b;
+ if (a) *a = tx->style_colors.double_underline.a;
+ ewl_text_context_release(tx);
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs