📄 gui_dispstringinrect.lst
字号:
C51 COMPILER V8.05a GUI_DISPSTRINGINRECT 04/11/2008 14:18:34 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUI_DISPSTRINGINRECT
OBJECT MODULE PLACED IN GUI_DispStringInRect.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\GUI_DispStringInRect.c LARGE BROWSE MDU_F120 DEBUG O
-BJECTEXTEND PRINT(.\GUI_DispStringInRect.lst) OBJECT(GUI_DispStringInRect.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/GUI
4 * Universal graphic software for embedded applications
5 *
6 * (c) Copyright 2002, Micrium Inc., Weston, FL
7 * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
8 *
9 * 礐/GUI is protected by international copyright laws. Knowledge of the
10 * source code may not be used to write a similar product. This file may
11 * only be used in accordance with a license and should not be redistributed
12 * in any way. We appreciate your understanding and fairness.
13 *
14 ----------------------------------------------------------------------
15 File : GUI_DispStringInRect.c
16 Purpose : Implementation of GUI_DispStringInRect
17 ---------------------------END-OF-HEADER------------------------------
18 */
19
20
21 #include <stddef.h> /* needed for definition of NULL */
22 #include <stdio.h>
23 #include <string.h>
24 #include "gui\Core\GUI_Private.h"
25
26
27 /********************************************************************
28 *
29 * Display String in given rectangle
30 *
31 *********************************************************************
32 */
33
34 static void _DispStringInRect(const char GUI_FAR *s, GUI_RECT* pRect, int TextAlign) {
35 1 GUI_RECT r;
36 1 GUI_RECT rLine;
37 1 int y;
38 1 int NumLines;
39 1 const char *sOrg =s;
40 1 int FontYSize;
41 1 int xLine;
42 1 FontYSize = GUI_GetFontSizeY();
43 1 if (pRect) {
44 2 r = *pRect;
45 2 } else {
46 2 GUI_GetClientRect(&r);
47 2 }
48 1 /* Count the number of lines for vertical alignment */
49 1 for (NumLines=1; ;NumLines++) {
50 2 int LineLen= GUI__GetLineLen(s,0x7fff);
51 2 s += LineLen;
52 2 if (GUI__HandleEOLine(&s))
53 2 break;
54 2 }
C51 COMPILER V8.05a GUI_DISPSTRINGINRECT 04/11/2008 14:18:34 PAGE 2
55 1 /* Do the vertical alignment */
56 1 switch (TextAlign & GUI_TA_VERTICAL) {
57 2 case GUI_TA_TOP:
58 2 y = r.y0;
59 2 break;
60 2 case GUI_TA_BASELINE:
61 2 case GUI_TA_BOTTOM:
62 2 y = r.y1 -NumLines * FontYSize+1;
63 2 break;
64 2 case GUI_TA_VCENTER:
65 2 y = r.y0+(r.y1-r.y0+1 -NumLines * FontYSize) /2;
66 2 break;
67 2 }
68 1 for (s=sOrg; ;) {
69 2 int LineLen= GUI__GetLineLen(s,0x7fff);
70 2 int xLineSize = GUI_GetLineDistX(s, LineLen);
71 2 switch (TextAlign & GUI_TA_HORIZONTAL) {
72 3 case GUI_TA_HCENTER:
73 3 xLine = r.x0+(r.x1-r.x0-xLineSize)/2; break;
74 3 case GUI_TA_LEFT:
75 3 xLine = r.x0; break;
76 3 case GUI_TA_RIGHT:
77 3 xLine = r.x1 -xLineSize;
78 3 }
79 2 rLine.x0 = GUI_Context.DispPosX = xLine;
80 2 rLine.x1 = rLine.x0 + xLineSize-1;
81 2 rLine.y0 = GUI_Context.DispPosY = y;
82 2 rLine.y1 = y + FontYSize-1;
83 2 GUI__DispLine(s, LineLen, &rLine);
84 2 s += LineLen;
85 2 y += GUI_GetFontDistY();
86 2 if (GUI__HandleEOLine(&s))
87 2 break;
88 2 }
89 1 }
90
91
92 void GUI_DispStringInRect(const char GUI_FAR *s, GUI_RECT* pRect, int TextAlign) {
93 1 #if (GUI_WINSUPPORT)
const GUI_RECT *pClipRect_Old;
#else
96 1 GUI_RECT Rect_Old;
97 1 #endif
98 1 if (s) {
99 2 GUI_LOCK();
100 2 if (pRect) {
101 3 #if (GUI_WINSUPPORT)
pClipRect_Old = WM_SetUserClipRect(pRect);
#else
104 3 Rect_Old = GUI_Context.ClipRect;
105 3 LCD_SetClipRectEx(pRect);
106 3 #endif
107 3 }
108 2 _DispStringInRect(s, pRect, TextAlign);
109 2 #if (GUI_WINSUPPORT)
WM_SetUserClipRect(pClipRect_Old);
#else
112 2 LCD_SetClipRectEx(&Rect_Old);
113 2 #endif
114 2 GUI_UNLOCK();
115 2 }
116 1 }
C51 COMPILER V8.05a GUI_DISPSTRINGINRECT 04/11/2008 14:18:34 PAGE 3
117
118 /*** End of file ***/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 799 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- 55
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 + -