87 !CodeNavigationService class methodsFor:'accessing - defaults'! |
87 !CodeNavigationService class methodsFor:'accessing - defaults'! |
88 |
88 |
89 defaultSelectorEmphasis |
89 defaultSelectorEmphasis |
90 DefaultSelectorEmphasis isNil ifTrue:[ |
90 DefaultSelectorEmphasis isNil ifTrue:[ |
91 DefaultSelectorEmphasis := |
91 DefaultSelectorEmphasis := |
92 Array with:(#backgroundColor -> (Color rgbValue:16rDBEEFF)) |
92 Array with:(#backgroundColor -> (Color rgbValue:16rADD9FF "16rDBEEFF")) |
93 ]. |
93 ]. |
94 ^ DefaultSelectorEmphasis |
94 ^ DefaultSelectorEmphasis |
95 |
95 |
96 "Modified: / 21-08-2011 / 09:58:18 / cg" |
96 "Modified: / 21-08-2011 / 09:58:18 / cg" |
97 ! |
97 ! |
98 |
98 |
99 defaultVariableEmphasis |
99 defaultVariableEmphasis |
100 DefaultVariableEmphasis isNil ifTrue:[ |
100 DefaultVariableEmphasis isNil ifTrue:[ |
101 DefaultVariableEmphasis := Array with:(#backgroundColor -> (Color redByte: 240 greenByte: 216 blueByte: 168)) |
101 DefaultVariableEmphasis := Array with:(#backgroundColor -> (Color gray: 80 "90")) |
102 ]. |
102 ]. |
103 ^ DefaultVariableEmphasis |
103 ^ DefaultVariableEmphasis |
104 |
104 |
105 "Created: / 25-06-2010 / 13:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
105 "Created: / 25-06-2010 / 13:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
106 "Modified: / 21-08-2011 / 11:04:20 / cg" |
106 "Modified: / 21-08-2011 / 11:04:20 / cg" |
107 "Modified: / 15-02-2012 / 19:38:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
108 ! ! |
107 ! ! |
109 |
108 |
110 |
109 |
111 !CodeNavigationService methodsFor:'change & update'! |
110 !CodeNavigationService methodsFor:'change & update'! |
112 |
111 |
244 buttonMotion:button x:x y:y in:view |
243 buttonMotion:button x:x y:y in:view |
245 "Handles an event in given view (a subview of codeView). |
244 "Handles an event in given view (a subview of codeView). |
246 If the method returns true, the event will not be processed |
245 If the method returns true, the event will not be processed |
247 by the view." |
246 by the view." |
248 |
247 |
249 (view == textView and:[ textView sensor ctrlDown ]) ifTrue:[ |
248 (view == textView and:[ textView sensor metaDown ]) ifTrue:[ |
250 self highlightElementAtX:x y:y. |
249 self highlightElementAtX:x y:y. |
251 ^ true |
250 ^ true |
252 ]. |
251 ]. |
253 ^ false |
252 ^ false |
254 |
253 |
261 "Handles an event in given view (a subview of codeView). |
260 "Handles an event in given view (a subview of codeView). |
262 If the method returns true, the event will not be processed |
261 If the method returns true, the event will not be processed |
263 by the view." |
262 by the view." |
264 |
263 |
265 (view == textView) ifTrue:[ |
264 (view == textView) ifTrue:[ |
266 codeView sensor ctrlDown ifTrue:[ |
265 textView isQuickMenuModifierPressed ifTrue:[ |
267 button == 1 ifTrue: [self button1Press.^true]. |
266 button == 1 ifTrue: [^self button1Press]. |
268 button == #paste ifTrue: [self button2Press.^true]. |
267 button == #paste ifTrue: [^self button2Press]. |
269 button == 2 ifTrue: [self button2Press.^true] |
268 button == 2 ifTrue: [^self button2Press] |
270 ]. |
269 ] ifFalse:[ |
271 button == 1 ifTrue:[ |
270 button == 1 ifTrue:[ |
272 self highlightVariableAtX:x y:y. |
271 self highlightVariableAtX:x y:y. |
|
272 ] |
273 ] |
273 ] |
274 ]. |
274 ]. |
275 ^false |
275 ^false |
276 |
276 |
277 "Created: / 06-03-2010 / 21:12:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
277 "Created: / 06-03-2010 / 21:12:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
278 "Modified: / 25-06-2010 / 14:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
278 "Modified: / 25-06-2010 / 14:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
279 "Modified (format): / 21-08-2011 / 10:06:54 / cg" |
279 "Modified (format): / 21-08-2011 / 10:06:54 / cg" |
|
280 ! |
|
281 |
|
282 isQuickMenuModifierPressed |
|
283 UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[ |
|
284 ^ textView sensor ctrlDown |
|
285 ]. |
|
286 ^ textView sensor metaDown |
|
287 ! |
|
288 |
|
289 isQuickMenuModifierReleased |
|
290 UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[ |
|
291 ^ textView sensor ctrlDown not |
|
292 ]. |
|
293 ^ textView sensor metaDown not |
280 ! |
294 ! |
281 |
295 |
282 keyPress:key x:x y:y in:view |
296 keyPress:key x:x y:y in:view |
283 "Handles an event in given view (a subview of codeView). |
297 "Handles an event in given view (a subview of codeView). |
284 If the method returns true, it has eaten the event and it will not be processed |
298 If the method returns true, it has eaten the event and it will not be processed |
287 <resource: #keyboard (#Control_L #Ctrl |
301 <resource: #keyboard (#Control_L #Ctrl |
288 #CursorRight #CursorDown #CursorLeft #CursorUp)> |
302 #CursorRight #CursorDown #CursorLeft #CursorUp)> |
289 |
303 |
290 |ev p| |
304 |ev p| |
291 |
305 |
292 (view == textView) ifTrue:[ |
306 (view == textView) ifTrue:[ |
293 (key == #'Control_L' or:[ key == #Ctrl ]) ifTrue:[ |
307 "/ ("ctrlDown" "key == #'Control_L' or:[ key == #Ctrl ]") ifTrue:[ |
|
308 (textView isQuickMenuModifierPressed) ifTrue:[ |
294 "/ because it is delegated, the position is not correct |
309 "/ because it is delegated, the position is not correct |
295 ev := WindowGroup lastEventQuerySignal query. |
310 ev := WindowGroup lastEventQuerySignal query. |
296 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
311 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
297 view sensor pushUserEvent:#highlightElementAtX:y: for: self withArguments:{p x. p y.}. |
312 view sensor |
298 ^ true. |
313 pushUserEvent:#highlightElementAtX:y: |
|
314 for: self |
|
315 withArguments:{p x. p y.}. |
|
316 ^ false "/ true. -- no, dont eat the key |
299 ]. |
317 ]. |
300 |
318 |
301 "/ codeView reallyModified "textView modified" ifTrue:[ |
319 "/ codeView reallyModified "textView modified" ifTrue:[ |
302 "/ self highlightClear. |
320 "/ self highlightClear. |
303 "/ codeView syntaxElements: nil. |
321 "/ codeView syntaxElements: nil. |
325 If the method returns true, it has eaten the event and it will not be processed |
343 If the method returns true, it has eaten the event and it will not be processed |
326 by the view." |
344 by the view." |
327 |
345 |
328 |ev p| |
346 |ev p| |
329 |
347 |
330 (view == textView and:[key == #'Control_L' or:[key == #Ctrl]]) ifTrue:[ |
348 (view == textView and:[textView isQuickMenuModifierReleased]) ifTrue:[ |
|
349 "/ (view == textView and:[key == #'Control_L' or:[key == #Ctrl]]) ifTrue:[ |
331 "/ because it is delegated, the position is not correct |
350 "/ because it is delegated, the position is not correct |
332 ev := WindowGroup lastEventQuerySignal query. |
351 ev := WindowGroup lastEventQuerySignal query. |
333 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
352 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
334 self highlightClear. |
353 self highlightClear. |
335 "/ view sensor pushUserEvent:#highlightClear for:self. |
354 "/ view sensor pushUserEvent:#highlightClear for:self. |
336 ^ true |
355 ^ false "/ true -- do not eat the event |
337 ]. |
356 ]. |
338 ^ false |
357 ^ false |
339 |
358 |
340 "Created: / 06-03-2010 / 21:03:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
359 "Created: / 06-03-2010 / 21:03:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
341 "Modified: / 21-08-2011 / 11:32:40 / cg" |
360 "Modified: / 21-08-2011 / 11:32:40 / cg" |