+ more regexp, options now in Find/Replace dialogs

This commit is contained in:
pierre 2001-09-14 23:47:08 +00:00
parent cab2e25ed5
commit f1dd7fd8db
3 changed files with 58 additions and 12 deletions

View File

@ -1132,6 +1132,8 @@ begin
inc(i); inc(i);
inc(rx); inc(rx);
if s[i]=#9 then if s[i]=#9 then
inc(rx,TabSize-(rx mod tabsize)); inc(rx,TabSize-(rx mod tabsize));
end; end;
GetDisplayTextPos:=rx; GetDisplayTextPos:=rx;
@ -1990,7 +1992,10 @@ end;
END. END.
{ {
$Log$ $Log$
Revision 1.3 2001-09-14 16:33:06 pierre Revision 1.4 2001-09-14 23:47:08 pierre
+ more regexp, options now in Find/Replace dialogs
Revision 1.3 2001/09/14 16:33:06 pierre
* several small changes * several small changes
Revision 1.2 2001/08/05 02:01:48 peter Revision 1.2 2001/08/05 02:01:48 peter

View File

@ -27,6 +27,7 @@
label_find_texttofind = '~T~ext to find'; label_find_texttofind = '~T~ext to find';
label_find_casesensitive = '~C~ase sensitive'; label_find_casesensitive = '~C~ase sensitive';
label_find_wholewordsonly = '~W~hole words only'; label_find_wholewordsonly = '~W~hole words only';
label_find_useregexp = '~U~se regular expr.';
label_find_direction = 'Direction'; label_find_direction = 'Direction';
label_find_forward = 'Forwar~d~'; label_find_forward = 'Forwar~d~';
label_find_backward = '~B~ackward'; label_find_backward = '~B~ackward';
@ -42,6 +43,7 @@
label_replace_newtext = ' ~N~ew text'; label_replace_newtext = ' ~N~ew text';
label_replace_options = label_find_options; label_replace_options = label_find_options;
label_replace_casesensitive = label_find_casesensitive; label_replace_casesensitive = label_find_casesensitive;
label_replace_useregexp = label_find_useregexp;
label_replace_wholewordsonly = label_find_wholewordsonly; label_replace_wholewordsonly = label_find_wholewordsonly;
label_replace_promptonreplace = '~P~rompt on replace'; label_replace_promptonreplace = '~P~rompt on replace';
label_replace_direction = label_find_direction; label_replace_direction = label_find_direction;
@ -113,7 +115,10 @@
{ {
$Log$ $Log$
Revision 1.1 2001-08-04 11:30:25 peter Revision 1.2 2001-09-14 23:47:09 pierre
+ more regexp, options now in Find/Replace dialogs
Revision 1.1 2001/08/04 11:30:25 peter
* ide works now with both compiler versions * ide works now with both compiler versions
Revision 1.1.2.3 2001/03/06 22:04:53 pierre Revision 1.1.2.3 2001/03/06 22:04:53 pierre

View File

@ -141,7 +141,11 @@ const
ffEntireScope = $0020; ffEntireScope = $0020;
{$ifdef TEST_REGEXP} {$ifdef TEST_REGEXP}
ffUseRegExp = $0040; ffUseRegExp = $0100;
ffmUseRegExpFind = $0004;
ffsUseRegExpFind = 8 - 2;
ffmUseRegExpReplace = $0008;
ffsUseRegExpReplace = 8 - 3;
{$endif TEST_REGEXP} {$endif TEST_REGEXP}
coTextColor = 0; coTextColor = 0;
@ -5866,7 +5870,12 @@ begin
Find := FindStr; Find := FindStr;
if GetCurrentWord<>'' then if GetCurrentWord<>'' then
Find:=GetCurrentWord; Find:=GetCurrentWord;
{$ifdef TEST_REGEXP}
Options := (FindFlags and ffmOptions) shr ffsOptions or
(FindFlags and ffUseRegExp) shr ffsUseRegExpFind;
{$else not TEST_REGEXP}
Options := (FindFlags and ffmOptions) shr ffsOptions; Options := (FindFlags and ffmOptions) shr ffsOptions;
{$endif TEST_REGEXP}
Direction := (FindFlags and ffmDirection) shr ffsDirection; Direction := (FindFlags and ffmDirection) shr ffsDirection;
Scope := (FindFlags and ffmScope) shr ffsScope; Scope := (FindFlags and ffmScope) shr ffsScope;
Origin := (FindFlags and ffmOrigin) shr ffsOrigin; Origin := (FindFlags and ffmOrigin) shr ffsOrigin;
@ -5874,7 +5883,10 @@ begin
if EditorDialog(edFind, @FindRec) <> cmCancel then if EditorDialog(edFind, @FindRec) <> cmCancel then
begin begin
FindStr := Find; FindStr := Find;
FindFlags := (Options shl ffsOptions) or (Direction shl ffsDirection) or FindFlags := ((Options and ffmOptions) shl ffsOptions) or (Direction shl ffsDirection) or
{$ifdef TEST_REGEXP}
((Options and ffmUseRegExpFind) shl ffsUseRegExpFind) or
{$endif TEST_REGEXP}
(Scope shl ffsScope) or (Origin shl ffsOrigin); (Scope shl ffsScope) or (Origin shl ffsOrigin);
FindFlags := FindFlags and not ffDoReplace; FindFlags := FindFlags and not ffDoReplace;
if DoConf then if DoConf then
@ -5900,7 +5912,12 @@ begin
if GetCurrentWord<>'' then if GetCurrentWord<>'' then
Find:=GetCurrentWord; Find:=GetCurrentWord;
Replace := ReplaceStr; Replace := ReplaceStr;
{$ifdef TEST_REGEXP}
Options := (FindFlags and ffmOptions) shr ffsOptions or
(FindFlags and ffUseRegExp) shr ffsUseRegExpReplace;
{$else not TEST_REGEXP}
Options := (FindFlags and ffmOptions) shr ffsOptions; Options := (FindFlags and ffmOptions) shr ffsOptions;
{$endif TEST_REGEXP}
Direction := (FindFlags and ffmDirection) shr ffsDirection; Direction := (FindFlags and ffmDirection) shr ffsDirection;
Scope := (FindFlags and ffmScope) shr ffsScope; Scope := (FindFlags and ffmScope) shr ffsScope;
Origin := (FindFlags and ffmOrigin) shr ffsOrigin; Origin := (FindFlags and ffmOrigin) shr ffsOrigin;
@ -5910,6 +5927,9 @@ begin
FindStr := Find; FindStr := Find;
ReplaceStr := Replace; ReplaceStr := Replace;
FindFlags := (Options shl ffsOptions) or (Direction shl ffsDirection) or FindFlags := (Options shl ffsOptions) or (Direction shl ffsDirection) or
{$ifdef TEST_REGEXP}
((Options and ffmUseRegExpReplace) shl ffsUseRegExpReplace) or
{$endif TEST_REGEXP}
(Scope shl ffsScope) or (Origin shl ffsOrigin); (Scope shl ffsScope) or (Origin shl ffsOrigin);
FindFlags := FindFlags or ffDoReplace; FindFlags := FindFlags or ffDoReplace;
if Re = cmYes then if Re = cmYes then
@ -6086,9 +6106,13 @@ begin
begin begin
getmem(findstrpchar,length(Copy(S,X+1,high(S)))+1); getmem(findstrpchar,length(Copy(S,X+1,high(S)))+1);
strpcopy(findstrpchar,Copy(S,X+1,high(S))); strpcopy(findstrpchar,Copy(S,X+1,high(S)));
{ If start of line is required do check other positions PM }
if (FindStr[1]='^') and (X<>0) then
Found:=false
else
Found:=RegExprPos(RegExpEngine,findstrpchar,regexpindex,regexplen); Found:=RegExprPos(RegExpEngine,findstrpchar,regexpindex,regexplen);
strdispose(findstrpchar); strdispose(findstrpchar);
P:=regexpindex; P:=regexpindex+X+1;
end end
else else
{$endif TEST_REGEXP} {$endif TEST_REGEXP}
@ -6226,6 +6250,7 @@ begin
if FindStr<>'' then if FindStr<>'' then
PopInfo; PopInfo;
{$ifdef TEST_REGEXP} {$ifdef TEST_REGEXP}
if UseRegExp then
DestroyRegExprEngine(RegExpEngine); DestroyRegExprEngine(RegExpEngine);
{$endif TEST_REGEXP} {$endif TEST_REGEXP}
if (FindFlags and ffmScope)=ffSelectedText then if (FindFlags and ffmScope)=ffSelectedText then
@ -6671,11 +6696,15 @@ begin
Insert(Control); Insert(Control);
R1.Copy(R); Inc(R1.A.Y,2); R1.B.Y:=R1.A.Y+1; R1.B.X:=R1.A.X+(R1.B.X-R1.A.X) div 2-1; R1.Copy(R); Inc(R1.A.Y,2); R1.B.Y:=R1.A.Y+1; R1.B.X:=R1.A.X+(R1.B.X-R1.A.X) div 2-1;
R2.Copy(R1); R2.Move(0,1); R2.B.Y:=R2.A.Y+2; R2.Copy(R1); R2.Move(0,1);
R2.B.Y:=R2.A.Y+{$ifdef TEST_REGEXP}3{$else}2{$endif};
New(CB1, Init(R2, New(CB1, Init(R2,
NewSItem(label_find_casesensitive, NewSItem(label_find_casesensitive,
NewSItem(label_find_wholewordsonly, NewSItem(label_find_wholewordsonly,
nil)))); {$ifdef TEST_REGEXP}
NewSItem(label_find_useregexp,
{$endif TEST_REGEXP}
nil)))){$ifdef TEST_REGEXP}){$endif TEST_REGEXP};
Insert(CB1); Insert(CB1);
Insert(New(PLabel, Init(R1, label_find_options, CB1))); Insert(New(PLabel, Init(R1, label_find_options, CB1)));
@ -6751,12 +6780,16 @@ begin
Insert(Control); Insert(Control);
R1.Copy(R); Inc(R1.A.Y,4); R1.B.Y:=R1.A.Y+1; R1.B.X:=R1.A.X+(R1.B.X-R1.A.X) div 2-1; R1.Copy(R); Inc(R1.A.Y,4); R1.B.Y:=R1.A.Y+1; R1.B.X:=R1.A.X+(R1.B.X-R1.A.X) div 2-1;
R2.Copy(R1); R2.Move(0,1); R2.B.Y:=R2.A.Y+3; R2.Copy(R1); R2.Move(0,1);
R2.B.Y:=R2.A.Y+{$ifdef TEST_REGEXP}4{$else}3{$endif};
New(CB1, Init(R2, New(CB1, Init(R2,
NewSItem(label_replace_casesensitive, NewSItem(label_replace_casesensitive,
NewSItem(label_replace_wholewordsonly, NewSItem(label_replace_wholewordsonly,
NewSItem(label_replace_promptonreplace, NewSItem(label_replace_promptonreplace,
nil))))); {$ifdef TEST_REGEXP}
NewSItem(label_find_useregexp,
{$endif TEST_REGEXP}
nil))))){$ifdef TEST_REGEXP}){$endif TEST_REGEXP};
Insert(CB1); Insert(CB1);
Insert(New(PLabel, Init(R1, label_replace_options, CB1))); Insert(New(PLabel, Init(R1, label_replace_options, CB1)));
@ -6992,7 +7025,10 @@ end;
END. END.
{ {
$Log$ $Log$
Revision 1.6 2001-09-13 16:11:34 pierre Revision 1.7 2001-09-14 23:47:09 pierre
+ more regexp, options now in Find/Replace dialogs
Revision 1.6 2001/09/13 16:11:34 pierre
+ test code for regexpr use in find dialog + test code for regexpr use in find dialog
Revision 1.5 2001/09/12 09:31:42 pierre Revision 1.5 2001/09/12 09:31:42 pierre