📄 wm.lst
字号:
C51 COMPILER V8.05a WM 04/11/2008 14:19:41 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE WM
OBJECT MODULE PLACED IN wm.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\WM\wm.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND PRINT(.\
-wm.lst) OBJECT(wm.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 : WM.C
16 Purpose : Windows manager core
17 ----------------------------------------------------------------------
18 Version-Date---Author-Explanation
19 ----------------------------------------------------------------------
20
21 3.00a 010621 RS a) module accelerated by skipping parameter
22 to FindNext_IVR
23 3.00 010502 RS a) WM module split up for library applications
24 b) Module dramatically accelerated (without
25 changes in the routine structure)
26 1.18 000909 RS a) WM_CreateBWin does not activate the
27 new window unless specified via create flags
28 1.16a 000724 RS a) Function WM_EnableMemdevRead added
29 1.16 000614 RS a) Cleanup
30 b) Counter for invalid windows and
31 WM_GetNumInvalidWindows() added
32 1.14g 000522 RS a) WM_ExecAll added
33 1.14f 000316 RS a) Internal Create routine created in order to
34 handle creation of regular windows and
35 objects seperately (and correctly) in all
36 cases (by avoiding casts)
37 1.14e 000307 RS a) WM_MoveTo added
38 1.14d 000224 RS a) WM_CF_ACTIVATE flag now needed in order to
39 automatically activate a created window
40 1.14c 000209 RS a) GUI_Clear eliminated in default callback for
41 default background window
42 1.14b 000125 RS a) Bugfix for bug created in 1.14a
43 1.14a 000122 RS a) WM_CreateObj: Change in order to avoid
44 compiler warning with IARs new frontend
45 1.14 999109 RS a) Bugfix: Deleted window could still receive
46 up to 1 drawing message. Fixed. (->NextDrawWin)
47 b) WM_Obj now uses memory handle
48 c) WM_DefaultProc now handles WM_DELETE
49 d) Drawing area reduction for callbacks
50 to invalide area
51 e) WM_SetCallback added
52 f) Call to WM_Error if insufficient windows have
53 been configured
54 1.12h 000107 RS a) WM_Sendmessage: unused local eliminated
C51 COMPILER V8.05a WM 04/11/2008 14:19:41 PAGE 2
55 b) WMALLOC_Init call eliminated
56 1.12g 991230 RS a) Callback for background window defined
57 1.12f 991228 RS a) Locking macros moved -> WM.h
58 1.12e 991208 RS a) WM_DrawNext now saves the entire context, not
59 just the active window
60 1.12d 991204 RS a) WM_GetBGndWin added
61 1.12c 991203 RS a) WM_Init now creates default window
62 1.12b 991126 RS a) Cleanup in order to avoid compiler warnings
63 1.12a 991112 RS a) Invalidate now also invalidates any
64 transparent window on top of the invalidated
65 area
66 b) Internal changes in order to support
67 dynamic memory (using WM_ALLOC)
68 c) Additional ASSERTs inserted
69 1.12 991110 RS a) Invalidate now also invalidates a window
70 below a transparent window
71 1.10c 991018 RS a) WM_DrawNext:
72 NextDrawWin=WM_HWIN_NULL -> NextDrawWin==WM_HWIN_NULL
73 1.10b 991015 RS a) WM_ValidateBWin corrected (Invalid
74 flag was never reset, leading to superfluos redraws)
75 b) WM_SetDefault(void) implemented
76 1.10a 991012 RS a) Compile warnings eliminated
77 1.10 990918 RS a) Objects for windows manager added:
78 WM_CreateObject, WM_DeleteObject
79 b) "Magic number" -1 eliminated
80 c) static routines put on top of file
81 d) Locking added (WM_LOCK), ensuring thread
82 safety of all routines
83 e) Window marked as valid only if a callback
84 exists, allowing mixed callback/non callback
85 modes for different windows
86 1.08.02 990827 RS a) Optimization bug in WM_SetHasTrans
87 fixed
88 1.08.01 990826 RS a) Transparent windows can no longer obstruct
89 an area of a window below in Z-direction
90 (in FindNext_IVR) for correct handling of
91 transparent windows
92 1.08.00 990823 RS a) WM__GetOrgX -> WM_GetOrgX
93 WM__GetOrgY -> WM_GetOrgY
94 b) Clearing memory in WM_Init
95 1.07.01 990730 RS a) In WM_DrawNext() add. condition added to make
96 sure that loop does not iterate using
97 -1 (end-of-list) as index
98 1.07 990720 RS a) New switch: WM_SUPPORT_OBSTRUCT, def. 1
99 1.06 990504 BB functions WM_GetWinSizeX() and WM_GetWinSizeY()
100 added.
101 1.05 990423 RS a) Prototype for WM_CreateBWin changed,
102 parameter WM_MESSAGE* is no longer const
103 (Causing some other changes reg. const)
104 b) WM_ShowBWin WM_HideBWin tested in simulator
105 1.04 990417 RS a) DrawNext bug fixed: It had passed the
106 entire WIndow-Rectangle instead of just
107 the InvalidRectangle with the WM_PAINT
108 command
109 1.03 990401 RS a) Implemented the following functions
110 WM_SetHasTrans()
111 WM_ClrHasTrans()
112 WM_GetHasTrans()
113 WM_HideBWin()
114 WM_ShowBWin()
115 WM_ValidateBWin()
116 WM_GetActiveBWin()
C51 COMPILER V8.05a WM 04/11/2008 14:19:41 PAGE 3
117 1.02 990315 RS a) Windows stack organisation routines cleaned
118 up, resulting in more efficient code
119 1.01 990314 RS a) Invalidation and IVR calculation optimized
120 b) Windows which are on top of a window causing
121 invalidation are no longer affected
122 1.00 990310 RS Moving and resizing tested in simulation
123 0.99 990309 RS All routines implemented, moving & resizing
124 need to be tested under different circumstances.
125 0.50 990308 RS Core of WM works (Calculation and iteration over
126 IVRs). Side routines like moving windows and the
127 corresponding message handling missing.
128 There is now a clear seperation between the LCD
129 and GL layers and WM.
130 0.01 990301 RS Incomplete version, for BB to check
131 ----------------------------------------------------------------------
132 Known problems:
133 None.
134 ----------------------------------------------------------------------
135 Open issues:
136 None.
137 ----------------------------------------------------------------------
138 Todo:
139 Nothing.
140 */
141
142
143 #include <stddef.h> /* needed for definition of NULL */
144 #include <string.h> /* required for memset */
145
146 #define WM_C
147 #include "WM_Intern.h"
148
149 #if GUI_WINSUPPORT /* If 0, WM will not generate any code */
/******************************************************************
*
* Config defaults
*
*******************************************************************
*/
/* This is for tests only. It will fill the invalid area of a window.
Can be used for debugging. */
#ifndef WM_SHOW_INVALID
#define WM_SHOW_INVALID 0
#endif
/*******************************************************************
*
* Macros for internal use
*
********************************************************************
*/
#define ASSIGN_IF_LESS(v0,v1) if (v1<v0) v0=v1
/******************************************************************
*
* Local typedefs
*
C51 COMPILER V8.05a WM 04/11/2008 14:19:41 PAGE 4
*******************************************************************
*/
typedef struct {
GUI_RECT ClientRect;
GUI_RECT CurRect;
int Cnt;
int EntranceCnt;
} WM_IVR_CONTEXT;
/******************************************************************
*
* WM_ global data
*
*******************************************************************
*/
U8 WM_IsActive;
U16 WM__CreateFlags;
WM_DELETE_WINDOW_HOOK* WM__pfDeleteWindowHook;
GUI_COLOR WM__BkColor = GUI_INVALID_COLOR;
WM_HWIN WM__hCapture, WM__hWinFocus;
char WM__CaptureReleaseAuto;
WM_tfPollPID* WM_pfPollPID;
/******************************************************************
*
* Static data
*
*******************************************************************
*/
static WM_HWIN NextDrawWin;
static U8 IsInCallback;
static WM_IVR_CONTEXT ClipContext;
static char _IsInited;
/*******************************************************************
*
* Static routines
*
********************************************************************
*/
/*******************************************************************
*
* _ClipAtParentBorders
Iterates over all its ancestors and intersects all rectangles to
find out which part is actually visible.
Reduces the rectangle to the visible area.
*/
void _ClipAtParentBorders(GUI_RECT* pRect, WM_Obj* pWin) {
WM_HWIN hWin;
hWin = pWin->hParent;
while (hWin) {
pWin = WM_H2P(hWin);
GUI__IntersectRect(pRect, &pWin->Rect);
hWin = pWin->hParent;
}
}
C51 COMPILER V8.05a WM 04/11/2008 14:19:41 PAGE 5
/*******************************************************************
*
*
When drawing, we have to start at the bottom window !
*/
static void ResetNextDrawWin(void) {
NextDrawWin = WM_HWIN_NULL;
}
/*******************************************************************
*
* _AddChild
*/
void _AddChild(WM_HWIN hParent, WM_HWIN hChild, int OnTop) {
WM_Obj* pChild;
WM_Obj* pParent;
WM_Obj* pi;
WM_HWIN hi;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -