14 instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown nLinesShown |
14 instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown nLinesShown |
15 fgColor bgColor partialLines leftMargin topMargin textStartLeft |
15 fgColor bgColor partialLines leftMargin topMargin textStartLeft |
16 textStartTop innerWidth tabPositions lineSpacing fontHeight |
16 textStartTop innerWidth tabPositions lineSpacing fontHeight |
17 fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock |
17 fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock |
18 autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine |
18 autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine |
19 listMsg viewOrigin listChannel backgroundAlreadyClearedColor' |
19 listMsg viewOrigin listChannel backgroundAlreadyClearedColor |
|
20 scrollWhenUpdating' |
20 classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions |
21 classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions |
21 DefaultLeftMargin DefaultTopMargin' |
22 DefaultLeftMargin DefaultTopMargin' |
22 poolDictionaries:'' |
23 poolDictionaries:'' |
23 category:'Views-Text' |
24 category:'Views-Text' |
24 ! |
25 ! |
93 |
94 |
94 |
95 |
95 [Instance variables:] |
96 [Instance variables:] |
96 |
97 |
97 list <aCollection> the text strings, a collection of lines. |
98 list <aCollection> the text strings, a collection of lines. |
98 Nils may be used for empty lines. |
99 Nils may be used for empty lines. |
99 |
100 |
100 firstLineShown <Number> the index of the 1st visible line (1 ..) |
101 firstLineShown <Number> the index of the 1st visible line (1 ..) |
101 leftOffset <Number> left offset for horizontal scroll |
102 leftOffset <Number> left offset for horizontal scroll |
102 |
103 |
103 nFullLinesShown <Number> the number of unclipped lines in visible area |
104 nFullLinesShown <Number> the number of unclipped lines in visible area |
104 (internal; updated on size changes) |
105 (internal; updated on size changes) |
105 nLinesShown <Number> the number of lines in visible area, incl. partial |
106 nLinesShown <Number> the number of lines in visible area, incl. partial |
106 (internal; updated on size changes) |
107 (internal; updated on size changes) |
107 |
108 |
108 fgColor <Color> color to draw characters |
109 fgColor <Color> color to draw characters |
109 bgColor <Color> the background |
110 bgColor <Color> the background |
110 |
111 |
111 partialLines <Boolean> allow last line to be partial displayed |
112 partialLines <Boolean> allow last line to be partial displayed |
119 fontAscent <Number> font ascent in pixels (internal) |
120 fontAscent <Number> font ascent in pixels (internal) |
120 fontIsFixed <Boolean> true if its a fixed font (internal) |
121 fontIsFixed <Boolean> true if its a fixed font (internal) |
121 fontWidth <Number> width of space (internal) |
122 fontWidth <Number> width of space (internal) |
122 lineSpacing <Number> pixels between lines |
123 lineSpacing <Number> pixels between lines |
123 lastSearchPattern <String> last pattern for searching |
124 lastSearchPattern <String> last pattern for searching |
124 (kept to provide a default for next search) |
125 (kept to provide a default for next search) |
125 lastSearchIgnoredCase <Boolean> last search ignored case |
126 lastSearchIgnoredCase <Boolean> last search ignored case |
126 (kept to provide a default for next search) |
127 (kept to provide a default for next search) |
127 wordCheck <Block> rule used for check for word boundaries in word select |
128 wordCheck <Block> rule used for check for word boundaries in word select |
128 The default rule is to return true for alphaNumeric characters. |
129 The default rule is to return true for alphaNumeric characters. |
129 (can be changed to allow for underscore and other |
130 (can be changed to allow for underscore and other |
130 characters to be treated as alphaCharacters) |
131 characters to be treated as alphaCharacters) |
131 |
132 |
132 autoScrollBlock <Block> block installed as timeoutBlock when doing an |
133 autoScrollBlock <Block> block installed as timeoutBlock when doing an |
133 autoScroll (internal) |
134 autoScroll (internal) |
134 autoScrollDeltaT computed scroll time delta in seconds (internal) |
135 autoScrollDeltaT computed scroll time delta in seconds (internal) |
135 |
136 |
136 includesNonStrings cached flag if any non-strings are in list |
137 includesNonStrings cached flag if any non-strings are in list |
137 widthOfWidestLine cached width of widest line |
138 widthOfWidestLine cached width of widest line |
138 listMsg if view has a model and listMsg is non-nil, |
139 listMsg if view has a model and listMsg is non-nil, |
139 this is sent to the model to aquired a new contents |
140 this is sent to the model to aquired a new contents |
140 whenever a change of the aspect (aspectMsg) occurs. |
141 whenever a change of the aspect (aspectMsg) occurs. |
141 |
142 |
142 viewOrigin the current origin |
143 viewOrigin the current origin |
143 |
144 |
144 backgroundAlreadyClearedColor internal; speedup by avoiding |
145 backgroundAlreadyClearedColor internal; speedup by avoiding |
145 multiple fills when drawing |
146 multiple fills when drawing |
146 internal lines |
147 internal lines |
|
148 |
|
149 scrollWhenUpdating |
|
150 <Symbol> defines how the view is scrolled if the |
|
151 model changes its value by some outside activity |
|
152 (i.e. not by user input). |
|
153 Can be one of: |
|
154 #keep / nil -> stay unchanged |
|
155 #endOfText -> scroll to the end |
|
156 #beginOfText -> scroll to the top |
|
157 The default is #beginOfText (i.e. scroll to top). |
147 |
158 |
148 [StyleSheet parameters:] |
159 [StyleSheet parameters:] |
149 |
160 |
150 textForegroundColor defaults to Black |
161 textForegroundColor defaults to Black |
151 textBackgroundColor defaults to White |
162 textBackgroundColor defaults to White |
152 textFont defaults to defaultFont |
163 textFont defaults to defaultFont |
153 textTabPositions defaults to #(1 9 17 25 ...) |
164 textTabPositions defaults to #(1 9 17 25 ...) |
154 |
165 |
155 [author:] |
166 [author:] |
156 Claus Gittinger |
167 Claus Gittinger |
157 |
168 |
158 [see also:] |
169 [see also:] |
159 TextView EditTextView |
170 TextView EditTextView |
160 |
171 |
161 " |
172 " |
162 ! |
173 ! |
163 |
174 |
164 examples |
175 examples |
702 "Modified: 5.6.1997 / 11:10:54 / cg" |
713 "Modified: 5.6.1997 / 11:10:54 / cg" |
703 ! |
714 ! |
704 |
715 |
705 list:aCollection |
716 list:aCollection |
706 "set the contents (a collection of strings or list entries) |
717 "set the contents (a collection of strings or list entries) |
707 and scroll to top-left. |
718 and scroll as specified in scrollWhenUpdating (default:top-left). |
708 See also #setList:, which does not scroll. |
719 See also #setList:, which does not scroll. |
709 Tabs are expanded (to spaces). |
720 Tabs are expanded (to spaces). |
710 The passed list is scanned for nonStrings |
721 The passed list is scanned for nonStrings |
711 (remembered to optimize later redraws)." |
722 (remembered to optimize later redraws)." |
712 |
723 |
714 |
725 |
715 "Modified: 5.6.1997 / 11:10:45 / cg" |
726 "Modified: 5.6.1997 / 11:10:45 / cg" |
716 ! |
727 ! |
717 |
728 |
718 list:aCollection expandTabs:expand |
729 list:aCollection expandTabs:expand |
719 "set the contents (a collection of strings) and scroll to top-left. |
730 "set the contents (a collection of strings) |
|
731 and scroll as specified in scrollWhenUpdating (default:top-left). |
720 If expand is true, tabs are expanded (to spaces). |
732 If expand is true, tabs are expanded (to spaces). |
721 The passed list is scanned for nonStrings (remembered to optimize |
733 The passed list is scanned for nonStrings (remembered to optimize |
722 later redraws)." |
734 later redraws)." |
723 |
735 |
724 self list:aCollection expandTabs:expand scanForNonStrings:true |
736 self list:aCollection expandTabs:expand scanForNonStrings:true |
725 |
737 |
726 "Modified: 5.6.1997 / 11:09:44 / cg" |
738 "Modified: 5.6.1997 / 11:09:44 / cg" |
727 ! |
739 ! |
728 |
740 |
729 list:aCollection expandTabs:expand scanForNonStrings:scan |
741 list:aCollection expandTabs:expand scanForNonStrings:scan |
730 "set the contents (a collection of strings) and scroll to top-left. |
742 "set the contents (a collection of strings) |
|
743 and scroll as specified in scrollWhenUpdating (default:top-left). |
731 If expand is true, tabs are expanded (to spaces). |
744 If expand is true, tabs are expanded (to spaces). |
732 If scan is true, scan the passed list for nonStrings; otherwise, |
745 If scan is true, scan the passed list for nonStrings; otherwise, |
733 assume that it does contain non-strings |
746 assume that it does contain non-strings |
734 (remembered to optimize later redraws)." |
747 (remembered to optimize later redraws)." |
735 |
748 |
736 self |
749 self |
737 list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true |
750 list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true |
738 |
751 |
739 "Modified: 5.6.1997 / 12:40:35 / cg" |
752 "Modified: 5.6.1997 / 12:40:35 / cg" |
740 ! |
753 ! |
741 |
754 |
742 list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings |
755 list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings |
743 "set the contents (a collection of strings) and scroll to top-left. |
756 "set the contents (a collection of strings) |
|
757 and scroll as specified in scrollWhenUpdating (default:top-left). |
744 If expand is true, tabs are expanded (to spaces). |
758 If expand is true, tabs are expanded (to spaces). |
745 If scan is true, scan the passed list for nonStrings; |
759 If scan is true, scan the passed list for nonStrings; |
746 otherwise, take the information from the nonStrings arg. |
760 otherwise, take the information from the nonStrings arg. |
747 (the nonStrings information is remembered to optimize later redraws & height computations)." |
761 (the nonStrings information is remembered to optimize later redraws & height computations)." |
748 |
762 |
749 |oldFirst oldLeft nonStringsBefore fontHeightBefore| |
763 |oldFirst oldLeft nonStringsBefore fontHeightBefore| |
750 |
764 |
751 (aCollection isNil and:[list isNil]) ifTrue:[ |
765 (aCollection isNil and:[list isNil]) ifTrue:[ |
752 "no change" |
766 "no contents change" |
753 self scrollToTop. |
767 (scrollWhenUpdating == #begin |
754 self scrollToLeft. |
768 or:[scrollWhenUpdating == #beginOfText]) ifTrue:[ |
|
769 self scrollToTop. |
|
770 self scrollToLeft. |
|
771 ] ifFalse:[ |
|
772 (scrollWhenUpdating == #end |
|
773 or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
|
774 self scrollToBottom. |
|
775 ] |
|
776 ]. |
755 ^ self |
777 ^ self |
756 ]. |
778 ]. |
757 list := aCollection. |
779 list := aCollection. |
758 |
780 |
759 nonStringsBefore := includesNonStrings. |
781 nonStringsBefore := includesNonStrings. |
776 ]. |
798 ]. |
777 |
799 |
778 widthOfWidestLine := nil. "/ i.e. unknown |
800 widthOfWidestLine := nil. "/ i.e. unknown |
779 oldFirst := firstLineShown. |
801 oldFirst := firstLineShown. |
780 oldLeft := leftOffset. |
802 oldLeft := leftOffset. |
781 firstLineShown := 1. |
803 |
782 leftOffset := 0. |
804 (scrollWhenUpdating == #begin |
|
805 or:[scrollWhenUpdating == #beginOfText]) ifTrue:[ |
|
806 firstLineShown := 1. |
|
807 leftOffset := 0. |
|
808 ] ifFalse:[ |
|
809 (scrollWhenUpdating == #end |
|
810 or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
|
811 firstLineShown := (list size - nFullLinesShown - 1) max:1. |
|
812 leftOffset := 0. |
|
813 ] |
|
814 ]. |
783 |
815 |
784 realized ifTrue:[ |
816 realized ifTrue:[ |
785 (includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
817 (includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
786 self computeNumberOfLinesShown. |
818 self computeNumberOfLinesShown. |
787 ]. |
819 ]. |