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