equal
deleted
inserted
replaced
1203 ! |
1203 ! |
1204 |
1204 |
1205 buttonPress:button x:x y:y |
1205 buttonPress:button x:x y:y |
1206 "a button was pressed - handle selection here |
1206 "a button was pressed - handle selection here |
1207 " |
1207 " |
1208 |sensor item menu appl isSelected lineNr startLine clickPoint startDragDistance| |
1208 |sensor item menu appl isSelected lineNr startLine dragDistance| |
1209 |
1209 |
1210 buttonMotionAction := buttonReleaseAction := nil. |
1210 buttonMotionAction := buttonReleaseAction := nil. |
1211 |
1211 |
1212 self pointerEntersItem:nil. |
1212 self pointerEntersItem:nil. |
1213 self cursorEntersItem:nil. |
1213 self cursorEntersItem:nil. |
1267 ]. |
1267 ]. |
1268 |
1268 |
1269 isSelected := self isInSelection:lineNr. |
1269 isSelected := self isInSelection:lineNr. |
1270 |
1270 |
1271 (self canDrag and:[sensor shiftDown not]) ifTrue:[ |
1271 (self canDrag and:[sensor shiftDown not]) ifTrue:[ |
1272 startDragDistance := UserPreferences current motionDistanceToStartDrag. |
1272 dragDistance := UserPreferences current motionDistanceToStartDrag. |
1273 |
1273 |
1274 isSelected ifTrue:[ |
1274 isSelected ifTrue:[ |
1275 buttonMotionAction := [:p| |
1275 buttonMotionAction := [:p| |
1276 ((x@y) dist:p) > startDragDistance ifTrue:[ |
1276 ((x@y) dist:p) > dragDistance ifTrue:[ |
1277 self startDragAt:p. |
1277 self startDragAt:p. |
1278 ] |
1278 ] |
1279 ]. |
1279 ]. |
1280 buttonReleaseAction := [ self buttonPressOrReleaseAtLine:lineNr x:x y:y ]. |
1280 buttonReleaseAction := [ self buttonPressOrReleaseAtLine:lineNr x:x y:y ]. |
1281 ^ self |
1281 ^ self |
1284 |
1284 |
1285 multipleSelectOk ifFalse:[ |
1285 multipleSelectOk ifFalse:[ |
1286 (isSelected or:[self canSelectIndex:lineNr forAdd:false]) ifTrue:[ |
1286 (isSelected or:[self canSelectIndex:lineNr forAdd:false]) ifTrue:[ |
1287 self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
1287 self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
1288 |
1288 |
1289 (startDragDistance notNil and:[self isInSelection:lineNr]) ifTrue:[ |
1289 (dragDistance notNil and:[self isInSelection:lineNr]) ifTrue:[ |
1290 buttonMotionAction := [:p| |
1290 buttonMotionAction := [:p| |
1291 ((x@y) dist:p) > startDragDistance ifTrue:[ |
1291 ((x@y) dist:p) > dragDistance ifTrue:[ |
1292 self startDragAt:p. |
1292 self startDragAt:p. |
1293 ]. |
1293 ]. |
1294 ]. |
1294 ]. |
1295 ]. |
1295 ]. |
1296 ]. |
1296 ]. |
1319 ^ self |
1319 ^ self |
1320 ]. |
1320 ]. |
1321 self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
1321 self buttonPressOrReleaseAtLine:lineNr x:x y:y. |
1322 ]. |
1322 ]. |
1323 |
1323 |
1324 clickPoint := x@y. |
|
1325 |
|
1326 multipleSelectOk ifTrue:[ |
1324 multipleSelectOk ifTrue:[ |
1327 buttonMotionAction := [:p| |ln| |
1325 buttonMotionAction := [:p| |ln| |
1328 (p y between:0 and:height) ifTrue:[ |
1326 (p y between:0 and:height) ifTrue:[ |ln| |
1329 ln := self yVisibleToLineNr:p y. |
1327 ln := self yVisibleToLineNr:p y. |
1330 ln isNil ifTrue:[ln := self size]. |
1328 ln isNil ifTrue:[ln := self size]. |
1331 |
1329 |
1332 (ln ~~ self lastInSelection and:[ln ~~ self firstInSelection]) ifTrue:[ |
1330 (ln ~~ self lastInSelection and:[ln ~~ self firstInSelection]) ifTrue:[ |
1333 self selectFrom:startLine to:ln. |
1331 self selectFrom:startLine to:ln. |
1334 clickPoint := p. |
1332 dragDistance := nil. "/ selection changed - no longer dragable |
1335 ] |
1333 ] |
1336 ]. |
1334 ]. |
1337 |
1335 |
1338 (startDragDistance notNil and:[(clickPoint x dist:p x) > startDragDistance]) ifTrue:[ |
1336 (dragDistance notNil and:[(x dist:p x) > dragDistance]) ifTrue:[ |
1339 self startDragAt:p. |
1337 self startDragAt:p. |
1340 ]. |
1338 ]. |
1341 ]. |
1339 ]. |
1342 ]. |
1340 ]. |
1343 ! |
1341 ! |
2385 ! ! |
2383 ! ! |
2386 |
2384 |
2387 !SelectionInListModelView class methodsFor:'documentation'! |
2385 !SelectionInListModelView class methodsFor:'documentation'! |
2388 |
2386 |
2389 version |
2387 version |
2390 ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.117 2006-11-07 16:21:48 ca Exp $' |
2388 ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.118 2006-11-09 07:41:35 ca Exp $' |
2391 ! ! |
2389 ! ! |