コード例 #1
0
ファイル: iclass.c プロジェクト: burzumishi/e16
static ImageClass  *
ImageclassGetFallback(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__fb_ic", 0);
   if (ic)
      return ic;

   /* Create fallback imageclass */
   ic = ImageclassCreate("__fb_ic");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreateX(255, 255, 0, 0, 160, 160, 160);
   ic->norm.hilited = ImagestateCreateX(255, 255, 0, 0, 192, 192, 192);
   ic->norm.clicked = ImagestateCreateX(0, 0, 255, 255, 192, 192, 192);
   ic->active.normal = ImagestateCreateX(255, 255, 0, 0, 180, 140, 160);
   ic->active.hilited = ImagestateCreateX(255, 255, 0, 0, 230, 190, 210);
   ic->active.clicked = ImagestateCreateX(0, 0, 255, 255, 230, 190, 210);

   ic->padding.left = 4;
   ic->padding.right = 4;
   ic->padding.top = 4;
   ic->padding.bottom = 4;

   ImageclassPopulate(ic);

   return ic;
}
コード例 #2
0
ファイル: iclass.c プロジェクト: Limsik/e17
static ImageClass  *
ImageclassGetFallback(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__fb_ic", 0);
   if (ic)
      return ic;

   /* Create fallback imageclass */
   ic = ImageclassCreate("__fb_ic");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.normal, 255, 255, 160, 0, 0);
   ic->norm.normal->bevelstyle = BEVEL_AMIGA;

   ic->norm.hilited = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.hilited, 255, 255, 192, 0, 0);
   ic->norm.hilited->bevelstyle = BEVEL_AMIGA;

   ic->norm.clicked = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.clicked, 0, 0, 192, 255, 255);
   ic->norm.clicked->bevelstyle = BEVEL_AMIGA;

   ic->active.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.normal, 255, 255, 0, 0, 0);
   COLOR32_FROM_RGB(ic->active.normal->bg, 180, 140, 160);
   ic->active.normal->bevelstyle = BEVEL_AMIGA;

   ic->active.hilited = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.hilited, 255, 255, 0, 0, 0);
   COLOR32_FROM_RGB(ic->active.hilited->bg, 230, 190, 210);
   ic->active.hilited->bevelstyle = BEVEL_AMIGA;

   ic->active.clicked = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.clicked, 0, 0, 0, 255, 255);
   COLOR32_FROM_RGB(ic->active.clicked->bg, 230, 190, 210);
   ic->active.clicked->bevelstyle = BEVEL_AMIGA;

   ic->padding.left = 4;
   ic->padding.right = 4;
   ic->padding.top = 4;
   ic->padding.bottom = 4;

   ImageclassPopulate(ic);

   return ic;
}
コード例 #3
0
ファイル: iclass.c プロジェクト: Limsik/e17
ImageClass         *
ImageclassCreateSimple(const char *name, const char *image)
{
   ImageClass         *ic;

   ic = ImageclassCreate(name);
   if (!ic)
      return NULL;

   ic->norm.normal = ImagestateCreate(image);
   ic->norm.normal->unloadable = 1;
   ImageclassPopulate(ic);

   ImagestateRealize(ic->norm.normal);

   return ic;
}
コード例 #4
0
ファイル: iclass.c プロジェクト: Limsik/e17
ImageClass         *
ImageclassGetBlack(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__BLACK", 0);
   if (ic)
      return ic;

   /* Create all black image class for filler borders */
   ic = ImageclassCreate("__BLACK");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.normal, 0, 0, 0, 0, 0);

   ImageclassPopulate(ic);

   return ic;
}
コード例 #5
0
ファイル: iclass.c プロジェクト: Limsik/e17
int
ImageclassConfigLoad(FILE * fs)
{
   int                 err = 0;
   char                s[FILEPATH_LEN_MAX];
   char                s2[FILEPATH_LEN_MAX];
   char               *p2;
   int                 i1;
   ImageClass         *ic = NULL;
   ImageState         *is = NULL;
   int                 l, r, t, b;

   while (GetLine(s, sizeof(s), fs))
     {
	i1 = ConfigParseline1(s, s2, &p2, NULL);

	/* ic not needed */
	switch (i1)
	  {
	  case CONFIG_CLOSE:
	     ImageclassPopulate(ic);
	     goto done;
	  case CONFIG_COLORMOD:
	  case ICLASS_COLORMOD:
	     continue;
	  case CONFIG_CLASSNAME:
	  case ICLASS_NAME:
	     if (ImageclassFind(s2, 0))
	       {
		  SkipTillEnd(fs);
		  goto done;
	       }
	     ic = ImageclassCreate(s2);
	     continue;
	  }

	/* ic needed */
	if (!ic)
	   break;

	switch (i1)
	  {
	  case CONFIG_INHERIT:
	     {
		ImageClass         *ic2;

		ic2 = ImageclassFind(s2, 0);
		if (!ic2)
		   goto not_ok;
		ic->norm = ic2->norm;
		ic->active = ic2->active;
		ic->sticky = ic2->sticky;
		ic->sticky_active = ic2->sticky_active;
		ic->padding = ic2->padding;
	     }
	     continue;
	  case ICLASS_PADDING:
	     l = r = t = b = 0;
	     sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
	     ic->padding.left = l;
	     ic->padding.right = r;
	     ic->padding.top = t;
	     ic->padding.bottom = b;
	     continue;
	  case CONFIG_DESKTOP:
	     /* don't ask... --mandrake */
	  case ICLASS_NORMAL:
	     is = ImagestateSet(&ic->norm.normal, s2);
	     continue;
	  case ICLASS_CLICKED:
	     is = ImagestateSet(&ic->norm.clicked, s2);
	     continue;
	  case ICLASS_HILITED:
	     is = ImagestateSet(&ic->norm.hilited, s2);
	     continue;
	  case ICLASS_DISABLED:
	     is = ImagestateSet(&ic->norm.disabled, s2);
	     continue;
	  case ICLASS_STICKY_NORMAL:
	     is = ImagestateSet(&ic->sticky.normal, s2);
	     continue;
	  case ICLASS_STICKY_CLICKED:
	     is = ImagestateSet(&ic->sticky.clicked, s2);
	     continue;
	  case ICLASS_STICKY_HILITED:
	     is = ImagestateSet(&ic->sticky.hilited, s2);
	     continue;
	  case ICLASS_STICKY_DISABLED:
	     is = ImagestateSet(&ic->sticky.disabled, s2);
	     continue;
	  case ICLASS_ACTIVE_NORMAL:
	     is = ImagestateSet(&ic->active.normal, s2);
	     continue;
	  case ICLASS_ACTIVE_CLICKED:
	     is = ImagestateSet(&ic->active.clicked, s2);
	     continue;
	  case ICLASS_ACTIVE_HILITED:
	     is = ImagestateSet(&ic->active.hilited, s2);
	     continue;
	  case ICLASS_ACTIVE_DISABLED:
	     is = ImagestateSet(&ic->active.disabled, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_NORMAL:
	     is = ImagestateSet(&ic->sticky_active.normal, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_CLICKED:
	     is = ImagestateSet(&ic->sticky_active.clicked, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_HILITED:
	     is = ImagestateSet(&ic->sticky_active.hilited, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_DISABLED:
	     is = ImagestateSet(&ic->sticky_active.disabled, s2);
	     continue;
	  }

	/* is needed */
	if (!is)
	   break;

	switch (i1)
	  {
	  case ICLASS_LRTB:
	     if (!is->border)
		is->border = EMALLOC(EImageBorder, 1);
	     l = r = t = b = 0;
	     sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
	     is->border->left = l;
	     is->border->right = r;
	     is->border->top = t;
	     is->border->bottom = b;
	     /* Hmmm... imlib2 works better with this */
	     is->border->right++;
	     is->border->bottom++;
	     continue;
	  case ICLASS_FILLRULE:
	     is->pixmapfillstyle = atoi(s2);
	     continue;
	  case ICLASS_TRANSPARENT:
	     is->transparent = strtoul(s2, NULL, 0);
	     continue;
	  case ICLASS_ROTATE:	/* flip goes here too */
	     is->rotate = strtoul(s2, NULL, 0);
	     continue;
	  case ICLASS_BEVEL:
	     {
		int                 n, bevel;

		n = sscanf(p2, "%i %i %i %i %i %i",
			   &bevel, &is->hihi, &is->hi, &is->bg, &is->lo,
			   &is->lolo);
		if (n < 6)
		   goto not_ok;
		is->bevelstyle = bevel;
	     }
	     continue;
	  default:
	     goto not_ok;
	  }
     }
 not_ok:
   err = -1;

 done:
   return err;
}