2349 (self lineIsFullyVisible:aLnNr) ifTrue:[^ self]. |
2349 (self lineIsFullyVisible:aLnNr) ifTrue:[^ self]. |
2350 ]. |
2350 ]. |
2351 self makeLineVisible:(self firstInSelection). |
2351 self makeLineVisible:(self firstInSelection). |
2352 ! |
2352 ! |
2353 |
2353 |
|
2354 nextAfterSelection |
|
2355 "return the index of the next selectable entry after the selection. |
|
2356 Wrap at end." |
|
2357 |
|
2358 ^ self nextSelectableAfter:selection |
|
2359 ! |
|
2360 |
|
2361 nextSelectableAfter:indexOrIndexCollection |
|
2362 "return the index of the next selectable entry after the indexOrIndexCollection. |
|
2363 Wrap at end." |
|
2364 |
|
2365 |next sz| |
|
2366 |
|
2367 indexOrIndexCollection isNil ifTrue:[ |
|
2368 next := 1 |
|
2369 ] ifFalse:[ |
|
2370 indexOrIndexCollection isCollection ifTrue:[ |
|
2371 indexOrIndexCollection size == 0 ifTrue:[ |
|
2372 next := 1 |
|
2373 ] ifFalse:[ |
|
2374 next := indexOrIndexCollection max + 1 |
|
2375 ] |
|
2376 ] ifFalse:[ |
|
2377 next := indexOrIndexCollection + 1 |
|
2378 ]. |
|
2379 ]. |
|
2380 |
|
2381 (self canSelectIndex:next) ifFalse:[ |
|
2382 sz := self size. |
|
2383 next > sz ifTrue:[ |
|
2384 next := 1. |
|
2385 ] ifFalse:[ |
|
2386 [next <= sz |
|
2387 and:[(self canSelectIndex:next) not ]] whileTrue:[ |
|
2388 next := next + 1 |
|
2389 ]. |
|
2390 ]. |
|
2391 ]. |
|
2392 |
|
2393 (self canSelectIndex:next) ifFalse:[ |
|
2394 next := nil |
|
2395 ]. |
|
2396 ^ next |
|
2397 |
|
2398 "Modified: / 08-08-1998 / 03:36:55 / cg" |
|
2399 "Modified: / 22-04-2014 / 12:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2400 ! |
|
2401 |
2354 numberOfSelections |
2402 numberOfSelections |
2355 "return the number of selected items |
2403 "return the number of selected items |
2356 " |
2404 " |
2357 selection isNil ifTrue:[ ^ 0 ]. |
2405 selection isNil ifTrue:[ ^ 0 ]. |
2358 multipleSelectOk ifFalse:[ ^ 1 ]. |
2406 multipleSelectOk ifFalse:[ ^ 1 ]. |
2359 ^ selection size |
2407 ^ selection size |
|
2408 ! |
|
2409 |
|
2410 previousBeforeSelection |
|
2411 "return the index of the previous selectable entry before the selection. |
|
2412 Wrap at beginning." |
|
2413 |
|
2414 ^ self previousSelectableBefore:selection |
|
2415 |
|
2416 ! |
|
2417 |
|
2418 previousSelectableBefore:indexOrIndexCollection |
|
2419 "return the index of the previous selectable entry before the indexOrIndexCollection. |
|
2420 Wrap at beginning." |
|
2421 |
|
2422 |prev| |
|
2423 |
|
2424 indexOrIndexCollection isNil ifTrue:[ |
|
2425 prev := list size |
|
2426 ] ifFalse:[ |
|
2427 indexOrIndexCollection isCollection ifTrue:[ |
|
2428 indexOrIndexCollection size == 0 ifTrue:[ |
|
2429 prev := list size |
|
2430 ] ifFalse:[ |
|
2431 prev := indexOrIndexCollection min - 1 |
|
2432 ] |
|
2433 ] ifFalse:[ |
|
2434 prev := indexOrIndexCollection - 1 |
|
2435 ]. |
|
2436 ]. |
|
2437 (self canSelectIndex:prev) ifFalse:[ |
|
2438 prev < 1 ifTrue:[ |
|
2439 prev := self size. |
|
2440 ] ifFalse:[ |
|
2441 [prev >= 1 |
|
2442 and:[(self canSelectIndex:prev) not]] whileTrue:[ |
|
2443 prev := prev - 1 |
|
2444 ]. |
|
2445 ]. |
|
2446 ]. |
|
2447 (self canSelectIndex:prev) ifFalse:[ |
|
2448 prev := nil |
|
2449 ]. |
|
2450 ^ prev |
|
2451 |
|
2452 "Modified: / 22-04-2014 / 12:16:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2360 ! |
2453 ! |
2361 |
2454 |
2362 removeFromSelection:lineNr |
2455 removeFromSelection:lineNr |
2363 "remove line from selection without scrolling but raise a change notification |
2456 "remove line from selection without scrolling but raise a change notification |
2364 " |
2457 " |
2411 ^ exceptionalValue value |
2504 ^ exceptionalValue value |
2412 |
2505 |
2413 "Created: / 06-10-2011 / 13:32:28 / cg" |
2506 "Created: / 06-10-2011 / 13:32:28 / cg" |
2414 ! |
2507 ! |
2415 |
2508 |
|
2509 selectFirst |
|
2510 "select the first selectable element. |
|
2511 Model and/or actionBlock notification IS done." |
|
2512 |
|
2513 self selection:(self nextSelectableAfter:0) |
|
2514 ! |
|
2515 |
2416 selectFrom:aStart to:aStop |
2516 selectFrom:aStart to:aStop |
2417 "select lines between start and stop |
2517 "select lines between start and stop |
2418 " |
2518 " |
2419 |start stop step nsel| |
2519 |start stop step nsel| |
2420 |
2520 |
2444 ]. |
2544 ]. |
2445 |
2545 |
2446 (self selectWithoutScroll:nsel redraw:true) ifTrue:[ |
2546 (self selectWithoutScroll:nsel redraw:true) ifTrue:[ |
2447 self selectionChanged |
2547 self selectionChanged |
2448 ]. |
2548 ]. |
|
2549 ! |
|
2550 |
|
2551 selectLast |
|
2552 "select the last selectable element. |
|
2553 Model and/or actionBlock notification IS done." |
|
2554 |
|
2555 self selection:(self previousSelectableBefore:list size + 1) |
|
2556 ! |
|
2557 |
|
2558 selectNext |
|
2559 "select next line or first visible if there is currrently no selection. |
|
2560 Wrap at end. |
|
2561 Model and/or actionBlock notification IS done." |
|
2562 |
|
2563 self selection:(self nextAfterSelection) |
|
2564 |
|
2565 "Modified: 15.11.1996 / 17:01:27 / cg" |
|
2566 ! |
|
2567 |
|
2568 selectPrevious |
|
2569 "select previous line or previous visible if there is currently no selection. |
|
2570 Wrap at beginning. |
|
2571 Model and/or actionBlock notification IS done." |
|
2572 |
|
2573 self selection:(self previousBeforeSelection). |
|
2574 |
|
2575 "Modified: 26.9.1995 / 09:41:16 / stefan" |
|
2576 "Modified: 15.11.1996 / 17:01:34 / cg" |
2449 ! |
2577 ! |
2450 |
2578 |
2451 selectedElement |
2579 selectedElement |
2452 "return the single selected item or nil |
2580 "return the single selected item or nil |
2453 " |
2581 " |