Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        tclass.c 


Log Message:
Simplify.

===================================================================
RCS file: /cvs/e/e16/e/src/tclass.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- tclass.c    28 Aug 2007 17:58:23 -0000      1.57
+++ tclass.c    5 Jan 2008 10:43:56 -0000       1.58
@@ -46,7 +46,7 @@
 }
 
 static TextState   *
-TextstateCreate(void)
+TextstateCreate(const char *font)
 {
    TextState          *ts;
 
@@ -57,6 +57,12 @@
    ts->style.mode = MODE_WRAP_CHAR;
    ts->style.orientation = FONT_TO_RIGHT;
 
+   if (font)
+     {
+       ts->fontname = TextstateFontLookup(font);
+       ts->style.mode = MODE_VERBATIM;
+     }
+
    return ts;
 }
 
@@ -274,147 +280,67 @@
          case CONFIG_DESKTOP:
          case ICLASS_NORMAL:
             if (tc)
-               tc->norm.normal = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->norm.normal = ts = TextstateCreate(s2);
             break;
          case ICLASS_CLICKED:
             if (tc)
-               tc->norm.clicked = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->norm.clicked = ts = TextstateCreate(s2);
             break;
          case ICLASS_HILITED:
             if (tc)
-               tc->norm.hilited = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->norm.hilited = ts = TextstateCreate(s2);
             break;
          case ICLASS_DISABLED:
             if (tc)
-               tc->norm.disabled = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->norm.disabled = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_NORMAL:
             if (tc)
-               tc->sticky.normal = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky.normal = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_CLICKED:
             if (tc)
-               tc->sticky.clicked = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky.clicked = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_HILITED:
             if (tc)
-               tc->sticky.hilited = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky.hilited = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_DISABLED:
             if (tc)
-               tc->sticky.disabled = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky.disabled = ts = TextstateCreate(s2);
             break;
          case ICLASS_ACTIVE_NORMAL:
             if (tc)
-               tc->active.normal = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->active.normal = ts = TextstateCreate(s2);
             break;
          case ICLASS_ACTIVE_CLICKED:
             if (tc)
-               tc->active.clicked = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->active.clicked = ts = TextstateCreate(s2);
             break;
          case ICLASS_ACTIVE_HILITED:
             if (tc)
-               tc->active.hilited = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->active.hilited = ts = TextstateCreate(s2);
             break;
          case ICLASS_ACTIVE_DISABLED:
             if (tc)
-               tc->active.disabled = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->active.disabled = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_ACTIVE_NORMAL:
             if (tc)
-               tc->sticky_active.normal = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky_active.normal = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_ACTIVE_CLICKED:
             if (tc)
-               tc->sticky_active.clicked = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky_active.clicked = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_ACTIVE_HILITED:
             if (tc)
-               tc->sticky_active.hilited = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky_active.hilited = ts = TextstateCreate(s2);
             break;
          case ICLASS_STICKY_ACTIVE_DISABLED:
             if (tc)
-               tc->sticky_active.disabled = ts = TextstateCreate();
-            if (ts)
-              {
-                 ts->fontname = TextstateFontLookup(s2);
-                 ts->style.mode = MODE_VERBATIM;
-              }
+               tc->sticky_active.disabled = ts = TextstateCreate(s2);
             break;
          case TEXT_MODE:
             if (ts)
@@ -465,9 +391,8 @@
      case ESIGNAL_INIT:
        /* create a fallback textclass in case no textclass is found */
        tc = TextclassCreate("__FALLBACK_TCLASS");
-       tc->norm.normal = TextstateCreate();
-       tc->norm.normal->fontname =
-          Estrdup("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*");
+       tc->norm.normal =
+          TextstateCreate("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*");
        SET_COLOR(&(tc->norm.normal->fg_col), 0, 0, 0);
        TextclassPopulate(tc);
        break;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to