1528 "Modified: / 06-10-2011 / 14:14:00 / cg" |
1528 "Modified: / 06-10-2011 / 14:14:00 / cg" |
1529 "Modified (format): / 05-03-2012 / 08:56:02 / cg" |
1529 "Modified (format): / 05-03-2012 / 08:56:02 / cg" |
1530 ! |
1530 ! |
1531 |
1531 |
1532 buttonPress: button x:x y:y in: view |
1532 buttonPress: button x:x y:y in: view |
1533 "Delegates events to services. Answers true iff at least |
1533 "Possibly delegate event a service. |
1534 one service handler method returns true. In that case, |
1534 Answers true (i.e. event was handled) iff at least |
1535 the event is is NOT processes by the view." |
1535 one service handler method returns true. |
1536 |
1536 In that case, the event is is NOT processes by the view. |
1537 ^ services |
1537 Notice, that this is called both for events in the gutter AND for events in the text." |
1538 contains:[:service | |
1538 |
1539 service isEnabled and:[ ((service buttonPress: button x:x y:y in: view) == true) ] |
1539 |bpntService| |
|
1540 |
|
1541 "/ cg: I want to toggle breakpoints on single click, but only if its the only service |
|
1542 "/ which is interested in that line (i.e. there is no lint-info icon there). |
|
1543 "/ Modified to do a first round asking any for a single-press action; |
|
1544 "/ on the fly, remember any breakpoint service. |
|
1545 services |
|
1546 do:[:eachService | |
|
1547 eachService isEnabled ifTrue:[ |
|
1548 ((eachService buttonPress: button x:x y:y in: view) == true) ifTrue:[ |
|
1549 ^ true. |
|
1550 ]. |
|
1551 eachService isBreakpointService ifTrue:[ |
|
1552 bpntService := eachService |
|
1553 ] |
|
1554 ]. |
1540 ]. |
1555 ]. |
|
1556 |
|
1557 "/ then, if there was no one interested, but there is a breakpoint service, |
|
1558 "/ let it handle it. |
|
1559 bpntService notNil ifTrue:[ |
|
1560 view == gutterView ifTrue:[ |
|
1561 button == 1 ifTrue:[ |
|
1562 bpntService setOrToggleBreakpointAtX:x y:y. |
|
1563 ^ true. |
|
1564 ] |
|
1565 ] |
|
1566 ]. |
|
1567 ^ false. |
1541 |
1568 |
1542 "Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1569 "Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1543 "Modified: / 06-10-2011 / 14:14:00 / cg" |
1570 "Modified: / 06-10-2011 / 14:14:00 / cg" |
1544 "Modified (format): / 05-03-2012 / 08:56:02 / cg" |
1571 "Modified (format): / 05-03-2012 / 08:56:02 / cg" |
1545 ! |
1572 ! |
2901 ! ! |
2928 ! ! |
2902 |
2929 |
2903 !CodeView2::GutterView methodsFor:'event handling'! |
2930 !CodeView2::GutterView methodsFor:'event handling'! |
2904 |
2931 |
2905 buttonMultiPress: btn x: x y: y |
2932 buttonMultiPress: btn x: x y: y |
2906 |extraSafeArea| |
2933 |acceptCancelBarWidthOrZero extraSafeArea| |
2907 |
2934 |
2908 Processor removeTimedBlock:blockWaitingForPossibleDoubleClick. |
2935 Processor removeTimedBlock:blockWaitingForPossibleDoubleClick. |
2909 blockWaitingForPossibleDoubleClick := nil. |
2936 blockWaitingForPossibleDoubleClick := nil. |
2910 |
2937 |
2911 "/ for the embedded accept-cancel bar, if enabled |
2938 "/ for the embedded accept-cancel bar, if enabled |
2912 (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[ |
2939 (acceptCancelBarWidthOrZero := self usedWidthForAcceptCancel) ~~ 0 ifTrue:[ |
2913 textView reallyModified ifTrue:[ |
2940 (x <= (self paddingLeft + acceptCancelBarWidthOrZero)) ifTrue:[ |
2914 (y < self acceptButtonBottom) ifTrue:[ |
2941 textView reallyModified ifTrue:[ |
2915 ^self. |
2942 (y < self acceptButtonBottom) ifTrue:[ |
|
2943 ^self. |
|
2944 ]. |
|
2945 (y < self cancelButtonBottom) ifTrue:[ |
|
2946 ^self. |
|
2947 ]. |
2916 ]. |
2948 ]. |
2917 (y < self cancelButtonBottom) ifTrue:[ |
2949 ^self. |
2918 ^self. |
|
2919 ]. |
|
2920 ]. |
2950 ]. |
2921 ^self. |
|
2922 ]. |
2951 ]. |
2923 |
2952 |
2924 false ifTrue:[ |
2953 false ifTrue:[ |
2925 "Do not allow clicking on line numbers..." |
2954 "Do not allow clicking on line numbers..." |
2926 extraSafeArea := "('999' widthOn:self)" 5. |
2955 extraSafeArea := "('999' widthOn:self)" 5. |
2927 x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self]. |
2956 x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self]. |
2928 ]. |
2957 ]. |
2929 |
2958 |
2930 codeView notNil ifTrue:[ |
2959 codeView notNil ifTrue:[ |
2931 ((x > (self paddingLeft + self usedWidthForAcceptCancel)) or: |
2960 ((x > (self paddingLeft + acceptCancelBarWidthOrZero)) or: |
2932 [x < (self width - self paddingRight - widthDiffInfo)] |
2961 [x < (self width - self paddingRight - widthDiffInfo)] |
2933 ) ifTrue:[ |
2962 ) ifTrue:[ |
2934 (codeView buttonMultiPress: btn x:x y:y in: self) ifTrue:[^ self]. "/ event eaten |
2963 (codeView buttonMultiPress: btn x:x y:y in: self) ifTrue:[^ self]. "/ event eaten |
2935 ]. |
2964 ]. |
2936 ]. |
2965 ]. |
3035 |tooltip| |
3064 |tooltip| |
3036 |
3065 |
3037 tooltip := eachService helpTextAtLine:lineNr. |
3066 tooltip := eachService helpTextAtLine:lineNr. |
3038 tooltip notEmptyOrNil ifTrue:[ |
3067 tooltip notEmptyOrNil ifTrue:[ |
3039 textCollector notEmpty ifTrue:[ textCollector cr]. |
3068 textCollector notEmpty ifTrue:[ textCollector cr]. |
3040 textCollector nextPutAllText:tooltip. |
3069 textCollector nextPutAllText:tooltip withCRs. |
3041 tooltip last == Character cr ifFalse:[textCollector cr]. |
3070 tooltip last == Character cr ifFalse:[textCollector cr]. |
3042 ]. |
3071 ]. |
3043 ]. |
3072 ]. |
3044 textCollector isEmpty ifTrue:[ ^ nil ]. |
3073 textCollector isEmpty ifTrue:[ ^ nil ]. |
3045 ^ textCollector contents. |
3074 ^ textCollector contents. |