Ejemplo n.º 1
0
int
TooltipConfigLoad(FILE * fs)
{
   int                 err = 0;
   char                s[FILEPATH_LEN_MAX];
   char                s2[FILEPATH_LEN_MAX];
   char                name[64];
   char                iclass[64];
   char                bubble1[64], bubble2[64], bubble3[64], bubble4[64];
   char                tclass[64];
   char                tooltiphelppic[64];
   int                 i1;
   int                 distance = 0;

   name[0] = iclass[0] = tclass[0] = '\0';
   bubble1[0] = bubble2[0] = bubble3[0] = bubble4[0] = '\0';
   tooltiphelppic[0] = '\0';

   while (GetLine(s, sizeof(s), fs))
     {
	i1 = ConfigParseline1(s, s2, NULL, NULL);
	switch (i1)
	  {
	  case CONFIG_CLOSE:
	     if (iclass[0] && tclass[0] && name[0])
		TooltipCreate(name, iclass, bubble1, bubble2,
			      bubble3, bubble4, tclass, distance,
			      tooltiphelppic);
	     goto done;

	  case CONFIG_CLASSNAME:
	     if (TooltipFind(s2))
	       {
		  SkipTillEnd(fs);
		  goto done;
	       }
	     STRCPY(name, s2);
	     break;
	  case TOOLTIP_DRAWICLASS:
	  case CONFIG_IMAGECLASS:
	     STRCPY(iclass, s2);
	     break;
	  case TOOLTIP_BUBBLE1:
	     STRCPY(bubble1, s2);
	     break;
	  case TOOLTIP_BUBBLE2:
	     STRCPY(bubble2, s2);
	     break;
	  case TOOLTIP_BUBBLE3:
	     STRCPY(bubble3, s2);
	     break;
	  case TOOLTIP_BUBBLE4:
	     STRCPY(bubble4, s2);
	     break;
	  case CONFIG_TEXT:
	     STRCPY(tclass, s2);
	     break;
	  case TOOLTIP_DISTANCE:
	     distance = atoi(s2);
	     break;
	  case TOOLTIP_HELP_PIC:
	     STRCPY(tooltiphelppic, s2);
	     break;
	  default:
	     ConfigParseError("ToolTip", s);
	     break;
	  }
     }
   err = -1;

 done:
   return err;
}
Ejemplo n.º 2
0
Archivo: iclass.c Proyecto: 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;
}
Ejemplo n.º 3
0
int
ECursorConfigLoad(FILE * fs)
{
   int                 err = 0;
   unsigned int        clr, clr2;
   char                s[FILEPATH_LEN_MAX];
   char                s2[FILEPATH_LEN_MAX];
   char               *p2;
   int                 i1, i2, r, g, b;
   char                name[FILEPATH_LEN_MAX], *pname;
   char                file[FILEPATH_LEN_MAX], *pfile;
   int                 native_id = -1;

   COLOR32_FROM_RGB(clr, 0, 0, 0);
   COLOR32_FROM_RGB(clr2, 255, 255, 255);

   pname = pfile = NULL;

   while (GetLine(s, sizeof(s), fs))
     {
	i1 = ConfigParseline1(s, s2, &p2, NULL);
	switch (i1)
	  {
	  case CONFIG_CURSOR:
	     err = -1;
	     i2 = atoi(s2);
	     if (i2 != CONFIG_OPEN)
		goto done;
	     COLOR32_FROM_RGB(clr, 0, 0, 0);
	     COLOR32_FROM_RGB(clr2, 255, 255, 255);
	     pname = pfile = NULL;
	     native_id = -1;
	     break;
	  case CONFIG_CLOSE:
	     ECursorCreate(pname, pfile, native_id, clr, clr2);
	     err = 0;
	     break;

	  case CONFIG_CLASSNAME:
	     if (ECursorFind(s2))
	       {
		  SkipTillEnd(fs);
		  goto done;
	       }
	     strcpy(name, s2);
	     pname = name;
	     break;
	  case CURS_BG_RGB:
	     r = g = b = 0;
	     sscanf(p2, "%d %d %d", &r, &g, &b);
	     COLOR32_FROM_RGB(clr, r, g, b);
	     break;
	  case CURS_FG_RGB:
	     r = g = b = 255;
	     sscanf(p2, "%d %d %d", &r, &g, &b);
	     COLOR32_FROM_RGB(clr2, r, g, b);
	     break;
	  case XBM_FILE:
	     strcpy(file, s2);
	     pfile = file;
	     break;
	  case NATIVE_ID:
	     native_id = atoi(s2);
	     break;
	  default:
	     break;
	  }
     }

 done:
   if (err)
      ConfigAlertLoad("Cursor");

   return err;
}