📄 guiuc1.lst
字号:
C51 COMPILER V8.05a GUIUC1 04/11/2008 14:18:59 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUIUC1
OBJECT MODULE PLACED IN GUIUC1.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\GUIUC1.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND PR
-INT(.\GUIUC1.lst) OBJECT(GUIUC1.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 : GUIUC1.C
16 Purpose : Implementation of character and string services
17 ----------------------------------------------------------------------
18 Version-Date---Author-Explanation
19 ---------------------------END-OF-HEADER------------------------------
20 */
21
22 #include <stddef.h> /* needed for definition of NULL */
23 #include "gui\Core\GUI_Private.h"
24
25 #if GUI_SUPPORT_UNICODE
26
27 /*
28 ************************************************************
29 *
30 * static functions
31 *
32 ************************************************************
33 */
34
35 static int GetLineDistX(const U16 GUI_FAR *s, int Len) {
36 1 int Dist =0;
37 1 if (s) {
38 2 U16 c0;
39 2 while (((c0=*s) !=0) && Len >=0) {
40 3 s++; Len--;
41 3 Dist += GUI_GetCharDistX(c0);
42 3 }
43 2 }
44 1 return Dist;
45 1 }
46
47 static int GetLineLen(const U16 GUI_FAR *s, int MaxLen) {
48 1 int Len =0;
49 1 if (!s)
50 1 return 0;
51 1 {
52 2 while ((*s !=0) && Len < MaxLen) {
53 3 Len++; s++;
54 3 }
C51 COMPILER V8.05a GUIUC1 04/11/2008 14:18:59 PAGE 2
55 2 }
56 1 return Len;
57 1 }
58
59 static void DispLine_UC(const U16 GUI_FAR *s, int Len, const GUI_RECT *pRect) {
60 1 if (GUI_Context.pClipRect_HL) {
61 2 if (GUI_RectsIntersect(GUI_Context.pClipRect_HL, pRect) == 0)
62 2 return;
63 2 }
64 1 {
65 2 U16 c0;
66 2 while (--Len >=0) {
67 3 c0=*s++;
68 3 GL_DispChar (c0);
69 3 }
70 2 }
71 1 }
72
73 static void DispLine(const U16 GUI_FAR *s, int Len, const GUI_RECT* pr) {
74 1 GUI_RECT r;
75 1 r = *pr;
76 1 #if GUI_WINSUPPORT
WM_ADDORG(r.x0,r.y0);
WM_ADDORG(r.x1,r.y1);
WM_ITERATE_START(&r) {
#endif
81 1 GUI_Context.DispPosX = r.x0;
82 1 GUI_Context.DispPosY = r.y0;
83 1 DispLine_UC(s, Len, &r); /* Do the actual drawing via routine call. */
84 1 #if GUI_WINSUPPORT
} WM_ITERATE_END();
WM_SUBORG(GUI_Context.DispPosX, GUI_Context.DispPosY);
#endif
88 1 }
89
90 /*
91 ************************************************************
92 *
93 * UNICODE routines
94 *
95 ************************************************************
96 */
97
98 void GUI_DispString_UC(const U16 GUI_FAR *s) {
99 1 int xAdjust, yAdjust, xOrg;
100 1 int FontSizeY;
101 1 if (!s)
102 1 return;
103 1 GUI_LOCK();
104 1 FontSizeY = GUI_Context.pAFont->YSize;
105 1 xOrg = GUI_Context.DispPosX;
106 1 /* Adjust vertical position */
107 1 yAdjust = GUI_GetYAdjust();
108 1 GUI_Context.DispPosY -= yAdjust;
109 1 for (; *s; s++) {
110 2 GUI_RECT r;
111 2 int LineLen= GetLineLen(s,0x7fff);
112 2 int xLineSize = GetLineDistX(s, LineLen);
113 2 /* Check if x-position needs to be changed due to h-alignment */
114 2 switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) {
115 3 case GUI_TA_CENTER: xAdjust= xLineSize/2; break;
116 3 case GUI_TA_RIGHT: xAdjust= xLineSize; break;
C51 COMPILER V8.05a GUIUC1 04/11/2008 14:18:59 PAGE 3
117 3 default: xAdjust= 0;
118 3 }
119 2 r.x0 = GUI_Context.DispPosX -= xAdjust;
120 2 r.x1 = r.x0 + xLineSize-1;
121 2 r.y0 = GUI_Context.DispPosY;
122 2 r.y1 = r.y0 + FontSizeY-1;
123 2 DispLine(s, LineLen, &r);
124 2 GUI_Context.DispPosY = r.y0;
125 2 s += LineLen;
126 2 if (*s=='\n') {
127 3 switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) {
128 4 case GUI_TA_CENTER:
129 4 case GUI_TA_RIGHT:
130 4 GUI_Context.DispPosX = xOrg;
131 4 break;
132 4 default:
133 4 GUI_Context.DispPosX = GUI_Context.LBorder;
134 4 break;
135 4 }
136 3 GUI_Context.DispPosY += GUI_GetFontDistY();
137 3 } else {
138 3 GUI_Context.DispPosX = r.x0+xLineSize;
139 3 }
140 2 if (*s==0) /* end of string (last line) reached ? */
141 2 break;
142 2 }
143 1 GUI_Context.DispPosY += yAdjust;
144 1 GUI_Context.TextAlign &= ~GUI_TA_HORIZONTAL;
145 1 GUI_UNLOCK();
146 1 }
147
148 #else
void GUIUC1_C(void) {} /* avoid empty object files */
#endif /* GUI_SUPPORT_UNICODE */
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 947 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- 60
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 + -