changed default for Jan's quick menus to use the ALT button isntead
of the CTRL button - users complained, loosing the quick-ctrl textmenu.
Made this configurable, so Jan can change it in the UserPreferences.
--- a/Tools__CodeNavigationService.st Wed Jan 30 18:52:18 2013 +0100
+++ b/Tools__CodeNavigationService.st Wed Jan 30 18:54:04 2013 +0100
@@ -87,7 +87,7 @@
defaultSelectorEmphasis
DefaultSelectorEmphasis isNil ifTrue:[
DefaultSelectorEmphasis :=
- Array with:(#backgroundColor -> (Color rgbValue:16rDBEEFF))
+ Array with:(#backgroundColor -> (Color rgbValue:16rADD9FF "16rDBEEFF"))
].
^ DefaultSelectorEmphasis
@@ -96,7 +96,7 @@
defaultVariableEmphasis
DefaultVariableEmphasis isNil ifTrue:[
- DefaultVariableEmphasis := Array with:(#backgroundColor -> (Color gray: 90))
+ DefaultVariableEmphasis := Array with:(#backgroundColor -> (Color gray: 80 "90"))
].
^ DefaultVariableEmphasis
@@ -150,11 +150,13 @@
!CodeNavigationService methodsFor:'event handling'!
button1Press
-
- codeView syntaxElementSelection isNil ifTrue:[^self].
+ |element|
- codeView syntaxElementSelection type == #selector ifTrue:[^self button1PressForSelector: codeView syntaxElementSelection value].
- codeView syntaxElementSelection type == #class ifTrue:[^self browseClass:codeView syntaxElementSelection value].
+ (element := codeView syntaxElementSelection) notNil ifTrue:[
+ element type == #selector ifTrue:[self button1PressForSelector: element value. ^true].
+ element type == #class ifTrue:[self browseClass:element value. ^true].
+ ].
+ ^ false
"Created: / 14-02-2010 / 18:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-03-2010 / 21:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -177,10 +179,12 @@
!
button2Press
+ | element |
- | sel |
- sel := codeView syntaxElementSelection.
- (sel notNil and:[sel type == #selector]) ifTrue:[^self button2PressForSelector: sel value].
+ (element := codeView syntaxElementSelection) notNil ifTrue:[
+ element type == #selector ifTrue:[self button2PressForSelector: element value. ^ true].
+ ].
+ ^ false
"Created: / 14-02-2010 / 18:43:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-06-2011 / 08:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -205,7 +209,7 @@
If the method returns true, the event will not be processed
by the view."
- (view == textView and:[ textView sensor ctrlDown ]) ifTrue:[
+ (view == textView and:[ textView sensor metaDown ]) ifTrue:[
self highlightElementAtX:x y:y.
^ true
].
@@ -222,13 +226,14 @@
by the view."
(view == textView) ifTrue:[
- codeView sensor ctrlDown ifTrue:[
- button == 1 ifTrue: [self button1Press.^true].
- button == #paste ifTrue: [self button2Press.^true].
- button == 2 ifTrue: [self button2Press.^true]
- ].
- button == 1 ifTrue:[
- self highlightVariableAtX:x y:y.
+ textView isQuickMenuModifierPressed ifTrue:[
+ button == 1 ifTrue: [^self button1Press].
+ button == #paste ifTrue: [^self button2Press].
+ button == 2 ifTrue: [^self button2Press]
+ ] ifFalse:[
+ button == 1 ifTrue:[
+ self highlightVariableAtX:x y:y.
+ ]
]
].
^false
@@ -238,6 +243,20 @@
"Modified (format): / 21-08-2011 / 10:06:54 / cg"
!
+isQuickMenuModifierPressed
+ UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
+ ^ textView sensor ctrlDown
+ ].
+ ^ textView sensor metaDown
+!
+
+isQuickMenuModifierReleased
+ UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
+ ^ textView sensor ctrlDown not
+ ].
+ ^ textView sensor metaDown not
+!
+
keyPress:key x:x y:y in:view
"Handles an event in given view (a subview of codeView).
If the method returns true, it has eaten the event and it will not be processed
@@ -248,13 +267,17 @@
|ev p|
- (view == textView) ifTrue:[
- (key == #'Control_L' or:[ key == #Ctrl ]) ifTrue:[
+ (view == textView) ifTrue:[
+ "/ ("ctrlDown" "key == #'Control_L' or:[ key == #Ctrl ]") ifTrue:[
+ (textView isQuickMenuModifierPressed) ifTrue:[
"/ because it is delegated, the position is not correct
ev := WindowGroup lastEventQuerySignal query.
p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view.
- view sensor pushUserEvent:#highlightElementAtX:y: for: self withArguments:{p x. p y.}.
- ^ true.
+ view sensor
+ pushUserEvent:#highlightElementAtX:y:
+ for: self
+ withArguments:{p x. p y.}.
+ ^ false "/ true. -- no, dont eat the key
].
"/ codeView reallyModified "textView modified" ifTrue:[
@@ -286,13 +309,14 @@
|ev p|
- (view == textView and:[key == #'Control_L' or:[key == #Ctrl]]) ifTrue:[
+ (view == textView and:[textView isQuickMenuModifierReleased]) ifTrue:[
+ "/ (view == textView and:[key == #'Control_L' or:[key == #Ctrl]]) ifTrue:[
"/ because it is delegated, the position is not correct
ev := WindowGroup lastEventQuerySignal query.
p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view.
self highlightClear.
"/ view sensor pushUserEvent:#highlightClear for:self.
- ^ true
+ ^ false "/ true -- do not eat the event
].
^ false
@@ -602,7 +626,7 @@
!CodeNavigationService class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.19 2013-01-17 10:35:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.20 2013-01-30 17:54:04 cg Exp $'
!
version_SVN