242 If the method returns true, it has eaten the event and it will not be processed |
242 If the method returns true, it has eaten the event and it will not be processed |
243 by the view." |
243 by the view." |
244 |
244 |
245 |ev p| |
245 |ev p| |
246 |
246 |
247 (view == textView) ifTrue:[ |
247 (view == textView) ifTrue:[ |
248 (key == #'Control_L' or:[ key == #Ctrl ]) ifTrue:[ |
248 (key == #'Control_L' or:[ key == #Ctrl ]) ifTrue:[ |
249 "/ because it is delegated, the position is not correct |
249 "/ because it is delegated, the position is not correct |
250 ev := WindowGroup lastEventQuerySignal query. |
250 ev := WindowGroup lastEventQuerySignal query. |
251 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
251 p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view. |
252 view sensor pushUserEvent:#highlightElementAtX:y: for:self withArguments:{p x. p y.}. |
252 view sensor pushUserEvent:#highlightElementAtX:y: for: self withArguments:{p x. p y.}. |
253 ^ true. |
253 ^ true. |
254 ]. |
254 ]. |
255 |
255 |
256 codeView reallyModified "textView modified" ifTrue:[ |
256 "/ codeView reallyModified "textView modified" ifTrue:[ |
257 self highlightClear. |
257 "/ self highlightClear. |
258 codeView syntaxElements: nil. |
258 "/ codeView syntaxElements: nil. |
259 ^ false |
259 "/ ^ false |
260 ]. |
260 "/ ]. |
261 view sensor pushUserEvent:#highlightVariableAtCursor for:self . |
261 (key == #CursorRight |
|
262 or:[key == #CursorDown |
|
263 or:[key == #CursorLeft |
|
264 or:[key == #CursorUp]]]) ifTrue:[ |
|
265 view sensor pushUserEvent:#highlightVariableAtCursor for:self . |
|
266 ] ifFalse:[ |
|
267 self highlightClear. |
|
268 ] |
|
269 |
262 ]. |
270 ]. |
263 ^ false |
271 ^ false |
264 |
272 |
265 "Created: / 06-03-2010 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
273 "Created: / 06-03-2010 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
266 "Modified: / 20-07-2011 / 18:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
267 "Modified: / 05-09-2011 / 05:17:30 / cg" |
274 "Modified: / 05-09-2011 / 05:17:30 / cg" |
|
275 "Modified: / 16-09-2011 / 15:28:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
268 ! |
276 ! |
269 |
277 |
270 keyRelease: key x:x y:y in: view |
278 keyRelease: key x:x y:y in: view |
271 "Handles an event in given view (a subview of codeView). |
279 "Handles an event in given view (a subview of codeView). |
272 If the method returns true, it has eaten the event and it will not be processed |
280 If the method returns true, it has eaten the event and it will not be processed |
284 ]. |
292 ]. |
285 ^ false |
293 ^ false |
286 |
294 |
287 "Created: / 06-03-2010 / 21:03:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
295 "Created: / 06-03-2010 / 21:03:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
288 "Modified: / 21-08-2011 / 11:32:40 / cg" |
296 "Modified: / 21-08-2011 / 11:32:40 / cg" |
|
297 ! |
|
298 |
|
299 linesDeletedFrom: start to: end |
|
300 |
|
301 self highlightClear |
|
302 |
|
303 "Created: / 06-07-2011 / 17:14:36 / jv" |
|
304 "Created: / 16-09-2011 / 15:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 ! |
|
306 |
|
307 linesInsertedFrom: start to: end |
|
308 |
|
309 self highlightClear |
|
310 |
|
311 "Created: / 06-07-2011 / 17:14:36 / jv" |
|
312 "Created: / 16-09-2011 / 15:39:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
313 ! |
|
314 |
|
315 linesModifiedFrom: start to: end |
|
316 |
|
317 self highlightClear |
|
318 |
|
319 "Created: / 06-07-2011 / 17:14:36 / jv" |
|
320 "Created: / 16-09-2011 / 15:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
289 ! ! |
321 ! ! |
290 |
322 |
291 !CodeNavigationService methodsFor:'initialization'! |
323 !CodeNavigationService methodsFor:'initialization'! |
292 |
324 |
293 initialize |
325 initialize |
317 characterPosition := textView characterPositionOfLine:line col:col. |
349 characterPosition := textView characterPositionOfLine:line col:col. |
318 index := SortedCollection binarySearch: (codeView syntaxElements) forIndexOf: characterPosition. |
350 index := SortedCollection binarySearch: (codeView syntaxElements) forIndexOf: characterPosition. |
319 index > (codeView syntaxElements) size ifTrue:[^nil]. |
351 index > (codeView syntaxElements) size ifTrue:[^nil]. |
320 element := (codeView syntaxElements) at:index ifAbsent:nil. |
352 element := (codeView syntaxElements) at:index ifAbsent:nil. |
321 element notNil ifTrue:[ |
353 element notNil ifTrue:[ |
322 (characterPosition between: element start and: element stop) ifTrue:[^element]. |
354 (characterPosition between: element start - 1 and: element stop) ifTrue:[^element]. |
323 ]. |
355 ]. |
324 ^nil |
356 ^nil |
325 |
357 |
326 "Created: / 25-06-2010 / 14:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
358 "Created: / 25-06-2010 / 14:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
327 "Modified: / 21-08-2011 / 11:03:29 / cg" |
359 "Modified: / 21-08-2011 / 11:03:29 / cg" |
|
360 "Modified: / 16-09-2011 / 17:04:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
328 ! |
361 ! |
329 |
362 |
330 elementAtX:x y:y |
363 elementAtX:x y:y |
331 |visibleLine line col| |
364 |visibleLine line col| |
332 |
365 |