-
Notifications
You must be signed in to change notification settings - Fork 74
/
PaletteWDEF.p
160 lines (109 loc) · 2.74 KB
/
PaletteWDEF.p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{Photoshop version 1.0.1, file: PaletteWDEF.p
Computer History Museum, www.computerhistory.org
This material is (C)Copyright 1990 Adobe Systems Inc.
It may not be distributed to third parties.
It is licensed for non-commercial use according to
www.computerhistory.org/softwarelicense/photoshop/ }
UNIT UPaletteWDEF;
INTERFACE
USES
MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf;
FUNCTION PaletteWDEF (varCode: INTEGER;
theWindow: WindowPtr;
message: INTEGER;
param: LONGINT): LONGINT;
IMPLEMENTATION
FUNCTION PaletteWDEF (varCode: INTEGER;
theWindow: WindowPtr;
message: INTEGER;
param: LONGINT): LONGINT;
CONST
kTitleHeight = 10;
VAR
r: Rect;
frame: Rect;
pat: Pattern;
goAway: Rect;
index: INTEGER;
savePen: PenState;
BEGIN
PaletteWDEF := 0;
frame := WindowPeek (theWindow)^.strucRgn^^.rgnBBox;
goAway := frame;
goAway.top := goAway.top + 2;
goAway.left := goAway.left + 6;
goAway.bottom := goAway.top + 7;
goAway.right := goAway.left + 7;
CASE message OF
wDraw:
IF WindowPeek (theWindow)^.visible THEN
IF param <> 0 THEN
BEGIN
r := goAway;
InsetRect (r, 1, 1);
InvertRect (r)
END
ELSE
BEGIN
GetPenState (savePen);
PenNormal;
FrameRect (frame);
r := frame;
r.bottom := r.top + kTitleHeight + 1;
FrameRect (r);
FOR index := 0 TO 7 DO
IF ODD (r.top + index) THEN
pat [index] := 0
ELSE
IF ODD (r.left) THEN
pat [index] := $55
ELSE
pat [index] := $AA;
InsetRect (r, 1, 1);
IF WindowPeek (theWindow)^.hilited THEN
BEGIN
FillRect (r, pat);
IF WindowPeek (theWindow)^.goAwayFlag THEN
BEGIN
r := goAway;
InsetRect (r, -1, -1);
EraseRect (r);
FrameRect (goAway)
END
END
ELSE
EraseRect (r);
SetPenState (savePen)
END;
wHit:
BEGIN
r := WindowPeek (theWindow)^.contRgn^^.rgnBBox;
IF PtInRect (Point (param), r) THEN
PaletteWDEF := wInContent
ELSE
BEGIN
r := frame;
r.bottom := r.top + kTitleHeight + 1;
IF WindowPeek (theWindow)^.goAwayFlag &
WindowPeek (theWindow)^.hilited &
PtInRect (Point (param), goAway) THEN
PaletteWDEF := wInGoAway
ELSE IF PtInRect (Point (param), r) THEN
PaletteWDEF := wInDrag
ELSE
PaletteWDEF := wNoHit
END
END;
wCalcRgns:
BEGIN
r := theWindow^.portRect;
OffsetRect (r, -theWindow^.portBits.bounds.left,
-theWindow^.portBits.bounds.top);
RectRgn (WindowPeek (theWindow)^.contRgn, r);
InsetRect (r, -1, -1);
r.top := r.top - kTitleHeight;
RectRgn (WindowPeek (theWindow)^.strucRgn, r)
END
END
END;
END.