TextView.st
changeset 1353 5dac6aa6ac96
parent 1349 09db5ecfb437
child 1359 d1d0c157a85f
equal deleted inserted replaced
1352:d017596ca663 1353:5dac6aa6ac96
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 'From Smalltalk/X, Version:3.2.1 on 14-oct-1997 at 11:22:55 pm'                 !
    13 'From Smalltalk/X, Version:3.2.1 on 20-oct-1997 at 2:11:29 pm'                  !
    14 
    14 
    15 ListView subclass:#TextView
    15 ListView subclass:#TextView
    16 	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
    16 	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
    17 		selectionEndCol clickStartLine clickStartCol clickLine clickCol
    17 		selectionEndCol clickStartLine clickStartCol clickLine clickCol
    18 		clickCount expandingTop wordStartCol wordStartLine wordEndCol
    18 		clickCount expandingTop wordStartCol wordStartLine wordEndCol
   203 !
   203 !
   204 
   204 
   205 updateStyleCache
   205 updateStyleCache
   206     "extract values from the styleSheet and cache them in class variables"
   206     "extract values from the styleSheet and cache them in class variables"
   207 
   207 
   208     <resource: #style (#textViewBackground
   208     <resource: #style (#'textView.background'
   209                        #textSelectionForegroundColor #textSelectionBackgroundColor
   209                        #'textSelection.foregroundColor' #'textSelection.backgroundColor'
   210                        #textViewFont #textWordSelectCatchesBlanks
   210                        #'textView.font' #textWordSelectCatchesBlanks
   211                        #st80Selections)>
   211                        #st80Selections)>
   212 
   212 
   213     DefaultViewBackground := StyleSheet colorAt:'textViewBackground' default:White.
   213     DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White.
   214     DefaultSelectionForegroundColor := StyleSheet colorAt:'textSelectionForegroundColor'.
   214     DefaultSelectionForegroundColor := StyleSheet colorAt:'textSelection.foregroundColor'.
   215     DefaultSelectionBackgroundColor := StyleSheet colorAt:'textSelectionBackgroundColor'.
   215     DefaultSelectionBackgroundColor := StyleSheet colorAt:'textSelection.backgroundColor'.
   216     DefaultFont := StyleSheet fontAt:'textViewFont'.
   216     DefaultFont := StyleSheet fontAt:'textView.font'.
   217     MatchDelayTime := 0.6.
   217     MatchDelayTime := 0.6.
   218     WordSelectCatchesBlanks := StyleSheet at:'textWordSelectCatchesBlanks' default:false.
   218     WordSelectCatchesBlanks := StyleSheet at:'textWordSelectCatchesBlanks' default:false.
   219     ST80Selections := StyleSheet at:'TextView.st80Selections' default:false.
   219     ST80Selections := StyleSheet at:'TextView.st80Selections' default:false.
   220 
   220 
   221     "Modified: 11.9.1997 / 04:11:51 / cg"
   221     "Modified: 20.10.1997 / 14:05:53 / cg"
   222 ! !
   222 ! !
   223 
   223 
   224 !TextView class methodsFor:'startup'!
   224 !TextView class methodsFor:'startup'!
   225 
   225 
   226 open
   226 open
  1978 !
  1978 !
  1979 
  1979 
  1980 searchBwd
  1980 searchBwd
  1981     "search backward and -if found- position cursor"
  1981     "search backward and -if found- position cursor"
  1982 
  1982 
       
  1983     |ign|
       
  1984 
       
  1985     ign := lastSearchIgnoredCase ? false.
       
  1986 
  1983     self setSearchPattern.
  1987     self setSearchPattern.
  1984     lastSearchPattern notNil ifTrue:[
  1988     lastSearchPattern notNil ifTrue:[
  1985         self searchBwd:lastSearchPattern ignoreCase:lastSearchIgnoredCase
  1989         self 
       
  1990 	    searchBwd:lastSearchPattern 
       
  1991 	    ignoreCase:ign
  1986     ]
  1992     ]
  1987 
  1993 
  1988     "Modified: 13.9.1997 / 06:24:35 / cg"
  1994     "Modified: 13.9.1997 / 06:24:35 / cg"
  1989 !
  1995 !
  1990 
  1996 
  2225 !
  2231 !
  2226 
  2232 
  2227 searchFwd
  2233 searchFwd
  2228     "search forward for pattern or selection"
  2234     "search forward for pattern or selection"
  2229 
  2235 
       
  2236     |ign|
       
  2237 
       
  2238     ign := lastSearchIgnoredCase ? false.
       
  2239 
  2230     selectStyle == #wordLeft ifTrue:[
  2240     selectStyle == #wordLeft ifTrue:[
  2231         "
  2241         "
  2232          remove the space from the selection
  2242          remove the space from the selection
  2233         "
  2243         "
  2234         selectionStartCol := selectionStartCol + 1.
  2244         selectionStartCol := selectionStartCol + 1.
  2235         super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
  2245         super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
  2236         selectStyle := #word.
  2246         selectStyle := #word.
  2237     ].
  2247     ].
  2238     self setSearchPattern.
  2248     self setSearchPattern.
  2239     lastSearchPattern notNil ifTrue:[
  2249     lastSearchPattern notNil ifTrue:[
  2240         self searchFwd:lastSearchPattern ignoreCase:lastSearchIgnoredCase
  2250         self 
       
  2251 	    searchFwd:lastSearchPattern
       
  2252 	    ignoreCase:ign
  2241     ]
  2253     ]
  2242 
  2254 
  2243     "Modified: 13.9.1997 / 06:24:26 / cg"
  2255     "Modified: 13.9.1997 / 06:24:26 / cg"
  2244 !
  2256 !
  2245 
  2257 
  2793 ! !
  2805 ! !
  2794 
  2806 
  2795 !TextView class methodsFor:'documentation'!
  2807 !TextView class methodsFor:'documentation'!
  2796 
  2808 
  2797 version
  2809 version
  2798     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.108 1997-10-15 11:28:03 cg Exp $'
  2810     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.109 1997-10-21 18:03:14 cg Exp $'
  2799 ! !
  2811 ! !