--- a/Tools__CodeView2.st Fri Aug 30 10:46:35 2019 +0200
+++ b/Tools__CodeView2.st Fri Aug 30 10:46:49 2019 +0200
@@ -1530,15 +1530,42 @@
!
buttonPress: button x:x y:y in: view
- "Delegates events to services. Answers true iff at least
- one service handler method returns true. In that case,
- the event is is NOT processes by the view."
-
- ^ services
- contains:[:service |
- service isEnabled and:[ ((service buttonPress: button x:x y:y in: view) == true) ]
+ "Possibly delegate event a service.
+ Answers true (i.e. event was handled) iff at least
+ one service handler method returns true.
+ In that case, the event is is NOT processes by the view.
+ Notice, that this is called both for events in the gutter AND for events in the text."
+
+ |bpntService|
+
+ "/ cg: I want to toggle breakpoints on single click, but only if its the only service
+ "/ which is interested in that line (i.e. there is no lint-info icon there).
+ "/ Modified to do a first round asking any for a single-press action;
+ "/ on the fly, remember any breakpoint service.
+ services
+ do:[:eachService |
+ eachService isEnabled ifTrue:[
+ ((eachService buttonPress: button x:x y:y in: view) == true) ifTrue:[
+ ^ true.
+ ].
+ eachService isBreakpointService ifTrue:[
+ bpntService := eachService
+ ]
+ ].
].
+ "/ then, if there was no one interested, but there is a breakpoint service,
+ "/ let it handle it.
+ bpntService notNil ifTrue:[
+ view == gutterView ifTrue:[
+ button == 1 ifTrue:[
+ bpntService setOrToggleBreakpointAtX:x y:y.
+ ^ true.
+ ]
+ ]
+ ].
+ ^ false.
+
"Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-10-2011 / 14:14:00 / cg"
"Modified (format): / 05-03-2012 / 08:56:02 / cg"
@@ -2903,22 +2930,24 @@
!CodeView2::GutterView methodsFor:'event handling'!
buttonMultiPress: btn x: x y: y
- |extraSafeArea|
+ |acceptCancelBarWidthOrZero extraSafeArea|
Processor removeTimedBlock:blockWaitingForPossibleDoubleClick.
blockWaitingForPossibleDoubleClick := nil.
"/ for the embedded accept-cancel bar, if enabled
- (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[
- textView reallyModified ifTrue:[
- (y < self acceptButtonBottom) ifTrue:[
- ^self.
+ (acceptCancelBarWidthOrZero := self usedWidthForAcceptCancel) ~~ 0 ifTrue:[
+ (x <= (self paddingLeft + acceptCancelBarWidthOrZero)) ifTrue:[
+ textView reallyModified ifTrue:[
+ (y < self acceptButtonBottom) ifTrue:[
+ ^self.
+ ].
+ (y < self cancelButtonBottom) ifTrue:[
+ ^self.
+ ].
].
- (y < self cancelButtonBottom) ifTrue:[
- ^self.
- ].
+ ^self.
].
- ^self.
].
false ifTrue:[
@@ -2928,7 +2957,7 @@
].
codeView notNil ifTrue:[
- ((x > (self paddingLeft + self usedWidthForAcceptCancel)) or:
+ ((x > (self paddingLeft + acceptCancelBarWidthOrZero)) or:
[x < (self width - self paddingRight - widthDiffInfo)]
) ifTrue:[
(codeView buttonMultiPress: btn x:x y:y in: self) ifTrue:[^ self]. "/ event eaten
@@ -3037,7 +3066,7 @@
tooltip := eachService helpTextAtLine:lineNr.
tooltip notEmptyOrNil ifTrue:[
textCollector notEmpty ifTrue:[ textCollector cr].
- textCollector nextPutAllText:tooltip.
+ textCollector nextPutAllText:tooltip withCRs.
tooltip last == Character cr ifFalse:[textCollector cr].
].
].