-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass-def.lisp
More file actions
204 lines (149 loc) · 6.36 KB
/
class-def.lisp
File metadata and controls
204 lines (149 loc) · 6.36 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
;;;-*- Mode:Common-Lisp; Package:PICTURES; Base:10 -*-
;;;
;;;
;;;
;;; TEXAS INSTRUMENTS INCORPORATED
;;; P.O. BOX 149149
;;; AUSTIN, TEXAS 78714-9149
;;;
;;; Copyright (C)1987,1988,1989,1990 Texas Instruments Incorporated.
;;;
;;; Permission is granted to any individual or institution to use, copy, modify,
;;; and distribute this software, provided that this complete copyright and
;;; permission notice is maintained, intact, in all copies and supporting
;;; documentation.
;;;
;;; Texas Instruments Incorporated provides this software "as is" without
;;; express or implied warranty.
;;;
;;; Authors: Delmar Hager, James Dutton, Teri Crowe
;;; Contributors: Kerry Kimbrough, Patrick Hogan, Eric Mielke
(in-package "PICTURES")
;;; Graphic class definition
(defclass graphic ()
(
(gstate :type (or null gstate)
:initarg :gstate
:initform nil
:documentation "The graphic's visual attributes (R)")
(parent :type (or null graphic)
:initarg :parent
:initform nil
:documentation "The graphic's parent picture, if one exists (R)")
(plist :type list
:accessor graphic-plist
:initarg :plist
:initform nil
:documentation "A list of graphic properties")
(sensitivity :type (member :hidden :viewable :selectable :editable :subselectable )
:initarg :sensitivity
:initform :editable
:reader graphic-sensitivity
:documentation "Controls state transitions")
(transform :type (or null transform)
:initarg :transform
:reader graphic-transform
:initform nil
:documentation "The graphic's rotation and translation in the coordinate system (R)")
(views :type list
:initform nil
:documentation "The views to which the graphic is attached(mR)")
)
(:documentation "Base class for graphical objects"))
(defmethod initialize-instance :after ((graphic graphic) &rest initargs &key parent)
(when parent
(scene-insert parent graphic)))
(deftype scene-position () '(or graphic (integer 1 *) nil))
(defclass scene (edge extent-cache graphic )
(
(elements :type array
:initform (make-array '(10) :adjustable t :fill-pointer 0)
:documentation "The graphic objects in the scene(mR)")
)
(:documentation "Base class for composite graphical objects"))
;;view class definition
(defcontact view (composite)
(
(plist :type list
:initarg :plist
:initform nil
:documentation "A list of view properties")
(button-release-p :type (OR nil t)
:initform nil
:accessor button-release-p
:documentation "toggle action for release button event")
(damage-count :type card8
:initform 0
:accessor view-damage-count
:documentation "Number of active damage rectangles.
Zero means no damage.")
(damage :type vector
:initform (make-array (list max-damage)
:element-type 'extent-rect)
:documentation "Damage rectangles for a view")
(default-gcontext :type (OR null gcontext)
:documentation "Default gcontext, X window visual attributes, for a view")
(gcontext-cache :type array
:accessor view-gcontext-cache
:initform (MAKE-ARRAY 10 :adjustable t :fill-pointer 0)
:documentation "Working gcontext, X window Visual attributes, for a view")
(gravity :type (member :northwest :north :northeast
:west :center :east
:southwest :south :southeast)
:initarg :view-gravity
:initform :southwest
:documentation "The fixed point of the world coordinate system after resize")
(origin-x :type wcoord
:initarg :origin-x
:reader origin-x
:initform 0.0
:documentation "World x-coordinate of the southwest corner of the view")
(origin-y :type wcoord
:initarg :origin-y
:reader origin-y
:initform 0.0
:documentation "World y-coordinate of the southwest corner of the view")
(highlight-color :type pixel
:initarg :highlight-color
:accessor view-highlight-color
:initform 1
:documentation "define the highlight color of a view of the view")
(view-graphic :type (or null graphic)
:initarg :graphic
:initform nil
:accessor view-graphic
:documentation "The graphic object to be displayed(R)")
(resize-extent-p :type :boolean
:accessor view-resize-extent-p
:initarg :resize-extent-p
:initform t
:documentation "If true, resizing will change the world coordinate extent;
If false, resizing will cause a zoom effect.")
(scale-x :type wcoord
:initarg :scale-x
:initform 1.0
:accessor view-scale-x
:documentation "Number of pixels per world coordinate unit")
(scale-y :type wcoord
:initarg :scale-y
:initform 1.0
:accessor view-scale-y
:documentation "Number of pixels per world coordinate unit")
(selection :type scene
:accessor view-selection-scene
:documentation "Selected graphics in a view(mR)")
(grabber-rect-transform :type transform
:accessor grabber-rect-transform
:documentation "the transform of the grabber-rect - inverse of view transform")
)
(:resources ; Turn on exposure events for this composite
(event-mask :initform #.(make-event-mask :exposure)))
(:documentation "A CLUE contact for viewing a picture"))
(defun graphic-events-enabled-p (view)
(not (GETF (slot-value view 'plist) :ignore-graphic-events)))
(DEFUN set-graphic-events-enabled-p (view boolean)
(IF boolean
(SETF (GETF (slot-value view 'plist) :ignore-graphic-events) nil)
(SETF (GETF (slot-value view 'plist) :ignore-graphic-events) t))
boolean)
(defsetf graphic-events-enabled-p set-graphic-events-enabled-p)