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