Mercurial > mplayer.hg
changeset 33058:b8374f9dc87b
Replace macro by function.
The check whether a command is forbidden within a specific window
is now performed by function in_window().
author | ib |
---|---|
date | Tue, 29 Mar 2011 11:17:01 +0000 |
parents | 0d6b33bc311e |
children | 492520edebad |
files | gui/skin/skin.c |
diffstat | 1 files changed, 54 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/skin/skin.c Tue Mar 29 10:47:07 2011 +0000 +++ b/gui/skin/skin.c Tue Mar 29 11:17:01 2011 +0000 @@ -80,15 +80,16 @@ return 1; } -#define CHECK(name) \ - { \ - if (!strcmp(currWinName, name)) \ - { \ - skin_error(MSGTR_SKIN_ERROR_IN_WINDOW, name); \ - return 1; \ - } \ +static int in_window(char *name) +{ + if (strcmp(currWinName, name) == 0) { + skin_error(MSGTR_SKIN_ERROR_IN_WINDOW, name); + return 1; } + return 0; +} + int skinBPRead(char *fname, txSample *bf) { int i = bpRead(fname, bf); @@ -339,8 +340,10 @@ if (!window_cmd("background")) return 1; - CHECK("menu"); - CHECK("main"); + if (in_window("main")) + return 1; + if (in_window("menu")) + return 1; currWin->R = cutItemToInt(in, ',', 0); currWin->G = cutItemToInt(in, ',', 1); @@ -362,8 +365,10 @@ if (!window_cmd("button")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; cutItem(in, fname, ',', 0); x = cutItemToInt(in, ',', 1); @@ -420,9 +425,12 @@ if (!window_cmd("selected")) return 1; - CHECK("main"); - CHECK("sub"); - CHECK("playbar"); + if (in_window("main")) + return 1; + if (in_window("sub")) + return 1; + if (in_window("playbar")) + return 1; cutItem(in, fname, ',', 0); @@ -453,9 +461,12 @@ if (!window_cmd("menu")) return 1; - CHECK("main"); - CHECK("sub"); - CHECK("playbar"); + if (in_window("main")) + return 1; + if (in_window("sub")) + return 1; + if (in_window("playbar")) + return 1; x = cutItemToInt(in, ',', 0); y = cutItemToInt(in, ',', 1); @@ -495,8 +506,10 @@ if (!window_cmd("h/v potmeter")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; cutItem(in, pfname, ',', 0); pwidth = cutItemToInt(in, ',', 1); @@ -584,8 +597,10 @@ if (!window_cmd("potmeter")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; cutItem(in, phfname, ',', 0); ph = cutItemToInt(in, ',', 1); @@ -636,8 +651,10 @@ if (!window_cmd("font")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; cutItem(in, name, ',', 0); @@ -680,8 +697,10 @@ if (!window_cmd("slabel")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; x = cutItemToInt(in, ',', 0); y = cutItemToInt(in, ',', 1); @@ -730,8 +749,10 @@ if (!window_cmd("dlabel")) return 1; - CHECK("sub"); - CHECK("menu"); + if (in_window("sub")) + return 1; + if (in_window("menu")) + return 1; x = cutItemToInt(in, ',', 0); y = cutItemToInt(in, ',', 1); @@ -781,9 +802,12 @@ if (!window_cmd("decoration")) return 1; - CHECK("sub"); - CHECK("menu"); - CHECK("playbar"); + if (in_window("sub")) + return 1; + if (in_window("playbar")) + return 1; + if (in_window("menu")) + return 1; cutItem(strlower(in), tmp, ',', 0);