2852 "Created: / 25-07-2012 / 11:59:58 / cg" |
2852 "Created: / 25-07-2012 / 11:59:58 / cg" |
2853 ! |
2853 ! |
2854 |
2854 |
2855 getFontParameters |
2855 getFontParameters |
2856 "get some info of the used font. They are cached since we use them often .. |
2856 "get some info of the used font. They are cached since we use them often .. |
2857 The code below uses the fonts average height parameters - these |
2857 The code below uses the font's average height parameters - these |
2858 are not OK for some oversized national characters (such as A-dieresis). |
2858 are not OK for some oversized national characters (such as A-dieresis). |
2859 Therefore, this method should be redefined in views which will be used |
2859 Therefore, this method should be redefined in views which will be used |
2860 with national characters (i.e. editTextViews)." |
2860 with national characters (i.e. editTextViews)." |
2861 |
2861 |
2862 |hMax newDeviceFont| |
2862 |hMax newDeviceFont| |
4871 ! |
4871 ! |
4872 |
4872 |
4873 searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
4873 searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
4874 "search for a pattern, if found evaluate block1 with row/col as arguments, |
4874 "search for a pattern, if found evaluate block1 with row/col as arguments, |
4875 if not found evaluate block2. |
4875 if not found evaluate block2. |
4876 If the block is a three-arg block, it gets the end-col (or nil, if not found)" |
4876 If the block is a three-arg block, it gets the end-col (or nil, if not known)" |
4877 |
4877 |
4878 |lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly |
4878 |lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly |
4879 wrapAtEndOfText patternSize matcher lnr "{Class: SmallInteger}" |
4879 wrapAtEndOfText patternSize matcher lnr "{Class: SmallInteger}" |
4880 line1 "{Class: SmallInteger}" |
4880 line1 "{Class: SmallInteger}" |
4881 line2 "{Class: SmallInteger}" |
4881 line2 "{Class: SmallInteger}" |
4882 p realPattern runner foundCol endCol| |
4882 p realPattern runner foundCol endCol| |
4883 |
4883 |
4884 pattern := searchSpec pattern. |
4884 pattern := searchSpec pattern. |
4885 match := searchSpec match. |
4885 match := searchSpec match. |
4886 regexMatch := searchSpec regexMatch. |
4886 regexMatch := searchSpec regexMatch. |
|
4887 (match and:[regexMatch not]) ifTrue:[ |
|
4888 pattern := pattern globPatternAsRegexPattern. |
|
4889 regexMatch := true. |
|
4890 ]. |
4887 ignCase := searchSpec ignoreCase. |
4891 ignCase := searchSpec ignoreCase. |
4888 fullWord := searchSpec fullWord. |
4892 fullWord := searchSpec fullWord. |
4889 atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
4893 atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
4890 wrapAtEndOfText := searchSpec wrapAtEndOfText. |
4894 wrapAtEndOfText := searchSpec wrapAtEndOfText. |
4891 |
4895 |
4941 foundCol >= col ifTrue:[ |
4945 foundCol >= col ifTrue:[ |
4942 (atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
4946 (atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
4943 ^ block1 value:lnr value:foundCol optionalArgument:endCol. |
4947 ^ block1 value:lnr value:foundCol optionalArgument:endCol. |
4944 ]]]]]]. |
4948 ]]]]]]. |
4945 ] ifFalse:[ |
4949 ] ifFalse:[ |
4946 (match and:[regexMatch or:[pattern includesUnescapedMatchCharacters]]) ifTrue:[ |
4950 (match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[ |
4947 "perform a findMatchString (glob matching)" |
4951 "perform a findMatchString (glob matching)" |
4948 p := pattern species new:0. |
4952 p := pattern species new:0. |
4949 (pattern startsWith:$*) ifFalse:[p := p , '*']. |
4953 (pattern startsWith:$*) ifFalse:[p := p , '*']. |
4950 p := p , pattern. |
4954 p := p , pattern. |
4951 (pattern endsWith:$*) ifFalse:[p := p , '*']. |
4955 (pattern endsWith:$*) ifFalse:[p := p , '*']. |
4965 ^ block1 value:lnr value:foundCol optionalArgument:nil. |
4969 ^ block1 value:lnr value:foundCol optionalArgument:nil. |
4966 ]]]]. |
4970 ]]]]. |
4967 ] ifFalse:[ |
4971 ] ifFalse:[ |
4968 "perform a findString (no matching)" |
4972 "perform a findString (no matching)" |
4969 p := pattern. |
4973 p := pattern. |
|
4974 (match and:[pattern includesMatchCharacters]) ifTrue:[ |
|
4975 p := pattern withoutMatchEscapes |
|
4976 ]. |
4970 runner |
4977 runner |
4971 value:[:lnr :col :lineString | |
4978 value:[:lnr :col :lineString | |
4972 foundCol := lineString |
4979 foundCol := lineString |
4973 findString:p startingAt:col ifAbsent:0 caseSensitive: ignCase not. |
4980 findString:p startingAt:col ifAbsent:0 caseSensitive: ignCase not. |
4974 foundCol ~~ 0 ifTrue:[ |
4981 foundCol ~~ 0 ifTrue:[ |