equal
deleted
inserted
replaced
594 percentage:aNumber |
594 percentage:aNumber |
595 "set the percentage" |
595 "set the percentage" |
596 |
596 |
597 |newPercentage| |
597 |newPercentage| |
598 |
598 |
599 newPercentage := ((aNumber max:0) min:100) rounded. |
599 aNumber < 0 ifTrue:[ |
|
600 newPercentage := -1. |
|
601 ] ifFalse:[ |
|
602 newPercentage := ((aNumber max:0) min:100) rounded. |
|
603 ]. |
600 newPercentage ~= percentage ifTrue:[ |
604 newPercentage ~= percentage ifTrue:[ |
601 percentage := newPercentage. |
605 percentage := newPercentage. |
602 shown ifTrue:[self invalidateRepairNow:true]. |
606 shown ifTrue:[self invalidateRepairNow:true]. |
603 ] |
607 ] |
604 |
608 |
732 !ProgressIndicator methodsFor:'drawing'! |
736 !ProgressIndicator methodsFor:'drawing'! |
733 |
737 |
734 redraw |
738 redraw |
735 "redraw the percentage bar and optional percentage string" |
739 "redraw the percentage bar and optional percentage string" |
736 |
740 |
737 |s lx rx sx sy sw m2 m w h| |
741 |s lx rx sx sy sw m2 m w h doBusy| |
738 |
742 |
739 m := margin + 1. |
743 m := margin + 1. |
740 m2 := m*2. |
744 m2 := m*2. |
741 |
745 |
742 w := width - m2. |
746 w := width - m2. |
743 h := height - m2. |
747 h := height - m2. |
744 |
748 |
745 "/ self clear. |
749 "/ self clear. |
746 |
750 |
747 showBusy value ifTrue:[ |
751 doBusy := showBusy value. |
|
752 doBusy ifFalse:[ |
|
753 percentage value < 0 ifTrue:[ |
|
754 self startBusyIndicationProcess. |
|
755 doBusy := true. |
|
756 ]. |
|
757 ]. |
|
758 |
|
759 doBusy ifTrue:[ |
748 self paint:bgColor. |
760 self paint:bgColor. |
749 self fillRectangleX:m y:m width:w height:h. |
761 self fillRectangleX:m y:m width:w height:h. |
750 |
762 |
751 lx := (w * busyPosition / 100) rounded. |
763 lx := (w * busyPosition / 100) rounded. |
752 rx := (w * (busyPosition + 20) / 100) rounded. |
764 rx := (w * (busyPosition + 20) / 100) rounded. |
754 lx := lx max:m. |
766 lx := lx max:m. |
755 self paint:fgColor. |
767 self paint:fgColor. |
756 self fillRectangleX:lx y:m width:(rx - lx) height:h. |
768 self fillRectangleX:lx y:m width:(rx - lx) height:h. |
757 ^ self |
769 ^ self |
758 ]. |
770 ]. |
|
771 |
|
772 self stopBusyIndicationProcess. |
759 |
773 |
760 rx := (w * percentage / 100) rounded. |
774 rx := (w * percentage / 100) rounded. |
761 self paint:bgColor. |
775 self paint:bgColor. |
762 self fillRectangleX:m+rx y:m width:w-rx height:h. |
776 self fillRectangleX:m+rx y:m width:w-rx height:h. |
763 |
777 |
1013 ! ! |
1027 ! ! |
1014 |
1028 |
1015 !ProgressIndicator class methodsFor:'documentation'! |
1029 !ProgressIndicator class methodsFor:'documentation'! |
1016 |
1030 |
1017 version |
1031 version |
1018 ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.36 2001-02-14 10:20:12 frank Exp $' |
1032 ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.37 2001-10-26 13:51:30 cg Exp $' |
1019 ! ! |
1033 ! ! |