663 self contentsChanged. |
663 self contentsChanged. |
664 " |
664 " |
665 dont use scroll here to avoid the redraw |
665 dont use scroll here to avoid the redraw |
666 " |
666 " |
667 oldFirst ~~ firstLineShown ifTrue:[ |
667 oldFirst ~~ firstLineShown ifTrue:[ |
668 self originChanged:(oldFirst - 1) negated. |
668 self originChanged:0 @ ((oldFirst - 1) * fontHeight negated). |
669 ]. |
669 ]. |
670 shown ifTrue:[ |
670 shown ifTrue:[ |
671 self redrawFromVisibleLine:1 to:nLinesShown |
671 self redrawFromVisibleLine:1 to:nLinesShown |
672 ] |
672 ] |
673 ] |
673 ] |
787 "/ new - reposition vertically if too big |
787 "/ new - reposition vertically if too big |
788 (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
788 (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
789 oldFirst := firstLineShown. |
789 oldFirst := firstLineShown. |
790 firstLineShown := self size - nFullLinesShown + 1. |
790 firstLineShown := self size - nFullLinesShown + 1. |
791 firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
791 firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
792 self originChanged:(oldFirst - 1) negated. |
792 self originChanged:0 @ ((oldFirst - 1) negated * fontHeight). |
793 shown ifTrue:[ |
793 shown ifTrue:[ |
794 self clear. |
794 self clear. |
795 ] |
795 ] |
796 ]. |
796 ]. |
797 "/ end new |
797 "/ end new |
2358 |
2358 |
2359 |nLines| |
2359 |nLines| |
2360 |
2360 |
2361 nLines := nFullLinesShown. |
2361 nLines := nFullLinesShown. |
2362 (firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[ |
2362 (firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[ |
2363 nLines := self size - firstLineShown - nFullLinesShown + 1 |
2363 nLines := self size - firstLineShown - nFullLinesShown + 1 |
2364 ]. |
2364 ]. |
2365 nLines <= 0 ifTrue:[^ self]. |
2365 nLines <= 0 ifTrue:[^ self]. |
2366 |
2366 |
2367 self originWillChange. |
2367 self originWillChange. |
2368 firstLineShown := firstLineShown + nLines. |
2368 firstLineShown := firstLineShown + nLines. |
2369 self originChanged:nLines. |
2369 self originChanged:0 @ (nLines * fontHeight). |
2370 self redrawFromVisibleLine:1 to:nLinesShown |
2370 self redrawFromVisibleLine:1 to:nLinesShown |
2371 |
2371 |
2372 ! |
2372 ! |
2373 |
2373 |
2374 pageUp |
2374 pageUp |
2375 "change origin to display previous page" |
2375 "change origin to display previous page" |
2376 |
2376 |
2377 |oldOrg| |
2377 |oldOrg| |
2378 |
2378 |
2379 (firstLineShown == 1) ifFalse:[ |
2379 (firstLineShown == 1) ifFalse:[ |
2380 self originWillChange. |
2380 self originWillChange. |
2381 oldOrg := firstLineShown. |
2381 oldOrg := firstLineShown. |
2382 firstLineShown := firstLineShown - nFullLinesShown. |
2382 firstLineShown := firstLineShown - nFullLinesShown. |
2383 (firstLineShown < 1) ifTrue:[ |
2383 (firstLineShown < 1) ifTrue:[ |
2384 firstLineShown := 1 |
2384 firstLineShown := 1 |
2385 ]. |
2385 ]. |
2386 self originChanged:(firstLineShown - oldOrg). |
2386 self originChanged:0 @ (firstLineShown - oldOrg * fontHeight). |
2387 self redrawFromVisibleLine:1 to:nLinesShown |
2387 self redrawFromVisibleLine:1 to:nLinesShown |
2388 ] |
2388 ] |
2389 ! |
2389 ! |
2390 |
2390 |
2391 scrollDown |
2391 scrollDown |
2392 "change origin to scroll down one line (towards the bottom of the text)" |
2392 "change origin to scroll down one line (towards the bottom of the text)" |
2489 ! |
2489 ! |
2490 |
2490 |
2491 scrollLeft:nPixel |
2491 scrollLeft:nPixel |
2492 "change origin to scroll left some cols" |
2492 "change origin to scroll left some cols" |
2493 |
2493 |
2494 |newLeftOffset| |
2494 |newLeftOffset delta| |
2495 |
2495 |
2496 nPixel <= 0 ifTrue:[^ self]. |
2496 nPixel <= 0 ifTrue:[^ self]. |
2497 |
2497 |
2498 newLeftOffset := leftOffset - nPixel. |
2498 newLeftOffset := leftOffset - nPixel. |
2499 newLeftOffset <= 0 ifTrue:[ |
2499 newLeftOffset <= 0 ifTrue:[ |
2500 leftOffset == 0 ifTrue:[^ self]. |
2500 leftOffset == 0 ifTrue:[^ self]. |
2501 newLeftOffset := 0 |
2501 newLeftOffset := 0 |
2502 ]. |
2502 ]. |
2503 |
2503 |
2504 self originWillChange. |
2504 self originWillChange. |
|
2505 delta := newLeftOffset - leftOffset. |
2505 leftOffset := newLeftOffset. |
2506 leftOffset := newLeftOffset. |
2506 viewOrigin := newLeftOffset @ viewOrigin y. |
2507 viewOrigin := newLeftOffset @ viewOrigin y. |
2507 self redrawFromVisibleLine:1 to:nLinesShown. |
2508 self redrawFromVisibleLine:1 to:nLinesShown. |
2508 self originChanged:(0 @ nPixel) |
2509 self originChanged:(delta @ 0) |
2509 ! |
2510 ! |
2510 |
2511 |
2511 scrollRight |
2512 scrollRight |
2512 "scroll right by one character |
2513 "scroll right by one character |
2513 - question is how much is a good for variable fonts" |
2514 - question is how much is a good for variable fonts" |
2531 " |
2532 " |
2532 the 10 below allows scrolling somewhat behind the end of the line |
2533 the 10 below allows scrolling somewhat behind the end of the line |
2533 " |
2534 " |
2534 wMax := self widthOfContents + 10. |
2535 wMax := self widthOfContents + 10. |
2535 (leftOffset + nPixel + width > wMax) ifTrue:[ |
2536 (leftOffset + nPixel + width > wMax) ifTrue:[ |
2536 cnt := wMax - leftOffset - width |
2537 cnt := wMax - leftOffset - width |
2537 ]. |
2538 ]. |
2538 " " |
2539 " " |
2539 cnt <= 0 ifTrue:[^ self]. |
2540 cnt <= 0 ifTrue:[^ self]. |
2540 self originWillChange. |
2541 self originWillChange. |
2541 leftOffset := leftOffset + cnt. |
2542 leftOffset := leftOffset + cnt. |
2659 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
2660 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
2660 self redrawFromVisibleLine:1 to:count. |
2661 self redrawFromVisibleLine:1 to:count. |
2661 self waitForExpose. |
2662 self waitForExpose. |
2662 ]. |
2663 ]. |
2663 ]. |
2664 ]. |
2664 self originChanged:(count negated). |
2665 self originChanged:(0 @ (nPixel negated)). |
2665 |
2666 |
2666 "Modified: 24.2.1996 / 16:17:17 / cg" |
2667 "Modified: 24.2.1996 / 16:17:17 / cg" |
2667 ! |
2668 ! |
2668 |
2669 |
2669 scrollVerticalToPercent:percent |
2670 scrollVerticalToPercent:percent |