📄 guichar.lst
字号:
218 * Linefeed *
219 * *
220 *********************************
221
222 */
223 void GUI_DispNextLine(void) {
224 1 GUI_Context.DispPosY +=GUI_GetFontDistY();
225 1 GUI_Context.DispPosX = GUI_Context.LBorder;
226 1 }
227
228
229
230 /*
231 ************************************************************
232 * *
233 * Set the write position *
234 * *
235 ************************************************************
236
237 Sets the write position. The routines routine 1 if it is clear that
238 the current write position is in an area outside the current window
239 and will therefor not be written.
240
C51 COMPILER V8.05a GUICHAR 04/11/2008 14:18:54 PAGE 5
241 */
242
243 static char _GotoY(int y) {
244 1 GUI_Context.DispPosY = y;
245 1 return 0;
246 1 }
247
248 static char _GotoX(int x) {
249 1 GUI_Context.DispPosX = x;
250 1 return 0;
251 1 }
252
253
254 char GUI_GotoY(int y) {
255 1 char r;
256 1 GUI_LOCK();
257 1 r = _GotoY(y);
258 1 GUI_UNLOCK();
259 1 return r;
260 1 }
261
262
263 char GUI_GotoX(int x) {
264 1 char r;
265 1 GUI_LOCK();
266 1 r = _GotoX(x);
267 1 GUI_UNLOCK();
268 1 return r;
269 1 }
270
271 char GUI_GotoXY(int x, int y) {
272 1 char r;
273 1 GUI_LOCK();
274 1 r = GUI_GotoX(x);
275 1 r |= GUI_GotoY(y);
276 1 GUI_UNLOCK();
277 1 return r;
278 1 }
279
280
281
282
283
284
285 /*
286 ********************************************************
287 *
288 * Display line
289 *
290 ********************************************************
291 */
292
293 void GL_DispLine(const char GUI_FAR *s, int Len, const GUI_RECT *pRect) {
294 1 /*
295 1 Check if we have anything to do at all ...
296 1 If the window manager has already set the clipping rect, it does not
297 1 make sense to due this. So it makes sense only if
298 1 a) The window manager is not used (-> Configuration)
299 1 or
300 1 b) The window manager is inactive (-> Memory device active)
301 1 */
302 1 if (GUI_Context.pClipRect_HL) {
C51 COMPILER V8.05a GUICHAR 04/11/2008 14:18:54 PAGE 6
303 2 if (GUI_RectsIntersect(GUI_Context.pClipRect_HL, pRect) == 0)
304 2 return;
305 2 }
306 1 if (GUI_Context.pAFont->pafEncode) {
307 2 GUI_Context.pAFont->pafEncode->pfDispLine(s, Len);
308 2 return;
309 2 }
310 1 #if (GUI_SUPPORT_UNICODE)
311 1 {
312 2 U8 c0;
313 2 char UCActive=0;
314 2 while (--Len >=0) {
315 3 c0=*(U8*)s++;
316 3 if (UCActive) {
317 4 if (c0 == GUI_UC_ENDCHAR)
318 4 UCActive = 0;
319 4 else {
320 5 U8 c1 = *(U8*)s++;
321 5 Len--;
322 5 GL_DispChar (GUI_DB2UC(c0, c1));
323 5 }
324 4 } else { /* Unicode not active */
325 4 if (c0 == GUI_UC_STARTCHAR)
326 4 UCActive = 1;
327 4 else
328 4 GL_DispChar(c0);
329 4 }
330 3 }
331 2 }
332 1 #else
{
while (--Len >=0) {
GL_DispChar(*(U8*)s++);
}
}
#endif
339 1 }
340
341 void GUI__DispLine(const char GUI_FAR *s, int Len, const GUI_RECT* pr) {
342 1 GUI_RECT r;
343 1 r = *pr;
344 1 #if GUI_WINSUPPORT
WM_ADDORG(r.x0,r.y0);
WM_ADDORG(r.x1,r.y1);
WM_ITERATE_START(&r) {
#endif
349 1 GUI_Context.DispPosX = r.x0;
350 1 GUI_Context.DispPosY = r.y0;
351 1 /* Do the actual drawing via routine call. */
352 1 GL_DispLine(s, Len, &r);
353 1 #if GUI_WINSUPPORT
} WM_ITERATE_END();
WM_SUBORG(GUI_Context.DispPosX, GUI_Context.DispPosY);
#endif
357 1 }
358
359
360
361
362
363
364
C51 COMPILER V8.05a GUICHAR 04/11/2008 14:18:54 PAGE 7
365
366
367 /********************************************************************
368 *
369 * Display String
370 *
371 *********************************************************************
372 */
373
374 void GUI_DispString(const char GUI_FAR *s) {
375 1 int xAdjust, yAdjust, xOrg;
376 1 int FontSizeY;
377 1 if (!s)
378 1 return;
379 1 GUI_LOCK();
380 1 FontSizeY = GUI_Context.pAFont->YDist;
381 1 xOrg = GUI_Context.DispPosX;
382 1 /* Adjust vertical position */
383 1 yAdjust = GUI_GetYAdjust();
384 1 GUI_Context.DispPosY -= yAdjust;
385 1 for (; *s; s++) {
386 2 GUI_RECT r;
387 2 int LineLen= GUI__GetLineLen(s,0x7fff);
388 2 int xLineSize = GUI_GetLineDistX(s, LineLen);
389 2 /* Check if x-position needs to be changed due to h-alignment */
390 2 switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) {
391 3 case GUI_TA_CENTER: xAdjust= xLineSize/2; break;
392 3 case GUI_TA_RIGHT: xAdjust= xLineSize; break;
393 3 default: xAdjust= 0;
394 3 }
395 2 r.x0 = GUI_Context.DispPosX -= xAdjust;
396 2 r.x1 = r.x0 + xLineSize-1;
397 2 r.y0 = GUI_Context.DispPosY;
398 2 r.y1 = r.y0 + FontSizeY-1;
399 2 GUI__DispLine(s, LineLen, &r);
400 2 GUI_Context.DispPosY = r.y0;
401 2 s += LineLen;
402 2 if ((*s=='\n') || (*s=='\r')) {
403 3 switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) {
404 4 case GUI_TA_CENTER:
405 4 case GUI_TA_RIGHT:
406 4 GUI_Context.DispPosX = xOrg;
407 4 break;
408 4 default:
409 4 GUI_Context.DispPosX = GUI_Context.LBorder;
410 4 break;
411 4 }
412 3 if (*s=='\n')
413 3 GUI_Context.DispPosY += GUI_GetFontDistY();
414 3 } else {
415 3 GUI_Context.DispPosX = r.x0+xLineSize;
416 3 }
417 2 if (*s==0) /* end of string (last line) reached ? */
418 2 break;
419 2 }
420 1 GUI_Context.DispPosY += yAdjust;
421 1 GUI_Context.TextAlign &= ~GUI_TA_HORIZONTAL;
422 1 GUI_UNLOCK();
423 1 }
424
425
426
C51 COMPILER V8.05a GUICHAR 04/11/2008 14:18:54 PAGE 8
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1766 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- 71
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -