FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDMenuInfoBoxShow.c
Go to the documentation of this file.
1#include <string.h>
2#include "FBLib_TMSOSDMenu.h"
3
5
6void OSDMenuInfoBoxShow(const char *Title, const char *Text, dword Timeout)
7{
9
10 dword x, y, dy, i;
11 char *pText;
12 char *EndOfText;
13 dword Lines;
14 char s[256];
15 tOSDMapInfo *OSDMapInfo;
16
18
20
21 if(!InfoBoxOSDRgn)
22 {
23 x = (720 - _InfoBox_Gd.width) >> 1;
24 y = (576 - _InfoBox_Gd.height) >> 1;
25 if(OSDRgn || MyOSDRgn)
26 {
29 if(MyOSDRgn)
30 {
31 OSDMapInfo = (tOSDMapInfo*) FIS_vOsdMap();
32 if(OSDMapInfo)
33 InfoBoxSaveArea = TAP_Osd_SaveBox(MyOSDRgn, InfoBoxSaveAreaX - OSDMapInfo[MyOSDRgn].x, InfoBoxSaveAreaY - OSDMapInfo[MyOSDRgn].y, _InfoBox_Gd.width, _InfoBox_Gd.height);
34 }
35 else
37 }
38
39 InfoBoxOSDRgn = TAP_Osd_Create(x, y, _InfoBox_Gd.width, _InfoBox_Gd.height, 0, 0);
40 TAP_ExitNormal();
41 }
42 TAP_Osd_PutGd(InfoBoxOSDRgn, 0, 0, &_InfoBox_Gd, FALSE);
43
44 OSDMenuPutS(InfoBoxOSDRgn, 0, 10, 380, Title, RGB(232,146,17), COLOR_None, 14, FALSE, ALIGN_CENTER);
45
46 //Count the number of lines
47 strncpy(s, Text, 255);
48 s[255] = '\0';
49 pText = s;
50 EndOfText = s + strlen(s);
51 Lines = 0;
52 while(pText < EndOfText)
53 {
54 Lines++;
55 pText = strpbrk(pText, "\x0d\x0a");
56 if(!pText) break;
57 *pText = '\0';
58 pText++;
59 if (Lines == 7) break;
60 }
61
62 dy = 20;
63 y = 70 - 10 * (Lines - 1);
64 pText = s;
65 for(i = 0; i < Lines; i++)
66 {
67 OSDMenuPutS(InfoBoxOSDRgn, 0, y - 7 + 36, 380, pText, RGB(192,192,192), COLOR_None, 14, FALSE, ALIGN_CENTER);
68 y += dy;
69 pText += (strlen(pText) + 1);
70 }
71
72 WaitSpinnerPosY = (Lines == 6 ? 164 : 158) + ((24 - WaitSpinnerItemHeight) >> 1);
73
74 if(Timeout)
75 InfoBoxTimeOut = TAP_GetTick() + Timeout;
76 else
77 {
78 if (InfoBoxExitButton) TAP_Osd_PutGd(InfoBoxOSDRgn, _InfoBox_Gd.width - _Button_exit_Gd.width - 8, Lines == 6 ? 167 : 163, &_Button_exit_Gd, TRUE);
79
80 InfoBoxTimeOut = 0xffffffff;
81 }
82
83 TAP_Osd_Sync();
84
85 TRACEEXIT();
86}
dword InfoBoxSaveAreaX
Definition: OSDMenuInit.c:15
TYPE_GrData _Button_exit_Gd
word MessageBoxOSDRgn
Definition: OSDMenuInit.c:18
dword InfoBoxTimeOut
Definition: OSDMenuInit.c:13
bool InfoBoxExitButton
Definition: OSDMenuInit.c:16
word InfoBoxOSDRgn
Definition: OSDMenuInit.c:12
void OSDMenuPutS(word rgn, dword x, dword y, dword maxX, const char *str, dword fcolor, dword bcolor, byte fntSize, byte bDot, byte align)
Definition: OSDMenuPutS.c:3
TYPE_GrData _InfoBox_Gd
byte * InfoBoxSaveArea
Definition: OSDMenuInit.c:14
#define WaitSpinnerItemHeight
word OSDRgn
Definition: OSDMenuInit.c:4
void OSDMenuLoadStdFonts(void)
word MyOSDRgn
Definition: OSDMenuInit.c:4
dword InfoBoxSaveAreaY
dword FIS_vOsdMap(void)
Definition: FIS_vOSDMap.c:3
void OSDMenuInfoBoxShow(const char *Title, const char *Text, dword Timeout)
dword WaitSpinnerPosY
#define TRACEEXIT()
Definition: libFireBird.h:1244
void OSDMenuMessageBoxDestroy(void)
#define TRACEENTER()
Definition: libFireBird.h:1243