@@ -53,49 +53,42 @@ GtPharoStyler >> colorParenthesesLeft: aLeftIndex right: aRightIndex atNestingLe
53
53
54
54
{ #category : #' visiting - variables' }
55
55
GtPharoStyler >> definitionTooltipAttributeFor: aNamedVariable [
56
- | definer |
56
+ | definer aptitude |
57
57
definer := self coderViewModel behavior
58
58
whichClassDefinesInstVar: aNamedVariable name value.
59
59
definer ifNil: [ ^ BlFontWeightAttribute semiBold ].
60
- ^ BrTextAdornmentDynamicAttribute new
61
- beOverlay;
62
- stencil: [ :aTextPiece :anEditorElement |
63
- | aContainer aValueElement tooltipContent |
64
- aContainer := BlElement new
65
- clipChildren: false ;
66
- layout: BlFrameLayout new ;
67
- constraintsDo: [ :c |
68
- c horizontal exact: aTextPiece textLength * 10 .
69
- c vertical exact: 15 ].
70
- aValueElement := BlElement new
71
- clipChildren: true ;
72
- constraintsDo: [ :c |
73
- c horizontal matchParent.
74
- c vertical matchParent ].
75
- tooltipContent := [ BrLabel new
76
- aptitude: BrLabelAptitude ;
77
- padding: (BlInsets all: 5 );
78
- text: (aNamedVariable name value , ' defined in ' ) asRopedText
79
- , definer name asRopedText glamorousCodeFont;
80
- alignCenter ] asStencil.
81
- aValueElement
82
- addAptitude: (BrGlamorousWithExplicitTooltipAptitude content: tooltipContent).
83
- aContainer addChild: aValueElement ]
60
+ aptitude := BrGlamorousWithExplicitTooltipAptitude new
61
+ stencil: [ :aContext |
62
+ BrMenuExplicitHandle new
63
+ menu: (BrMenuLabelItem new
64
+ label: ' Defined in ' asRopedText , definer asRopedText glamorousCodeDefaultFont) ].
65
+ ^ BrTextHoverAttribute new
66
+ enterAction: [ :aText :aTextElement :aTextEditor :anEvent |
67
+ | bounds offset |
68
+ offset := aText textOffset - aTextElement text textOffset + (aText size / 2 ).
69
+ bounds := aTextElement globalCursorBoundsForIndex: offset.
70
+ aptitude relocator: (BrPopoverExplicitRelocator new globalBounds: bounds).
71
+ aTextElement addAptitude: aptitude.
72
+ aptitude show ];
73
+ leaveAction: [ :aText :aTextElement :aTextEditor :anEvent |
74
+ aTextElement dispatchEvent: BrTooltipHideWish new .
75
+ aTextElement removeAptitude: aptitude ];
76
+ yourself
84
77
]
85
78
86
79
{ #category : #private }
87
80
GtPharoStyler >> highlightParenthesesLeft: aLeftIndex right: aRightIndex [
88
- | theParanthesesMarker cursorEnterAction cursorLeaveAction |
81
+ | theParenthesesMarker cursorEnterAction cursorLeaveAction |
89
82
90
- theParanthesesMarker := BrTextInvisibleMarkerAttribute new .
83
+ theParenthesesMarker := BrTextInvisibleMarkerAttribute new .
91
84
text
92
- attribute: theParanthesesMarker
85
+ attribute: theParenthesesMarker
93
86
from: aLeftIndex + 1
94
87
to: aRightIndex - 1 .
95
88
96
89
cursorEnterAction := [ :aTextEditor |
97
90
aTextEditor text
98
- findAttribute: theParanthesesMarker
91
+ findAttribute: theParenthesesMarker
99
92
indicesDo: [ :aParanthesesStart :aParanthesesEnd |
100
93
aTextEditor text
101
94
attribute: (GtPharoParenthesesHighlightAttribute paint: BrGlamorousColors neutralBackgroundColor)
@@ -104,7 +97,7 @@ GtPharoStyler >> highlightParenthesesLeft: aLeftIndex right: aRightIndex [
104
97
105
98
cursorLeaveAction := [ :aTextEditor |
106
99
aTextEditor text
107
- findAttribute: theParanthesesMarker
100
+ findAttribute: theParenthesesMarker
108
101
indicesDo: [ :aParanthesesStart :aParanthesesEnd |
109
102
(aTextEditor text
110
103
from: aParanthesesStart
0 commit comments