263 "Modified (comment): / 06-02-2018 / 20:35:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
263 "Modified (comment): / 06-02-2018 / 20:35:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
264 ! ! |
264 ! ! |
265 |
265 |
266 !VDBAbstractApplication methodsFor:'change & update'! |
266 !VDBAbstractApplication methodsFor:'change & update'! |
267 |
267 |
268 enqueueDelayedUpdate: selector |
268 update:aspect with:aParameter from:changedObject |
269 "Arrange for and update to be processed 'later' some time. |
269 "Invoked when an object that I depend upon sends a change notification." |
270 There's no time guarantee on when it'd be processed but |
270 |
271 if if more updates are delayed, they're guaranteed to |
271 changedObject == debuggerHolder ifTrue:[ |
272 process in order." |
272 debuggerHolder value == debugger ifFalse:[ |
|
273 debugger notNil ifTrue:[ |
|
274 self unsubscribe. |
|
275 ]. |
|
276 debugger := debuggerHolder value. |
|
277 debugger notNil ifTrue:[ |
|
278 self subscribe. |
|
279 ]. |
|
280 ]. |
|
281 ^ self. |
|
282 ]. |
|
283 changedObject == window ifTrue:[ |
|
284 aspect == #visibility ifTrue:[ |
|
285 windowVisible ~~ window shown ifTrue:[ |
|
286 windowVisible := window shown. |
|
287 self updateAfterWindowVisibilityChanged. |
|
288 ]. |
|
289 |
|
290 ]. |
|
291 |
|
292 ]. |
|
293 |
|
294 super update:aspect with:aParameter from:changedObject |
|
295 |
|
296 "Modified: / 07-10-2018 / 22:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
297 ! |
|
298 |
|
299 updateAfterWindowVisibilityChanged |
|
300 "/ Nothing by default, to be overriden by subclasses. |
|
301 |
|
302 "Created: / 07-10-2018 / 22:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
303 ! ! |
|
304 |
|
305 !VDBAbstractApplication methodsFor:'delayed actions (enqueue)'! |
|
306 |
|
307 enqueueMessage:selector for: object arguments: arguments |
|
308 "enqueue a message to be sent to someone later, when my process |
|
309 is back in its eventLoop. Also, filter duplicates. |
|
310 This is useful, to buffer redraws and avoid flicker due to multiple |
|
311 redraws (especially in browsers, when reacting on changeMessages resulting |
|
312 from changes made in other browsers)" |
273 |
313 |
274 | w wg | |
314 | w wg | |
275 |
315 |
276 |
316 |
277 "/ Technicallly, this is done by pushing an user event onto |
317 "/ Technicallly, this is done by pushing an user event onto |
302 ]. |
342 ]. |
303 wg isNil ifTrue:[ |
343 wg isNil ifTrue:[ |
304 wg := WindowGroup activeGroup |
344 wg := WindowGroup activeGroup |
305 ]. |
345 ]. |
306 wg notNil ifTrue:[ |
346 wg notNil ifTrue:[ |
307 wg sensor pushUserEvent: selector for:self |
347 wg sensor enqueueMessage: selector for:object arguments: arguments |
308 ] ifFalse:[ |
348 ] ifFalse:[ |
309 [ self perform: selector ] fork. |
349 [ object perform: selector withArguments: arguments ] fork. |
310 ] |
350 ] |
311 |
351 |
312 "Created: / 17-01-2018 / 06:50:29 / jv" |
352 "Created: / 18-02-2019 / 10:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
313 "Modified (format): / 03-10-2018 / 15:22:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
314 ! |
|
315 |
|
316 enqueueDelayedUpdate: selector with: argument |
|
317 | w | |
|
318 |
|
319 w := self window. |
|
320 w notNil ifTrue:[ |
|
321 self window sensor pushUserEvent: selector for:self withArgument: argument |
|
322 ] ifFalse:[ |
|
323 self perform: selector with: argument |
|
324 ]. |
|
325 |
|
326 "Created: / 17-01-2018 / 06:50:39 / jv" |
|
327 "Modified: / 03-02-2018 / 08:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
328 ! |
|
329 |
|
330 update:aspect with:aParameter from:changedObject |
|
331 "Invoked when an object that I depend upon sends a change notification." |
|
332 |
|
333 changedObject == debuggerHolder ifTrue:[ |
|
334 debuggerHolder value == debugger ifFalse:[ |
|
335 debugger notNil ifTrue:[ |
|
336 self unsubscribe. |
|
337 ]. |
|
338 debugger := debuggerHolder value. |
|
339 debugger notNil ifTrue:[ |
|
340 self subscribe. |
|
341 ]. |
|
342 ]. |
|
343 ^ self. |
|
344 ]. |
|
345 changedObject == window ifTrue:[ |
|
346 aspect == #visibility ifTrue:[ |
|
347 windowVisible ~~ window shown ifTrue:[ |
|
348 windowVisible := window shown. |
|
349 self updateAfterWindowVisibilityChanged. |
|
350 ]. |
|
351 |
|
352 ]. |
|
353 |
|
354 ]. |
|
355 |
|
356 super update:aspect with:aParameter from:changedObject |
|
357 |
|
358 "Modified: / 07-10-2018 / 22:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 ! |
|
360 |
|
361 updateAfterWindowVisibilityChanged |
|
362 "/ Nothing by default, to be overriden by subclasses. |
|
363 |
|
364 "Created: / 07-10-2018 / 22:51:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
365 ! ! |
353 ! ! |
366 |
354 |
367 !VDBAbstractApplication methodsFor:'dependents access'! |
355 !VDBAbstractApplication methodsFor:'dependents access'! |
368 |
356 |
369 release |
357 release |