FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDMenuKeyboard_Draw.c
Go to the documentation of this file.
1#include <string.h>
3
5{
7
8 int i=0;
9 int j=0;
10 int k=0;
11 char *keytext;
12 dword tw, cw;
13 char CharAtCursor, *pCharAtCursor;
14 char sCharAtCursor[5];
15 byte cl;
16 dword x, cx = 0;
17 #define MAXX 437
18 char *StringVarStart;
19 dword State, SubState;
20 extern TYPE_GrData _TextCursor14_Gd;
21
22 int w, h;
23 float AntiAliasFactor;
24
25 w = 444;
26 h = 383;
27 AntiAliasFactor = 1;
28
29 if(OSDMenuKeyboard_rgn == 0)
30 {
31 TAP_GetState(&State, &SubState);
32 OSDMenuKeyboard_ReturnToNormal = (State == STATE_Normal) && (SubState == SUBSTATE_Normal);
33 TAP_ExitNormal();
34 OSDMenuKeyboard_rgn = TAP_Osd_Create((720 - w) >> 1, (576 - h) >> 1, w, h, 0, 0);
35 }
36 TAP_Osd_FillBox(OSDMenuKeyboard_rgn, 0, 0, w, h, COLOR_Grey01);
37
38 // Titelbox erzeugen
39 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 0, 0, 444, 36, COLOR_Grey08, COLOR_Grey08, COLOR_Grey03);
40 FMUC_PutStringAA(OSDMenuKeyboard_rgn, 5, 7, 438, OSDMenuKeyboard_Title, COLOR_Orange01, 0, &KeyboardFont_14, FALSE, ALIGN_CENTER, AntiAliasFactor);
41
42 // Tastaturbox erzeugen
43 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 0, 34, 444, 244, COLOR_Grey08, COLOR_Grey08, COLOR_Grey04);
44
45 // Textbox erzeugen
46 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 0, 276, 444, 30, COLOR_Grey08, COLOR_Grey08, COLOR_Grey04);
47
48 for(i = 0; i < NRKEYPADKEYS; i++)
49 {
50 if(i < 26)
51 {
52 if(i != KeyPadPosition)
53 {
54 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 22+k*50, 56+(j*50), 50, 50, COLOR_Grey12, COLOR_Grey08, COLOR_Grey04);
55 FMUC_PutStringAA(OSDMenuKeyboard_rgn, 23+k*50, 70+(j*50), 70+(k*50), Keypad[KeyPadMode][i], COLOR_Grey19, 0, &KeyboardFont_14, FALSE, ALIGN_CENTER, AntiAliasFactor);
56 }
57 else
58 {
59 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 22+k*50, 56+(j*50), 50, 50, COLOR_Grey08, COLOR_Grey12, COLOR_Orange03);
60 TAP_Osd_FillBox(OSDMenuKeyboard_rgn, 24+k*50, 81+(j*50), 46, 23, COLOR_Orange02);
61 FMUC_PutStringAA(OSDMenuKeyboard_rgn, 23+k*50, 70+(j*50), 70+(k*50), Keypad[KeyPadMode][i], COLOR_Grey00, 0, &KeyboardFont_14, FALSE, ALIGN_CENTER, AntiAliasFactor);
62 }
63
64 k++;
65 if(k == 8)
66 {
67 k=0;
68 j++;
69 }
70 }
71 else
72 {
73 if(i == 26) keytext = "Space";
74 else if(i == 27) keytext = "Backspace";
75 else keytext = "OK";
76
77 if(i != KeyPadPosition)
78 {
79 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 22+k*50, 56+(j*50), 100, 50, COLOR_Grey12, COLOR_Grey08, COLOR_Grey04);
80 FMUC_PutStringAA(OSDMenuKeyboard_rgn, 23+k*50, 70+(j*50), 120+(k*50), keytext, COLOR_Grey19, 0, &KeyboardFont_14, FALSE, ALIGN_CENTER, AntiAliasFactor);
81 }
82 else
83 {
84 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 22+k*50, 56+(j*50), 100, 50, COLOR_Grey08, COLOR_Grey12, COLOR_Orange03);
85 TAP_Osd_FillBox(OSDMenuKeyboard_rgn, 24+k*50, 81+(j*50), 96, 23, COLOR_Orange02);
86 FMUC_PutStringAA(OSDMenuKeyboard_rgn, 23+k*50, 70+(j*50), 120+(k*50), keytext, COLOR_Grey00, 0, &KeyboardFont_14, FALSE, ALIGN_CENTER, AntiAliasFactor);
87 }
88 k+=2;
89 }
90 }
91
92 //Aktuellen Text malen
93 x = 6;
94
95 //OSDMenuKeyboard_TextStartPosition prüfen und anpassen
98 CharAtCursor = *pCharAtCursor;
99 *pCharAtCursor = '\0';
100
102 {
105 }
106 *pCharAtCursor = CharAtCursor;
107
109
110 TAP_Osd_FillBox(OSDMenuKeyboard_rgn, 4, 280, 436, 22, COLOR_Grey05);
111
112 //..., falls der Text bereits links hinausgeschoben ist
114 {
115 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x, 280, MAXX, "…", COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
116 x += FMUC_GetStringWidth("…", &KeyboardFont_14);
117 }
118
120 {
122 {
123 //Cursor malen
124 TAP_Osd_PutGd(OSDMenuKeyboard_rgn, 6, 284, &_TextCursor14_Gd, TRUE);
125
126 //Ganzen Text malen
127 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x + _TextCursor14_Gd.width, 280, MAXX, OSDMenuKeyboard_StringVar, COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
128 }
129 else
130 {
131 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x, 280, MAXX, OSDMenuKeyboard_StringVar, COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
132 cx = x;
134 strncpy(sCharAtCursor, OSDMenuKeyboard_StringVar, cl);
135 sCharAtCursor[cl] = 0;
136 }
137 }
139 {
140 //Ganzen Text malen
141 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x, 280, MAXX, StringVarStart, COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
142
143 tw = FMUC_GetStringWidth(StringVarStart, &KeyboardFont_14);
144
146 {
147 //Cursor malen
148 TAP_Osd_PutGd(OSDMenuKeyboard_rgn, x + tw, 284, &_TextCursor14_Gd, TRUE);
149 }
150 else
151 {
152 cx = x + tw;
153 sCharAtCursor[0] = 0;
154 }
155 }
156 else
157 {
158 //Ersten Teil des Textes malen
160 CharAtCursor = *pCharAtCursor;
161 *pCharAtCursor = '\0';
162 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x, 280, MAXX, StringVarStart, COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
163
164 x += FMUC_GetStringWidth(StringVarStart, &KeyboardFont_14);
165
167 {
168 //Cursor malen
169 TAP_Osd_PutGd(OSDMenuKeyboard_rgn, x, 284, &_TextCursor14_Gd, TRUE);
170 x += _TextCursor14_Gd.width;
171 }
172
173 //Zweiten Teil des Textes malen
174 *pCharAtCursor = CharAtCursor;
175 FMUC_PutStringAA(OSDMenuKeyboard_rgn, x, 280, MAXX, pCharAtCursor, COLOR_Grey19, 0, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
176
177 cx = x;
178 isUTF8Char(pCharAtCursor, &cl);
179 strncpy(sCharAtCursor, pCharAtCursor, cl);
180 sCharAtCursor[cl] = 0;
181
182 }
183
185 {
186 if (!*sCharAtCursor) strcpy(sCharAtCursor, " ");
187
188 cw = FMUC_GetStringWidth(sCharAtCursor, &KeyboardFont_14);
189 FMUC_PutStringAA(OSDMenuKeyboard_rgn, cx, 280, cx + cw - 1, sCharAtCursor, COLOR_Grey19, COLOR_Orange02, &KeyboardFont_14, TRUE, ALIGN_LEFT, AntiAliasFactor);
190 }
191
192 //Legende
196 TAP_Osd_Draw3dBoxFill(OSDMenuKeyboard_rgn, 0, 306, 444, 77, COLOR_Grey08, COLOR_Grey08, COLOR_Grey04);
197 for(i = 0; i < OSDMenuKeyboard_NrButtons; i++)
199
200 TAP_Osd_Sync();
201
202 TRACEEXIT();
203}
char * OSDMenuKeyboard_Title
char Keypad[KPM_NrModes][26][4]
#define NRKEYPADKEYS
int OSDMenuKeyboard_NrButtons
void OSDMenuKeyboard_DrawLegendButton(dword Line, tButtonIcon ButtonIcon, const char *Text)
int KeyPadPosition
char * OSDMenuKeyboard_StringVar
tFontDataUC KeyboardFont_14
int OSDMenuKeyboard_ButtonsX[3]
tOSDMenuKeyboard_Buttons OSDMenuKeyboard_Buttons[20]
int OSDMenuKeyboard_CursorPosition
tKeyPadMode KeyPadMode
bool OSDMenuKeyboard_ReturnToNormal
tKeyboardCursor KeyboardCursorType
word OSDMenuKeyboard_rgn
int OSDMenuKeyboard_TextStartPosition
dword FMUC_GetStringWidth(const char *Text, tFontDataUC *FontData)
void FMUC_PutStringAA(word rgn, dword x, dword y, dword maxX, const char *str, dword fcolor, dword bcolor, tFontDataUC *FontData, byte bDot, byte align, float AntiAliasFactor)
#define COLOR_Orange03
#define COLOR_Orange01
#define COLOR_Grey03
#define COLOR_Grey00
#define COLOR_Grey04
#define COLOR_Grey19
#define COLOR_Orange02
#define COLOR_Grey05
#define COLOR_Grey08
#define COLOR_Grey12
#define COLOR_Grey01
#define MAXX
void OSDMenuKeyboard_Draw(void)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
@ KC_Box
Definition: libFireBird.h:2989
@ KC_Text
Definition: libFireBird.h:2988
byte * GetUCPos(const byte *String, int CharPos)
Definition: GetUCPos.c:3
bool isUTF8Char(const byte *p, byte *BytesPerChar)
Definition: isUTF8Char.c:3