#DOCUMENTATION
class: TextView
class definition
comment/format in: #nativeWindowType
changed:
#changeFont
#openSearchBoxAndSearch
#searchDialogSpec
--- a/TextView.st Fri Jan 15 17:58:49 2016 +0100
+++ b/TextView.st Fri Jan 15 17:59:06 2016 +0100
@@ -29,7 +29,8 @@
DefaultAlternativeSelectionBackgroundColor MatchDelayTime
WordSelectCatchesBlanks LastSearchPatterns
NumRememberedSearchPatterns LastSearchIgnoredCase
- LastSearchWasMatch DefaultParenthesisSpecification'
+ LastSearchWasMatch DefaultParenthesisSpecification
+ LastSearchWasMatchWithRegex LastSearchWasWithWrapAtEnd'
poolDictionaries:''
category:'Views-Text'
!
@@ -381,7 +382,7 @@
name: 'String search'
min: (Point 10 10)
max: (Point 1280 1024)
- bounds: (Rectangle 0 0 319 266)
+ bounds: (Rectangle 0 0 411 272)
)
component:
(SpecCollection
@@ -425,17 +426,36 @@
tabable: true
model: caseSensitive
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 411 24)
)
- (CheckBoxSpec
- label: 'Match (forward only)'
- name: 'matchCheckBox'
- activeHelpKey: matchSearch
- level: 0
- tabable: true
- model: match
- translateLabel: true
- extent: (Point 319 24)
+ (ViewSpec
+ name: 'MatchBox'
+ component:
+ (SpecCollection
+ collection: (
+ (CheckBoxSpec
+ label: 'Match (forward only)'
+ name: 'matchCheckBox'
+ layout: (LayoutFrame 0 0 0 0 260 0 0 1)
+ activeHelpKey: matchSearch
+ level: 0
+ tabable: true
+ model: match
+ translateLabel: true
+ )
+ (CheckBoxSpec
+ label: 'Regex Match'
+ name: 'CheckBox6'
+ layout: (LayoutFrame -151 1 0 0 0 1 22 0)
+ visibilityChannel: match
+ enableChannel: match
+ model: matchWithRegex
+ translateLabel: true
+ )
+ )
+
+ )
+ extent: (Point 411 24)
)
(CheckBoxSpec
label: 'Search Full Words'
@@ -446,7 +466,7 @@
tabable: true
model: searchFullWord
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 411 24)
)
(CheckBoxSpec
label: 'At Begin of Line Only'
@@ -456,7 +476,7 @@
tabable: true
model: searchAtBeginOfLineOnly
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 411 24)
)
(CheckBoxSpec
label: 'Variable Only'
@@ -469,7 +489,7 @@
model: searchVariable
translateLabel: true
labelChannel: stringWithVariableUnderCursorHolder
- extent: (Point 319 24)
+ extent: (Point 411 24)
)
(CheckBoxSpec
label: 'Select Lines'
@@ -483,14 +503,14 @@
extent: (Point 302 24)
)
(ViewSpec
- name: 'Box1'
+ name: 'ReplaceBox'
component:
(SpecCollection
collection: (
(CheckBoxSpec
label: 'Global Replace With:'
name: 'CheckBox4'
- layout: (LayoutFrame 0 0 0 0 162 0 23 0)
+ layout: (LayoutFrame 0 0 0 0 180 0 23 0)
activeHelpKey: replaceText
level: 0
enableChannel: replaceEnabled
@@ -500,7 +520,7 @@
)
(InputFieldSpec
name: 'ReplaceEntryField'
- layout: (LayoutFrame 164 0 0 0 -2 1 22 0)
+ layout: (LayoutFrame 180 0 0 0 -2 1 22 0)
activeHelpKey: replaceText
visibilityChannel: replaceBoolean
enableChannel: replaceBoolean
@@ -512,7 +532,7 @@
)
)
- extent: (Point 319 24)
+ extent: (Point 411 24)
)
)
@@ -1981,13 +2001,27 @@
changeFont
"pop up a fontPanel to change font"
- |newFont|
+ |newFont fp|
self withWaitCursorDo:[
- newFont := FontPanel fontFromUserInitial:font.
+ fp := FontPanel new.
+ fp withChangeFontInViewsAllCheckBox:true.
+ newFont := fp fontFromUserInitial:font.
].
newFont notNil ifTrue:[
self font:newFont.
+ fp changeFontInAllViews ifTrue:[
+ "/ user checked this box - change the defaults,
+ "/ and update all other textviews now.
+
+ TextView defaultFont:newFont.
+ UserPreferences current fontPreferences
+ at:#Text put:(newFont storeString).
+ DebugView newDebugger.
+ TextView allSubInstances do:[:v |
+ v font:newFont
+ ].
+ ].
]
"Modified: 27.2.1996 / 00:53:51 / cg"
@@ -2163,7 +2197,8 @@
Q: is it a good idea to preserve the last searchstring between views?
cg: yes - turns out to be useful and less confusing than keeping last per view
"
- |searchBox patternHolder caseHolder matchHolder fwd ign match initialString
+ |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder
+ wrapAtEndHolder fwd ign match initialString
bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder
replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
searchAtBeginOfLineOnlyHolder|
@@ -2181,6 +2216,8 @@
match := lastSearchWasMatch ? LastSearchWasMatch ? false.
matchHolder := match asValue.
+ matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
+ wrapAtEndHolder := (LastSearchWasWithWrapAtEnd ? false) asValue.
searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
searchFullWordHolder := false asValue.
searchAtBeginOfLineOnlyHolder := false asValue.
@@ -2226,6 +2263,7 @@
lastSearchWasVariableSearch := false.
LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
+ LastSearchWasMatchWithRegex := matchWithRegexHolder value.
pattern := patternHolder value.
pattern notEmptyOrNil ifTrue:[
searchAction := [
@@ -2233,11 +2271,13 @@
ListView::SearchSpec new
pattern:pattern
ignoreCase:lastSearchIgnoredCase
- match: lastSearchWasMatch
+ match: lastSearchWasMatch
+ regexMatch:matchWithRegexHolder value
variable: searchVariableHolder value
fullWord: searchFullWordHolder value
forward:fwd
- atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value).
+ atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
+ wrapAroundEndOfText:wrapAtEndHolder value).
]
]
].
@@ -2285,6 +2325,7 @@
].
bindings at:#caseSensitive put:caseHolder.
bindings at:#match put:matchHolder.
+ bindings at:#matchWithRegex put:matchWithRegexHolder.
bindings at:#patternList put:LastSearchPatterns.
self supportsSyntaxElements ifFalse:[
@@ -2553,7 +2594,8 @@
nativeWindowType
"return a symbol describing my native window type
- (may be used internally by the device as a native window creation hint)"
+ (may be used internally by the device as a native window creation hint,
+ if the device supports native windows)"
^ #TextView