1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-22 09:12:19 -05:00

Fixed some bugs in replace and added a confirmation dialog.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@218 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
bullzeye95 2009-11-08 19:09:45 +00:00
parent 270394a397
commit a8d4830b71
4 changed files with 2561 additions and 2529 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="6"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -162,8 +162,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="43" Y="963"/>
<TopLine Value="946"/>
<CursorPos X="156" Y="888"/>
<TopLine Value="865"/>
<EditorIndex Value="0"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -410,7 +410,7 @@
<Unit51>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="33"/>
<TopLine Value="1"/>
<EditorIndex Value="7"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
@ -1669,7 +1669,7 @@
<UsageCount Value="10"/>
</Unit232>
</Units>
<JumpHistory Count="8" HistoryIndex="7">
<JumpHistory Count="9" HistoryIndex="8">
<Position1>
<Filename Value="testunit.pas"/>
<Caret Line="837" Column="30" TopLine="831"/>
@ -1702,6 +1702,10 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="242" Column="18" TopLine="227"/>
</Position8>
<Position9>
<Filename Value="testunit.pas"/>
<Caret Line="963" Column="43" TopLine="946"/>
</Position9>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -1,11 +1,11 @@
object Form1: TForm1
Left = 274
Left = 474
Height = 557
Top = 233
Top = 246
Width = 731
ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA'
ClientHeight = 537
ClientHeight = 532
ClientWidth = 731
KeyPreview = True
Menu = MainMenu1
@ -166,8 +166,8 @@ object Form1: TForm1
end
object StatusBar: TStatusBar
Left = 0
Height = 23
Top = 514
Height = 21
Top = 511
Width = 731
Panels = <
item
@ -184,17 +184,17 @@ object Form1: TForm1
end
object PanelMemo: TPanel
Left = 0
Height = 154
Height = 151
Top = 360
Width = 731
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
ClientHeight = 154
ClientHeight = 151
ClientWidth = 731
TabOrder = 2
object Memo1: TMemo
Left = 1
Height = 152
Height = 149
Top = 1
Width = 729
Align = alClient
@ -252,7 +252,7 @@ object Form1: TForm1
Visible = False
object LabeledEditSearch: TLabeledEdit
Left = 104
Height = 21
Height = 27
Top = 6
Width = 174
AutoSelect = False
@ -261,10 +261,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 73
EditLabel.Height = 14
EditLabel.Top = 9
EditLabel.Width = 28
EditLabel.Left = 65
EditLabel.Height = 18
EditLabel.Top = 10
EditLabel.Width = 36
EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False
LabelPosition = lpLeft
@ -363,9 +363,9 @@ object Form1: TForm1
end
object CheckBoxMatchCase: TCheckBox
Left = 320
Height = 17
Height = 22
Top = 6
Width = 72
Width = 98
Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick
TabOrder = 1

File diff suppressed because it is too large Load Diff

View File

@ -861,13 +861,41 @@ end;
procedure TForm1.dlgReplaceReplace(Sender: TObject);
var
Options: TSynSearchOptions;
SOptions: TSynSearchOptions;
P: TPoint;
Y: Boolean;
Btns: TMsgDlgButtons;
procedure Replace;
begin
CurrScript.SynEdit.SearchReplaceEx(dlgReplace.FindText, dlgReplace.ReplaceText, SOptions + [ssoReplace], P);
end;
begin
if(frEntireScope in dlgReplace.Options)then Options:= [ssoEntireScope];
if(frMatchCase in dlgReplace.Options)then Options:= Options + [ssoMatchCase];
if(frWholeWord in dlgReplace.Options)then Options:= Options + [ssoWholeWord];
if(frReplaceAll in dlgReplace.Options)then Options:= Options + [ssoReplaceAll];
CurrScript.SynEdit.SearchReplace(dlgReplace.FindText, dlgReplace.ReplaceText, Options);
Y:= False;
SOptions:= [];
if(frMatchCase in dlgReplace.Options)then SOptions:= [ssoMatchCase];
if(frWholeWord in dlgReplace.Options)then SOptions+= [ssoWholeWord];
with CurrScript.SynEdit do
begin
Btns:= [mbYes, mbNo];
if(frReplaceAll in dlgReplace.Options)then Btns+= [mbYesToAll];
if(frEntireScope in dlgReplace.Options)then P:= Point(0, 0) else P:= CaretXY;
while SearchReplaceEx(dlgReplace.FindText, '', SOptions, P) > 0 do
begin
if(Y)then
Replace
else case MessageDlg('Replace', Format('Do you want to replace "%s" with "%s"?', [dlgReplace.FindText, dlgReplace.ReplaceText]), mtConfirmation, Btns, 0) of
mrYes: Replace;
mrYesToAll: begin
Replace;
Y:= True;
end;
end;
if(not(frReplaceAll in dlgReplace.Options))then exit;
P:= CaretXY;
end;
end;
end;
procedure TForm1.EditSearchChange(Sender: TObject);