author | Claus Gittinger <cg@exept.de> |
Fri, 17 Aug 2018 17:36:55 +0200 | |
changeset 5890 | 99d778b7d1a3 |
parent 5817 | 7779078ac861 |
child 5898 | a0cae09e9108 |
permissions | -rw-r--r-- |
5796 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1431 | 3 |
" |
4 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3728 | 5 |
All Rights Reserved |
1431 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1752 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
4692
433047d28c93
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4667
diff
changeset
|
16 |
"{ NameSpace: Smalltalk }" |
433047d28c93
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4667
diff
changeset
|
17 |
|
1390 | 18 |
ListModelView subclass:#SelectionInListModelView |
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
19 |
instanceVariableNames:'selection multipleSelectOk actionBlock doubleClickActionBlock |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
20 |
selectConditionBlock buttonMotionAction buttonReleaseAction |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
21 |
highlightMode useIndex ignoreReselect toggleSelect hilightFgColor |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
22 |
hilightBgColor hilightFgColorNoFocus hilightBgColorNoFocus |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
23 |
hilightLevel hilightFrameColor hilightStyle dropSource editorView |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
24 |
openEditorAction closeEditorAction highlightEnterItem enterItem |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
25 |
cursorItem lineMask keyActionStyle returnKeyActionStyle strikeOut |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
26 |
modelChangedDuringButtonPress selectOnButtonPress |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
27 |
selectOnMenuButton minimumEditorHeight extraSpaceAtBottomForDrop' |
1390 | 28 |
classVariableNames:'DefaultHilightStyle DefaultHilightBackgroundColor |
29 |
DefaultHilightForegroundColor DefaultHilightLevel |
|
4648
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
30 |
DefaultHilightFrameColor DefaultHilightBackgroundColorNoFocus |
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
31 |
DefaultHilightForegroundColorNoFocus' |
1390 | 32 |
poolDictionaries:'' |
1430 | 33 |
category:'Views-Lists' |
1390 | 34 |
! |
35 |
||
36 |
!SelectionInListModelView class methodsFor:'documentation'! |
|
37 |
||
1431 | 38 |
copyright |
39 |
" |
|
40 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3728 | 41 |
All Rights Reserved |
1431 | 42 |
|
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
" |
|
50 |
||
51 |
! |
|
52 |
||
1390 | 53 |
documentation |
54 |
" |
|
55 |
SelectionInListModelView is mostly like SelectionInListView, |
|
56 |
but derives from the ListModelView and thus the list is kept |
|
3387 | 57 |
in the list. |
58 |
||
1390 | 59 |
[Instance variables:] |
2228 | 60 |
|
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
61 |
selection <misc> the current selection. nil, a number or collection of numbers |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
62 |
multipleSelectOk <Boolean> allow/disallow multiple selections( default:false ) |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
63 |
selectMenuButton <Boolean> enable/disable selection will change on menu pressed |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
64 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
65 |
buttonReleaseAction <Action> called if the mouse button is released |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
66 |
buttonMotionAction <Action> called during mouse motion with one argument the point |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
67 |
under the mouse. |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
68 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
69 |
actionBlock <Block> action evaluated on single click (0/1/2 arguments) |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
70 |
doubleClickActionBlock <Block> action evaluated on double click (0/1/2 arguments) |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
71 |
selectConditionBlock <Block> action evaluated before selection changed (0/1/2 arguments) |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
72 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
73 |
keyActionStyle <Symbol> controls how to respond to keyboard selects |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
74 |
returnKeyActionStyle <Symbol> controls how to respond to return key |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
75 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
76 |
useIndex <Boolean> representation of the model selection |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
77 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
78 |
ignoreReselect <Boolean> if set, a click on an already selected entry is ignored |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
79 |
toggleSelect <Boolean> a click on an entry unselects it and vice versa |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
80 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
81 |
highlightMode <Symbol> how to draw the selection |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
82 |
hilightFgColor <Color> foregroundColor of highlighted items |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
83 |
hilightBgColor <Color> backgroundColor of highlighted items |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
84 |
hilightLevel <Integer> level to draw selections (i.e. for 3D effect) |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
85 |
hilightFrameColor <Color> rectangle around highlighted items |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
86 |
hilightStyle <Boolean> actions on widget are enabled/disabled |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
87 |
strikeOut <Boolean> turn on/off strikeOut mode |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
88 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
89 |
dropTarget <DropTarget> keeps information about the drop operation |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
90 |
dropSource <DropSource> keeps information about the drag operation |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
91 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
92 |
editorView <View> editor on current selected item |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
93 |
openEditorAction <Action> action to get an editor on the current selection from user |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
94 |
closeEditorAction <Action> action invoked before the editor is closed. |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
95 |
|
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
96 |
enterItem <Item/nil> item over which the mouse pointer is located |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
97 |
or nil |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
98 |
highlightEnterItem <Boolean> enable or disable highlight of enterItem |
2323 | 99 |
|
1390 | 100 |
[author:] |
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
101 |
Claus Atzkern |
1390 | 102 |
|
103 |
[see also:] |
|
104 |
||
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
105 |
ListModelView |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
106 |
HierarchicalListView |
1390 | 107 |
" |
108 |
! |
|
109 |
||
110 |
examples |
|
111 |
" |
|
5810 | 112 |
[exBegin] |
1390 | 113 |
|top list view| |
114 |
||
115 |
list := List new. |
|
116 |
||
117 |
1 to:100 do:[:i| list add:('element: ', i printString) ]. |
|
118 |
top := StandardSystemView new; extent:300@300. |
|
119 |
view := ScrollableView for:SelectionInListModelView miniScroller:true |
|
5810 | 120 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
1390 | 121 |
view list:list. |
122 |
top open. |
|
5810 | 123 |
[exEnd] |
124 |
||
125 |
||
126 |
[exBegin] |
|
1915 | 127 |
|top list view| |
128 |
||
129 |
list := List new. |
|
130 |
||
131 |
1 to:100 do:[:i| list add:('element: ', i printString) ]. |
|
132 |
top := StandardSystemView new; extent:300@300. |
|
133 |
view := ScrollableView for:SelectionInListModelView miniScroller:true |
|
5810 | 134 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
1915 | 135 |
view list:list. |
136 |
||
137 |
view openEditorAction:[:ln :aGC| |field| |
|
5810 | 138 |
field := EditField new. |
139 |
field level:0. |
|
140 |
field acceptOnLostFocus:true. |
|
141 |
field acceptAction:[:x| list at:ln put:(field contents) ]. |
|
142 |
field font:(aGC font). |
|
143 |
field contents:(list at:ln). |
|
144 |
field |
|
1915 | 145 |
]. |
146 |
top open. |
|
5810 | 147 |
[exEnd] |
148 |
||
149 |
[exBegin] |
|
1390 | 150 |
|top list view item| |
151 |
||
152 |
list := HierarchicalList new. |
|
153 |
item := HierarchicalItem::Example labeled:'Test'. |
|
154 |
item expand. |
|
155 |
list showRoot:false. |
|
156 |
list root:item. |
|
157 |
||
158 |
top := StandardSystemView new; extent:300@300. |
|
159 |
view := ScrollableView for:SelectionInListModelView miniScroller:true |
|
5810 | 160 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
1390 | 161 |
|
162 |
view list:list. |
|
163 |
view doubleClickAction:[:i| (list at:i) toggleExpand ]. |
|
164 |
top open. |
|
5810 | 165 |
[exEnd] |
166 |
||
167 |
ca |
|
168 |
|top list view| |
|
169 |
||
170 |
list := List new. |
|
171 |
||
172 |
1 to:100 do:[:i| list add:('element: ', i printString) ]. |
|
173 |
||
174 |
top := StandardSystemView extent:300@300. |
|
175 |
view := ScrollableView for:SelectionInListModelView miniScroller:true |
|
176 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
177 |
||
178 |
view minimumEditorHeight:100. |
|
179 |
view openEditorAction:[:ln :aGC| |f| |
|
180 |
f := SimpleView in:aGC. |
|
181 |
f viewBackground:(Color red). |
|
182 |
f |
|
183 |
]. |
|
184 |
view list:list. |
|
185 |
top open. |
|
1390 | 186 |
" |
187 |
! ! |
|
188 |
||
189 |
!SelectionInListModelView class methodsFor:'defaults'! |
|
190 |
||
191 |
updateStyleCache |
|
192 |
"extract values from the styleSheet and cache them in class variables" |
|
193 |
||
194 |
<resource: #style ( |
|
3927 | 195 |
#'selection.hilightForegroundColor' #'selection.hilightBackgroundColor' |
4648
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
196 |
#'selection.hilightForegroundColorNoFocus' #'selection.hilightBackgroundColorNoFocus' |
3927 | 197 |
#'selection.hilightFrameColor' #'selection.hilightLevel' |
198 |
#'selection.foregroundColor' #'selection.backgroundColor' |
|
199 |
#'selection.shadowColor' #'selection.lightColor' |
|
200 |
#'selection.font' #'selection.hilightStyle' |
|
201 |
#'text.foregroundColor' |
|
202 |
)> |
|
1390 | 203 |
|
204 |
DefaultHilightForegroundColor := StyleSheet colorAt:'selection.hilightForegroundColor'. |
|
205 |
DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor'. |
|
4648
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
206 |
DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:'selection.hilightForegroundColorNoFocus'. |
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
207 |
DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:'selection.hilightBackgroundColorNoFocus'. |
1390 | 208 |
DefaultHilightFrameColor := StyleSheet colorAt:'selection.hilightFrameColor'. |
209 |
DefaultHilightLevel := StyleSheet at:'selection.hilightLevel' default:0. |
|
210 |
DefaultHilightStyle := StyleSheet at:'selection.hilightStyle' default:(StyleSheet name). |
|
211 |
DefaultForegroundColor := StyleSheet colorAt:'selection.foregroundColor'. |
|
212 |
DefaultBackgroundColor := StyleSheet colorAt:'selection.backgroundColor'. |
|
213 |
DefaultShadowColor := StyleSheet colorAt:'selection.shadowColor'. |
|
214 |
DefaultLightColor := StyleSheet colorAt:'selection.lightColor'. |
|
215 |
||
216 |
DefaultForegroundColor isNil ifTrue:[ |
|
4515
6ca475e94989
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4512
diff
changeset
|
217 |
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black |
1390 | 218 |
]. |
3927 | 219 |
|
220 |
DefaultFont := SelectionInListView defaultFont. |
|
221 |
||
1390 | 222 |
" |
223 |
self updateStyleCache |
|
224 |
" |
|
225 |
||
3927 | 226 |
"Modified: / 14-08-2010 / 11:55:20 / cg" |
1390 | 227 |
! ! |
228 |
||
229 |
!SelectionInListModelView methodsFor:'accessing'! |
|
230 |
||
2377 | 231 |
cursorLine |
232 |
"returns the index of the cursor line or 0 |
|
233 |
" |
|
234 |
|index| |
|
235 |
||
236 |
cursorItem isNil ifTrue:[^ 0 ]. |
|
237 |
||
2408 | 238 |
index := self identityIndexOf:cursorItem. |
2377 | 239 |
index == 0 ifTrue:[ cursorItem := nil ]. |
240 |
^ index |
|
241 |
! |
|
242 |
||
1390 | 243 |
list:aList |
1547 | 244 |
self deselectWithoutRedraw. |
2867 | 245 |
^ super list:aList |
1390 | 246 |
! ! |
247 |
||
1818 | 248 |
!SelectionInListModelView methodsFor:'accessing-actions'! |
1641 | 249 |
|
250 |
action |
|
251 |
"get the action block to be performed on select |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
252 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
253 |
The arguments to the block are: |
3728 | 254 |
- no argument |
255 |
- 1 argument index or item |
|
256 |
- 2 argument index or item, self |
|
1641 | 257 |
" |
258 |
^ actionBlock |
|
259 |
! |
|
260 |
||
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
261 |
action:anUpToTwoArgBlock |
1641 | 262 |
"set the action block to be performed on select |
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
263 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
264 |
The arguments to the block are: |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
265 |
- no argument |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
266 |
- 1 argument index or item |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
267 |
- 2 argument index or item, self |
1641 | 268 |
" |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
269 |
actionBlock := anUpToTwoArgBlock |
1641 | 270 |
! |
271 |
||
272 |
doubleClickAction |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
273 |
"get the action block to be performed on doubleclick. |
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
274 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
275 |
The arguments to the block are: |
3728 | 276 |
- no argument |
277 |
- 1 argument selectedIndex |
|
278 |
- 2 argument selectedIndex, self |
|
1641 | 279 |
" |
280 |
^ doubleClickActionBlock |
|
281 |
! |
|
282 |
||
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
283 |
doubleClickAction:anUpToTwoArgBlock |
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
284 |
"set the action block to be performed on doubleclick. |
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
285 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
286 |
The arguments to the block are: |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
287 |
- no argument |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
288 |
- 1 argument selectedIndex |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
289 |
- 2 argument selectedIndex, self |
1641 | 290 |
" |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
291 |
doubleClickActionBlock := anUpToTwoArgBlock |
1641 | 292 |
! |
293 |
||
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
294 |
keyActionStyle |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
295 |
"defines how the view should respond to alpha-keys pressed. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
296 |
Possible values are: |
3728 | 297 |
#select -> will select next entry starting with that |
298 |
character and perform the click-action |
|
299 |
||
300 |
#selectAndDoubleclick -> will select next & perform double-click action |
|
301 |
||
302 |
#pass -> will pass key to superclass (i.e. no special treatment) |
|
303 |
||
304 |
nil -> will ignore key |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
305 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
306 |
the default (set in #initialize) is #select |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
307 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
308 |
^ keyActionStyle |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
309 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
310 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
311 |
keyActionStyle:aSymbol |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
312 |
"defines how the view should respond to alpha-keys pressed. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
313 |
Possible values are: |
3728 | 314 |
#select -> will select next entry starting with that |
315 |
character and perform the click-action |
|
316 |
||
317 |
#selectAndDoubleclick -> will select next & perform double-click action |
|
318 |
||
319 |
#pass -> will pass key to superclass (i.e. no special treatment) |
|
320 |
||
321 |
nil -> will ignore key |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
322 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
323 |
the default (set in #initialize) is #select |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
324 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
325 |
keyActionStyle := aSymbol |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
326 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
327 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
328 |
returnKeyActionStyle |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
329 |
"defines how the view should respond to a return key pressed. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
330 |
Possible values are: |
3728 | 331 |
#doubleClick -> perform double-click action |
332 |
||
333 |
#pass -> will pass key to superclass (i.e. no special treatment) |
|
334 |
||
335 |
nil -> will ignore key |
|
336 |
||
337 |
the default (set in #initialize) is #doubleClick |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
338 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
339 |
^ returnKeyActionStyle |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
340 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
341 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
342 |
returnKeyActionStyle:aSymbol |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
343 |
"defines how the view should respond to a return key pressed. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
344 |
Possible values are: |
3728 | 345 |
#doubleClick -> perform double-click action |
346 |
||
347 |
#pass -> will pass key to superclass (i.e. no special treatment) |
|
348 |
||
349 |
nil -> will ignore key |
|
350 |
||
351 |
the default (set in #initialize) is #doubleClick |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
352 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
353 |
returnKeyActionStyle := aSymbol |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
354 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
355 |
|
1641 | 356 |
selectConditionBlock |
357 |
"set the conditionBlock; this block is evaluated before a selection |
|
358 |
change is performed; the change will not be done, if the evaluation |
|
359 |
returns false |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
360 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
361 |
The arguments to the block are: |
3728 | 362 |
- no argument |
363 |
- 1 argument index |
|
364 |
- 2 argument index, isForAdd |
|
1641 | 365 |
" |
366 |
^ selectConditionBlock |
|
367 |
! |
|
368 |
||
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
369 |
selectConditionBlock:anUpToTwoArgBlock |
1641 | 370 |
"set the conditionBlock; this block is evaluated before a selection |
371 |
change is performed; the change will not be done, if the evaluation |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
372 |
returns false. |
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
373 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
374 |
The arguments to the block are: |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
375 |
- no argument |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
376 |
- 1 argument index |
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
377 |
- 2 argument index, isForAdd |
1641 | 378 |
" |
4700
29ddd6d5a8e7
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
379 |
selectConditionBlock := anUpToTwoArgBlock. |
1641 | 380 |
! ! |
381 |
||
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
382 |
!SelectionInListModelView methodsFor:'accessing-attributes'! |
1390 | 383 |
|
2323 | 384 |
highlightEnterItem |
385 |
"enable or disable to highlight the item over which the mouse pointer is located |
|
386 |
" |
|
387 |
^ highlightEnterItem |
|
388 |
! |
|
389 |
||
390 |
highlightEnterItem:aBool |
|
391 |
"enable or disable to highlight the item over which the mouse pointer is located |
|
392 |
" |
|
393 |
highlightEnterItem ~~ aBool ifTrue:[ |
|
3728 | 394 |
highlightEnterItem := aBool. |
395 |
self pointerEntersItem:nil. |
|
396 |
||
397 |
highlightEnterItem ifTrue:[ |
|
398 |
self enableMotionEvents |
|
399 |
]. |
|
2323 | 400 |
]. |
401 |
! |
|
402 |
||
1390 | 403 |
highlightMode |
404 |
"get the mode how to draw a selected line: |
|
3728 | 405 |
#line draw whole line selected |
406 |
#label draw label selected |
|
407 |
#dropMode set during drop |
|
1390 | 408 |
" |
409 |
^ highlightMode |
|
410 |
! |
|
411 |
||
412 |
highlightMode:aMode |
|
413 |
"set the mode how to draw a selected line: |
|
3728 | 414 |
#line draw whole line selected |
415 |
#label draw label selected |
|
416 |
#dropMode set during drop |
|
1390 | 417 |
" |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
418 |
highlightMode ~~ aMode ifTrue:[ |
3728 | 419 |
highlightMode := aMode. |
420 |
self invalidateSelection. |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
421 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
422 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
423 |
|
3338 | 424 |
highlightWithUnderline |
425 |
^ false |
|
426 |
! |
|
427 |
||
2644 | 428 |
hilightBackgroundColor |
429 |
"returns the color used for the hilighted background |
|
430 |
" |
|
431 |
^ hilightBgColor |
|
432 |
! |
|
433 |
||
434 |
hilightForegroundColor |
|
435 |
"returns the color used for the hilighted foreground |
|
436 |
" |
|
437 |
^ hilightFgColor |
|
438 |
! |
|
439 |
||
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
440 |
strikeout |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
441 |
"turn on/off strikeOut mode |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
442 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
443 |
^ strikeOut |
1390 | 444 |
! |
445 |
||
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
446 |
strikeout:aBoolean |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
447 |
"turn on/off strikeOut mode |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
448 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
449 |
strikeOut ~~ aBoolean ifTrue:[ |
3728 | 450 |
strikeOut := aBoolean. |
451 |
self invalidateSelection. |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
452 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
453 |
! ! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
454 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
455 |
!SelectionInListModelView methodsFor:'accessing-behavior'! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
456 |
|
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
457 |
ignoreReselect |
5663 | 458 |
"controls if clicking on an already selected item should |
459 |
be ignored or should perform the select action again. |
|
460 |
By default, these are ignored" |
|
461 |
||
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
462 |
^ ignoreReselect |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
463 |
! |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
464 |
|
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
465 |
ignoreReselect:aBoolean |
3728 | 466 |
"set/clear the ignoreReselect flag - |
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
467 |
if set, a click on an already selected entry is ignored. |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
468 |
Otherwise the notification is done, even if no |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
469 |
change in the selection occurs. |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
470 |
(for example, in browser to update a method). |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
471 |
Setting ignoreReselect to false makes sense if data is shown |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
472 |
which may change by itself (i.e. without the user doing anything) |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
473 |
For example, the inspector uses this, and redisplays the value, |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
474 |
if the selection is the same. |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
475 |
The default is true, meaning that a click on an already selected |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
476 |
does not lead to a notification via the actionBlock/change mechanism. |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
477 |
" |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
478 |
ignoreReselect := aBoolean |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
479 |
|
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
480 |
! |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
481 |
|
1390 | 482 |
multipleSelectOk |
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
483 |
"return true if multiple selections are allowed; the default is false" |
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
484 |
|
1390 | 485 |
^ multipleSelectOk |
486 |
! |
|
487 |
||
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
488 |
multipleSelectOk:aBoolean |
2381 | 489 |
"allow/disallow multiple selections. If enabled, the |
490 |
user may select multiple entries in the list, and the program |
|
491 |
always gets a collection of selected items (indexes if useIndex is true, |
|
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
492 |
values otherwise). The default is false, for single selections." |
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
493 |
|
2381 | 494 |
|state| |
495 |
||
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
496 |
state := aBoolean ? false. |
2381 | 497 |
|
498 |
multipleSelectOk == state ifTrue:[ ^ self ]. |
|
499 |
||
500 |
selection isNil ifTrue:[ |
|
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
501 |
multipleSelectOk := state. |
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
502 |
^ self. |
2381 | 503 |
]. |
504 |
||
505 |
multipleSelectOk ifFalse:[ |
|
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
506 |
selection := Array with:selection. |
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
507 |
multipleSelectOk := true. |
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
508 |
^ self |
2381 | 509 |
]. |
510 |
||
511 |
selection size == 1 ifTrue:[ |
|
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
512 |
selection := selection first. |
2381 | 513 |
] ifFalse:[ |
4667
dc071f35a463
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4652
diff
changeset
|
514 |
self selection:nil |
2381 | 515 |
]. |
516 |
multipleSelectOk := false. |
|
1390 | 517 |
! |
518 |
||
2815 | 519 |
selectOnButtonMenu |
3438 | 520 |
<resource: #obsolete> |
521 |
self obsoleteMethodWarning:'use selectOnMenuButton'. |
|
522 |
^ self selectOnMenuButton |
|
2228 | 523 |
! |
524 |
||
2815 | 525 |
selectOnButtonMenu:aBoolean |
3438 | 526 |
<resource: #obsolete> |
527 |
self obsoleteMethodWarning:'use selectOnMenuButton:'. |
|
528 |
self selectOnMenuButton:aBoolean. |
|
2228 | 529 |
! |
530 |
||
3370
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
531 |
selectOnButtonPress |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
532 |
"get the selectOnButtonPress flag - see method #selectOnButtonPress: for more details |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
533 |
" |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
534 |
^ selectOnButtonPress ? true |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
535 |
! |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
536 |
|
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
537 |
selectOnButtonPress:aBoolean |
3728 | 538 |
"set/clear the selectOnButtonPress flag - |
3370
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
539 |
if set (default), the selection changed on button press. This was the |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
540 |
behaviour until now. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
541 |
if cleared, the selection is changed on button release. This new behaviour allows to start |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
542 |
a drag without changing the real selection. The selection is changed during the |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
543 |
drag and restored after the drop. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
544 |
" |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
545 |
selectOnButtonPress := aBoolean |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
546 |
! |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
547 |
|
3438 | 548 |
selectOnMenuButton |
5776 | 549 |
"define the menu-button (middle button) press behavior; |
550 |
if true, the line under the mouse |
|
551 |
will be selected before the menu is opened (Windows behavior). |
|
552 |
Otherwise the selection is unchanged and the menu is opened |
|
553 |
for the current selection (Unix behavior)." |
|
3438 | 554 |
|
3461 | 555 |
selectOnMenuButton isNil ifTrue:[ |
5776 | 556 |
^ UserPreferences current selectOnRightClick |
3461 | 557 |
]. |
3438 | 558 |
^ selectOnMenuButton |
5776 | 559 |
|
560 |
"Modified (comment): / 28-05-2018 / 10:12:41 / Claus Gittinger" |
|
3438 | 561 |
! |
562 |
||
563 |
selectOnMenuButton:aBoolean |
|
5776 | 564 |
"define the menu-button (middle button) press behavior; |
565 |
if true, the line under the mouse |
|
566 |
will be selected before the menu is opened (Windows behavior). |
|
567 |
Otherwise the selection is unchanged and the menu is opened |
|
568 |
for the current selection (Unix behavior)." |
|
3438 | 569 |
|
570 |
selectOnMenuButton := aBoolean. |
|
5776 | 571 |
|
572 |
"Modified (comment): / 28-05-2018 / 10:12:52 / Claus Gittinger" |
|
3438 | 573 |
! |
574 |
||
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
575 |
toggleSelect |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
576 |
"get the toggleSelect flag - see method #toggleSelect: for more details |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
577 |
" |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
578 |
^ toggleSelect |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
579 |
! |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
580 |
|
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
581 |
toggleSelect:aBoolean |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
582 |
"turn on/off toggle select. If true, clicking on a selected entry |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
583 |
unselects it and vice versa. The default is false, which means |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
584 |
that clicking on an already selected entry does not change its |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
585 |
select status (see also ignoreReselect:). |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
586 |
" |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
587 |
toggleSelect := aBoolean. |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
588 |
|
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
589 |
|
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
590 |
! |
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
591 |
|
1390 | 592 |
useIndex |
593 |
"set/clear the useIndex flag. |
|
594 |
the selection writen to the model are the indices into the list |
|
595 |
or the elements selected. |
|
596 |
" |
|
597 |
^ useIndex |
|
598 |
||
599 |
||
600 |
! |
|
601 |
||
602 |
useIndex:aBoolean |
|
603 |
"set/clear the useIndex flag. |
|
604 |
the selection writen to the model are the indices into the list |
|
605 |
or the elements selected. |
|
606 |
" |
|
607 |
useIndex := aBoolean ? true |
|
608 |
||
609 |
||
610 |
! ! |
|
611 |
||
2404 | 612 |
!SelectionInListModelView methodsFor:'accessing-editor'! |
613 |
||
614 |
closeEditor |
|
615 |
"close the current editor |
|
616 |
" |
|
2596 | 617 |
|editor action| |
2404 | 618 |
|
5733 | 619 |
"/ cg: due to the closeEditorAction, |
620 |
"/ there is a posiibility of recursive invocation, |
|
621 |
"/ iff the closeEditorAction opens a dialog and the editor looses its focus |
|
622 |
"/ (again). |
|
623 |
thisContext isRecursive ifTrue:[^ self]. |
|
624 |
||
2404 | 625 |
(editor := editorView) notNil ifTrue:[ |
5733 | 626 |
"/ clear editorView after calling the closeEditorAction; |
627 |
"/ it might abort the operation (after some confirmation dialog) |
|
628 |
"/ editorView := nil. |
|
629 |
action := self closeEditorAction. |
|
630 |
action notNil ifTrue:[action value:editor]. |
|
631 |
editor destroy. |
|
632 |
editorView := nil. |
|
2404 | 633 |
]. |
634 |
! |
|
635 |
||
636 |
closeEditorAction |
|
637 |
"get the block which is evaluated before the editor is closed; the argument |
|
638 |
to the action is the editor. |
|
639 |
" |
|
640 |
^ closeEditorAction |
|
641 |
! |
|
642 |
||
643 |
closeEditorAction:anOneArgAction |
|
644 |
"get the block which is evaluated before the editor is closed; the argument |
|
645 |
to the action is the editor. |
|
646 |
" |
|
647 |
closeEditorAction := anOneArgAction. |
|
648 |
! |
|
649 |
||
2527 | 650 |
hasOpenEditor |
651 |
||
652 |
^ editorView notNil |
|
653 |
! |
|
654 |
||
3524 | 655 |
minimumEditorHeight |
656 |
"answer the minumium height of the editor or nil. |
|
657 |
If the height is nil the height of the line is used" |
|
658 |
||
659 |
^ minimumEditorHeight |
|
660 |
! |
|
661 |
||
662 |
minimumEditorHeight:aHeightOrNil |
|
663 |
"set the minumium height of the editor or nil. |
|
664 |
If the height is nil the height of the line is used" |
|
665 |
||
666 |
minimumEditorHeight := aHeightOrNil. |
|
667 |
! |
|
668 |
||
2404 | 669 |
openEditor |
670 |
"opens the editor on the current selection; |
|
671 |
returns the editorView or nil if no openEditorAction is defined |
|
672 |
or no single selection exists ... |
|
673 |
" |
|
2596 | 674 |
|lnNr action| |
2404 | 675 |
|
676 |
self closeEditor. |
|
677 |
shown ifFalse:[^ nil]. |
|
2596 | 678 |
|
679 |
action := self openEditorAction. |
|
680 |
action isNil ifTrue:[^ nil]. |
|
681 |
||
2404 | 682 |
lnNr := self selectedIndex. |
683 |
lnNr == 0 ifTrue:[^ nil]. |
|
684 |
||
685 |
self makeSelectionVisible. |
|
686 |
||
2596 | 687 |
editorView := action valueWithOptionalArgument:lnNr and:self. |
2404 | 688 |
editorView isNil ifTrue:[^ nil]. |
689 |
||
690 |
editorView superView isNil ifTrue:[ |
|
3728 | 691 |
self addSubView:editorView |
2404 | 692 |
]. |
693 |
self computeEditorLayout. |
|
694 |
editorView realize. |
|
695 |
self windowGroup focusView:editorView. |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
696 |
^ editorView |
2404 | 697 |
! |
698 |
||
699 |
openEditorAction |
|
700 |
"get the block which is evaluated to get the editor which is set for the |
|
701 |
line; the arguments to the block is the line number and the widget itself |
|
702 |
" |
|
703 |
^ openEditorAction |
|
704 |
||
705 |
! |
|
706 |
||
707 |
openEditorAction:aTwoArgAction |
|
708 |
"set the block which is evaluated to get the editor which is set for the |
|
709 |
line; the arguments to the block is the line number and the widget itself |
|
710 |
" |
|
711 |
openEditorAction := aTwoArgAction. |
|
712 |
! ! |
|
713 |
||
1390 | 714 |
!SelectionInListModelView methodsFor:'change & update'! |
715 |
||
716 |
argForChangeMessage |
|
717 |
"return the argument for a selectionChange; |
|
718 |
depending on the setting of useIndex, this is either the numeric |
|
719 |
index of the selection or the value (i.e. the string) |
|
720 |
" |
|
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
721 |
useIndex ifFalse:[ ^ self selectionValue ]. |
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
722 |
multipleSelectOk ifFalse:[ ^ selection ? 0 ]. |
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
723 |
^ selection ? #() |
1390 | 724 |
! |
725 |
||
1755 | 726 |
contentsChanged |
4258
d6ea83906c4e
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4242
diff
changeset
|
727 |
"this one is sent, whenever contents changes its size" |
d6ea83906c4e
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4242
diff
changeset
|
728 |
|
1755 | 729 |
super contentsChanged. |
3482 | 730 |
self computeEditorLayout. |
1755 | 731 |
! |
732 |
||
733 |
lineChangedAt:aLnNr with:arg |
|
734 |
super lineChangedAt:aLnNr with:arg. |
|
735 |
||
736 |
(editorView notNil and:[aLnNr == self selectedIndex]) ifTrue:[ |
|
3728 | 737 |
self computeEditorLayout. |
1755 | 738 |
] |
739 |
! |
|
740 |
||
1390 | 741 |
listSizeChanged:aLnNr nLines:aDeltaLines |
1563 | 742 |
|changed cnts| |
1390 | 743 |
|
744 |
super listSizeChanged:aLnNr nLines:aDeltaLines. |
|
745 |
||
746 |
selection isNil ifTrue:[^ self]. |
|
747 |
||
2408 | 748 |
self size == 0 ifTrue:[ |
3728 | 749 |
selection := nil. |
750 |
^ self selectionChanged |
|
1390 | 751 |
]. |
752 |
||
1563 | 753 |
multipleSelectOk ifFalse:[ |
3728 | 754 |
selection < aLnNr ifTrue:[^ self]. |
755 |
||
756 |
selection := selection + aDeltaLines. |
|
757 |
||
758 |
(aDeltaLines < 0 and:[selection < aLnNr]) ifTrue:[ |
|
759 |
selection := nil. |
|
760 |
^ self selectionChanged |
|
761 |
] |
|
1563 | 762 |
] ifTrue:[ |
3728 | 763 |
changed := false. |
764 |
||
765 |
aDeltaLines < 0 ifFalse:[ |
|
766 |
selection keysAndValuesDo:[:i :ln| |
|
767 |
ln >= aLnNr ifTrue:[ |
|
768 |
changed := true. |
|
769 |
selection at:i put:(ln + aDeltaLines) |
|
770 |
] |
|
771 |
] |
|
772 |
] ifTrue:[ |
|
773 |
cnts := 0. |
|
774 |
||
775 |
selection keysAndValuesDo:[:i :ln||new| |
|
776 |
ln >= aLnNr ifTrue:[ |
|
777 |
changed := true. |
|
778 |
||
779 |
(new := ln + aDeltaLines) < aLnNr ifTrue:[ |
|
780 |
cnts := cnts + 1. |
|
781 |
new := nil |
|
782 |
]. |
|
783 |
selection at:i put:new |
|
784 |
] |
|
785 |
]. |
|
786 |
cnts ~~ 0 ifTrue:[ |
|
787 |
cnts == selection size ifTrue:[ |
|
788 |
selection := nil |
|
789 |
] ifFalse:[ |
|
790 |
selection := selection select:[:ln| ln notNil] |
|
791 |
]. |
|
792 |
^ self selectionChanged. |
|
793 |
]. |
|
794 |
]. |
|
795 |
changed ifFalse:[^ self]. |
|
1390 | 796 |
]. |
797 |
||
1563 | 798 |
(useIndex and:[model notNil]) ifTrue:[ |
3728 | 799 |
model setValue:(self argForChangeMessage) |
1563 | 800 |
]. |
1390 | 801 |
! |
802 |
||
1755 | 803 |
originChanged:delta |
804 |
"setup the origin of the editing view |
|
805 |
" |
|
806 |
self computeEditorLayout. |
|
807 |
super originChanged:delta. |
|
808 |
||
809 |
||
810 |
! |
|
811 |
||
1390 | 812 |
selectionChanged |
813 |
"selection has changed. Call actionblock and/or send changeMessage if defined |
|
814 |
" |
|
1554 | 815 |
|arg| |
1390 | 816 |
|
1755 | 817 |
self closeEditor. |
818 |
||
1390 | 819 |
(model isNil and:[actionBlock isNil]) ifTrue:[ |
3728 | 820 |
^ self |
1390 | 821 |
]. |
822 |
||
823 |
arg := self argForChangeMessage. |
|
824 |
||
825 |
model notNil ifTrue:[ |
|
3728 | 826 |
model removeDependent:self. |
827 |
"/ change models value to force a change notification: reselect mode |
|
828 |
arg = model value ifTrue:[ |
|
829 |
model setValue:(arg isNil ifTrue:[0] ifFalse:[nil]). |
|
830 |
]. |
|
831 |
self sendChangeMessage:#value: with:arg. |
|
832 |
model notNil ifTrue:[ "/ argggh could be nilled |
|
833 |
model addDependent:self. |
|
834 |
self updateFromModel. "/ care for possibly lost change notification, due to #removeDependent |
|
835 |
] |
|
1390 | 836 |
]. |
837 |
||
838 |
actionBlock notNil ifTrue:[ |
|
3728 | 839 |
actionBlock valueWithOptionalArgument:arg and:self |
1390 | 840 |
]. |
841 |
! |
|
842 |
||
1554 | 843 |
updateFromModel |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
844 |
"update selection from the model |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
845 |
" |
2522 | 846 |
|value newSelection| |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
847 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
848 |
model isNil ifTrue:[ |
4273
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
849 |
^ self |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
850 |
]. |
2401 | 851 |
|
852 |
buttonMotionAction notNil ifTrue:[ |
|
4273
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
853 |
"running in button motion; discard change notification |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
854 |
" |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
855 |
^ self |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
856 |
]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
857 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
858 |
value := model value. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
859 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
860 |
(useIndex or:[value isNil or:[value isNumber]]) ifFalse:[ |
4273
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
861 |
multipleSelectOk ifFalse:[ |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
862 |
newSelection := self identityIndexOf:value |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
863 |
] ifTrue:[ |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
864 |
value size == 0 ifTrue:[ |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
865 |
newSelection := nil |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
866 |
] ifFalse:[ |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
867 |
newSelection := OrderedCollection new. |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
868 |
|
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
869 |
value do:[:e||index| |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
870 |
index := self identityIndexOf:e. |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
871 |
index ~~ 0 ifTrue:[ newSelection add:index ]. |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
872 |
]. |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
873 |
newSelection := newSelection asNilIfEmpty. |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
874 |
] |
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
875 |
]. |
2522 | 876 |
] ifTrue:[ |
4273
d56dfb04df83
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4258
diff
changeset
|
877 |
newSelection := value copy |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
878 |
]. |
2522 | 879 |
self setSelection:newSelection. |
1390 | 880 |
! ! |
881 |
||
882 |
!SelectionInListModelView methodsFor:'drag & drop'! |
|
883 |
||
884 |
canDrag |
|
3918 | 885 |
"returns true if dragging is enabled" |
886 |
||
1390 | 887 |
^ dropSource notNil |
888 |
||
3918 | 889 |
"Modified: / 18-07-2010 / 09:07:20 / cg" |
1390 | 890 |
! |
891 |
||
5810 | 892 |
dragAutoScroll:aDropContext |
2572 | 893 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
5807 | 894 |
if required (decided by the widget itself). |
895 |
If a scroll was done, return true; |
|
896 |
otherwise false (used to restore the background)" |
|
3918 | 897 |
|
3899 | 898 |
|scrollUp targetY deltaY pixels| |
899 |
||
5810 | 900 |
^ super dragAutoScroll:aDropContext. |
901 |
||
5812 | 902 |
targetY := aDropContext targetPointInDeviceCoordinates y. |
3899 | 903 |
scrollUp := (targetY < (height // 2)). |
904 |
||
905 |
scrollUp ifTrue:[ |
|
906 |
self yOriginOfContents = 0 ifTrue:[ ^ false]. |
|
907 |
deltaY := targetY. |
|
2572 | 908 |
] ifFalse:[ |
3899 | 909 |
deltaY := height - targetY. |
910 |
self yOriginOfContents < self maxViewOriginY ifFalse:[ ^ false ]. |
|
2572 | 911 |
]. |
3899 | 912 |
pixels := 24 min:(height // 4). |
913 |
deltaY > pixels ifTrue:[^ false]. |
|
914 |
||
915 |
deltaY <= (pixels // 2) ifTrue:[ |
|
916 |
deltaY <= (pixels // 4) |
|
917 |
ifTrue:[ pixels := pixels * 3] |
|
918 |
ifFalse:[ pixels := pixels * 2 ]. |
|
919 |
]. |
|
5810 | 920 |
aDropContext contentsWillChange. |
2572 | 921 |
|
3918 | 922 |
scrollUp |
923 |
ifTrue:[ self scrollUp:pixels ] |
|
924 |
ifFalse:[ self scrollDown:pixels ]. |
|
2572 | 925 |
|
926 |
^ true |
|
3918 | 927 |
|
928 |
"Modified: / 18-07-2010 / 09:08:29 / cg" |
|
5812 | 929 |
"Modified: / 15-06-2018 / 02:25:57 / Claus Gittinger" |
2572 | 930 |
! |
931 |
||
1390 | 932 |
dropSource |
2891 | 933 |
"returns the dropSource or nil" |
3728 | 934 |
|
1390 | 935 |
^ dropSource |
936 |
! |
|
937 |
||
3728 | 938 |
dropSource:aDropSourceOrNil |
2891 | 939 |
"set the dropSource or nil" |
3728 | 940 |
|
1390 | 941 |
dropSource := aDropSourceOrNil. |
942 |
! |
|
943 |
||
944 |
startDragAt:aPoint |
|
3918 | 945 |
"start drag at a point" |
946 |
||
2976 | 947 |
buttonMotionAction := buttonReleaseAction := nil. |
948 |
||
1390 | 949 |
dropSource notNil ifTrue:[ |
3918 | 950 |
dropSource startDragSelector notNil ifTrue:[ |
951 |
^ dropSource startDragIn:self at:aPoint |
|
5810 | 952 |
]. |
953 |
^ DragAndDropManager startDragFrom:self dropSource:dropSource offset:#center |
|
3370
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
954 |
]. |
3684 | 955 |
^ nil |
3918 | 956 |
|
957 |
"Modified: / 18-07-2010 / 09:07:26 / cg" |
|
5810 | 958 |
"Modified: / 14-06-2018 / 10:49:50 / Claus Gittinger" |
1390 | 959 |
! ! |
960 |
||
961 |
!SelectionInListModelView methodsFor:'drawing'! |
|
962 |
||
2642 | 963 |
drawElementsFrom:start to:stop x:x y:y w:w |
964 |
"draw the items between start to stop without clearing the background |
|
965 |
" |
|
966 |
|y0 "{ Class:SmallInteger }" |
|
967 |
y1 "{ Class:SmallInteger }" |
|
968 |
x0 "{ Class:SmallInteger }" |
|
969 |
| |
|
970 |
x0 := textStartLeft - viewOrigin x. |
|
971 |
y1 := y. |
|
972 |
||
973 |
start to:stop do:[:i| |
|
3728 | 974 |
y0 := y1. |
975 |
y1 := self yVisibleOfLine:(i + 1). |
|
976 |
self drawLabelAt:i x:x0 y:y0 h:(y1 - y0) |
|
2642 | 977 |
]. |
978 |
||
979 |
||
980 |
! |
|
981 |
||
1533 | 982 |
drawFrom:start to:stop x:x y:y w:w |
1390 | 983 |
"draw the lines between start to stop without clearing the background |
984 |
" |
|
1557 | 985 |
highlightMode notNil ifTrue:[ |
3728 | 986 |
self selectionDo:[:lnNr| |
987 |
(lnNr between:start and:stop) ifTrue:[ |
|
988 |
self drawSelectionFrameAt:lnNr x:x w:w |
|
989 |
] |
|
990 |
] |
|
1390 | 991 |
]. |
2642 | 992 |
super drawFrom:start to:stop x:x y:y w:w. |
1390 | 993 |
! |
994 |
||
2377 | 995 |
drawLabelAt:anIndex x:xI y:y h:h |
1390 | 996 |
"draw the label at position x/y without clearing the background |
997 |
" |
|
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
998 |
|item y0 x1 x w drawStrikeOut xOut0 xOut1 isHighlightedAsSelected| |
1554 | 999 |
|
2377 | 1000 |
x := xI + 1. |
1755 | 1001 |
editorView notNil ifTrue:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1002 |
"/ there is an open editor for the line; thus no redraw for the label (hidden by editor) |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1003 |
self selectedIndex == anIndex ifTrue:[^ self]. |
1755 | 1004 |
]. |
1005 |
||
2408 | 1006 |
item := self at:anIndex ifAbsent:nil. |
2377 | 1007 |
item isNil ifTrue:[^ self]. |
1390 | 1008 |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1009 |
drawStrikeOut := false. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1010 |
isHighlightedAsSelected := false. |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1011 |
|
2377 | 1012 |
(highlightMode notNil and:[self isInSelection:anIndex]) ifTrue:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1013 |
strikeOut ifTrue:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1014 |
drawStrikeOut := true. |
5426 | 1015 |
gc paint:fgColor on:bgColor |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1016 |
] ifFalse:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1017 |
(highlightMode == #dropMode or:[self hasFocus not]) ifTrue:[ |
5426 | 1018 |
gc paint:hilightFgColorNoFocus on:hilightBgColorNoFocus. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1019 |
] ifFalse:[ |
5426 | 1020 |
gc paint:hilightFgColor on:hilightBgColor |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1021 |
]. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1022 |
isHighlightedAsSelected := true. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1023 |
] |
2377 | 1024 |
] ifFalse:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1025 |
enterItem == item ifTrue:[ |
5426 | 1026 |
gc paint:hilightBgColor on:bgColor. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1027 |
] ifFalse:[ |
5426 | 1028 |
gc paint:fgColor on:bgColor. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1029 |
]. |
2377 | 1030 |
]. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1031 |
listRenderer display:item atX:x y:y lineHeight:h isHighlightedAsSelected:isHighlightedAsSelected. |
1390 | 1032 |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1033 |
drawStrikeOut ifTrue:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1034 |
xOut0 := self xVisibleOfItem:item. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1035 |
highlightMode == #label ifTrue:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1036 |
xOut1 := xOut0 + (listRenderer widthFor:item). |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1037 |
] ifFalse:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1038 |
xOut1 := width - margin. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1039 |
]. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1040 |
y0 := y + (h // 2). |
5426 | 1041 |
gc displayLineFromX:xOut0 y:y0 toX:xOut1 y:y0. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1042 |
y0 := y0 - 1. |
5426 | 1043 |
gc displayLineFromX:xOut0 y:y0 toX:xOut1 y:y0. |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1044 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1045 |
|
3338 | 1046 |
cursorItem == item ifTrue:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1047 |
"/ textStartLeft |
5426 | 1048 |
gc maskOrigin:((self viewOrigin + (0 @ 1)) \\ (lineMask extent)). |
1049 |
gc mask:lineMask. |
|
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1050 |
w := listRenderer widthFor:item. |
5426 | 1051 |
gc displayRectangleX:x -1 y:(y+2) width:w+2 height:(h - 4). |
1052 |
gc mask:nil. |
|
3338 | 1053 |
] ifFalse:[ |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1054 |
enterItem == item ifTrue:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1055 |
self highlightWithUnderline ifTrue:[ |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1056 |
"/ underline the hilite... |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1057 |
y0 := y + h - 2. |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1058 |
x1 := x + (listRenderer widthFor:item). |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1059 |
|
5426 | 1060 |
gc displayLineFromX:x y:y0 toX:x1 y:y0. |
4702
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1061 |
] |
e7e4cf796487
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4700
diff
changeset
|
1062 |
]. |
2377 | 1063 |
]. |
1390 | 1064 |
! |
1065 |
||
1554 | 1066 |
drawSelectionFrameAt:lnNr x:x w:w |
1067 |
"draw the background and foreground of the selection frame |
|
1068 |
at a lineNr. |
|
1390 | 1069 |
" |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1070 |
|item xMax xLftDmg xRgtDmg x0 x1 y0 y1 hL wL| |
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1071 |
|
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1072 |
(strikeOut or:[highlightMode isNil]) ifTrue:[ |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1073 |
^ self |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1074 |
]. |
1755 | 1075 |
editorView notNil ifTrue:[ |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1076 |
"/ there is an open editor; do not redraw selected |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1077 |
^ self |
1755 | 1078 |
]. |
3367 | 1079 |
|
1080 |
( highlightMode == #line |
|
1081 |
or:[highlightMode == #label |
|
1082 |
or:[highlightMode == #dropMode]] |
|
1083 |
) ifFalse:[ |
|
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1084 |
"/ highlightMode not supported |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1085 |
^ self |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1086 |
]. |
2408 | 1087 |
(item := self at:lnNr ifAbsent:nil) isNil ifTrue:[ |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1088 |
"/ list might change during drawing; item no longer visible |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1089 |
^ self |
1554 | 1090 |
]. |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1091 |
xMax := x + w. |
1554 | 1092 |
|
1093 |
"/ CLEAR THE BACKGROUND |
|
1094 |
||
1095 |
y0 := self yVisibleOfLine:lnNr. |
|
1096 |
y1 := self yVisibleOfLine:(lnNr + 1). |
|
1097 |
hL := y1 - y0. |
|
1098 |
||
1099 |
highlightMode == #line ifTrue:[ |
|
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1100 |
x0 := x. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1101 |
x1 := xMax. |
3367 | 1102 |
] ifFalse:[ "/ is #label or #rectangle |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1103 |
x0 := (self xVisibleOfItem:item) - (textStartLeft // 2). |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1104 |
x0 >= xMax ifTrue:[ ^ self ]. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1105 |
|
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1106 |
x1 := x0 + (listRenderer widthFor:item) + textStartLeft + 1. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1107 |
x1 < x ifTrue:[ ^ self ]. |
1554 | 1108 |
]. |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1109 |
xLftDmg := x0 max:x. |
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1110 |
xRgtDmg := x1 min:xMax. |
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1111 |
xRgtDmg > xLftDmg ifFalse:[^ self]. |
1554 | 1112 |
|
3367 | 1113 |
(highlightMode == #dropMode or:[self hasFocus not]) ifTrue:[ |
5426 | 1114 |
gc paint:hilightBgColorNoFocus. |
3367 | 1115 |
] ifFalse:[ |
5426 | 1116 |
gc paint:hilightBgColor. |
3137 | 1117 |
]. |
5426 | 1118 |
gc fillRectangleX:xLftDmg y:y0 width:(xRgtDmg - xLftDmg) height:hL. |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1119 |
wL := x1 - x0. |
1554 | 1120 |
|
1121 |
"/ DRAW THE FRAME |
|
1390 | 1122 |
|
1123 |
hilightFrameColor notNil ifTrue:[ |
|
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1124 |
hilightLevel == 0 ifTrue:[ |
5426 | 1125 |
gc paint:hilightFrameColor. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1126 |
|
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1127 |
highlightMode == #line ifTrue:[ |
5426 | 1128 |
gc displayLineFromX:x0 y:y0 toX:x1 y:y0. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1129 |
y1 := y0 + hL - 1. |
5426 | 1130 |
gc displayLineFromX:x0 y:y1 toX:x1 y:y1. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1131 |
] ifFalse:[ |
5426 | 1132 |
gc displayRectangleX:x0 y:y0 width:wL height:hL |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1133 |
]. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1134 |
^ self. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1135 |
] |
1390 | 1136 |
] ifFalse:[ |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1137 |
hilightStyle == #motif ifTrue:[ |
5426 | 1138 |
gc paint:bgColor. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1139 |
y1 := y0 + 1. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1140 |
highlightMode == #line ifTrue:[ |
5426 | 1141 |
gc displayLineFromX:x0 y:y1 toX:x1 y:y1. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1142 |
y1 := y0 + hL - 2. |
5426 | 1143 |
gc displayLineFromX:x0 y:y1 toX:x1 y:y1. |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1144 |
] ifFalse:[ |
5426 | 1145 |
gc displayRectangleX:x0 + 1 y:y1 width:wL - 2 height:hL - 2 |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1146 |
] |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1147 |
]. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1148 |
hilightLevel == 0 ifTrue:[ ^ self ]. |
1390 | 1149 |
]. |
1150 |
||
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1151 |
"/ draw edge |
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1152 |
highlightMode == #line ifTrue:[ |
4318
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1153 |
x0 := margin. |
ee2c154ee065
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4273
diff
changeset
|
1154 |
wL := width - margin - margin. |
2646
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1155 |
]. |
8be2becc5152
drawSelectionFrameAt:.. clear damaged background not items background
ca
parents:
2644
diff
changeset
|
1156 |
self drawEdgesForX:x0 y:y0 width:wL height:hL level:hilightLevel. |
1390 | 1157 |
! |
1158 |
||
4206
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1159 |
drawSelectionFrameFrom:start to:stop x:x y:y w:w |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1160 |
"draw the selection frame between start to stop without clearing the background |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1161 |
" |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1162 |
highlightMode notNil ifTrue:[ |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1163 |
self selectionDo:[:lnNr| |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1164 |
(lnNr between:start and:stop) ifTrue:[ |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1165 |
self drawSelectionFrameAt:lnNr x:x w:w |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1166 |
] |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1167 |
] |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1168 |
]. |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1169 |
|
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1170 |
"Created: / 24-04-2013 / 14:06:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1171 |
! |
95f294d62b07
Added support for drawing only columns, not the item itself (implicit first-column)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4181
diff
changeset
|
1172 |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1173 |
invalidateSelection |
5215 | 1174 |
"invalidate (force async redraw) the current selection |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1175 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1176 |
shown ifTrue:[ |
5215 | 1177 |
self selectionDo:[:aLnNr| self invalidateLineAt:aLnNr]. |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1178 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1179 |
! |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1180 |
|
2245
546c6e5d0951
change #redrawSelectionAt: to #invalidateSelectionAt: (because is a invalidate)
ca
parents:
2228
diff
changeset
|
1181 |
invalidateSelectionAt:aLineNr |
1569 | 1182 |
"redraw a line which changed its selection status. |
1183 |
optimized when drawing only the label. |
|
1390 | 1184 |
" |
2323 | 1185 |
|item x| |
1569 | 1186 |
|
1755 | 1187 |
editorView notNil ifTrue:[ |
3728 | 1188 |
"/ there is an open editor; do not redraw selected |
1189 |
^ self |
|
1755 | 1190 |
]. |
1191 |
||
1569 | 1192 |
(shown and:[aLineNr notNil and:[highlightMode notNil]]) ifFalse:[ |
3728 | 1193 |
^ self |
1557 | 1194 |
]. |
1195 |
||
2323 | 1196 |
highlightMode == #label ifTrue:[ |
3728 | 1197 |
item := self at:aLineNr ifAbsent:nil. |
1198 |
||
1199 |
item isNil ifTrue:[ |
|
1200 |
^ self |
|
1201 |
]. |
|
1202 |
x := (self xVisibleOfItem:item) - (textStartLeft // 2) |
|
1569 | 1203 |
] ifFalse:[ |
3728 | 1204 |
x := 0. |
1569 | 1205 |
]. |
2323 | 1206 |
self invalidateLineAt:aLineNr fromX:x |
1390 | 1207 |
! ! |
1208 |
||
1209 |
!SelectionInListModelView methodsFor:'event handling'! |
|
1210 |
||
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1211 |
activateMenu |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1212 |
|item menu appl| |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1213 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1214 |
enabled ifFalse:[^ self]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1215 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1216 |
item := self selectedElement. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1217 |
item notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1218 |
menu := item perform:#middleButtonMenu ifNotUnderstood:nil. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1219 |
menu notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1220 |
menu isCollection ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1221 |
menu := Menu decodeFromLiteralArray:menu. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1222 |
appl := self application. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1223 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1224 |
appl notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1225 |
menu findGuiResourcesIn:appl. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1226 |
"/ menu receiver:appl -- now done in findGuiResources ... |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1227 |
] ifFalse:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1228 |
menu receiver:item |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1229 |
] |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1230 |
]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1231 |
self startUpMenu:menu. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1232 |
^ self |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1233 |
]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1234 |
]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1235 |
super activateMenu |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1236 |
! |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1237 |
|
2401 | 1238 |
buttonControlPressAtLine:lineNr x:x y:y |
1239 |
"handle a button control press |
|
1390 | 1240 |
" |
2401 | 1241 |
|isInSelection prvLine chgSet doAdd| |
1747
f46c5941c028
better alghorithm for button motion in multipleSelection mode
ca
parents:
1745
diff
changeset
|
1242 |
|
2401 | 1243 |
isInSelection := self isInSelection:lineNr. |
1390 | 1244 |
|
2401 | 1245 |
multipleSelectOk ifFalse:[ |
3728 | 1246 |
isInSelection ifTrue:[ |
1247 |
self deselect |
|
1248 |
]ifFalse:[ |
|
1249 |
(self canSelectIndex:lineNr forAdd:false) ifTrue:[ |
|
1250 |
self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
|
1251 |
]. |
|
1252 |
]. |
|
1253 |
^ self |
|
1390 | 1254 |
]. |
2410 | 1255 |
isInSelection ifTrue:[ |
3728 | 1256 |
self removeFromSelection:lineNr |
2410 | 1257 |
] ifFalse:[ |
3728 | 1258 |
self addToSelection:lineNr. |
1259 |
||
1260 |
(self isInSelection:lineNr) ifFalse:[ |
|
1261 |
"/ cannot add to selection |
|
1262 |
^ self |
|
1263 |
]. |
|
1390 | 1264 |
]. |
1265 |
||
2401 | 1266 |
prvLine := lineNr. |
1267 |
chgSet := IdentitySet new. |
|
1268 |
doAdd := isInSelection not. |
|
1269 |
||
1270 |
buttonMotionAction := [:p| |rowNr mustRestore step f| |
|
3728 | 1271 |
rowNr := self yVisibleToLineNr:(p y). |
1272 |
||
1273 |
(rowNr notNil and:[rowNr ~~ prvLine]) ifTrue:[ |
|
1274 |
rowNr == lineNr ifTrue:[ |
|
1275 |
mustRestore := true |
|
1276 |
] ifFalse:[ |
|
1277 |
rowNr > lineNr ifTrue:[ mustRestore := (rowNr < prvLine) ] |
|
1278 |
ifFalse:[ mustRestore := (rowNr > prvLine) ]. |
|
1279 |
]. |
|
1280 |
prvLine > rowNr ifTrue:[ step := -1 ] |
|
1281 |
ifFalse:[ step := 1 ]. |
|
1282 |
mustRestore ifTrue:[ |
|
1283 |
[ prvLine ~~ rowNr ] whileTrue:[ |
|
1284 |
(chgSet removeIdentical:prvLine ifAbsent:nil) notNil ifTrue:[ |
|
1285 |
doAdd ifFalse:[ self addToSelection:prvLine ] |
|
1286 |
ifTrue:[ self removeFromSelection:prvLine ]. |
|
1287 |
]. |
|
1288 |
prvLine := prvLine + step. |
|
1289 |
]. |
|
1290 |
] ifFalse:[ |
|
1291 |
[ prvLine ~~ rowNr ] whileTrue:[ |
|
1292 |
prvLine := prvLine + step. |
|
1293 |
||
1294 |
doAdd ~~ (self isInSelection:rowNr) ifTrue:[ |
|
1295 |
chgSet add:prvLine. |
|
1296 |
||
1297 |
doAdd ifTrue:[ self addToSelection:prvLine ] |
|
1298 |
ifFalse:[ self removeFromSelection:prvLine ]. |
|
1299 |
] |
|
1300 |
]. |
|
1301 |
]. |
|
1302 |
]. |
|
1748 | 1303 |
]. |
2401 | 1304 |
! |
1748 | 1305 |
|
2401 | 1306 |
buttonMotion:buttonMask x:x y:y |
1307 |
"mouse-move while button was pressed - handle selection changes |
|
1308 |
" |
|
1309 |
|lnNr item| |
|
1310 |
||
1748 | 1311 |
self stopAutoScroll. |
1312 |
||
2441
9ca40d634ff8
attention - do no motionAction, if no button is pressed
Claus Gittinger <cg@exept.de>
parents:
2418
diff
changeset
|
1313 |
(buttonMask ~~ 0 and:[buttonMotionAction notNil]) ifTrue:[ |
3728 | 1314 |
buttonMotionAction value:(x@y). |
1315 |
||
1316 |
(autoScroll and:[buttonMotionAction notNil]) ifTrue:[ |
|
1317 |
"/ if moved outside of view, start autoscroll |
|
1318 |
(y between:0 and:height) ifFalse:[ |
|
1319 |
y < 0 ifTrue:[ self startAutoScroll:#scrollUp distance:y ] |
|
1320 |
ifFalse:[ self startAutoScroll:#scrollDown distance:(y - height) ]. |
|
1321 |
]. |
|
1322 |
]. |
|
1323 |
^ self |
|
1390 | 1324 |
]. |
2401 | 1325 |
|
1326 |
(enabled and:[highlightEnterItem]) ifTrue:[ |
|
3728 | 1327 |
self sensor anyButtonPressed ifFalse:[ |
1328 |
lnNr := self yVisibleToLineNr:y. |
|
1329 |
||
1330 |
lnNr notNil ifTrue:[ item := self at:lnNr ifAbsent:nil ] |
|
1331 |
ifFalse:[ item := nil ]. |
|
1332 |
||
1333 |
self pointerEntersItem:item. |
|
1334 |
] |
|
1335 |
]. |
|
1390 | 1336 |
! |
1337 |
||
1338 |
buttonMultiPress:button x:x y:y |
|
2948 | 1339 |
"button was pressed multiple - handle a doubleClick action" |
1340 |
||
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
1341 |
|lnNr| |
3704
c9b2102bfd1c
handle doubleClick - element under point is not selected
ca
parents:
3684
diff
changeset
|
1342 |
|
2401 | 1343 |
buttonMotionAction := buttonReleaseAction := nil. |
1390 | 1344 |
enabled ifFalse:[^ self]. |
1345 |
||
5817 | 1346 |
(self hasToSkipButtonMultiPress:button x:x y:y) ifTrue:[ |
1347 |
self buttonPress:button x:x y:y. |
|
1348 |
^ self |
|
1349 |
]. |
|
1350 |
||
5158 | 1351 |
button == 1 ifTrue:[ |
4043
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1352 |
( (lnNr := self yVisibleToLineNr:y) notNil |
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
1353 |
and:[(self at:lnNr ifAbsent:nil) notNil] |
4043
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1354 |
) ifTrue:[ |
5158 | 1355 |
self selectedIndex ~~ lnNr ifTrue:[ |
4043
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1356 |
self breakPoint:#ca |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1357 |
]. |
4043
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1358 |
self doubleClicked. |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1359 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1360 |
^ self. |
1390 | 1361 |
]. |
2947 | 1362 |
|
2948 | 1363 |
super buttonMultiPress:button x:x y:y |
4043
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1364 |
|
532a328a9e0e
changed: #buttonMultiPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3963
diff
changeset
|
1365 |
"Modified: / 30-06-2011 / 20:04:28 / cg" |
5817 | 1366 |
"Modified: / 22-06-2018 / 14:46:50 / sr" |
1390 | 1367 |
! |
1368 |
||
1369 |
buttonPress:button x:x y:y |
|
1370 |
"a button was pressed - handle selection here |
|
1371 |
" |
|
3146 | 1372 |
|sensor item menu appl isSelected lineNr startLine dragDistance| |
1390 | 1373 |
|
3205 | 1374 |
modelChangedDuringButtonPress := buttonMotionAction := buttonReleaseAction := nil. |
1390 | 1375 |
|
2323 | 1376 |
self pointerEntersItem:nil. |
2377 | 1377 |
self cursorEntersItem:nil. |
3728 | 1378 |
self closeEditor. |
2323 | 1379 |
|
1390 | 1380 |
enabled ifFalse:[^ self]. |
1381 |
||
2228 | 1382 |
sensor := self sensor. |
2399 | 1383 |
lineNr := self yVisibleToLineNr:y. |
2228 | 1384 |
|
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1385 |
(button == 2) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1386 |
(self selectOnMenuButton and:[self numberOfSelections <= 1]) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1387 |
( lineNr notNil |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1388 |
and:[self canSelectIndex:lineNr forAdd:false ] |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1389 |
) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1390 |
(lineNr ~~ self selectedIndex) ifTrue: [ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1391 |
(self selectWithoutScroll:lineNr redraw:true) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1392 |
self selectionChanged |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1393 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1394 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1395 |
] |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1396 |
]. |
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1397 |
item := self selectedElement. |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1398 |
item notNil ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1399 |
self makeSelectionVisible. |
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1400 |
"/ now in activateMenu... |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1401 |
"/ menu := item perform:#middleButtonMenu ifNotUnderstood:nil. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1402 |
"/ menu notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1403 |
"/ menu isCollection ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1404 |
"/ menu := Menu decodeFromLiteralArray:menu. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1405 |
"/ appl := self application. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1406 |
"/ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1407 |
"/ appl notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1408 |
"/ menu findGuiResourcesIn:appl. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1409 |
"/ "/ menu receiver:appl -- now done in findGuiResources ... |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1410 |
"/ ] ifFalse:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1411 |
"/ menu receiver:item |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1412 |
"/ ] |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1413 |
"/ ]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1414 |
"/ self startUpMenu:menu. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1415 |
"/ ^ self |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1416 |
"/ ]. |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1417 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1418 |
super buttonPress:button x:x y:y. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1419 |
^ self |
1390 | 1420 |
]. |
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1421 |
|
2399 | 1422 |
lineNr isNil ifTrue:[ ^ self ]. |
3205 | 1423 |
modelChangedDuringButtonPress := false. |
1578 | 1424 |
|
2401 | 1425 |
sensor ctrlDown ifTrue:[ |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1426 |
self buttonControlPressAtLine:lineNr x:x y:y. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1427 |
^ self |
2401 | 1428 |
]. |
1429 |
||
2976 | 1430 |
isSelected := self isInSelection:lineNr. |
1431 |
||
1432 |
(self canDrag and:[sensor shiftDown not]) ifTrue:[ |
|
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1433 |
dragDistance := UserPreferences current motionDistanceToStartDrag. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1434 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1435 |
isSelected ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1436 |
buttonMotionAction := |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1437 |
[:p| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1438 |
((x@y) dist:p) > dragDistance ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1439 |
self startDragAt:p. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1440 |
] |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1441 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1442 |
buttonReleaseAction := [ self buttonPressOrReleaseAtLine:lineNr x:x y:y ]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1443 |
^ self. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1444 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1445 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1446 |
self selectOnButtonPress ifFalse: [ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1447 |
|oldSelection| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1448 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1449 |
"/ set selection to line; |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1450 |
"/ set the model without change notification (objects to drag) |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1451 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1452 |
oldSelection := selection copy. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1453 |
self selectAndUpdateModelWithoutChangeNotification: lineNr. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1454 |
self windowGroup processExposeEvents. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1455 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1456 |
buttonMotionAction := |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1457 |
[:p| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1458 |
((x@y) dist:p) > dragDistance ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1459 |
|handler| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1460 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1461 |
handler := self startDragAt:p. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1462 |
handler contentsWillChange. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1463 |
"/ restore old selection |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1464 |
self selectAndUpdateModelWithoutChangeNotification: oldSelection. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1465 |
self windowGroup processExposeEvents. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1466 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1467 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1468 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1469 |
buttonReleaseAction := [ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1470 |
(self canSelectIndex:lineNr forAdd:false) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1471 |
"/ notify selection change |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1472 |
self selectionChanged. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1473 |
] ifFalse:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1474 |
"/ restore old selection |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1475 |
self selectAndUpdateModelWithoutChangeNotification: oldSelection. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1476 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1477 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1478 |
^ self |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1479 |
]. |
2976 | 1480 |
]. |
1390 | 1481 |
|
2401 | 1482 |
multipleSelectOk ifFalse:[ |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1483 |
(isSelected or:[self canSelectIndex:lineNr forAdd:false]) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1484 |
self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1485 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1486 |
(dragDistance notNil and:[self isInSelection:lineNr]) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1487 |
buttonMotionAction := |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1488 |
[:p| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1489 |
((x@y) dist:p) > dragDistance ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1490 |
self startDragAt:p. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1491 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1492 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1493 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1494 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1495 |
^ self |
2399 | 1496 |
]. |
2401 | 1497 |
startLine := lineNr. |
2399 | 1498 |
|
2401 | 1499 |
sensor shiftDown ifTrue:[ |min max| |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1500 |
(isSelected or:[self canSelectIndex:lineNr forAdd:true]) ifFalse:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1501 |
^ self |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1502 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1503 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1504 |
multipleSelectOk ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1505 |
startLine := self firstInSelection. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1506 |
startLine isNil ifTrue:[ startLine := lineNr ]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1507 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1508 |
startLine <= lineNr ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1509 |
self selectFrom:startLine to:lineNr. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1510 |
] ifFalse:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1511 |
startLine := self lastInSelection. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1512 |
self selectFrom:lineNr to:startLine. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1513 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1514 |
] |
2401 | 1515 |
] ifFalse:[ |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1516 |
(isSelected or:[self canSelectIndex:lineNr forAdd:false]) ifFalse:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1517 |
^ self |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1518 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1519 |
self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
1390 | 1520 |
]. |
1521 |
||
2401 | 1522 |
multipleSelectOk ifTrue:[ |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1523 |
buttonMotionAction := |
4483
b3f21fdb636c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4318
diff
changeset
|
1524 |
[:p| |
3740
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1525 |
(p y between:0 and:height) ifTrue:[ |ln| |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1526 |
ln := self yVisibleToLineNr:p y. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1527 |
ln isNil ifTrue:[ln := self size]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1528 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1529 |
(ln ~~ self lastInSelection and:[ln ~~ self firstInSelection]) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1530 |
self selectFrom:startLine to:ln. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1531 |
dragDistance := nil. "/ selection changed - no longer dragable |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1532 |
] |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1533 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1534 |
|
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1535 |
(dragDistance notNil and:[(x dist:p x) > dragDistance]) ifTrue:[ |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1536 |
self startDragAt:p. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1537 |
]. |
67a77c2fcb03
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3728
diff
changeset
|
1538 |
]. |
1915 | 1539 |
]. |
3221 | 1540 |
|
1541 |
"Modified: / 27-03-2007 / 08:43:58 / cg" |
|
1915 | 1542 |
! |
1543 |
||
1544 |
buttonPressOrReleaseAtLine:aLnNr x:x y:y |
|
1545 |
"handle a button press or release at a line |
|
1546 |
" |
|
1547 |
aLnNr == self selectedIndex ifTrue:[ |
|
3728 | 1548 |
editorView notNil ifTrue:[^ self]. |
1549 |
||
1550 |
self openEditorAction notNil ifTrue:[ |
|
1551 |
self openEditorAtX:x y:y. |
|
1552 |
editorView notNil ifTrue:[^ self]. |
|
1553 |
]. |
|
1554 |
||
1555 |
ignoreReselect ifFalse:[ |
|
1556 |
(toggleSelect and:[self sensor ctrlDown]) ifTrue:[ |
|
1557 |
self selection:nil |
|
1558 |
] ifFalse:[ |
|
1559 |
self selectionChanged |
|
1560 |
]. |
|
1561 |
]. |
|
1915 | 1562 |
] ifFalse:[ |
3728 | 1563 |
(self selectWithoutScroll:aLnNr redraw:true) ifTrue:[ |
1564 |
self selectionChanged |
|
1565 |
] |
|
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
1566 |
]. |
1390 | 1567 |
! |
1568 |
||
1569 |
buttonRelease:button x:x y:y |
|
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1570 |
"a button was released" |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1571 |
|
3205 | 1572 |
|makeSelectionVisible| |
1573 |
||
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1574 |
button == 1 ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1575 |
makeSelectionVisible := modelChangedDuringButtonPress. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1576 |
buttonMotionAction := modelChangedDuringButtonPress := nil. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1577 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1578 |
buttonReleaseAction notNil ifTrue:[ |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1579 |
buttonReleaseAction value. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1580 |
buttonReleaseAction := nil. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1581 |
]. |
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1582 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1583 |
self cursorEntersItem:nil. |
2401 | 1584 |
]. |
1748 | 1585 |
self stopAutoScroll. |
3205 | 1586 |
|
1587 |
(makeSelectionVisible == true and:[self hasSelection]) ifTrue:[ |
|
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1588 |
self makeSelectionVisible |
3205 | 1589 |
]. |
3750
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1590 |
|
948546ea76a5
fixed handling of menu button (fire on release)
Claus Gittinger <cg@exept.de>
parents:
3740
diff
changeset
|
1591 |
super buttonRelease:button x:x y:y |
1390 | 1592 |
! |
1593 |
||
1594 |
characterPress:aKey x:x y:y |
|
1595 |
" a character is pressed - lookup and change selection |
|
1596 |
" |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2455
diff
changeset
|
1597 |
|lnNr size idx stp to1 fr2| |
1390 | 1598 |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1599 |
size := self size. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1600 |
size > 1 ifFalse:[^ self]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1601 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1602 |
lnNr := self firstInSelection. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1603 |
lnNr isNil ifTrue:[lnNr := 0]. |
1390 | 1604 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2455
diff
changeset
|
1605 |
self sensor shiftDown ifTrue:[ |
3728 | 1606 |
stp := -1. "/ search backward |
1607 |
to1 := 1. |
|
1608 |
fr2 := size. |
|
1390 | 1609 |
] ifFalse:[ |
3728 | 1610 |
stp := 1. "/ search forward |
1611 |
to1 := size. |
|
1612 |
fr2 := 1. |
|
1390 | 1613 |
]. |
1614 |
||
1615 |
idx := self findLineFrom:lnNr+stp to:to1 by:stp startingWithCharacter:aKey. |
|
1616 |
||
1617 |
idx == 0 ifTrue:[ |
|
3728 | 1618 |
idx := self findLineFrom:fr2 to:lnNr-stp by:stp startingWithCharacter:aKey. |
1619 |
idx == 0 ifTrue:[^ self]. |
|
1390 | 1620 |
]. |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1621 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1622 |
self selection:idx. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1623 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1624 |
keyActionStyle == #selectAndDoubleClick ifTrue:[ |
3728 | 1625 |
self doubleClicked |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1626 |
]. |
1390 | 1627 |
! |
1628 |
||
1768
04b330a75f75
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1629 |
characterSearchItemStringAt:anIndex |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1630 |
"for first-character search: |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1631 |
return a lines item-string. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1632 |
For multi-col items, this may be different from the actual string |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1633 |
" |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1634 |
|item s| |
1768
04b330a75f75
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1635 |
|
2408 | 1636 |
item := self at:anIndex ifAbsent:nil. |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1637 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1638 |
item isHierarchicalItem ifTrue:[ |
3728 | 1639 |
item := item string |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1640 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1641 |
item isNil ifTrue:[^ nil]. |
1768
04b330a75f75
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1642 |
|
2455
44300555526c
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
2447
diff
changeset
|
1643 |
(Error catch:[ |
3728 | 1644 |
s := item asString |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1645 |
]) ifTrue:[ |
3728 | 1646 |
s := item displayString |
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1647 |
]. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
1648 |
^ s |
1768
04b330a75f75
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1649 |
! |
04b330a75f75
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1650 |
|
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1651 |
containerChangedSize |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1652 |
"/ stupid kludge for motif-style (which draws a frame at the right-edge) |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1653 |
"/ cg: I think it should not (see normal SelectionInListView, which does only |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1654 |
"/ draw the frame at the top and bottom, but NOT at the left and right |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1655 |
|
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
1656 |
self hasSelection ifTrue:[ |
3728 | 1657 |
(hilightFrameColor notNil |
1658 |
or:[hilightStyle == #motif |
|
1659 |
or:[hilightLevel ~~ 0]]) ifTrue:[ |
|
1660 |
"/ invalidate the right-edge |
|
1661 |
self invalidate:(((width-3) @ 0) corner:((width-1) @ (height-1))). |
|
1662 |
] |
|
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1663 |
]. |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1664 |
|
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1665 |
super containerChangedSize. |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1666 |
! |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1667 |
|
2377 | 1668 |
cursorEntersItem:anItemOrNil |
1669 |
"the cursor enters an item or nil |
|
1670 |
" |
|
1671 |
|lnNr x| |
|
1672 |
||
2408 | 1673 |
(shown and:[self size ~~ 0]) ifFalse:[ |
3728 | 1674 |
cursorItem := nil. |
1675 |
^ self. |
|
2377 | 1676 |
]. |
1677 |
||
1678 |
anItemOrNil == cursorItem ifTrue:[ ^ self ]. |
|
1679 |
||
1680 |
2 timesRepeat:[ |
|
3728 | 1681 |
cursorItem notNil ifTrue:[ |
1682 |
lnNr := self identityIndexOf:cursorItem. |
|
1683 |
lnNr notNil ifTrue:[ |
|
1684 |
x := self xVisibleOfItem:cursorItem. |
|
1685 |
self invalidateLineAt:lnNr fromX:x |
|
1686 |
]. |
|
1687 |
]. |
|
1688 |
"/ set the new item |
|
1689 |
cursorItem := anItemOrNil. |
|
2377 | 1690 |
]. |
1691 |
cursorItem notNil ifTrue:[ |
|
3728 | 1692 |
self makeLineVisible:lnNr |
2377 | 1693 |
]. |
1694 |
! |
|
1695 |
||
1390 | 1696 |
doubleClicked |
1697 |
"handle a double click |
|
1698 |
" |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
1699 |
|arg| |
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
1700 |
|
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
1701 |
doubleClickActionBlock notNil ifTrue:[ |
3728 | 1702 |
arg := self selectedIndex. |
1703 |
||
1704 |
arg ~~ 0 ifTrue:[ |
|
1705 |
doubleClickActionBlock valueWithOptionalArgument:arg and:self. |
|
1706 |
] |
|
2416
dd563121a967
instead of #numArgs use: #valueWithOptionalArgument:and
ca
parents:
2413
diff
changeset
|
1707 |
]. |
1390 | 1708 |
! |
1709 |
||
1710 |
findLineFrom:aStart to:aStop by:aStep startingWithCharacter:aCharacter |
|
1711 |
"find a line starting with a character |
|
1712 |
" |
|
2408 | 1713 |
|char lbl cmp |
1390 | 1714 |
size "{ Class:SmallInteger }" |
1715 |
start "{ Class:SmallInteger }" |
|
1716 |
stop "{ Class:SmallInteger }" |
|
1717 |
| |
|
2408 | 1718 |
(size := self size) ~~ 0 ifTrue:[ |
3728 | 1719 |
aStep > 0 ifTrue:[ |
1720 |
aStart > aStop ifTrue:[^ 0]. |
|
1721 |
] ifFalse:[ |
|
1722 |
(aStep == 0 or:[aStop > aStart]) ifTrue:[^ 0] |
|
1723 |
]. |
|
1724 |
||
1725 |
start := aStart < 0 ifTrue:[1] ifFalse:[aStart min:size]. |
|
1726 |
stop := aStop < 0 ifTrue:[1] ifFalse:[aStop min:size]. |
|
1727 |
char := aCharacter asUppercase. |
|
1728 |
||
1729 |
start to:stop by:aStep do:[:anIndex| |
|
1730 |
lbl := self characterSearchItemStringAt:anIndex. |
|
1731 |
lbl notNil ifTrue:[ |
|
1732 |
cmp := lbl string at:1 ifAbsent:nil. |
|
1733 |
||
1734 |
cmp notNil ifTrue:[ |
|
1735 |
(char == cmp or:[char == cmp asUppercase]) ifTrue:[ |
|
1736 |
(self canSelectIndex:anIndex forAdd:false) ifTrue:[ |
|
1737 |
^ anIndex |
|
1738 |
]. |
|
1739 |
^ 0 |
|
1740 |
] |
|
1741 |
] |
|
1742 |
] |
|
1743 |
] |
|
1390 | 1744 |
]. |
1745 |
^ 0 |
|
3081 | 1746 |
|
1747 |
"Modified: / 15-09-2006 / 11:26:29 / User" |
|
1390 | 1748 |
! |
1749 |
||
3338 | 1750 |
invalidateLineOfItem:anItem |
1751 |
|lnNr x| |
|
1752 |
||
1753 |
lnNr := self identityIndexOf:enterItem. |
|
1754 |
lnNr notNil ifTrue:[ |
|
3728 | 1755 |
x := self xVisibleOfItem:enterItem. |
1756 |
self invalidateLineAt:lnNr fromX:x |
|
3338 | 1757 |
]. |
1758 |
! |
|
1759 |
||
1390 | 1760 |
keyPress:aKey x:x y:y |
1761 |
"a key was pressed - handle page-keys here |
|
1762 |
" |
|
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
1763 |
<resource: #keyboard( #CursorUp #CursorDown #EndOfText #EndOfLine |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1764 |
#BeginOfText #BeginOfLine #Return |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1765 |
#CmdReturn #CmdCursorUp #CmdCursorDown #SelectAll)> |
1390 | 1766 |
|
2413 | 1767 |
|lineNr listSize shifted newSel step start| |
1390 | 1768 |
|
5794 | 1769 |
enabled ifFalse:[ |
1770 |
super keyPress:aKey x:x y:y. |
|
1771 |
^ self |
|
1772 |
]. |
|
2377 | 1773 |
|
2408 | 1774 |
listSize := self size. |
2377 | 1775 |
listSize == 0 ifTrue:[^ self]. |
1776 |
||
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
1777 |
aKey isCharacter ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1778 |
keyActionStyle notNil ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1779 |
keyActionStyle == #pass ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1780 |
super keyPress:aKey x:x y:y |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1781 |
] ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1782 |
self characterPress:aKey x:x y:y. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1783 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1784 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1785 |
^ self |
1390 | 1786 |
]. |
1787 |
||
2377 | 1788 |
aKey == #Escape ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1789 |
cursorItem notNil ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1790 |
self cursorEntersItem:nil. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1791 |
self makeSelectionVisible. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1792 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1793 |
super keyPress:aKey x:x y:y. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1794 |
^ self |
1390 | 1795 |
]. |
1796 |
||
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
1797 |
((aKey == #BeginOfText) or:[aKey == #BeginOfLine]) ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1798 |
self cursorEntersItem:nil. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1799 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1800 |
1 to:listSize do:[:i| |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1801 |
(self canSelectIndex:i forAdd:false) ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1802 |
self selection:i. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1803 |
^ self |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1804 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1805 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1806 |
^ self |
1390 | 1807 |
]. |
1808 |
||
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
1809 |
((aKey == #EndOfText) or:[aKey == #EndOfLine]) ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1810 |
self cursorEntersItem:nil. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1811 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1812 |
listSize to:1 by:-1 do:[:i| |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1813 |
(self canSelectIndex:i forAdd:false) ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1814 |
self selection:i. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1815 |
^ self |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1816 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1817 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1818 |
^ self |
2377 | 1819 |
]. |
1820 |
lineNr := self cursorLine. |
|
1821 |
||
1822 |
aKey == #Return ifTrue:[ |
|
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1823 |
returnKeyActionStyle == #pass ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1824 |
super keyPress:aKey x:x y:y |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1825 |
] ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1826 |
lineNr ~~ 0 ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1827 |
self cursorEntersItem:nil. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1828 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1829 |
(self canSelectIndex:lineNr forAdd:false) ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1830 |
self selection:lineNr |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1831 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1832 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1833 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1834 |
returnKeyActionStyle == #doubleClick ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1835 |
self doubleClicked |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1836 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1837 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1838 |
^ self |
2377 | 1839 |
]. |
2413 | 1840 |
|
3607 | 1841 |
aKey == #SelectAll ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1842 |
self selectAll. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1843 |
^ self |
3607 | 1844 |
]. |
1845 |
||
2413 | 1846 |
(lineNr == 0 and:[selection notNil]) ifTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1847 |
multipleSelectOk ifFalse:[lineNr := selection] |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1848 |
ifTrue:[lineNr := selection last]. |
2413 | 1849 |
]. |
1850 |
||
1851 |
aKey == #CmdReturn ifTrue:[ |
|
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1852 |
"/ toggle selection of the item |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1853 |
lineNr ~~ 0 ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1854 |
(self isInSelection:lineNr) ifTrue:[ self removeFromSelection:lineNr ] |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1855 |
ifFalse:[ self addToSelection:lineNr ]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1856 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1857 |
self cursorEntersItem:(self at:lineNr). |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1858 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1859 |
^ self |
2413 | 1860 |
]. |
1861 |
||
1862 |
(aKey == #CmdCursorDown or:[aKey == #CmdCursorUp]) ifTrue:[ |
|
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1863 |
aKey == #CmdCursorDown ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1864 |
lineNr := lineNr + 1. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1865 |
lineNr > listSize ifTrue:[lineNr := 1]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1866 |
] ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1867 |
lineNr := lineNr - 1. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1868 |
lineNr < 1 ifTrue:[lineNr := listSize]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1869 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1870 |
self cursorEntersItem:(self at:lineNr). |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1871 |
^ self |
2413 | 1872 |
]. |
1873 |
||
1874 |
(aKey == #CursorUp or:[aKey == #CursorDown]) ifFalse:[ |
|
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1875 |
super keyPress:aKey x:x y:y. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1876 |
^ self |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
1877 |
]. |
2413 | 1878 |
shifted := (multipleSelectOk and:[self sensor shiftDown]). |
2377 | 1879 |
self cursorEntersItem:nil. |
1880 |
||
2671 | 1881 |
aKey == #CursorDown ifTrue:[ step := 1.] |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1882 |
ifFalse:[ step := -1.]. |
2671 | 1883 |
|
1884 |
shifted ifFalse:[ |compressed| |
|
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1885 |
compressed := self sensor compressKeyPressEventsWithKey:aKey. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1886 |
|
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1887 |
compressed ~~ 0 ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1888 |
aKey == #CursorDown ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1889 |
lineNr := lineNr + compressed. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1890 |
lineNr > listSize ifTrue:[lineNr := 1]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1891 |
] ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1892 |
lineNr := lineNr - compressed. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1893 |
lineNr < 1 ifTrue:[lineNr := listSize]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1894 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1895 |
]. |
2671 | 1896 |
]. |
2377 | 1897 |
start := lineNr. |
1898 |
lineNr := lineNr + step. |
|
2368 | 1899 |
|
2377 | 1900 |
[ lineNr ~~ start ] whileTrue:[ |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1901 |
(lineNr between:1 and:listSize) ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1902 |
lineNr < 1 ifTrue:[ lineNr := listSize ] |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1903 |
ifFalse:[ lineNr := 1 ]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1904 |
] ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1905 |
(self canSelectIndex:lineNr forAdd:shifted) ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1906 |
shifted ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1907 |
self selection:lineNr. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1908 |
^ self |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1909 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1910 |
(self isInSelection:lineNr) ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1911 |
selection isNil ifTrue:[ newSel := Array with:lineNr ] |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1912 |
ifFalse:[ newSel := selection copyWith:lineNr ]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1913 |
] ifTrue:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1914 |
(start ~~ 0 and:[selection size > 1]) ifFalse:[ |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1915 |
^ self |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1916 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1917 |
newSel := selection copyWithout:start. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1918 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1919 |
self selection:newSel. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1920 |
"/ self selectWithoutScroll:newSel redraw:true. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1921 |
"/ self makeLineVisible:lineNr. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1922 |
"/ self selectionChanged. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1923 |
^ self |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1924 |
]. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1925 |
lineNr := lineNr + step. |
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
1926 |
] |
2377 | 1927 |
]. |
5794 | 1928 |
|
1929 |
"Modified: / 09-06-2018 / 09:28:00 / Claus Gittinger" |
|
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1930 |
! |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1931 |
|
2323 | 1932 |
pointerEntersItem:anItemOrNil |
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
1933 |
"the pointer moves over an item or nil" |
2323 | 1934 |
|
2408 | 1935 |
(shown and:[self size ~~ 0]) ifFalse:[ |
4571
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
1936 |
enterItem := nil. |
bf04b7618d7c
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4570
diff
changeset
|
1937 |
^ self. |
2323 | 1938 |
]. |
1939 |
||
1940 |
anItemOrNil == enterItem ifTrue:[ ^ self ]. |
|
1941 |
||
3338 | 1942 |
enterItem notNil ifTrue:[ self invalidateLineOfItem:enterItem ]. |
1943 |
enterItem := anItemOrNil. |
|
1944 |
enterItem notNil ifTrue:[ self invalidateLineOfItem:enterItem ]. |
|
2323 | 1945 |
! |
1946 |
||
1947 |
pointerLeave:state |
|
1948 |
self pointerEntersItem:nil. |
|
1949 |
super pointerLeave:state. |
|
1950 |
! |
|
1951 |
||
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1952 |
sizeChanged:how |
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1953 |
|selectionWasVisible| |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1954 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1955 |
selectionWasVisible := false. |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1956 |
|
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1957 |
"/ stupid kludge for motif-style (which draws a frame at the right-edge) |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1958 |
"/ cg: I think it should not (see normal SelectionInListView, which does only |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1959 |
"/ draw the frame at the top and bottom, but NOT at the left and right |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
1960 |
|
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
1961 |
self hasSelection ifTrue:[ |
3728 | 1962 |
selectionWasVisible := self isSelectionVisibleIn:(previousExtent ? self extent). |
1963 |
||
1964 |
(hilightFrameColor notNil |
|
1965 |
or:[hilightStyle == #motif |
|
1966 |
or:[hilightLevel ~~ 0]]) ifTrue:[ |
|
1967 |
"/ invalidate the right-edge |
|
1968 |
self invalidate:(((width-3) @ 0) corner:((width-1) @ (height-1))). |
|
1969 |
]. |
|
1917
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1970 |
]. |
21964f5b1cc1
fixed selection redraw when resizing (larger) in motif mode
Claus Gittinger <cg@exept.de>
parents:
1915
diff
changeset
|
1971 |
super sizeChanged:how. |
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1972 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1973 |
selectionWasVisible ifTrue:[ |
3728 | 1974 |
self makeSelectionVisible |
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
1975 |
]. |
1390 | 1976 |
! ! |
1977 |
||
1421 | 1978 |
!SelectionInListModelView methodsFor:'focus handling'! |
1979 |
||
3137 | 1980 |
showFocus:explicit |
1981 |
self invalidateSelection. |
|
1982 |
super showFocus:explicit |
|
1983 |
! |
|
1984 |
||
1985 |
showNoFocus:explicit |
|
1986 |
self invalidateSelection. |
|
1987 |
super showNoFocus:explicit |
|
1988 |
! |
|
1989 |
||
1421 | 1990 |
wantsFocusWithPointerEnter |
1991 |
"return true, if I want the focus when |
|
1992 |
the mouse pointer enters" |
|
1993 |
||
2701
d95a0a764f4d
do return false in #wantsFocusWithPointerEnter if an ecitor is open
ca
parents:
2671
diff
changeset
|
1994 |
(editorView notNil and:[editorView realized]) ifTrue:[ |
3728 | 1995 |
^ false |
2701
d95a0a764f4d
do return false in #wantsFocusWithPointerEnter if an ecitor is open
ca
parents:
2671
diff
changeset
|
1996 |
]. |
d95a0a764f4d
do return false in #wantsFocusWithPointerEnter if an ecitor is open
ca
parents:
2671
diff
changeset
|
1997 |
|
2959 | 1998 |
(UserPreferences current focusFollowsMouse ~~ false |
1421 | 1999 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
2000 |
]) ifTrue:[ |
|
3728 | 2001 |
self size > 0 ifTrue:[ |
2002 |
^ true |
|
2003 |
] |
|
1421 | 2004 |
]. |
2005 |
^ false |
|
2006 |
! ! |
|
2007 |
||
5069 | 2008 |
!SelectionInListModelView methodsFor:'help'! |
2009 |
||
5677 | 2010 |
helpTextAt:aPoint |
5069 | 2011 |
"for lines which are clipped, provide the full line as a tooltip |
5790 | 2012 |
(as in other listviews)" |
5069 | 2013 |
|
5790 | 2014 |
|lineNr len item line text text2| |
5069 | 2015 |
|
5083 | 2016 |
lineNr := self yVisibleToLineNr:aPoint y. |
5069 | 2017 |
lineNr isNil ifTrue:[ ^ nil ]. |
2018 |
||
5790 | 2019 |
item := self at:lineNr ifAbsent:nil. |
2020 |
item notNil ifTrue:[ |
|
2021 |
line := item perform:#label ifNotUnderstood:[item displayString]. |
|
5796 | 2022 |
(line isString or:[line isLabelAndIcon]) ifTrue:[ |
5792 | 2023 |
line := line string. |
2024 |
line := line withoutSeparators. |
|
2025 |
]. |
|
5790 | 2026 |
]. |
2027 |
line notNil ifTrue:[ |
|
2028 |
len := self widthOfWidestLineBetween:lineNr and:lineNr. |
|
2029 |
len > width ifTrue:[ |
|
5796 | 2030 |
(line isString or:[line isLabelAndIcon]) ifTrue:[ |
2031 |
text := line string collect:[:ch | ch isSeparator ifTrue:[Character space] ifFalse:[ch]]. |
|
2032 |
]. |
|
5790 | 2033 |
]. |
2034 |
||
2035 |
"/ a hack; maybe we'll find a better solution... |
|
2036 |
(line respondsTo:#helpText) ifTrue:[ |
|
2037 |
(text2 := line helpText) notEmptyOrNil ifTrue:[ |
|
2038 |
text2 := text2 withCRs. |
|
2039 |
text isEmptyOrNil ifTrue:[ |
|
2040 |
text := text2 |
|
2041 |
] ifFalse:[ |
|
2042 |
text := text , Character cr , text2. |
|
2043 |
]. |
|
2044 |
] |
|
5069 | 2045 |
]. |
2046 |
]. |
|
5381 | 2047 |
|
2048 |
^ text |
|
5496 | 2049 |
|
2050 |
"Modified: / 20-02-2017 / 10:11:58 / cg" |
|
5796 | 2051 |
"Modified: / 10-06-2018 / 18:35:41 / Claus Gittinger" |
5069 | 2052 |
! ! |
2053 |
||
2501 | 2054 |
!SelectionInListModelView methodsFor:'initialization & release'! |
1390 | 2055 |
|
2056 |
fetchResources |
|
2057 |
"fetch device colors and ..., to avoid reallocation at redraw time; |
|
2058 |
*** called after a create or snapin to fetch all device resources |
|
2059 |
" |
|
2060 |
||
2061 |
super fetchResources. |
|
2062 |
||
2063 |
hilightFgColor := self colorOnDevice:hilightFgColor. |
|
2064 |
hilightBgColor := self colorOnDevice:hilightBgColor. |
|
2065 |
hilightFrameColor := self colorOnDevice:hilightFrameColor. |
|
5002 | 2066 |
lineMask := lineMask onDevice:device. |
3137 | 2067 |
|
2068 |
hilightFgColorNoFocus := self colorOnDevice:hilightFgColorNoFocus. |
|
2069 |
hilightBgColorNoFocus := self colorOnDevice:hilightBgColorNoFocus. |
|
1390 | 2070 |
! |
2071 |
||
2072 |
initStyle |
|
2073 |
"setup viewStyle specifics |
|
2074 |
" |
|
3728 | 2075 |
<resource: #style (#'selection.selectOnMenuButton' |
3851 | 2076 |
#'selection.font')> |
1390 | 2077 |
super initStyle. |
2078 |
||
2377 | 2079 |
lineMask isNil ifTrue:[ |
3851 | 2080 |
lineMask := Form width:2 height:2 fromArray:#[16rAA 16r55]. |
2377 | 2081 |
]. |
2082 |
||
2228 | 2083 |
hilightFrameColor := nil. |
2084 |
hilightStyle := DefaultHilightStyle. |
|
2085 |
highlightMode := #label. |
|
2086 |
textStartLeft := 4. |
|
3461 | 2087 |
selectOnMenuButton := styleSheet at:#'selection.selectOnMenuButton' default:nil. |
2088 |
selectOnMenuButton isNil ifTrue:[ |
|
3851 | 2089 |
selectOnMenuButton := UserPreferences current selectOnRightClick |
3461 | 2090 |
]. |
1390 | 2091 |
|
3927 | 2092 |
self font:(SelectionInListView defaultFont). |
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
2093 |
|
5002 | 2094 |
device hasGrayscales ifTrue:[ |
3851 | 2095 |
" |
2096 |
must get rid of these hard codings |
|
2097 |
" |
|
2098 |
(hilightStyle == #next) ifTrue:[ |
|
2099 |
hilightFgColor := fgColor. |
|
4512
0b737fe17eea
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4483
diff
changeset
|
2100 |
hilightBgColor := self whiteColor. |
3851 | 2101 |
hilightFrameColor := fgColor |
2102 |
] ifFalse:[ |
|
2103 |
(hilightStyle == #motif) ifTrue:[ |
|
4512
0b737fe17eea
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4483
diff
changeset
|
2104 |
fgColor := self whiteColor. |
3851 | 2105 |
bgColor := Grey. |
2106 |
viewBackground := bgColor. |
|
2107 |
hilightFgColor := bgColor. |
|
2108 |
hilightBgColor := fgColor. |
|
2109 |
] ifFalse:[ |
|
2110 |
(hilightStyle == #openwin) ifTrue:[ |
|
2111 |
hilightFgColor := fgColor. |
|
4647
caf78f4a0548
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4638
diff
changeset
|
2112 |
hilightBgColor := Color gray. |
3851 | 2113 |
] |
2114 |
] |
|
2115 |
] |
|
1390 | 2116 |
]. |
2117 |
||
2118 |
hilightFgColor isNil ifTrue:[ |
|
3851 | 2119 |
hilightFgColor := bgColor. |
1390 | 2120 |
]. |
2121 |
hilightBgColor isNil ifTrue:[ |
|
3851 | 2122 |
hilightBgColor := fgColor. |
1390 | 2123 |
]. |
2124 |
DefaultForegroundColor notNil ifTrue:[ |
|
3851 | 2125 |
fgColor := DefaultForegroundColor |
1390 | 2126 |
]. |
2127 |
DefaultBackgroundColor notNil ifTrue:[ |
|
3851 | 2128 |
bgColor := viewBackground := DefaultBackgroundColor |
1390 | 2129 |
]. |
2130 |
||
2131 |
DefaultHilightForegroundColor notNil ifTrue:[ |
|
3851 | 2132 |
hilightFgColor := DefaultHilightForegroundColor |
1390 | 2133 |
]. |
2134 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
3851 | 2135 |
hilightBgColor := DefaultHilightBackgroundColor |
1390 | 2136 |
]. |
2137 |
DefaultHilightFrameColor notNil ifTrue:[ |
|
3851 | 2138 |
hilightFrameColor := DefaultHilightFrameColor |
1390 | 2139 |
]. |
2140 |
||
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
2141 |
hilightLevel := DefaultHilightLevel ? 0. |
4570
4da74a5c2f14
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4568
diff
changeset
|
2142 |
lineSpacing := gc font descent. |
4568
664bbb1743ff
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4515
diff
changeset
|
2143 |
lineSpacing := lineSpacing + ((hilightLevel abs > 0) ifTrue:[1] ifFalse:[0]). |
1741
d928cdc5f4e5
add #ignoreReselect #toggleSelect; behaviour like SelectionInListView
ca
parents:
1739
diff
changeset
|
2144 |
|
1390 | 2145 |
hilightFgColor isNil ifTrue:[ |
3851 | 2146 |
hilightFgColor := bgColor. |
2147 |
hilightBgColor := fgColor. |
|
3137 | 2148 |
]. |
2149 |
||
2150 |
hilightFgColorNoFocus isNil ifTrue:[ |
|
4652
1a4f9ee861c1
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4648
diff
changeset
|
2151 |
hilightFgColorNoFocus := DefaultHilightForegroundColorNoFocus. |
1a4f9ee861c1
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4648
diff
changeset
|
2152 |
hilightFgColorNoFocus isNil ifTrue:[ |
1a4f9ee861c1
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4648
diff
changeset
|
2153 |
hilightFgColorNoFocus := hilightFgColor slightlyLightened. |
1a4f9ee861c1
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4648
diff
changeset
|
2154 |
] |
3137 | 2155 |
]. |
2156 |
hilightBgColorNoFocus isNil ifTrue:[ |
|
4648
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
2157 |
hilightBgColorNoFocus := DefaultHilightBackgroundColorNoFocus. |
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
2158 |
hilightBgColorNoFocus isNil ifTrue:[ |
4652
1a4f9ee861c1
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4648
diff
changeset
|
2159 |
hilightBgColorNoFocus := hilightBgColor slightlyLightened. |
4648
5c5c17b052fb
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4647
diff
changeset
|
2160 |
]. |
1390 | 2161 |
]. |
3927 | 2162 |
|
2163 |
"Modified: / 14-08-2010 / 12:23:09 / cg" |
|
1390 | 2164 |
! |
2165 |
||
2166 |
initialize |
|
2167 |
"setup default attributes/behavior |
|
2168 |
" |
|
2418
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2169 |
multipleSelectOk := false. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2170 |
useIndex := true. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2171 |
ignoreReselect := true. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2172 |
toggleSelect := false. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2173 |
highlightEnterItem := false. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2174 |
strikeOut := false. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2175 |
|
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2176 |
keyActionStyle := #select. |
14a9dbec8434
support of #keyActionStyle #returnKeyActionStyle #strikeOut
ca
parents:
2416
diff
changeset
|
2177 |
returnKeyActionStyle := #doubleClick. |
2324 | 2178 |
|
3963
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2179 |
extraSpaceAtBottomForDrop := 20. |
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2180 |
|
2324 | 2181 |
super initialize. |
3963
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2182 |
|
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2183 |
"Modified: / 03-11-2010 / 01:34:54 / cg" |
1390 | 2184 |
! |
2185 |
||
1745 | 2186 |
mapped |
2187 |
"get selection from model; scroll to selection |
|
2188 |
" |
|
2189 |
super mapped. |
|
2190 |
self makeSelectionVisible. |
|
2191 |
! |
|
2192 |
||
1390 | 2193 |
realize |
2194 |
"get selection from model; scroll to selection |
|
2195 |
" |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2275
diff
changeset
|
2196 |
self updateFromModel. |
1390 | 2197 |
super realize. |
2198 |
! ! |
|
2199 |
||
2493 | 2200 |
!SelectionInListModelView methodsFor:'private-editor'! |
1755 | 2201 |
|
2202 |
computeEditorLayout |
|
2203 |
"update the layout of the editor |
|
2204 |
" |
|
3526 | 2205 |
|lnNr item y0 x0 y1| |
1755 | 2206 |
|
2207 |
editorView isNil ifTrue:[ |
|
3728 | 2208 |
^ self |
1755 | 2209 |
]. |
2210 |
||
2211 |
( (lnNr := self selectedIndex) == 0 |
|
2408 | 2212 |
or:[(item := self at:lnNr ifAbsent:nil) isNil] |
1755 | 2213 |
) ifTrue:[ |
3728 | 2214 |
"/ there is no more single selection; thus close the editor |
2215 |
^ self closeEditor |
|
1755 | 2216 |
]. |
2217 |
||
3526 | 2218 |
x0 := (self xVisibleOfItem:item) - (textStartLeft // 2). |
2219 |
y0 := self yVisibleOfLine:lnNr. |
|
2220 |
y1 := self yVisibleOfLine:(lnNr + 1). |
|
1755 | 2221 |
|
3524 | 2222 |
minimumEditorHeight notNil ifTrue:[ |
3728 | 2223 |
y1 := y0 + ((y1 - y0) max:minimumEditorHeight). |
3524 | 2224 |
]. |
2632 | 2225 |
"/ Changed by cg: |
2226 |
"/ editorView layout:( Rectangle left:x top:y right:(width - 1 - margin) bottom:(h + 2 "- 1") ). |
|
3526 | 2227 |
editorView layout:( Rectangle left:x0 top:y0-2 right:(width - 1 - margin) bottom:y1 ). |
1755 | 2228 |
! |
2229 |
||
2230 |
openEditorAtX:x y:y |
|
2231 |
"opens an editor on the current single selection |
|
2232 |
" |
|
2225 | 2233 |
|item lnNr x0 y0 editor| |
1755 | 2234 |
|
2235 |
self closeEditor. |
|
2308 | 2236 |
shown ifFalse:[^ self ]. |
2596 | 2237 |
self openEditorAction isNil ifTrue:[^ self]. |
1755 | 2238 |
|
2225 | 2239 |
lnNr := self selectedIndex. |
2240 |
lnNr == 0 ifTrue:[^ self]. |
|
2241 |
||
2408 | 2242 |
item := self at:lnNr ifAbsent:nil. |
2308 | 2243 |
item isNil ifTrue:[^ self]. |
1755 | 2244 |
|
1915 | 2245 |
x < (self xVisibleOfItem:item) ifTrue:[ |
3778 | 2246 |
"/ not part of the selection frame; ignorre |
2247 |
^ self |
|
1755 | 2248 |
]. |
2225 | 2249 |
editor := self openEditor. |
2308 | 2250 |
editor isNil ifTrue:[^ self]. |
1755 | 2251 |
|
2225 | 2252 |
y0 := (y - editor origin y) max:0. |
2253 |
x0 := (x - editor origin x) max:0. |
|
1755 | 2254 |
|
2125 | 2255 |
"/ simulate clicking into the editor |
2632 | 2256 |
|
2257 |
"/ Changed by cg: |
|
2258 |
"/ but only if there was no initial selection |
|
2259 |
editor isInputField ifTrue:[ |
|
3778 | 2260 |
editor hasSelection ifFalse:[ |
2261 |
self sensor |
|
2262 |
pushEvent:(WindowEvent buttonPress:1 x:x0 y:y0 view:editor); |
|
2263 |
pushEvent:(WindowEvent buttonRelease:1 x:x0 y:y0 view:editor). |
|
2264 |
] |
|
2632 | 2265 |
]. |
1755 | 2266 |
|
2267 |
"/ to clear the selection |
|
2245
546c6e5d0951
change #redrawSelectionAt: to #invalidateSelectionAt: (because is a invalidate)
ca
parents:
2228
diff
changeset
|
2268 |
self invalidateLineAt:lnNr. |
1755 | 2269 |
! ! |
2270 |
||
1390 | 2271 |
!SelectionInListModelView methodsFor:'protocol'! |
2272 |
||
1458 | 2273 |
lostSynchronisation |
2274 |
"called when the changes derived from the model are faster than the handling |
|
2275 |
" |
|
1547 | 2276 |
self deselectWithoutRedraw. |
1458 | 2277 |
super lostSynchronisation. |
1390 | 2278 |
! ! |
2279 |
||
2330 | 2280 |
!SelectionInListModelView methodsFor:'queries'! |
2281 |
||
4638
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2282 |
elementsForWhich:aBlock |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2283 |
|result| |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2284 |
|
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2285 |
result := OrderedCollection new. |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2286 |
1 to:self size do:[:idx | |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2287 |
|el| |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2288 |
|
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2289 |
el := self at:idx. |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2290 |
(aBlock value:el) ifTrue:[ result add:el]. |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2291 |
]. |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2292 |
^ result |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2293 |
! |
21fee5ee9af2
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4574
diff
changeset
|
2294 |
|
5817 | 2295 |
hasToSkipButtonMultiPress:button x:x y:y |
2296 |
"return true if a button multi press at x@y should be skipped" |
|
2297 |
^ false |
|
2298 |
||
2299 |
"Created: / 22-06-2018 / 14:32:38 / sr" |
|
2300 |
! |
|
2301 |
||
2330 | 2302 |
isCursorKeyConsumer |
2303 |
"return true, if the receiver can be controlled by cursor keys; |
|
2304 |
i.e. it can handle some keyboard input, |
|
2305 |
isCursorKeyConsumer are potential candidates for getting the keyboard |
|
2306 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
|
4692
433047d28c93
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4667
diff
changeset
|
2307 |
mode is off." |
2330 | 2308 |
|
2309 |
^ true |
|
2310 |
! ! |
|
2311 |
||
3526 | 2312 |
!SelectionInListModelView methodsFor:'scroller interface'! |
2313 |
||
2314 |
heightOfContents |
|
2315 |
"answer the height of the contents in pixels. |
|
2316 |
If the minimumEditorHeight and the openEditorAction is defined, |
|
2317 |
we have to involve the minimumEditorHeight in the computation, |
|
2318 |
to allow opening the editor fullyvisible at the last line." |
|
2319 |
||
2320 |
|cachedLinesY cachedMaxIdx y0 y1| |
|
2321 |
||
2322 |
cachedLinesY := self startOfLinesY. |
|
2323 |
cachedMaxIdx := cachedLinesY size. |
|
2324 |
cachedMaxIdx == 0 ifTrue:[ ^ 0 ]. |
|
2325 |
||
4796 | 2326 |
"/ !!!! cachedLinesY at:cachedMaxIdx might return nil (async reorg) |
2327 |
y1 := cachedLinesY at:cachedMaxIdx ifAbsent:nil. |
|
2328 |
y1 isNil ifTrue:[^ 0 ]. "/ is under construction due ro async. events |
|
3526 | 2329 |
|
2330 |
(minimumEditorHeight notNil and:[openEditorAction notNil]) ifTrue:[ |
|
3963
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2331 |
y0 := cachedLinesY at:(cachedMaxIdx - 1) ifAbsent:0. |
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2332 |
y1 := y0 + ((y1 - y0) max:minimumEditorHeight). |
3526 | 2333 |
]. |
3963
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2334 |
^ y1 + extraSpaceAtBottomForDrop. |
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2335 |
|
9fd5330c7e40
fix to allow dropping at the bottom
Claus Gittinger <cg@exept.de>
parents:
3927
diff
changeset
|
2336 |
"Modified: / 03-11-2010 / 01:35:05 / cg" |
3526 | 2337 |
! ! |
2338 |
||
1390 | 2339 |
!SelectionInListModelView methodsFor:'selection'! |
2340 |
||
2401 | 2341 |
addToSelection:lineNr |
2410 | 2342 |
"add line to selection without scrolling but raise a change notification |
2343 |
" |
|
2344 |
|oldSelect forAdd| |
|
2401 | 2345 |
|
2346 |
(self isInSelection:lineNr) ifTrue:[ |
|
3728 | 2347 |
^ self |
2401 | 2348 |
]. |
2349 |
||
2410 | 2350 |
multipleSelectOk ifTrue:[ forAdd := selection notNil ] |
3728 | 2351 |
ifFalse:[ forAdd := false ]. |
2410 | 2352 |
|
2353 |
(self canSelectIndex:lineNr forAdd:forAdd) ifFalse:[ |
|
3728 | 2354 |
^ self |
2401 | 2355 |
]. |
2356 |
||
2410 | 2357 |
self closeEditor. |
2358 |
self cursorEntersItem:nil. |
|
2359 |
||
2360 |
multipleSelectOk ifFalse:[ |
|
3728 | 2361 |
oldSelect := selection. |
2362 |
selection := lineNr. |
|
2363 |
oldSelect notNil ifTrue:[ self invalidateSelectionAt:oldSelect ]. |
|
2410 | 2364 |
] ifTrue:[ |
3728 | 2365 |
selection notNil ifTrue:[ selection := selection copyWith:lineNr ] |
2366 |
ifFalse:[ selection := OrderedCollection with:lineNr ]. |
|
2401 | 2367 |
]. |
2368 |
self invalidateSelectionAt:lineNr. |
|
2369 |
self selectionChanged. |
|
2370 |
! |
|
2371 |
||
1390 | 2372 |
deselect |
2373 |
"clear selection |
|
2374 |
" |
|
2375 |
self selection:nil |
|
2376 |
||
2377 |
! |
|
2378 |
||
2379 |
firstInSelection |
|
2399 | 2380 |
"returns the minimum index of selected indices or nil if nothing is selected |
1390 | 2381 |
" |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2382 |
|min| |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2383 |
|
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2384 |
multipleSelectOk ifFalse:[ ^ selection ]. |
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2385 |
selection size == 0 ifTrue:[ ^ nil ]. |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2386 |
|
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2387 |
min := selection at:1. |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2388 |
selection do:[:aNumber| min := min min:aNumber ]. |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2389 |
^ min |
1390 | 2390 |
! |
2391 |
||
2392 |
hasSelection |
|
5684 | 2393 |
"true if an item is selected" |
2394 |
||
1390 | 2395 |
^ selection notNil |
2396 |
! |
|
2397 |
||
2398 |
isInSelection:aNumber |
|
2399 |
"return true, if line, aNumber is in the selection |
|
2400 |
" |
|
1545 | 2401 |
multipleSelectOk ifFalse:[ |
3728 | 2402 |
^ (aNumber == selection) |
1545 | 2403 |
]. |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2404 |
selection notNil ifTrue:[ |
3728 | 2405 |
^ selection includesIdentical:aNumber |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2406 |
]. |
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2407 |
^ false |
1390 | 2408 |
! |
2409 |
||
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2410 |
isSelectionVisible |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2411 |
"returns true if any selected element is visible" |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2412 |
|
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2413 |
^ self isSelectionVisibleIn:(self extent) |
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2414 |
! |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2415 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2416 |
isSelectionVisibleIn:anExtentPoint |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2417 |
"returns true if any selected element is visible" |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2418 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2419 |
self selectionDo:[:aLineNr| |
3728 | 2420 |
(self isLineVisible:aLineNr in:anExtentPoint) ifTrue:[^ true]. |
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2421 |
]. |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2422 |
^ false |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2423 |
! |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2250
diff
changeset
|
2424 |
|
2330 | 2425 |
lastInSelection |
2399 | 2426 |
"returns the maximum index of selected indices or nil if nothing is selected |
2330 | 2427 |
" |
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2428 |
|max| |
2330 | 2429 |
|
2409
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2430 |
multipleSelectOk ifFalse:[ ^ selection ]. |
68095c891ceb
reuse selection methods (prepared for common controller)
ca
parents:
2408
diff
changeset
|
2431 |
selection size == 0 ifTrue:[ ^ nil ]. |
2330 | 2432 |
|
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2433 |
max := 1. |
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2434 |
selection do:[:aNumber| max := max max:aNumber ]. |
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2435 |
^ max |
2330 | 2436 |
! |
2437 |
||
2438 |
makeSelectionVisible |
|
2439 |
"scroll to make the selection line visible |
|
5316 | 2440 |
don't scroll, if any in the selection isVisible |
2330 | 2441 |
" |
3202 | 2442 |
|firstLine| |
2443 |
||
3205 | 2444 |
modelChangedDuringButtonPress notNil ifTrue:[^ self]. |
2445 |
||
3202 | 2446 |
firstLine := self firstInSelection. |
2447 |
(firstLine isNil or:[firstLine == 0]) ifTrue:[^ self]. |
|
2448 |
||
2449 |
self selectionDo:[:aLnNr| |
|
3889 | 2450 |
(self lineIsFullyVisible:aLnNr) ifTrue:[^ self]. |
3728 | 2451 |
]. |
2368 | 2452 |
self makeLineVisible:(self firstInSelection). |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2453 |
! |
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2454 |
|
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2455 |
nextAfterSelection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2456 |
"return the index of the next selectable entry after the selection. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2457 |
Wrap at end." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2458 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2459 |
^ self nextSelectableAfter:selection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2460 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2461 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2462 |
nextSelectableAfter:indexOrIndexCollection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2463 |
"return the index of the next selectable entry after the indexOrIndexCollection. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2464 |
Wrap at end." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2465 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2466 |
|next sz| |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2467 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2468 |
indexOrIndexCollection isNil ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2469 |
next := 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2470 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2471 |
indexOrIndexCollection isCollection ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2472 |
indexOrIndexCollection size == 0 ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2473 |
next := 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2474 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2475 |
next := indexOrIndexCollection max + 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2476 |
] |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2477 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2478 |
next := indexOrIndexCollection + 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2479 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2480 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2481 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2482 |
(self canSelectIndex:next) ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2483 |
sz := self size. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2484 |
next > sz ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2485 |
next := 1. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2486 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2487 |
[next <= sz |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2488 |
and:[(self canSelectIndex:next) not ]] whileTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2489 |
next := next + 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2490 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2491 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2492 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2493 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2494 |
(self canSelectIndex:next) ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2495 |
next := nil |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2496 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2497 |
^ next |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2498 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2499 |
"Modified: / 08-08-1998 / 03:36:55 / cg" |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2500 |
"Modified: / 22-04-2014 / 12:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2501 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2502 |
|
1390 | 2503 |
numberOfSelections |
2504 |
"return the number of selected items |
|
2505 |
" |
|
2330 | 2506 |
selection isNil ifTrue:[ ^ 0 ]. |
2507 |
multipleSelectOk ifFalse:[ ^ 1 ]. |
|
2508 |
^ selection size |
|
1390 | 2509 |
! |
2510 |
||
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2511 |
previousBeforeSelection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2512 |
"return the index of the previous selectable entry before the selection. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2513 |
Wrap at beginning." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2514 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2515 |
^ self previousSelectableBefore:selection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2516 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2517 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2518 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2519 |
previousSelectableBefore:indexOrIndexCollection |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2520 |
"return the index of the previous selectable entry before the indexOrIndexCollection. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2521 |
Wrap at beginning." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2522 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2523 |
|prev| |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2524 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2525 |
indexOrIndexCollection isNil ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2526 |
prev := list size |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2527 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2528 |
indexOrIndexCollection isCollection ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2529 |
indexOrIndexCollection size == 0 ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2530 |
prev := list size |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2531 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2532 |
prev := indexOrIndexCollection min - 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2533 |
] |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2534 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2535 |
prev := indexOrIndexCollection - 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2536 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2537 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2538 |
(self canSelectIndex:prev) ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2539 |
prev < 1 ifTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2540 |
prev := self size. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2541 |
] ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2542 |
[prev >= 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2543 |
and:[(self canSelectIndex:prev) not]] whileTrue:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2544 |
prev := prev - 1 |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2545 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2546 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2547 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2548 |
(self canSelectIndex:prev) ifFalse:[ |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2549 |
prev := nil |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2550 |
]. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2551 |
^ prev |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2552 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2553 |
"Modified: / 22-04-2014 / 12:16:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2554 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2555 |
|
2401 | 2556 |
removeFromSelection:lineNr |
2410 | 2557 |
"remove line from selection without scrolling but raise a change notification |
2558 |
" |
|
2401 | 2559 |
(self isInSelection:lineNr) ifFalse:[ |
3728 | 2560 |
^ self |
2401 | 2561 |
]. |
2562 |
self closeEditor. |
|
2410 | 2563 |
self cursorEntersItem:nil. |
2401 | 2564 |
|
2410 | 2565 |
(multipleSelectOk and:[self numberOfSelections > 1]) ifTrue:[ |
3728 | 2566 |
selection := selection copyWithout:lineNr. |
2401 | 2567 |
] ifFalse:[ |
3728 | 2568 |
selection := nil |
2401 | 2569 |
]. |
2410 | 2570 |
self invalidateSelectionAt:lineNr. |
2571 |
self selectionChanged. |
|
2401 | 2572 |
! |
2573 |
||
3607 | 2574 |
selectAll |
3728 | 2575 |
"select all entries. |
3607 | 2576 |
Model and/or actionBlock notification IS done." |
2577 |
||
2578 |
self selectFrom:1 to:self size. |
|
2579 |
! |
|
2580 |
||
1390 | 2581 |
selectElement:anElement |
2582 |
"select the element. Scroll to make the new selection visible. |
|
2583 |
Model and/or actionBlock notification IS done. |
|
2584 |
" |
|
2178 | 2585 |
self selectElement:anElement ifAbsent:[self deselect] |
2586 |
! |
|
2587 |
||
2588 |
selectElement:anElement ifAbsent:exceptionalValue |
|
2589 |
|idx| |
|
2590 |
||
2408 | 2591 |
idx := self identityIndexOf:anElement. |
2178 | 2592 |
idx == 0 ifTrue:[ |
3728 | 2593 |
^ exceptionalValue value |
2178 | 2594 |
]. |
2595 |
self selection:idx |
|
1390 | 2596 |
! |
2597 |
||
4085
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2598 |
selectElementForWhich:aBlock ifAbsent:exceptionalValue |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2599 |
1 to:self size do:[:idx | |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2600 |
(aBlock value:(self at:idx)) ifTrue:[ |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2601 |
self selection:idx. |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2602 |
^ self |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2603 |
]. |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2604 |
]. |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2605 |
^ exceptionalValue value |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2606 |
|
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2607 |
"Created: / 06-10-2011 / 13:32:28 / cg" |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2608 |
! |
532e33c6a5e6
added: #selectElementForWhich:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
4043
diff
changeset
|
2609 |
|
5729 | 2610 |
selectElements:aCollectionOfElement |
2611 |
"select the elements. |
|
2612 |
Scroll to make the new selection visible. |
|
2613 |
Model and/or actionBlock notification IS done. |
|
2614 |
" |
|
2615 |
self selectElements:aCollectionOfElement ifAnyAbsent:[] |
|
2616 |
! |
|
2617 |
||
2618 |
selectElements:aCollectionOfElements ifAnyAbsent:exceptionalValue |
|
2619 |
|indices| |
|
2620 |
||
2621 |
indices := aCollectionOfElements collect:[:each | |
|
2622 |
self identityIndexOf:each. |
|
2623 |
]. |
|
2624 |
(indices includes:0) ifTrue:[ |
|
2625 |
^ exceptionalValue value |
|
2626 |
]. |
|
2627 |
self selection:indices |
|
2628 |
! |
|
2629 |
||
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2630 |
selectFirst |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2631 |
"select the first selectable element. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2632 |
Model and/or actionBlock notification IS done." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2633 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2634 |
self selection:(self nextSelectableAfter:0) |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2635 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2636 |
|
4873 | 2637 |
selectFirstVisibleLine |
2638 |
"select the first visible selectable element. |
|
2639 |
Model and/or actionBlock notification IS done." |
|
2640 |
||
2641 |
|firstLineShown| |
|
2642 |
||
2643 |
firstLineShown := self yVisibleToLineNr:1. |
|
2644 |
self selection:(self nextSelectableAfter:firstLineShown-1) |
|
2645 |
! |
|
2646 |
||
2399 | 2647 |
selectFrom:aStart to:aStop |
2648 |
"select lines between start and stop |
|
2649 |
" |
|
2650 |
|start stop step nsel| |
|
2651 |
||
2652 |
multipleSelectOk ifFalse:[^ self]. |
|
2653 |
||
2654 |
start := aStart. |
|
2655 |
stop := aStop. |
|
2656 |
||
2657 |
aStart < aStop ifTrue:[ |
|
3728 | 2658 |
start := aStart max:1. |
2659 |
stop := aStop min:(self size). |
|
2660 |
step := 1. |
|
2661 |
start > stop ifTrue:[^ self]. |
|
2399 | 2662 |
|
2663 |
] ifFalse:[ |
|
3728 | 2664 |
start := aStart min:(self size). |
2665 |
stop := aStop max:1. |
|
2666 |
step := -1. |
|
2667 |
start < stop ifTrue:[^ self]. |
|
2399 | 2668 |
]. |
2669 |
nsel := OrderedCollection new. |
|
2670 |
||
2671 |
start to:stop by:step do:[:i| |
|
3728 | 2672 |
(self canSelectIndex:i forAdd:true) ifTrue:[ |
2673 |
nsel add:i. |
|
2674 |
]. |
|
2399 | 2675 |
]. |
2676 |
||
2677 |
(self selectWithoutScroll:nsel redraw:true) ifTrue:[ |
|
3728 | 2678 |
self selectionChanged |
2399 | 2679 |
]. |
2680 |
! |
|
2681 |
||
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2682 |
selectLast |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2683 |
"select the last selectable element. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2684 |
Model and/or actionBlock notification IS done." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2685 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2686 |
self selection:(self previousSelectableBefore:list size + 1) |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2687 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2688 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2689 |
selectNext |
5550 | 2690 |
"select next line or first visible if there is currently no selection. |
2691 |
Wrap at end. |
|
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2692 |
Model and/or actionBlock notification IS done." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2693 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2694 |
self selection:(self nextAfterSelection) |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2695 |
|
5550 | 2696 |
"Modified: / 15-11-1996 / 17:01:27 / cg" |
2697 |
"Modified (comment): / 07-06-2017 / 17:20:33 / mawalch" |
|
4574
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2698 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2699 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2700 |
selectPrevious |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2701 |
"select previous line or previous visible if there is currently no selection. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2702 |
Wrap at beginning. |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2703 |
Model and/or actionBlock notification IS done." |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2704 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2705 |
self selection:(self previousBeforeSelection). |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2706 |
|
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2707 |
"Modified: 26.9.1995 / 09:41:16 / stefan" |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2708 |
"Modified: 15.11.1996 / 17:01:34 / cg" |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2709 |
! |
4ccc6b5caf8c
Added selectFirst/Next/Last/Prev to make it polymorph with SelectionInListView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4571
diff
changeset
|
2710 |
|
1390 | 2711 |
selectedElement |
2712 |
"return the single selected item or nil |
|
2713 |
" |
|
1545 | 2714 |
|index| |
1390 | 2715 |
|
1545 | 2716 |
(index := self selectedIndex) ~~ 0 ifTrue:[ |
3728 | 2717 |
^ self at:index ifAbsent:nil |
1545 | 2718 |
]. |
2719 |
^ nil |
|
1390 | 2720 |
! |
2721 |
||
2722 |
selectedIndex |
|
5729 | 2723 |
"returns the index of the selected line or 0. |
2724 |
If multiple lines are selected, 0 is returned |
|
1390 | 2725 |
" |
2365
bdf6954a0358
key handling: EndOfText EndOfLine BeginOfText BeginOfLine
ca
parents:
2361
diff
changeset
|
2726 |
selection notNil ifTrue:[ |
5729 | 2727 |
multipleSelectOk ifFalse:[ ^ selection ]. |
2728 |
||
2729 |
selection size == 1 ifTrue:[ |
|
2730 |
^ selection at:1 |
|
2731 |
] |
|
1545 | 2732 |
]. |
2733 |
^ 0 |
|
1390 | 2734 |
! |
2735 |
||
2736 |
selection |
|
3728 | 2737 |
"return the selection index or collection of indices |
1390 | 2738 |
in case of multiple selection enabled |
2739 |
" |
|
2740 |
^ selection |
|
2741 |
||
2742 |
! |
|
2743 |
||
1545 | 2744 |
selection:something |
2745 |
"select something or deselect if the argument is nil; |
|
5729 | 2746 |
something is either an individual index |
2747 |
or (if multiSelect is enabled) a collection of indices. |
|
1390 | 2748 |
scroll to make the selected line visible. |
3873
ec4ba667fe41
comment/format in: #selection:
Claus Gittinger <cg@exept.de>
parents:
3851
diff
changeset
|
2749 |
The model and/or actionBlock IS notified." |
ec4ba667fe41
comment/format in: #selection:
Claus Gittinger <cg@exept.de>
parents:
3851
diff
changeset
|
2750 |
|
1545 | 2751 |
(self selectWithoutScroll:something redraw:true) ifTrue:[ |
3873
ec4ba667fe41
comment/format in: #selection:
Claus Gittinger <cg@exept.de>
parents:
3851
diff
changeset
|
2752 |
self makeSelectionVisible. |
ec4ba667fe41
comment/format in: #selection:
Claus Gittinger <cg@exept.de>
parents:
3851
diff
changeset
|
2753 |
self selectionChanged |
1545 | 2754 |
]. |
1390 | 2755 |
! |
2756 |
||
2330 | 2757 |
selectionAsCollection |
2758 |
"return the selection as a collection of line numbers. |
|
2759 |
This allows users of this class to enumerate independent of |
|
2760 |
the multipleSelect style. |
|
2761 |
" |
|
2762 |
selection isNil ifTrue:[ ^ #() ]. |
|
2763 |
multipleSelectOk ifTrue:[ ^ selection ]. |
|
2764 |
||
2765 |
^ OrderedCollection with:selection |
|
2766 |
! |
|
2767 |
||
1390 | 2768 |
selectionDo:aBlock |
2769 |
"perform aBlock for each nr in the selection. |
|
2770 |
For single selection, it is called once for the items nr. |
|
2771 |
For multiple selections, it is called for each. |
|
2772 |
" |
|
2773 |
selection notNil ifTrue:[ |
|
3728 | 2774 |
multipleSelectOk ifTrue:[ |
2775 |
selection do:aBlock |
|
2776 |
] ifFalse:[ |
|
2777 |
aBlock value:selection |
|
2778 |
]. |
|
1390 | 2779 |
]. |
2780 |
||
2781 |
||
2782 |
! |
|
2783 |
||
2330 | 2784 |
selectionValue |
2785 |
"return the selection value i.e. the text in the selected line. |
|
2786 |
For multiple selections a collection containing the entries is returned. |
|
2787 |
" |
|
2788 |
multipleSelectOk ifTrue:[ |
|
3728 | 2789 |
selection isNil ifTrue:[^ #()]. |
2790 |
^ selection collect:[:nr| self at:nr ] |
|
2330 | 2791 |
]. |
2792 |
selection isNil ifTrue:[^ nil]. |
|
2408 | 2793 |
^ self at:selection ifAbsent:nil. |
2330 | 2794 |
! |
2795 |
||
2346 | 2796 |
selectionValueAsCollection |
2797 |
"return the selection values as a collection - allows selectionValues to |
|
2798 |
be enumerated independent of the multiSelect settings |
|
2799 |
" |
|
2800 |
|value| |
|
2801 |
||
2802 |
value := self selectionValue. |
|
2803 |
multipleSelectOk ifTrue:[^ value]. |
|
2804 |
||
2805 |
value notNil ifTrue:[^ Array with:value ]. |
|
2806 |
^ #() |
|
2807 |
! |
|
2808 |
||
1542
8607d072c319
accessing selection through to selector
Claus Gittinger <cg@exept.de>
parents:
1537
diff
changeset
|
2809 |
setSelection:something |
1545 | 2810 |
"select something or deselect if the argument is nil; |
1390 | 2811 |
scroll to make the selected line visible. |
2812 |
*** No model and/or actionBlock notification is done here. |
|
2813 |
" |
|
1545 | 2814 |
(self selectWithoutScroll:something redraw:true) ifTrue:[ |
3728 | 2815 |
self makeSelectionVisible |
1390 | 2816 |
] |
2817 |
||
2818 |
! ! |
|
2819 |
||
2820 |
!SelectionInListModelView methodsFor:'selection private'! |
|
2821 |
||
1641 | 2822 |
canSelectIndex:anIndex |
2823 |
"return true, if the object identified by its index is selectable |
|
2824 |
" |
|
1920 | 2825 |
^ self canSelectIndex:anIndex forAdd:false |
2826 |
! |
|
2827 |
||
2828 |
canSelectIndex:anIndex forAdd:isForAdd |
|
2829 |
"return true, if the object identified by its index is selectable |
|
2830 |
" |
|
2831 |
|item isOk| |
|
1649 | 2832 |
|
2833 |
selectConditionBlock notNil ifTrue:[ |
|
3728 | 2834 |
isOk := selectConditionBlock valueWithOptionalArgument:anIndex and:isForAdd. |
2835 |
||
2836 |
isOk ifFalse:[ |
|
2837 |
^ false |
|
2838 |
] |
|
1641 | 2839 |
]. |
2840 |
||
2408 | 2841 |
item := self at:anIndex ifAbsent:nil. |
1752 | 2842 |
item isNil ifTrue:[^ false]. |
2408 | 2843 |
|
1752 | 2844 |
item isHierarchicalItem ifTrue:[ |
3728 | 2845 |
^ item isSelectable |
1649 | 2846 |
]. |
2847 |
^ true |
|
1641 | 2848 |
! |
2849 |
||
1547 | 2850 |
deselectWithoutRedraw |
2851 |
"clear the selection without redraw and scrolling; |
|
2852 |
the model and/or actionBlock is notified |
|
2853 |
" |
|
2854 |
(self selectWithoutScroll:nil redraw:false) ifTrue:[ |
|
3728 | 2855 |
self selectionChanged |
1547 | 2856 |
] |
2857 |
! |
|
2858 |
||
3370
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2859 |
selectAndUpdateModelWithoutChangeNotification: aLineNo |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2860 |
|arg| |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2861 |
|
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2862 |
self selectWithoutScroll:aLineNo redraw:true. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2863 |
modelChangedDuringButtonPress := false. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2864 |
model isNil ifTrue:[ ^ self ]. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2865 |
arg := self argForChangeMessage. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2866 |
self sendChangeMessage:#setValue: with:arg. |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2867 |
! |
5199f62a817d
Add posibility to configure the select behaviour (select on button press
ab
parents:
3367
diff
changeset
|
2868 |
|
1545 | 2869 |
selectWithoutScroll:something redraw:doRedraw |
5729 | 2870 |
"change selection to something; |
2871 |
something is either an individual index |
|
2872 |
or (if multiSelect is enabled) a collection of indices. |
|
2873 |
returns true if selection changed |
|
1390 | 2874 |
" |
4242 | 2875 |
|oldSelect size| |
1390 | 2876 |
|
1554 | 2877 |
selection = something ifTrue:[^ false]. |
2878 |
||
1390 | 2879 |
oldSelect := selection. |
4242 | 2880 |
selection := nil. "/reset selection |
2881 |
size := self size. |
|
2882 |
||
2883 |
( size > 0 and:[ something notNil ] ) ifTrue:[ |
|
2884 |
something isNumber ifTrue:[ |
|
2885 |
(something between:1 and:size) ifTrue:[ |
|
2886 |
selection := multipleSelectOk ifTrue:[Array with:something] |
|
2887 |
ifFalse:[something] |
|
2888 |
] |
|
2889 |
] ifFalse:[ |
|
2890 |
something size > 0 ifTrue:[ |
|
2891 |
selection := OrderedCollection new. |
|
2892 |
something do:[:each| |
|
2893 |
each isNumber ifTrue:[ |
|
2894 |
(each between:1 and:size) ifTrue:[ |
|
2895 |
selection add: each. |
|
2896 |
] |
|
2897 |
] |
|
2898 |
]. |
|
2899 |
selection isEmpty ifTrue:[ |
|
2900 |
selection := nil. |
|
2901 |
] ifFalse:[ |
|
2902 |
multipleSelectOk ifFalse:[ selection := selection first ]. |
|
2903 |
]. |
|
2904 |
]. |
|
2905 |
]. |
|
1545 | 2906 |
]. |
2907 |
selection = oldSelect ifTrue:[^ false]. |
|
3205 | 2908 |
|
2909 |
modelChangedDuringButtonPress notNil ifTrue:[ |
|
4242 | 2910 |
modelChangedDuringButtonPress := true. |
3205 | 2911 |
]. |
2912 |
||
1755 | 2913 |
self closeEditor. |
2377 | 2914 |
self cursorEntersItem:nil. |
1545 | 2915 |
|
3728 | 2916 |
|
1545 | 2917 |
(doRedraw and:[shown]) ifFalse:[ |
4242 | 2918 |
^ true |
1390 | 2919 |
]. |
2920 |
||
2921 |
multipleSelectOk ifFalse:[ |
|
4242 | 2922 |
oldSelect notNil ifTrue:[self invalidateSelectionAt:oldSelect]. |
2923 |
selection notNil ifTrue:[self invalidateSelectionAt:selection]. |
|
1390 | 2924 |
] ifTrue:[ |
4242 | 2925 |
(selection notNil and:[oldSelect notNil]) ifTrue:[ |
2926 |
selection do:[:i|(oldSelect includesIdentical:i) ifFalse:[self invalidateSelectionAt:i]]. |
|
2927 |
oldSelect do:[:i|(selection includesIdentical:i) ifFalse:[self invalidateSelectionAt:i]]. |
|
2928 |
] ifFalse:[ |
|
2929 |
oldSelect isNil ifTrue:[oldSelect := selection]. |
|
2930 |
oldSelect do:[:i|self invalidateSelectionAt:i] |
|
2931 |
] |
|
1390 | 2932 |
]. |
1545 | 2933 |
^ true |
1390 | 2934 |
! ! |
2935 |
||
2936 |
!SelectionInListModelView class methodsFor:'documentation'! |
|
2937 |
||
4515
6ca475e94989
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4512
diff
changeset
|
2938 |
version |
4796 | 2939 |
^ '$Header$' |
4515
6ca475e94989
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4512
diff
changeset
|
2940 |
! |
6ca475e94989
class: SelectionInListModelView
Stefan Vogel <sv@exept.de>
parents:
4512
diff
changeset
|
2941 |
|
3778 | 2942 |
version_CVS |
4796 | 2943 |
^ '$Header$' |
1390 | 2944 |
! ! |
4181
34f4fd818a18
class: SelectionInListModelView
Claus Gittinger <cg@exept.de>
parents:
4085
diff
changeset
|
2945 |