Skip to content

Commit

Permalink
Don't use item_hpotmeter() for vpotmeter parsing.
Browse files Browse the repository at this point in the history
Add a new function parse_potmeter()
as a common parser for all potmeters.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37123 b3059339-0415-0410-9bf9-f77b7e298cf2
  • Loading branch information
ib committed Apr 4, 2014
1 parent 1b5e628 commit f5a26df
Showing 1 changed file with 33 additions and 17 deletions.
50 changes: 33 additions & 17 deletions gui/skin/skin.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,21 +589,21 @@ static int item_menu(char *in)
}

/**
* @brief Parse a @a hpotmeter definition.
* @brief Parse a hpotmeter or vpotmeter definition.
*
* Syntax: hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
* Parameters: button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
*
* @param item pointer to item to store the parameters in
* @param in definition to be analyzed
*
* @return 0 (ok) or 1 (error)
*/
static int item_hpotmeter(char *in)
static int parse_potmeter(guiItem *item, char *in)
{
unsigned char bfname[256];
unsigned char phfname[256];
unsigned char buf[512];
int bwidth, bheight, num, d, x, y, w, h, message;
guiItem *item;

if (!window_item("h/v potmeter"))
return 1;
Expand Down Expand Up @@ -645,12 +645,6 @@ static int item_hpotmeter(char *in)
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", num, d);
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);

item = next_item();

if (!item)
return 1;

item->type = itHPotmeter;
item->x = x;
item->y = y;
item->width = w;
Expand Down Expand Up @@ -694,6 +688,29 @@ static int item_hpotmeter(char *in)
return 0;
}

/**
* @brief Parse a @a hpotmeter definition.
*
* Syntax: hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
*
* @param in definition to be analyzed
*
* @return 0 (ok) or 1 (error)
*/
static int item_hpotmeter(char *in)
{
guiItem *item;

item = next_item();

if (!item)
return 1;

item->type = itHPotmeter;

return parse_potmeter(item, in);
}

/**
* @brief Parse a @a vpotmeter definition.
*
Expand All @@ -705,17 +722,16 @@ static int item_hpotmeter(char *in)
*/
static int item_vpotmeter(char *in)
{
int r;
guiItem *item;

r = item_hpotmeter(in);
item = next_item();

if (!item)
return 1;

if (r == 0) {
item = &currWinItems[*currWinItemIdx];
item->type = itVPotmeter;
}
item->type = itVPotmeter;

return r;
return parse_potmeter(item, in);
}

/**
Expand Down

0 comments on commit f5a26df

Please sign in to comment.