TextView.st
changeset 3581 950b9b6939ee
parent 3577 092957d43987
child 3587 8685721a709f
equal deleted inserted replaced
3580:c9d10df2b8bc 3581:950b9b6939ee
    18 		wordEndCol wordEndLine selectionFgColor selectionBgColor
    18 		wordEndCol wordEndLine selectionFgColor selectionBgColor
    19 		selectStyle directoryForFileDialog defaultFileNameForFileDialog
    19 		selectStyle directoryForFileDialog defaultFileNameForFileDialog
    20 		externalEncoding contentsWasSaved searchAction lastSearchPattern
    20 		externalEncoding contentsWasSaved searchAction lastSearchPattern
    21 		lastSearchWasMatch lastSearchIgnoredCase lastSearchMatch
    21 		lastSearchWasMatch lastSearchIgnoredCase lastSearchMatch
    22 		lastSearchDirection parenthesisSpecification dropSource
    22 		lastSearchDirection parenthesisSpecification dropSource
    23 		dragIsActive saveAction st80SelectMode'
    23 		dragIsActive saveAction st80SelectMode searchActionBlock'
    24 	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
    24 	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
    25 		DefaultSelectionBackgroundColor
    25 		DefaultSelectionBackgroundColor
    26 		DefaultAlternativeSelectionForegroundColor
    26 		DefaultAlternativeSelectionForegroundColor
    27 		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
    27 		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
    28 		WordSelectCatchesBlanks LastSearchPatterns
    28 		WordSelectCatchesBlanks LastSearchPatterns
   770     parenthesisSpecification := aDictionary
   770     parenthesisSpecification := aDictionary
   771 !
   771 !
   772 
   772 
   773 saveAction:something
   773 saveAction:something
   774     saveAction := something.
   774     saveAction := something.
       
   775 !
       
   776 
       
   777 searchActionBlock
       
   778     ^ searchActionBlock
       
   779 !
       
   780 
       
   781 searchActionBlock:something
       
   782     searchActionBlock := something.
   775 ! !
   783 ! !
   776 
   784 
   777 !TextView methodsFor:'accessing-contents'!
   785 !TextView methodsFor:'accessing-contents'!
   778 
   786 
   779 contents:newContents selected:selectedBoolean
   787 contents:newContents selected:selectedBoolean
  1970     "
  1978     "
  1971 
  1979 
  1972     |searchBox patternHolder caseHolder matchHolder fwd ign match initialString
  1980     |searchBox patternHolder caseHolder matchHolder fwd ign match initialString
  1973      bindings bldr search modal|
  1981      bindings bldr search modal|
  1974 
  1982 
       
  1983     searchActionBlock notNil ifTrue:[
       
  1984         "/ clear the autosearch (browse variable uses, for example)
       
  1985         searchAction := nil.
       
  1986         searchActionBlock value:#search value:self.
       
  1987         ^ self
       
  1988     ].
       
  1989 
  1975     modal := (UserPreferences current searchDialogIsModal).   "/ thats experimental
  1990     modal := (UserPreferences current searchDialogIsModal).   "/ thats experimental
  1976 
  1991 
  1977     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  1992     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  1978     caseHolder := ign asValue.
  1993     caseHolder := ign asValue.
  1979 
  1994 
  2756 searchAgainInSameDirection
  2771 searchAgainInSameDirection
  2757     "search again in the same direction and -if found- position cursor"
  2772     "search again in the same direction and -if found- position cursor"
  2758 
  2773 
  2759     |ign match|
  2774     |ign match|
  2760 
  2775 
       
  2776     searchActionBlock notNil ifTrue:[
       
  2777         searchActionBlock value:#forward value:self.
       
  2778         ^ self
       
  2779     ].
       
  2780 
  2761     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  2781     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  2762     match := lastSearchWasMatch ? LastSearchWasMatch ? false.
  2782     match := lastSearchWasMatch ? LastSearchWasMatch ? false.
  2763 
  2783 
  2764     self setSearchPatternWithMatchEscapes: match.
  2784     self setSearchPatternWithMatchEscapes: match.
  2765     lastSearchPattern notNil ifTrue:[
  2785     lastSearchPattern notNil ifTrue:[
  2783     "search backward and -if found- position cursor"
  2803     "search backward and -if found- position cursor"
  2784 
  2804 
  2785     |ign|
  2805     |ign|
  2786 
  2806 
  2787     searchAction notNil ifTrue:[
  2807     searchAction notNil ifTrue:[
       
  2808         "/confusing: this is for autosearch of variables (browse variable uses, for example)
  2788         self searchUsingSearchAction:#backward.
  2809         self searchUsingSearchAction:#backward.
  2789         ^ self.
  2810         ^ self.
       
  2811     ].
       
  2812     searchActionBlock notNil ifTrue:[
       
  2813         searchActionBlock value:#backward value:self.
       
  2814         ^ self
  2790     ].
  2815     ].
  2791 
  2816 
  2792     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  2817     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  2793 
  2818 
  2794     self setSearchPatternWithMatchEscapes: false.
  2819     self setSearchPatternWithMatchEscapes: false.
  3258     "search forward for pattern or selection"
  3283     "search forward for pattern or selection"
  3259 
  3284 
  3260     |ign match|
  3285     |ign match|
  3261 
  3286 
  3262     searchAction notNil ifTrue:[
  3287     searchAction notNil ifTrue:[
       
  3288         "/confusing: this is for autosearch of variables (browse variable uses, for example)
  3263         self searchUsingSearchAction:#forward.
  3289         self searchUsingSearchAction:#forward.
  3264         ^ self.
  3290         ^ self.
  3265     ].
  3291     ].
       
  3292     searchActionBlock notNil ifTrue:[
       
  3293         searchActionBlock value:#forward value:self.
       
  3294         ^ self
       
  3295     ].
       
  3296 
  3266 
  3297 
  3267     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  3298     ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
  3268     match := lastSearchWasMatch ? LastSearchWasMatch ? false.
  3299     match := lastSearchWasMatch ? LastSearchWasMatch ? false.
  3269 
  3300 
  3270     selectStyle == #wordLeft ifTrue:[
  3301     selectStyle == #wordLeft ifTrue:[
  3387     pos :=  self startPositionForSearchForward.
  3418     pos :=  self startPositionForSearchForward.
  3388     startLine := pos y.
  3419     startLine := pos y.
  3389     startCol := pos x.
  3420     startCol := pos x.
  3390 
  3421 
  3391     self 
  3422     self 
       
  3423         searchFwd:pattern 
       
  3424         ignoreCase:ign
       
  3425         match: match
       
  3426         startingAtLine:startLine col:startCol
       
  3427         ifAbsent:aBlock
       
  3428 
       
  3429     "Modified: 13.9.1997 / 01:05:35 / cg"
       
  3430     "Created: 13.9.1997 / 06:18:27 / cg"
       
  3431 !
       
  3432 
       
  3433 searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
       
  3434     "do a forward search"
       
  3435 
       
  3436     self 
  3392         searchForwardFor:pattern 
  3437         searchForwardFor:pattern 
  3393         ignoreCase:ign
  3438         ignoreCase:ign
  3394         match: match
  3439         match: match
  3395         startingAtLine:startLine col:startCol
  3440         startingAtLine:startLine col:startCol
  3396         ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
  3441         ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
  3397         ifAbsent:aBlock
  3442         ifAbsent:aBlock
  3398 
       
  3399     "Modified: 13.9.1997 / 01:05:35 / cg"
       
  3400     "Created: 13.9.1997 / 06:18:27 / cg"
       
  3401 !
  3443 !
  3402 
  3444 
  3403 searchPattern
  3445 searchPattern
  3404     "return the last search pattern"
  3446     "return the last search pattern"
  3405 
  3447 
  4023 ! !
  4065 ! !
  4024 
  4066 
  4025 !TextView class methodsFor:'documentation'!
  4067 !TextView class methodsFor:'documentation'!
  4026 
  4068 
  4027 version
  4069 version
  4028     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.283 2008-04-02 11:58:30 fm Exp $'
  4070     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.284 2008-04-04 16:28:40 fm Exp $'
  4029 ! !
  4071 ! !
  4030 
  4072 
  4031 TextView initialize!
  4073 TextView initialize!