2566 |
2577 |
2567 |nLines| |
2578 |nLines| |
2568 |
2579 |
2569 nLines := nFullLinesShown. |
2580 nLines := nFullLinesShown. |
2570 (firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[ |
2581 (firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[ |
2571 nLines := self size - firstLineShown - nFullLinesShown + 1 |
2582 nLines := self size - firstLineShown - nFullLinesShown + 1 |
2572 ]. |
2583 ]. |
2573 nLines <= 0 ifTrue:[^ self]. |
2584 nLines <= 0 ifTrue:[^ self]. |
2574 |
2585 |
2575 self originWillChange. |
2586 self originWillChange. |
2576 firstLineShown := firstLineShown + nLines. |
2587 firstLineShown := firstLineShown + nLines. |
2577 self originChanged:0 @ (nLines * fontHeight). |
2588 self originChanged:0 @ (nLines * fontHeight). |
2578 self redrawFromVisibleLine:1 to:nLinesShown |
2589 "/ self redrawFromVisibleLine:1 to:nLinesShown |
2579 |
2590 self invalidate |
|
2591 |
|
2592 "Modified: 17.4.1997 / 01:46:34 / cg" |
2580 ! |
2593 ! |
2581 |
2594 |
2582 pageUp |
2595 pageUp |
2583 "change origin to display previous page" |
2596 "change origin to display previous page" |
2584 |
2597 |
2585 |oldOrg| |
2598 |oldOrg| |
2586 |
2599 |
2587 (firstLineShown == 1) ifFalse:[ |
2600 (firstLineShown == 1) ifFalse:[ |
2588 self originWillChange. |
2601 self originWillChange. |
2589 oldOrg := firstLineShown. |
2602 oldOrg := firstLineShown. |
2590 firstLineShown := firstLineShown - nFullLinesShown. |
2603 firstLineShown := firstLineShown - nFullLinesShown. |
2591 (firstLineShown < 1) ifTrue:[ |
2604 (firstLineShown < 1) ifTrue:[ |
2592 firstLineShown := 1 |
2605 firstLineShown := 1 |
2593 ]. |
2606 ]. |
2594 self originChanged:0 @ (firstLineShown - oldOrg * fontHeight). |
2607 self originChanged:0 @ (firstLineShown - oldOrg * fontHeight). |
2595 self redrawFromVisibleLine:1 to:nLinesShown |
2608 "/ self redrawFromVisibleLine:1 to:nLinesShown |
2596 ] |
2609 self invalidate |
|
2610 ] |
|
2611 |
|
2612 "Modified: 17.4.1997 / 01:46:57 / cg" |
2597 ! |
2613 ! |
2598 |
2614 |
2599 scrollDown |
2615 scrollDown |
2600 "change origin to scroll down one line (towards the bottom of the text)" |
2616 "change origin to scroll down one line (towards the bottom of the text)" |
2601 |
2617 |
2614 count "{ Class:SmallInteger }" |
2630 count "{ Class:SmallInteger }" |
2615 y0 "{ Class:SmallInteger }" |
2631 y0 "{ Class:SmallInteger }" |
2616 y1 "{ Class:SmallInteger }" |
2632 y1 "{ Class:SmallInteger }" |
2617 nPixel sz sH partialCopy| |
2633 nPixel sz sH partialCopy| |
2618 |
2634 |
|
2635 count := nLines. |
|
2636 sz := self size. |
|
2637 (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[ |
|
2638 count := sz - firstLineShown - nFullLinesShown + 1 |
|
2639 ]. |
|
2640 count <= 0 ifTrue:[^ self]. |
|
2641 |
|
2642 self originWillChange. |
|
2643 nPixel := fontHeight * count. |
|
2644 |
|
2645 shown ifFalse:[ |
|
2646 firstLineShown := firstLineShown + count. |
|
2647 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2648 ] ifTrue:[ |
|
2649 (count >= nLinesShown) ifTrue:[ |
|
2650 firstLineShown := firstLineShown + count. |
|
2651 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2652 "/ self redrawFromVisibleLine:1 to:nLinesShown. |
|
2653 self invalidate |
|
2654 ] ifFalse:[ |
|
2655 m2 := margin * 2. |
|
2656 w := self widthForScrollBetween:firstLineShown |
|
2657 and:(firstLineShown + nLinesShown). |
|
2658 w := w + leftMargin. |
|
2659 |
|
2660 sH := lineSpacing // 2. |
|
2661 y0 := textStartTop - sH. |
|
2662 h := nPixel + y0. |
|
2663 n := height - h + (lineSpacing " //2 "). |
|
2664 |
|
2665 y1 := h + n - 1. |
|
2666 y1 >= (height - margin) ifTrue:[ |
|
2667 partialCopy := true. |
|
2668 y1 := height - margin - 1 |
|
2669 ]. |
|
2670 |
|
2671 self catchExpose. |
|
2672 self |
|
2673 copyFrom:self x:margin y:h |
|
2674 toX:margin y:y0 |
|
2675 width:w height:(y1 - h + 1) |
|
2676 async:true. |
|
2677 |
|
2678 firstLineShown := firstLineShown + count. |
|
2679 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2680 |
|
2681 (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[ |
|
2682 self paint:bgColor. |
|
2683 self fillRectangleX:margin y:(y0 + (y1 - h + 1)) |
|
2684 width:w height:sH. |
|
2685 ]. |
|
2686 self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown. |
|
2687 self waitForExpose. |
|
2688 ]. |
|
2689 ]. |
|
2690 self originChanged:(0 @ nPixel). |
|
2691 |
|
2692 "Modified: 17.4.1997 / 01:47:46 / cg" |
|
2693 ! |
|
2694 |
|
2695 scrollDownPixels:pix |
|
2696 "change origin to scroll down some pixels |
|
2697 (towards the bottom of the text) |
|
2698 THIS WILL VANISH!!" |
|
2699 |
|
2700 |w "{ Class:SmallInteger }" |
|
2701 h "{ Class:SmallInteger }" |
|
2702 n "{ Class:SmallInteger }" |
|
2703 m2 "{ Class:SmallInteger }" |
|
2704 count "{ Class:SmallInteger }" |
|
2705 y0 "{ Class:SmallInteger }" |
|
2706 y1 "{ Class:SmallInteger }" |
|
2707 nLines nPixel sz sH partialCopy| |
|
2708 |
|
2709 nLines := pix / fontHeight. |
2619 count := nLines. |
2710 count := nLines. |
2620 sz := self size. |
2711 sz := self size. |
2621 (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[ |
2712 (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[ |
2622 count := sz - firstLineShown - nFullLinesShown + 1 |
2713 count := sz - firstLineShown - nFullLinesShown + 1 |
2623 ]. |
2714 ]. |
2670 self waitForExpose. |
2762 self waitForExpose. |
2671 ]. |
2763 ]. |
2672 ]. |
2764 ]. |
2673 self originChanged:(0 @ nPixel). |
2765 self originChanged:(0 @ nPixel). |
2674 |
2766 |
2675 "Modified: 29.1.1997 / 13:30:23 / cg" |
|
2676 ! |
|
2677 |
|
2678 scrollDownPixels:pix |
|
2679 "change origin to scroll down some pixels |
|
2680 (towards the bottom of the text) |
|
2681 THIS WILL VANISH!!" |
|
2682 |
|
2683 |w "{ Class:SmallInteger }" |
|
2684 h "{ Class:SmallInteger }" |
|
2685 n "{ Class:SmallInteger }" |
|
2686 m2 "{ Class:SmallInteger }" |
|
2687 count "{ Class:SmallInteger }" |
|
2688 y0 "{ Class:SmallInteger }" |
|
2689 y1 "{ Class:SmallInteger }" |
|
2690 nLines nPixel sz sH partialCopy| |
|
2691 |
|
2692 nLines := pix / fontHeight. |
|
2693 count := nLines. |
|
2694 sz := self size. |
|
2695 (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[ |
|
2696 count := sz - firstLineShown - nFullLinesShown + 1 |
|
2697 ]. |
|
2698 count <= 0 ifTrue:[^ self]. |
|
2699 |
|
2700 self originWillChange. |
|
2701 nPixel := fontHeight * count. |
|
2702 |
|
2703 shown ifFalse:[ |
|
2704 firstLineShown := firstLineShown + count. |
|
2705 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2706 ] ifTrue:[ |
|
2707 (count >= nLinesShown) ifTrue:[ |
|
2708 firstLineShown := firstLineShown + count. |
|
2709 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2710 self redrawFromVisibleLine:1 to:nLinesShown. |
|
2711 ] ifFalse:[ |
|
2712 m2 := margin * 2. |
|
2713 w := self widthForScrollBetween:firstLineShown |
|
2714 and:(firstLineShown + nLinesShown). |
|
2715 w := w + leftMargin. |
|
2716 |
|
2717 sH := lineSpacing // 2. |
|
2718 y0 := textStartTop - sH. |
|
2719 h := nPixel + y0. |
|
2720 n := height - h + (lineSpacing " //2 "). |
|
2721 |
|
2722 y1 := h + n - 1. |
|
2723 y1 >= (height - margin) ifTrue:[ |
|
2724 partialCopy := true. |
|
2725 y1 := height - margin - 1 |
|
2726 ]. |
|
2727 |
|
2728 self catchExpose. |
|
2729 self |
|
2730 copyFrom:self |
|
2731 x:margin y:h |
|
2732 toX:margin y:y0 |
|
2733 width:w height:(y1 - h + 1) |
|
2734 async:true. |
|
2735 |
|
2736 firstLineShown := firstLineShown + count. |
|
2737 viewOrigin := viewOrigin x @ (viewOrigin y + nPixel). |
|
2738 |
|
2739 (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[ |
|
2740 self paint:bgColor. |
|
2741 self fillRectangleX:margin y:(y0 + (y1 - h + 1)) |
|
2742 width:w height:sH. |
|
2743 ]. |
|
2744 self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown. |
|
2745 self waitForExpose. |
|
2746 ]. |
|
2747 ]. |
|
2748 self originChanged:(0 @ nPixel). |
|
2749 |
|
2750 "Modified: 29.1.1997 / 13:06:15 / cg" |
2767 "Modified: 29.1.1997 / 13:06:15 / cg" |
2751 ! |
2768 ! |
2752 |
2769 |
2753 scrollHorizontalTo:aPixelOffset |
2770 scrollHorizontalTo:aPixelOffset |
2754 "change origin to make aPixelOffset be the left col" |
2771 "change origin to make aPixelOffset be the left col" |
2780 |
2797 |
2781 nPixel <= 0 ifTrue:[^ self]. |
2798 nPixel <= 0 ifTrue:[^ self]. |
2782 |
2799 |
2783 newLeftOffset := leftOffset - nPixel. |
2800 newLeftOffset := leftOffset - nPixel. |
2784 newLeftOffset <= 0 ifTrue:[ |
2801 newLeftOffset <= 0 ifTrue:[ |
2785 leftOffset == 0 ifTrue:[^ self]. |
2802 leftOffset == 0 ifTrue:[^ self]. |
2786 newLeftOffset := 0 |
2803 newLeftOffset := 0 |
2787 ]. |
2804 ]. |
2788 |
2805 |
2789 self originWillChange. |
2806 self originWillChange. |
2790 delta := newLeftOffset - leftOffset. |
2807 delta := newLeftOffset - leftOffset. |
2791 leftOffset := newLeftOffset. |
2808 leftOffset := newLeftOffset. |
2792 viewOrigin := newLeftOffset @ viewOrigin y. |
2809 viewOrigin := newLeftOffset @ viewOrigin y. |
2793 self redrawFromVisibleLine:1 to:nLinesShown. |
2810 "/ self redrawFromVisibleLine:1 to:nLinesShown. |
|
2811 self invalidate. |
2794 self originChanged:(delta @ 0) |
2812 self originChanged:(delta @ 0) |
|
2813 |
|
2814 "Modified: 17.4.1997 / 01:48:34 / cg" |
2795 ! |
2815 ! |
2796 |
2816 |
2797 scrollRight |
2817 scrollRight |
2798 "scroll right by one character |
2818 "scroll right by one character |
2799 - question is how much is a good for variable fonts" |
2819 - question is how much is a good for variable fonts" |
2817 " |
2837 " |
2818 the 10 below allows scrolling somewhat behind the end of the line |
2838 the 10 below allows scrolling somewhat behind the end of the line |
2819 " |
2839 " |
2820 wMax := self widthOfContents + 10. |
2840 wMax := self widthOfContents + 10. |
2821 (leftOffset + nPixel + width > wMax) ifTrue:[ |
2841 (leftOffset + nPixel + width > wMax) ifTrue:[ |
2822 cnt := wMax - leftOffset - width |
2842 cnt := wMax - leftOffset - width |
2823 ]. |
2843 ]. |
2824 " " |
2844 " " |
2825 cnt <= 0 ifTrue:[^ self]. |
2845 cnt <= 0 ifTrue:[^ self]. |
2826 self originWillChange. |
2846 self originWillChange. |
2827 leftOffset := leftOffset + cnt. |
2847 leftOffset := leftOffset + cnt. |
2828 viewOrigin := leftOffset @ viewOrigin y. |
2848 viewOrigin := leftOffset @ viewOrigin y. |
2829 self redrawFromVisibleLine:1 to:nLinesShown. |
2849 "/ self redrawFromVisibleLine:1 to:nLinesShown. |
|
2850 self invalidate. |
2830 self originChanged:(cnt @ 0) |
2851 self originChanged:(cnt @ 0) |
|
2852 |
|
2853 "Modified: 17.4.1997 / 01:48:27 / cg" |
2831 ! |
2854 ! |
2832 |
2855 |
2833 scrollSelectDown |
2856 scrollSelectDown |
2834 "just a template - I do not know anything about selections" |
2857 "just a template - I do not know anything about selections" |
2835 |
2858 |
2987 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
3010 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
2988 ] ifTrue:[ |
3011 ] ifTrue:[ |
2989 (count >= nLinesShown) ifTrue:[ |
3012 (count >= nLinesShown) ifTrue:[ |
2990 firstLineShown := firstLineShown - count. |
3013 firstLineShown := firstLineShown - count. |
2991 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
3014 viewOrigin := viewOrigin x @ (viewOrigin y - nPixel). |
2992 self redrawFromVisibleLine:1 to:nLinesShown. |
3015 "/ self redrawFromVisibleLine:1 to:nLinesShown. |
|
3016 self invalidate. |
2993 ] ifFalse:[ |
3017 ] ifFalse:[ |
2994 w := self widthForScrollBetween:firstLineShown |
3018 w := self widthForScrollBetween:firstLineShown |
2995 and:(firstLineShown + nLinesShown). |
3019 and:(firstLineShown + nLinesShown). |
2996 w := w + leftMargin. |
3020 w := w + leftMargin. |
2997 h := nPixel + margin. |
3021 h := nPixel + margin. |