GDBEventSubscription.st
changeset 176 e734c17e7c37
parent 145 1256a03213cf
child 244 f0e4ddb50242
equal deleted inserted replaced
175:a04e1a36e888 176:e734c17e7c37
    56 
    56 
    57     | args |
    57     | args |
    58     args := aSelector numArgs.      
    58     args := aSelector numArgs.      
    59 
    59 
    60     anObject isView ifTrue:[ 
    60     anObject isView ifTrue:[ 
    61         args = 0 ifTrue: [ ^[ anObject sensor pushUserEvent: aSelector for: anObject ] ].
    61         args = 0 ifTrue: [ ^[ anObject pushEvent: aSelector ] ].
    62         args = 1 ifTrue: [ ^[ :anAnnouncement | anObject sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ] ].
    62         args = 1 ifTrue: [ ^[ :anAnnouncement | anObject pushEvent: aSelector with: anAnnouncement ] ].
    63         args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
    63         args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject pushEvent: aSelector with: anAnnouncement with: anAnnouncer ] ].
    64         self error: 'Couldn''t create block'.        
    64         self error: 'Couldn''t create block'.        
    65     ].
    65     ].
    66 
    66 
    67     "/ If the observer (receiver of events) is an application,
    67     "/ If the observer (receiver of events) is an application,
    68     "/ then push the event processing to application's event
    68     "/ then push the event processing to application's event
    72     "/ However, we must be carefull since application windows may 
    72     "/ However, we must be carefull since application windows may 
    73     "/ not yet be opened or fully initialized so we have to check
    73     "/ not yet be opened or fully initialized so we have to check
    74     "/ for existence of sensor. If application/window is not fully 
    74     "/ for existence of sensor. If application/window is not fully 
    75     "/ initialized, process the event as usual.
    75     "/ initialized, process the event as usual.
    76     (anObject isKindOf: ApplicationModel) ifTrue:[
    76     (anObject isKindOf: ApplicationModel) ifTrue:[
    77         args = 0 ifTrue: [  ^[  | window |
    77         args = 0 ifTrue: [  ^[ anObject enqueueMessage: aSelector ] ].
    78 
    78         args = 1 ifTrue: [  ^[ :anAnnouncement | anObject enqueueMessage: aSelector with: anAnnouncement ] ].
    79                                 window := anObject window.
    79         args = 1 ifTrue: [  ^[ :anAnnouncement :anAnnouncer | anObject enqueueMessage: aSelector arguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
    80                                 window notNil 
       
    81                                     ifTrue:[ window sensor pushUserEvent: aSelector for: anObject ]
       
    82                                     ifFalse:[ anObject perform: aSelector ]
       
    83                              ]
       
    84         ].
       
    85         args = 1 ifTrue: [  ^[ :anAnnouncement | | window |
       
    86 
       
    87                                 window := anObject window.
       
    88                                 window notNil 
       
    89                                     ifTrue:[ window sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ]
       
    90                                     ifFalse:[ anObject perform: aSelector with: anAnnouncement ]
       
    91                              ]
       
    92         ].
       
    93         args = 1 ifTrue: [  ^[ :anAnnouncement :anAnnouncer | | window |
       
    94         
       
    95                                 window := anObject window.
       
    96                                 window notNil 
       
    97                                     ifTrue:[ window sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ]
       
    98                                     ifFalse:[ anObject perform: aSelector with: anAnnouncement with: anAnnouncer ]
       
    99                              ].
       
   100         ].
       
   101         self error: 'Couldn''t create block'.        
    80         self error: 'Couldn''t create block'.        
   102     ].
    81     ].
   103     ^ super blockFor: anObject withSelector: aSelector
    82     ^ super blockFor: anObject withSelector: aSelector
   104 
    83 
   105     "Created: / 18-09-2014 / 00:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    84     "Created: / 18-09-2014 / 00:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   106     "Modified: / 01-10-2018 / 17:30:56 / jv"
    85     "Modified: / 01-10-2018 / 17:30:56 / jv"
       
    86     "Modified: / 18-02-2019 / 10:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   107 ! !
    87 ! !
   108 
    88 
   109 !GDBEventSubscription class methodsFor:'documentation'!
    89 !GDBEventSubscription class methodsFor:'documentation'!
   110 
    90 
   111 version_HG
    91 version_HG