547 bgLeft bgTop bgWidth bgHeight| |
547 bgLeft bgTop bgWidth bgHeight| |
548 |
548 |
549 newOrigin := (aNumber - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
549 newOrigin := (aNumber - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
550 |
550 |
551 ((newOrigin + thumbHeight) > 100) ifTrue:[ |
551 ((newOrigin + thumbHeight) > 100) ifTrue:[ |
552 realNewOrigin := 100 - thumbHeight |
552 realNewOrigin := 100 - thumbHeight |
553 ] ifFalse: [ |
553 ] ifFalse: [ |
554 realNewOrigin := newOrigin |
554 realNewOrigin := newOrigin |
555 ]. |
555 ]. |
556 (realNewOrigin > 100) ifTrue:[ |
556 (realNewOrigin > 100) ifTrue:[ |
557 realNewOrigin := 100 |
557 realNewOrigin := 100 |
558 ] ifFalse: [ |
558 ] ifFalse: [ |
559 (realNewOrigin < 0) ifTrue:[ |
559 (realNewOrigin < 0) ifTrue:[ |
560 realNewOrigin := 0 |
560 realNewOrigin := 0 |
561 ] |
561 ] |
562 ]. |
562 ]. |
563 ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
563 ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
564 thumbOrigin := realNewOrigin. |
564 thumbOrigin := realNewOrigin. |
565 |
565 |
566 shown ifTrue:[ |
566 shown ifTrue:[ |
567 oldFrame := thumbFrame. |
567 oldFrame := thumbFrame. |
568 self computeThumbFrame. |
568 self computeThumbFrame. |
569 (thumbHeight = 100) ifTrue:[ |
569 (thumbHeight = 100) ifTrue:[ |
570 "/ full: don't draw |
570 "/ full: don't draw |
571 ^ self |
571 ^ self |
572 ]. |
572 ]. |
573 |
573 |
574 (thumbFrame ~~ oldFrame) ifTrue:[ |
574 (thumbFrame ~~ oldFrame) ifTrue:[ |
575 oldFrame isNil ifTrue:[ |
575 oldFrame isNil ifTrue:[ |
576 self drawThumb. |
576 self drawThumb. |
577 ^ self |
577 ^ self |
578 ]. |
578 ]. |
579 tH := thumbFrame height. |
579 tH := thumbFrame height. |
580 tW := thumbFrame width. |
580 tW := thumbFrame width. |
581 |
581 |
582 oldTop := oldFrame top. |
582 oldTop := oldFrame top. |
583 oldBot := oldTop + tH. |
583 oldBot := oldTop + tH. |
584 oldLeft := oldFrame left. |
584 oldLeft := oldFrame left. |
585 oldRight := oldLeft + tW. |
585 oldRight := oldLeft + tW. |
586 |
586 |
587 thumbTop := thumbFrame top. |
587 thumbTop := thumbFrame top. |
588 thumbBot := thumbTop + tH. |
588 thumbBot := thumbTop + tH. |
589 thumbLeft := thumbFrame left. |
589 thumbLeft := thumbFrame left. |
590 thumbRight := thumbLeft + tW. |
590 thumbRight := thumbLeft + tW. |
591 |
591 |
592 needFullDraw := self exposeEventPending |
592 needFullDraw := self exposeEventPending |
593 or:[((orientation == #vertical) and:[oldBot >= height]) |
593 or:[((orientation == #vertical) and:[oldBot >= height]) |
594 or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
594 or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
595 |
595 |
596 needFullDraw ifTrue:[ |
596 needFullDraw ifTrue:[ |
597 " |
597 " |
598 cannot copy since thumb was below the end |
598 cannot copy since thumb was below the end |
599 or may be not available for the copy |
599 or may be not available for the copy |
600 " |
600 " |
601 (orientation == #vertical) ifTrue:[ |
601 (orientation == #vertical) ifTrue:[ |
602 self drawThumbBackgroundInX:thumbLeft y:oldTop |
602 self drawThumbBackgroundInX:thumbLeft y:oldTop |
603 width:tW height:(height - oldTop). |
603 width:tW height:(height - oldTop). |
604 ] ifFalse:[ |
604 ] ifFalse:[ |
605 self drawThumbBackgroundInX:oldLeft y:thumbTop |
605 self drawThumbBackgroundInX:oldLeft y:thumbTop |
606 width:(width - oldLeft) height:tH. |
606 width:(width - oldLeft) height:tH. |
607 ]. |
607 ]. |
608 self drawThumb. |
608 self drawThumb. |
609 ^ self |
609 ^ self |
610 ]. |
610 ]. |
611 |
611 |
612 self catchExpose. |
612 self catchExpose. |
613 " |
613 " |
614 copy the thumbs pixels |
614 copy the thumbs pixels |
615 " |
615 " |
616 (orientation == #vertical) ifTrue:[ |
616 (orientation == #vertical) ifTrue:[ |
617 self copyFrom:self x:thumbLeft y:oldTop |
617 self |
618 toX:thumbLeft y:thumbTop |
618 copyFrom:self |
619 width:tW height:tH. |
619 x:thumbLeft y:oldTop |
620 ] ifFalse:[ |
620 toX:thumbLeft y:thumbTop |
621 self copyFrom:self x:oldLeft y:thumbTop |
621 width:tW height:tH |
622 toX:thumbLeft y:thumbTop |
622 async:true. |
623 width:tW height:tH. |
623 ] ifFalse:[ |
624 ]. |
624 self |
625 |
625 copyFrom:self |
626 " |
626 x:oldLeft y:thumbTop |
627 clear some of the previous thumbs area to background |
627 toX:thumbLeft y:thumbTop |
628 " |
628 width:tW height:tH |
629 (orientation == #vertical) ifTrue:[ |
629 async:true. |
630 bgLeft := thumbLeft. |
630 ]. |
631 bgWidth := tW. |
631 |
632 oldTop > thumbTop ifTrue:[ |
632 " |
633 delta := oldTop - thumbTop. |
633 clear some of the previous thumbs area to background |
634 oldTop > thumbBot ifTrue:[ |
634 " |
635 bgTop := oldTop. |
635 (orientation == #vertical) ifTrue:[ |
636 bgHeight := tH + 1 |
636 bgLeft := thumbLeft. |
637 ] ifFalse:[ |
637 bgWidth := tW. |
638 bgTop := thumbBot. |
638 oldTop > thumbTop ifTrue:[ |
639 bgHeight := delta |
639 delta := oldTop - thumbTop. |
640 ] |
640 oldTop > thumbBot ifTrue:[ |
641 ] ifFalse:[ |
641 bgTop := oldTop. |
642 delta := thumbTop - oldTop. |
642 bgHeight := tH + 1 |
643 oldBot < thumbTop ifTrue:[ |
643 ] ifFalse:[ |
644 bgTop := oldTop. |
644 bgTop := thumbBot. |
645 bgHeight := tH + 1 |
645 bgHeight := delta |
646 ] ifFalse:[ |
646 ] |
647 bgTop := oldTop. |
647 ] ifFalse:[ |
648 bgHeight := delta |
648 delta := thumbTop - oldTop. |
649 ] |
649 oldBot < thumbTop ifTrue:[ |
650 ]. |
650 bgTop := oldTop. |
651 ] ifFalse:[ |
651 bgHeight := tH + 1 |
652 bgTop := thumbTop. |
652 ] ifFalse:[ |
653 bgHeight := tH. |
653 bgTop := oldTop. |
654 oldLeft > thumbLeft ifTrue:[ |
654 bgHeight := delta |
655 delta := oldLeft - thumbLeft. |
655 ] |
656 oldLeft > thumbRight ifTrue:[ |
656 ]. |
657 bgLeft := oldLeft. |
657 ] ifFalse:[ |
658 bgWidth := tW + 1. |
658 bgTop := thumbTop. |
659 ] ifFalse:[ |
659 bgHeight := tH. |
660 bgLeft := thumbRight. |
660 oldLeft > thumbLeft ifTrue:[ |
661 bgWidth := delta. |
661 delta := oldLeft - thumbLeft. |
662 ] |
662 oldLeft > thumbRight ifTrue:[ |
663 ] ifFalse:[ |
663 bgLeft := oldLeft. |
664 delta := thumbLeft - oldLeft. |
664 bgWidth := tW + 1. |
665 oldRight < thumbLeft ifTrue:[ |
665 ] ifFalse:[ |
666 bgLeft := oldLeft. |
666 bgLeft := thumbRight. |
667 bgWidth := tW + 1. |
667 bgWidth := delta. |
668 ] ifFalse:[ |
668 ] |
669 bgLeft := oldLeft. |
669 ] ifFalse:[ |
670 bgWidth := delta. |
670 delta := thumbLeft - oldLeft. |
671 ] |
671 oldRight < thumbLeft ifTrue:[ |
672 ]. |
672 bgLeft := oldLeft. |
673 ]. |
673 bgWidth := tW + 1. |
674 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
674 ] ifFalse:[ |
675 self waitForExpose |
675 bgLeft := oldLeft. |
676 ] |
676 bgWidth := delta. |
677 ] ifFalse:[ |
677 ] |
678 thumbFrame := nil |
678 ]. |
679 ] |
679 ]. |
|
680 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
681 self waitForExpose |
|
682 ] |
|
683 ] ifFalse:[ |
|
684 thumbFrame := nil |
|
685 ] |
680 ] |
686 ] |
|
687 |
|
688 "Modified: 29.1.1997 / 13:07:46 / cg" |
681 ! |
689 ! |
682 |
690 |
683 thumbOrigin:originNumber thumbHeight:heightNumber |
691 thumbOrigin:originNumber thumbHeight:heightNumber |
684 "set both thumbs height and origin (in percent by default)" |
692 "set both thumbs height and origin (in percent by default)" |
685 |
693 |