/usr/share/dx/samples/macros/GetEventsMacro.net is in dxsamples 4.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | //
// time: Wed Jul 30 09:48:24 1997
//
// version: 3.1.1 (format), 3.1.4 (DX)
//
//
// Begin MDF
// MODULE GetEvents
// CATEGORY Macros
// DESCRIPTION extracts requested information from events
// INPUT events; value list or field or string or string list; (no default); events output of SuperviseWindow
// INPUT button_mask; value list or field or string or string list; (no default); or-ing of buttons requested: left=1, middle=2, right=4
// INPUT buttonstate; value list or field or string or string list; (no default); up=1, down=2, motion=3
// OUTPUT position; object; x,y position of event
// OUTPUT event_occurred; object; whether or not a requested event occurred
// End MDF
//
// comment: This macro, given an "events" input (the output
// comment: of SuperviseWindow) and a user-specified
// comment: mask for which kind of events are desired (which
// comment: button, and button-up, down, or motion) outputs
// comment: for any events matching the criteria the x,y position
// comment: of the event. In addition, it outputs whether or not
// comment: the specified type of event occurred, which is useful
// comment: for switches and routes in the calling program.
// comment:
// comment: The input "button-mask" should be an "or-ring" of
// comment: which buttons are desired, where left=1, middle=2, and
// comment: right=4. For example, if you are interested in only left button events, then button-mask should be set to 1. If you are interested in both left and middle events, set button-mask to 3. If you are interested in only left and right button events, set button-mask to 5.
// comment:
// comment: The input "buttonstate" should be set to 1, 2, or 3, where
// comment: 1=buttonup, 2=buttondown, and 3=buttonmotion.
// workspace: width = 1005, height = 734
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro GetEvents(
events
,button_mask
,buttonstate
) -> (
position
,event_occurred
) {
//
// node Input[3]: x = 350, y = 14, inputs = 0, label = Input
// parameter: position = 1, name = 'events', value = '(no default)', descriptive = 1, description = ' events output of SuperviseWindow', required = 0, visible = 1
//
GetEvents_Input_3_out_1 = events;
//
// node Compute[6]: x = 405, y = 223, inputs = 2, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "[$0.1, $0.2]"
// expression: value = [a.1, a.2]
// name[2]: value = a
//
GetEvents_Compute_6_out_1 =
Compute(
"[$0.1, $0.2]",
GetEvents_Input_3_out_1
) [instance: 6, cache: 1];
//
// node Input[1]: x = 99, y = 10, inputs = 0, label = Input
// parameter: position = 2, name = 'button_mask', value = '(no default)', descriptive = 1, description = ' or-ing of buttons requested: left=1, middle=2, right=4', required = 0, visible = 1
//
GetEvents_Input_1_out_1 = button_mask;
//
// node Compute[7]: x = 112, y = 219, inputs = 3, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "and($0.0, $1) ? 1 : 0"
// expression: value = and(a.0, b) ? 1 : 0
// name[2]: value = a
// name[3]: value = b
//
GetEvents_Compute_7_out_1 =
Compute(
"and($0.0, $1) ? 1 : 0",
GetEvents_Input_3_out_1,
GetEvents_Input_1_out_1
) [instance: 7, cache: 1];
//
// node Input[2]: x = 220, y = 8, inputs = 0, label = Input
// parameter: position = 3, name = 'buttonstate', value = '(no default)', descriptive = 1, description = ' up=1, down=2, motion=3', required = 0, visible = 1
//
GetEvents_Input_2_out_1 = buttonstate;
//
// node Compute[8]: x = 214, y = 222, inputs = 3, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "$0.3 == $1 ? 1 : 0"
// expression: value = a.3 == b ? 1 : 0
// name[2]: value = a
// name[3]: value = b
//
GetEvents_Compute_8_out_1 =
Compute(
"$0.3 == $1 ? 1 : 0",
GetEvents_Input_3_out_1,
GetEvents_Input_2_out_1
) [instance: 8, cache: 1];
//
// node Compute[9]: x = 158, y = 308, inputs = 3, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 && $1"
// expression: value = a && b
// name[2]: value = a
// name[3]: value = b
//
GetEvents_Compute_9_out_1 =
Compute(
"$0 && $1",
GetEvents_Compute_7_out_1,
GetEvents_Compute_8_out_1
) [instance: 9, cache: 1];
//
// node Construct[3]: x = 321, y = 322, inputs = 4, label = Construct
//
GetEvents_Construct_3_out_1 =
Construct(
GetEvents_Compute_6_out_1,
NULL,
NULL,
GetEvents_Compute_9_out_1
) [instance: 3, cache: 1];
//
// node Include[2]: x = 412, y = 391, inputs = 6, label = Include
// input[2]: defaulting = 0, visible = 1, type = 5, value = 1.0
// input[3]: defaulting = 0, visible = 1, type = 5, value = 1.0
// input[6]: defaulting = 0, visible = 1, type = 3, value = 1
//
GetEvents_Include_2_out_1 =
Include(
GetEvents_Construct_3_out_1,
1.0,
1.0,
NULL,
NULL,
1
) [instance: 2, cache: 1];
//
// node Extract[2]: x = 659, y = 489, inputs = 2, label = Extract
// input[2]: defaulting = 0, visible = 1, type = 32, value = "positions"
//
GetEvents_Extract_2_out_1 =
Extract(
GetEvents_Include_2_out_1,
"positions"
) [instance: 2, cache: 1];
//
// node Compute[10]: x = 630, y = 561, inputs = 2, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "int($0)"
// expression: value = int(a)
// name[2]: value = a
//
GetEvents_Compute_10_out_1 =
Compute(
"int($0)",
GetEvents_Extract_2_out_1
) [instance: 10, cache: 1];
//
// node Inquire[2]: x = 431, y = 107, inputs = 3, label = Inquire
// input[2]: defaulting = 0, visible = 1, type = 32, value = "is null + 1"
//
GetEvents_Inquire_2_out_1 =
Inquire(
GetEvents_Input_3_out_1,
"is null + 1",
NULL
) [instance: 2, cache: 1];
//
// node Inquire[3]: x = 258, y = 461, inputs = 3, label = Inquire
// input[2]: defaulting = 0, visible = 1, type = 32, value = "is not empty"
//
GetEvents_Inquire_3_out_1 =
Inquire(
GetEvents_Include_2_out_1,
"is not empty",
NULL
) [instance: 3, cache: 1];
//
// node Transmitter[9]: x = 549, y = 146, inputs = 1, label = was_no_event
//
was_no_event = GetEvents_Inquire_2_out_1;
//
// node Receiver[11]: x = 55, y = 446, inputs = 1, label = was_no_event
//
GetEvents_Receiver_11_out_1[cache: 0] = was_no_event;
//
// node Switch[10]: x = 406, y = 585, inputs = 3, label = Switch
// input[3]: defaulting = 0, visible = 1, type = 67108863, value = 0
//
GetEvents_Switch_10_out_1 =
Switch(
GetEvents_Receiver_11_out_1,
GetEvents_Compute_10_out_1,
0
) [instance: 10, cache: 1];
//
// node Output[1]: x = 389, y = 672, inputs = 1, label = Output
// parameter: position = 1, name = 'position', value = ' ', descriptive = 0, description = ' x,y position of event', required = 0, visible = 1
//
position = GetEvents_Switch_10_out_1;
//
// node Switch[9]: x = 314, y = 586, inputs = 3, label = Switch
// input[3]: defaulting = 0, visible = 1, type = 67108863, value = 0
//
GetEvents_Switch_9_out_1 =
Switch(
GetEvents_Receiver_11_out_1,
GetEvents_Inquire_3_out_1,
0
) [instance: 9, cache: 1];
//
// node Output[2]: x = 314, y = 668, inputs = 1, label = Output
// parameter: position = 2, name = 'event_occurred', value = '(NULL)', descriptive = 1, description = ' whether or not a requested event occurred', required = 0, visible = 1
//
event_occurred = GetEvents_Switch_9_out_1;
//
// decorator Annotate pos=(449,57) size=204x44 style(Label), value = <NULL>
// annotation user_begin: 51
// annotation user: Determine whether or not
// annotation user: any mouse event occurred.
// annotation user_end: <NULL>
//
// decorator Annotate pos=(481,234) size=230x44 style(Label), value = <NULL>
// annotation user_begin: 39
// annotation user: extract the x,y position from the
// annotation user: event
// annotation user_end: <NULL>
//
// decorator Annotate pos=(5,140) size=300x76 style(Label), value = <NULL>
// annotation user_begin: 139
// annotation user: These computes determine whether the
// annotation user: mouse button pressed and the event type
// annotation user: (button up, down, or motion) match the
// annotation user: requested event
// annotation user_end: <NULL>
//
// decorator Annotate pos=(433,318) size=369x60 style(Label), value = <NULL>
// annotation user_begin: 119
// annotation user: create a field with the x,y of the event as "positions"
// annotation user: and whether or not it was the requested type of
// annotation user: event as "data"
// annotation user_end: <NULL>
//
// decorator Annotate pos=(567,402) size=348x44 style(Label), value = <NULL>
// annotation user_begin: 72
// annotation user: Use Include to save only events which match the
// annotation user: criteria set by the user
// annotation user_end: <NULL>
//
// decorator Annotate pos=(341,473) size=298x60 style(Label), value = <NULL>
// annotation user_begin: 114
// annotation user: Use Inquire to figure out if there were any
// annotation user: events of the requested type (is the
// annotation user: field after Include empty or not)
// annotation user_end: <NULL>
//
// decorator Annotate pos=(720,506) size=285x28 style(Label), value = <NULL>
// annotation user_begin: 42
// annotation user: Extract just the x,y position of the event
// annotation user_end: <NULL>
//
// decorator Annotate pos=(486,641) size=216x44 style(Label), value = <NULL>
// annotation user_begin: 63
// annotation user: If an event of the requested
// annotation user: type occurred, output the x,y.
// annotation user_end: <NULL>
//
// decorator Annotate pos=(14,630) size=280x60 style(Label), value = <NULL>
// annotation user_begin: 103
// annotation user: output whether or not an event of the
// annotation user: requested type occurred. If no event at
// annotation user: all occurred, output 0.
// annotation user_end: <NULL>
// network: end of macro body
}
GetEvents_Input_3_out_1 = NULL;
GetEvents_Compute_6_out_1 = NULL;
GetEvents_Input_1_out_1 = NULL;
GetEvents_Compute_7_out_1 = NULL;
GetEvents_Input_2_out_1 = NULL;
GetEvents_Compute_8_out_1 = NULL;
GetEvents_Compute_9_out_1 = NULL;
GetEvents_Construct_3_out_1 = NULL;
GetEvents_Include_2_out_1 = NULL;
GetEvents_Extract_2_out_1 = NULL;
GetEvents_Compute_10_out_1 = NULL;
GetEvents_Inquire_2_out_1 = NULL;
GetEvents_Inquire_3_out_1 = NULL;
GetEvents_Transmitter_9_out_1 = NULL;
GetEvents_Receiver_11_out_1 = NULL;
GetEvents_Switch_10_out_1 = NULL;
GetEvents_Switch_9_out_1 = NULL;
|