Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        iclass.c tclass.c 


Log Message:
Cleanups.

===================================================================
RCS file: /cvs/e/e16/e/src/iclass.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -3 -r1.113 -r1.114
--- iclass.c    15 Feb 2007 03:30:18 -0000      1.113
+++ iclass.c    25 Feb 2007 04:15:41 -0000      1.114
@@ -1490,17 +1490,16 @@
        return;
      }
 
-   if (!strcmp(param2, "create"))
-     {
-     }
-   else if (!strcmp(param2, "delete"))
+   if (!param1[0])
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
-          ImageclassDestroy(ic);
+       IpcPrintf("ImageClass not specified\n");
+       return;
      }
-   else if (!strcmp(param2, "modify"))
+
+   if (!strcmp(param2, "create"))
      {
+       /* Not implemented */
+       return;
      }
    else if (!strcmp(param2, "free_pixmap"))
      {
@@ -1509,130 +1508,123 @@
        word(params, 3, param3);
        p = (Pixmap) strtol(param3, (char **)NULL, 0);
        EImagePixmapFree(p);
+       return;
+     }
+
+   ic = ImageclassFind(param1, 0);
+   if (!ic)
+     {
+       IpcPrintf("ImageClass not found: %s\n", param1);
+       return;
+     }
+
+   if (!strcmp(param2, "delete"))
+     {
+       ImageclassDestroy(ic);
+     }
+   else if (!strcmp(param2, "modify"))
+     {
+       /* Not implemented */
      }
    else if (!strcmp(param2, "get_padding"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
-          IpcPrintf("%i %i %i %i\n",
-                    ic->padding.left, ic->padding.right,
-                    ic->padding.top, ic->padding.bottom);
-       else
-          IpcPrintf("Error: Imageclass does not exist\n");
+       IpcPrintf("%i %i %i %i\n",
+                 ic->padding.left, ic->padding.right,
+                 ic->padding.top, ic->padding.bottom);
      }
    else if (!strcmp(param2, "get_image_size"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
+       ImagestateRealize(ic->norm.normal);
+       if (ic->norm.normal->im)
          {
-            ImagestateRealize(ic->norm.normal);
-            if (ic->norm.normal->im)
-              {
-                 int                 w, h;
-
-                 EImageGetSize(ic->norm.normal->im, &w, &h);
-                 EImageFree(ic->norm.normal->im);
-                 IpcPrintf("%i %i\n", w, h);
-              }
+            int                 w, h;
+
+            EImageGetSize(ic->norm.normal->im, &w, &h);
+            EImageFree(ic->norm.normal->im);
+            IpcPrintf("%i %i\n", w, h);
          }
-       else
-          IpcPrintf("Error: Imageclass does not exist\n");
      }
    else if (!strcmp(param2, "apply"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
-         {
-            Window              xwin;
-            Win                 win;
-            char                state[20];
-            const char         *winptr, *hptr;
-            int                 st, w = -1, h = -1;
-
-            winptr = atword(params, 3);
-            xwin = (Window) strtoul(winptr, NULL, 0);
-            win = ECreateWinFromXwin(xwin);
-            if (!win)
-               return;
-
-            word(params, 4, state);
-            if (!strcmp(state, "hilited"))
-               st = STATE_HILITED;
-            else if (!strcmp(state, "clicked"))
-               st = STATE_CLICKED;
-            else if (!strcmp(state, "disabled"))
-               st = STATE_DISABLED;
-            else
-               st = STATE_NORMAL;
-
-            hptr = atword(params, 6);
-            if (hptr)
-              {
-                 w = (int)strtol(atword(params, 5), NULL, 0);
-                 h = (int)strtol(hptr, NULL, 0);
-              }
+       Window              xwin;
+       Win                 win;
+       char                state[20];
+       const char         *winptr, *hptr;
+       int                 st, w = -1, h = -1;
+
+       winptr = atword(params, 3);
+       xwin = (Window) strtoul(winptr, NULL, 0);
+       win = ECreateWinFromXwin(xwin);
+       if (!win)
+          return;
+
+       word(params, 4, state);
+       if (!strcmp(state, "hilited"))
+          st = STATE_HILITED;
+       else if (!strcmp(state, "clicked"))
+          st = STATE_CLICKED;
+       else if (!strcmp(state, "disabled"))
+          st = STATE_DISABLED;
+       else
+          st = STATE_NORMAL;
 
-            ImageclassApply(ic, win, w, h, 0, 0, st, ST_SOLID);
-            EDestroyWin(win);
+       hptr = atword(params, 6);
+       if (hptr)
+         {
+            w = (int)strtol(atword(params, 5), NULL, 0);
+            h = (int)strtol(hptr, NULL, 0);
          }
+
+       ImageclassApply(ic, win, w, h, 0, 0, st, ST_SOLID);
+       EDestroyWin(win);
      }
    else if (!strcmp(param2, "apply_copy"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
+       Window              xwin;
+       Win                 win;
+       char                state[20];
+       const char         *winptr, *hptr;
+       int                 st, w = -1, h = -1;
+       PmapMask            pmm;
+
+       winptr = atword(params, 3);
+       xwin = (Window) strtoul(winptr, NULL, 0);
+
+       word(params, 4, state);
+       if (!strcmp(state, "hilited"))
+          st = STATE_HILITED;
+       else if (!strcmp(state, "clicked"))
+          st = STATE_CLICKED;
+       else if (!strcmp(state, "disabled"))
+          st = STATE_DISABLED;
+       else
+          st = STATE_NORMAL;
+
+       hptr = atword(params, 6);
+       if (!hptr)
          {
-            Window              xwin;
-            Win                 win;
-            char                state[20];
-            const char         *winptr, *hptr;
-            int                 st, w = -1, h = -1;
-            PmapMask            pmm;
-
-            winptr = atword(params, 3);
-            xwin = (Window) strtoul(winptr, NULL, 0);
-
-            word(params, 4, state);
-            if (!strcmp(state, "hilited"))
-               st = STATE_HILITED;
-            else if (!strcmp(state, "clicked"))
-               st = STATE_CLICKED;
-            else if (!strcmp(state, "disabled"))
-               st = STATE_DISABLED;
-            else
-               st = STATE_NORMAL;
-
-            hptr = atword(params, 6);
-            if (!hptr)
-              {
-                 IpcPrintf("Error:  missing width and/or height\n");
-                 return;
-              }
+            IpcPrintf("Error:  missing width and/or height\n");
+            return;
+         }
 
-            w = (int)strtol(atword(params, 5), NULL, 0);
-            h = (int)strtol(hptr, NULL, 0);
+       w = (int)strtol(atword(params, 5), NULL, 0);
+       h = (int)strtol(hptr, NULL, 0);
 
-            win = ECreateWinFromXwin(xwin);
-            if (!win)
-               return;
-
-            ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm, 1, ST_SOLID);
-            IpcPrintf("0x%08lx 0x%08lx\n", pmm.pmap, pmm.mask);
-            EDestroyWin(win);
-         }
+       win = ECreateWinFromXwin(xwin);
+       if (!win)
+          return;
+
+       ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm, 1, ST_SOLID);
+       IpcPrintf("0x%08lx 0x%08lx\n", pmm.pmap, pmm.mask);
+       EDestroyWin(win);
      }
-   else if (!strcmp(param2, "ref_count"))
+   else if (!strcmp(param2, "query"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
-          IpcPrintf("%u references remain\n", ic->ref_count);
+       IpcPrintf("ImageClass %s found\n", ic->name);
      }
-   else if (!strcmp(param2, "query"))
+   else if (!strcmp(param2, "ref_count"))
      {
-       ic = ImageclassFind(param1, 0);
-       if (ic)
-          IpcPrintf("ImageClass %s found\n", ic->name);
-       else
-          IpcPrintf("ImageClass %s not found\n", param1);
+       IpcPrintf("%u references remain\n", ic->ref_count);
      }
    else
      {
===================================================================
RCS file: /cvs/e/e16/e/src/tclass.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- tclass.c    17 Jan 2007 01:10:43 -0000      1.51
+++ tclass.c    25 Feb 2007 04:15:41 -0000      1.52
@@ -524,6 +524,12 @@
        return;
      }
 
+   if (!strcmp(param2, "create"))
+     {
+       /* Not implemented */
+       return;
+     }
+
    tc = TextclassFind(param1, 0);
    if (!tc)
      {
@@ -531,82 +537,70 @@
        return;
      }
 
-   if (!strcmp(param2, "create"))
-     {
-     }
-   else if (!strcmp(param2, "delete"))
+   if (!strcmp(param2, "delete"))
      {
-       if (tc)
-          TextclassDestroy(tc);
+       TextclassDestroy(tc);
      }
    else if (!strcmp(param2, "modify"))
      {
+       /* Not implemented */
      }
    else if (!strcmp(param2, "apply"))
      {
-       if (tc)
-         {
-            Window              xwin;
-            Win                 win;
-            int                 state;
-            int                 x, y;
-            const char         *txt;
-
-            word(params, 3, param3);
-            xwin = (Window) strtoul(param3, NULL, 0);
-
-            word(params, 4, param3);
-            x = atoi(param3);
-            word(params, 5, param3);
-            y = atoi(param3);
-
-            word(params, 6, param3);
-            state = STATE_NORMAL;
-            if (!strcmp(param3, "normal"))
-               state = STATE_NORMAL;
-            else if (!strcmp(param3, "hilited"))
-               state = STATE_HILITED;
-            else if (!strcmp(param3, "clicked"))
-               state = STATE_CLICKED;
-            else if (!strcmp(param3, "disabled"))
-               state = STATE_DISABLED;
-
-            txt = atword(params, 7);
-            if (!txt)
-               return;
-
-            win = ECreateWinFromXwin(xwin);
-            if (!win)
-               return;
-
-            TextDraw(tc, win, None, 0, 0, state, txt, x, y, 99999, 99999, 17,
-                     0);
-            EDestroyWin(win);
-         }
+       Window              xwin;
+       Win                 win;
+       int                 state;
+       int                 x, y;
+       const char         *txt;
+
+       word(params, 3, param3);
+       xwin = (Window) strtoul(param3, NULL, 0);
+
+       word(params, 4, param3);
+       x = atoi(param3);
+       word(params, 5, param3);
+       y = atoi(param3);
+
+       word(params, 6, param3);
+       state = STATE_NORMAL;
+       if (!strcmp(param3, "normal"))
+          state = STATE_NORMAL;
+       else if (!strcmp(param3, "hilited"))
+          state = STATE_HILITED;
+       else if (!strcmp(param3, "clicked"))
+          state = STATE_CLICKED;
+       else if (!strcmp(param3, "disabled"))
+          state = STATE_DISABLED;
+
+       txt = atword(params, 7);
+       if (!txt)
+          return;
+
+       win = ECreateWinFromXwin(xwin);
+       if (!win)
+          return;
+
+       TextDraw(tc, win, None, 0, 0, state, txt, x, y, 99999, 99999, 17, 0);
+       EDestroyWin(win);
      }
    else if (!strcmp(param2, "query_size"))
      {
-       if (tc)
-         {
-            int                 w, h;
-            const char         *txt;
-
-            w = h = 0;
-            txt = atword(params, 3);
-            if (txt)
-               TextSize(tc, 0, 0, STATE_NORMAL, txt, &w, &h, 17);
-            IpcPrintf("%i %i\n", w, h);
-         }
+       int                 w, h;
+       const char         *txt;
+
+       w = h = 0;
+       txt = atword(params, 3);
+       if (txt)
+          TextSize(tc, 0, 0, STATE_NORMAL, txt, &w, &h, 17);
+       IpcPrintf("%i %i\n", w, h);
      }
    else if (!strcmp(param2, "query"))
      {
-       if (tc)
-          IpcPrintf("TextClass %s found\n", tc->name);
+       IpcPrintf("TextClass %s found\n", tc->name);
      }
    else if (!strcmp(param2, "ref_count"))
      {
-       if (tc)
-          IpcPrintf("%u references remain.\n", tc->ref_count);
+       IpcPrintf("%u references remain\n", tc->ref_count);
      }
    else
      {



-------------------------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to