Mercurial > mplayer.hg
comparison gui/skin/skin.c @ 33022:9abc0dbd6314
Cosmetic: Rename ERRORMESSAGE() skin_error().
The new name is more appropriate and isn't unnecessarily upper-case.
author | ib |
---|---|
date | Fri, 25 Mar 2011 09:26:00 +0000 |
parents | 2bfd000bb789 |
children | ba432e34dc7e |
comparison
equal
deleted
inserted
replaced
33021:63beda39479c | 33022:9abc0dbd6314 |
---|---|
44 static unsigned char currWinName[32]; | 44 static unsigned char currWinName[32]; |
45 static wItem *currWin; | 45 static wItem *currWin; |
46 static int *currWinItemIdx; | 46 static int *currWinItemIdx; |
47 static wItem *currWinItems; | 47 static wItem *currWinItems; |
48 | 48 |
49 static void ERRORMESSAGE(const char *format, ...) | 49 static void skin_error(const char *format, ...) |
50 { | 50 { |
51 char p[512]; | 51 char p[512]; |
52 char tmp[512]; | 52 char tmp[512]; |
53 va_list ap; | 53 va_list ap; |
54 | 54 |
66 | 66 |
67 #define CHECKDEFLIST(str) \ | 67 #define CHECKDEFLIST(str) \ |
68 { \ | 68 { \ |
69 if (skin == NULL) \ | 69 if (skin == NULL) \ |
70 { \ | 70 { \ |
71 ERRORMESSAGE(MSGTR_SKIN_ERROR_SECTION, str); \ | 71 skin_error(MSGTR_SKIN_ERROR_SECTION, str); \ |
72 return 1; \ | 72 return 1; \ |
73 } \ | 73 } \ |
74 } | 74 } |
75 | 75 |
76 #define CHECKWINLIST(str) \ | 76 #define CHECKWINLIST(str) \ |
77 { \ | 77 { \ |
78 if (!currWinName[0]) \ | 78 if (!currWinName[0]) \ |
79 { \ | 79 { \ |
80 ERRORMESSAGE(MSGTR_SKIN_ERROR_WINDOW, str); \ | 80 skin_error(MSGTR_SKIN_ERROR_WINDOW, str); \ |
81 return 1; \ | 81 return 1; \ |
82 } \ | 82 } \ |
83 } | 83 } |
84 | 84 |
85 #define CHECK(name) \ | 85 #define CHECK(name) \ |
86 { \ | 86 { \ |
87 if (!strcmp(currWinName, name)) \ | 87 if (!strcmp(currWinName, name)) \ |
88 { \ | 88 { \ |
89 ERRORMESSAGE(MSGTR_SKIN_ERROR_IN_WINDOW, name); \ | 89 skin_error(MSGTR_SKIN_ERROR_IN_WINDOW, name); \ |
90 return 1; \ | 90 return 1; \ |
91 } \ | 91 } \ |
92 } | 92 } |
93 | 93 |
94 static char *strlower(char *in) | 94 static char *strlower(char *in) |
109 { | 109 { |
110 int i = bpRead(fname, bf); | 110 int i = bpRead(fname, bf); |
111 | 111 |
112 switch (i) { | 112 switch (i) { |
113 case -1: | 113 case -1: |
114 ERRORMESSAGE(MSGTR_SKIN_BITMAP_16bit, fname); | 114 skin_error(MSGTR_SKIN_BITMAP_16bit, fname); |
115 break; | 115 break; |
116 | 116 |
117 case -2: | 117 case -2: |
118 ERRORMESSAGE(MSGTR_SKIN_BITMAP_FileNotFound, fname); | 118 skin_error(MSGTR_SKIN_BITMAP_FileNotFound, fname); |
119 break; | 119 break; |
120 | 120 |
121 case -3: | 121 case -3: |
122 ERRORMESSAGE(MSGTR_SKIN_BITMAP_BMPReadError, fname); | 122 skin_error(MSGTR_SKIN_BITMAP_BMPReadError, fname); |
123 break; | 123 break; |
124 | 124 |
125 case -4: | 125 case -4: |
126 ERRORMESSAGE(MSGTR_SKIN_BITMAP_TGAReadError, fname); | 126 skin_error(MSGTR_SKIN_BITMAP_TGAReadError, fname); |
127 break; | 127 break; |
128 | 128 |
129 case -5: | 129 case -5: |
130 ERRORMESSAGE(MSGTR_SKIN_BITMAP_PNGReadError, fname); | 130 skin_error(MSGTR_SKIN_BITMAP_PNGReadError, fname); |
131 break; | 131 break; |
132 | 132 |
133 case -6: | 133 case -6: |
134 ERRORMESSAGE(MSGTR_SKIN_BITMAP_RLENotSupported, fname); | 134 skin_error(MSGTR_SKIN_BITMAP_RLENotSupported, fname); |
135 break; | 135 break; |
136 | 136 |
137 case -7: | 137 case -7: |
138 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownFileType, fname); | 138 skin_error(MSGTR_SKIN_BITMAP_UnknownFileType, fname); |
139 break; | 139 break; |
140 | 140 |
141 case -8: | 141 case -8: |
142 ERRORMESSAGE(MSGTR_SKIN_BITMAP_ConversionError, fname); | 142 skin_error(MSGTR_SKIN_BITMAP_ConversionError, fname); |
143 break; | 143 break; |
144 } | 144 } |
145 | 145 |
146 return i; | 146 return i; |
147 } | 147 } |
210 } else if (!strncmp(in, "menu", 4)) { | 210 } else if (!strncmp(in, "menu", 4)) { |
211 currWin = &appMPlayer.menuBase; | 211 currWin = &appMPlayer.menuBase; |
212 currWinItemIdx = &appMPlayer.IndexOfMenuItems; | 212 currWinItemIdx = &appMPlayer.IndexOfMenuItems; |
213 currWinItems = appMPlayer.menuItems; | 213 currWinItems = appMPlayer.menuItems; |
214 } else | 214 } else |
215 ERRORMESSAGE(MSGTR_UNKNOWNWINDOWTYPE); | 215 skin_error(MSGTR_UNKNOWNWINDOWTYPE); |
216 | 216 |
217 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] window: %s\n", currWinName); | 217 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] window: %s\n", currWinName); |
218 | 218 |
219 return 0; | 219 return 0; |
220 } | 220 } |
388 currWinItems[*currWinItemIdx].height = sy; | 388 currWinItems[*currWinItemIdx].height = sy; |
389 | 389 |
390 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %d,%d\n", fname, x, y); | 390 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %d,%d\n", fname, x, y); |
391 | 391 |
392 if ((currWinItems[*currWinItemIdx].message = appFindMessage(msg)) == -1) { | 392 if ((currWinItems[*currWinItemIdx].message = appFindMessage(msg)) == -1) { |
393 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, msg); | 393 skin_error(MSGTR_SKIN_BITMAP_UnknownMessage, msg); |
394 return 0; | 394 return 0; |
395 } | 395 } |
396 | 396 |
397 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, currWinItems[*currWinItemIdx].message); | 397 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, currWinItems[*currWinItemIdx].message); |
398 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] size: %dx%d\n", sx, sy); | 398 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] size: %dx%d\n", sx, sy); |
480 skin->menuItems[skin->IndexOfMenuItems].height = sy; | 480 skin->menuItems[skin->IndexOfMenuItems].height = sy; |
481 | 481 |
482 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] item #%d: %d,%d %dx%d\n", skin->IndexOfMenuItems, x, y, sx, sy); | 482 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] item #%d: %d,%d %dx%d\n", skin->IndexOfMenuItems, x, y, sx, sy); |
483 | 483 |
484 if ((skin->menuItems[skin->IndexOfMenuItems].message = message) == -1) | 484 if ((skin->menuItems[skin->IndexOfMenuItems].message = message) == -1) |
485 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp); | 485 skin_error(MSGTR_SKIN_BITMAP_UnknownMessage, tmp); |
486 | 486 |
487 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", tmp, skin->menuItems[skin->IndexOfMenuItems].message); | 487 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", tmp, skin->menuItems[skin->IndexOfMenuItems].message); |
488 | 488 |
489 skin->menuItems[skin->IndexOfMenuItems].Bitmap.Image = NULL; | 489 skin->menuItems[skin->IndexOfMenuItems].Bitmap.Image = NULL; |
490 return 0; | 490 return 0; |
648 item->type = itFont; | 648 item->type = itFont; |
649 item->fontid = fntRead(path, name); | 649 item->fontid = fntRead(path, name); |
650 | 650 |
651 switch (item->fontid) { | 651 switch (item->fontid) { |
652 case -1: | 652 case -1: |
653 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); | 653 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory); |
654 return 1; | 654 return 1; |
655 | 655 |
656 case -2: | 656 case -2: |
657 ERRORMESSAGE(MSGTR_SKIN_FONT_TooManyFontsDeclared); | 657 skin_error(MSGTR_SKIN_FONT_TooManyFontsDeclared); |
658 return 1; | 658 return 1; |
659 | 659 |
660 case -3: | 660 case -3: |
661 ERRORMESSAGE(MSGTR_SKIN_FONT_FontFileNotFound); | 661 skin_error(MSGTR_SKIN_FONT_FontFileNotFound); |
662 return 1; | 662 return 1; |
663 | 663 |
664 case -4: | 664 case -4: |
665 ERRORMESSAGE(MSGTR_SKIN_FONT_FontImageNotFound); | 665 skin_error(MSGTR_SKIN_FONT_FontImageNotFound); |
666 return 1; | 666 return 1; |
667 } | 667 } |
668 | 668 |
669 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", name, fntFindID(name)); | 669 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", name, fntFindID(name)); |
670 | 670 |
695 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y); | 695 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y); |
696 | 696 |
697 id = fntFindID(sid); | 697 id = fntFindID(sid); |
698 | 698 |
699 if (id < 0) { | 699 if (id < 0) { |
700 ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid); | 700 skin_error(MSGTR_SKIN_FONT_NonExistentFontID, sid); |
701 return 1; | 701 return 1; |
702 } | 702 } |
703 | 703 |
704 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id); | 704 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id); |
705 | 705 |
712 item->width = -1; | 712 item->width = -1; |
713 item->height = -1; | 713 item->height = -1; |
714 item->label = strdup(tmp); | 714 item->label = strdup(tmp); |
715 | 715 |
716 if (!item->label) { | 716 if (!item->label) { |
717 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); | 717 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory); |
718 return 1; | 718 return 1; |
719 } | 719 } |
720 | 720 |
721 return 0; | 721 return 0; |
722 } | 722 } |
748 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d, align: %d\n", sx, a); | 748 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d, align: %d\n", sx, a); |
749 | 749 |
750 id = fntFindID(sid); | 750 id = fntFindID(sid); |
751 | 751 |
752 if (id < 0) { | 752 if (id < 0) { |
753 ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid); | 753 skin_error(MSGTR_SKIN_FONT_NonExistentFontID, sid); |
754 return 1; | 754 return 1; |
755 } | 755 } |
756 | 756 |
757 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id); | 757 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id); |
758 | 758 |
766 item->width = sx; | 766 item->width = sx; |
767 item->height = -1; | 767 item->height = -1; |
768 item->label = strdup(tmp); | 768 item->label = strdup(tmp); |
769 | 769 |
770 if (!item->label) { | 770 if (!item->label) { |
771 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); | 771 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory); |
772 return 1; | 772 return 1; |
773 } | 773 } |
774 | 774 |
775 return 0; | 775 return 0; |
776 } | 776 } |
789 | 789 |
790 strlower(in); | 790 strlower(in); |
791 cutItem(in, tmp, ',', 0); | 791 cutItem(in, tmp, ',', 0); |
792 | 792 |
793 if (strcmp(tmp, "enable") != 0 && strcmp(tmp, "disable") != 0) { | 793 if (strcmp(tmp, "enable") != 0 && strcmp(tmp, "disable") != 0) { |
794 ERRORMESSAGE(MSGTR_SKIN_UnknownParameter, tmp); | 794 skin_error(MSGTR_SKIN_UnknownParameter, tmp); |
795 return 1; | 795 return 1; |
796 } | 796 } |
797 | 797 |
798 if (strcmp(tmp, "enable") != 0) | 798 if (strcmp(tmp, "enable") != 0) |
799 skin->mainDecoration = 0; | 799 skin->mainDecoration = 0; |