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:
parent
270394a397
commit
a8d4830b71
@ -7,7 +7,7 @@
|
|||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<Title Value="Mufasa Stand Alone"/>
|
<Title Value="Mufasa Stand Alone"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<ActiveEditorIndexAtStart Value="6"/>
|
<ActiveEditorIndexAtStart Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -162,8 +162,8 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="TestUnit"/>
|
<UnitName Value="TestUnit"/>
|
||||||
<CursorPos X="43" Y="963"/>
|
<CursorPos X="156" Y="888"/>
|
||||||
<TopLine Value="946"/>
|
<TopLine Value="865"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="202"/>
|
<UsageCount Value="202"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -410,7 +410,7 @@
|
|||||||
<Unit51>
|
<Unit51>
|
||||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
|
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
|
||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
<TopLine Value="33"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="7"/>
|
<EditorIndex Value="7"/>
|
||||||
<UsageCount Value="38"/>
|
<UsageCount Value="38"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -1669,7 +1669,7 @@
|
|||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit232>
|
</Unit232>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="8" HistoryIndex="7">
|
<JumpHistory Count="9" HistoryIndex="8">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="testunit.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="837" Column="30" TopLine="831"/>
|
<Caret Line="837" Column="30" TopLine="831"/>
|
||||||
@ -1702,6 +1702,10 @@
|
|||||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||||
<Caret Line="242" Column="18" TopLine="227"/>
|
<Caret Line="242" Column="18" TopLine="227"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
|
<Position9>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="963" Column="43" TopLine="946"/>
|
||||||
|
</Position9>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 274
|
Left = 474
|
||||||
Height = 557
|
Height = 557
|
||||||
Top = 233
|
Top = 246
|
||||||
Width = 731
|
Width = 731
|
||||||
ActiveControl = ScriptPanel
|
ActiveControl = ScriptPanel
|
||||||
Caption = 'THA FUKING MUFASA'
|
Caption = 'THA FUKING MUFASA'
|
||||||
ClientHeight = 537
|
ClientHeight = 532
|
||||||
ClientWidth = 731
|
ClientWidth = 731
|
||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
@ -166,8 +166,8 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 21
|
||||||
Top = 514
|
Top = 511
|
||||||
Width = 731
|
Width = 731
|
||||||
Panels = <
|
Panels = <
|
||||||
item
|
item
|
||||||
@ -184,17 +184,17 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object PanelMemo: TPanel
|
object PanelMemo: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 154
|
Height = 151
|
||||||
Top = 360
|
Top = 360
|
||||||
Width = 731
|
Width = 731
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ClientHeight = 154
|
ClientHeight = 151
|
||||||
ClientWidth = 731
|
ClientWidth = 731
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object Memo1: TMemo
|
object Memo1: TMemo
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 152
|
Height = 149
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 729
|
Width = 729
|
||||||
Align = alClient
|
Align = alClient
|
||||||
@ -252,7 +252,7 @@ object Form1: TForm1
|
|||||||
Visible = False
|
Visible = False
|
||||||
object LabeledEditSearch: TLabeledEdit
|
object LabeledEditSearch: TLabeledEdit
|
||||||
Left = 104
|
Left = 104
|
||||||
Height = 21
|
Height = 27
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 174
|
Width = 174
|
||||||
AutoSelect = False
|
AutoSelect = False
|
||||||
@ -261,10 +261,10 @@ object Form1: TForm1
|
|||||||
EditLabel.AnchorSideTop.Side = asrCenter
|
EditLabel.AnchorSideTop.Side = asrCenter
|
||||||
EditLabel.AnchorSideRight.Control = LabeledEditSearch
|
EditLabel.AnchorSideRight.Control = LabeledEditSearch
|
||||||
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
|
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
|
||||||
EditLabel.Left = 73
|
EditLabel.Left = 65
|
||||||
EditLabel.Height = 14
|
EditLabel.Height = 18
|
||||||
EditLabel.Top = 9
|
EditLabel.Top = 10
|
||||||
EditLabel.Width = 28
|
EditLabel.Width = 36
|
||||||
EditLabel.Caption = 'Find: '
|
EditLabel.Caption = 'Find: '
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
@ -363,9 +363,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CheckBoxMatchCase: TCheckBox
|
object CheckBoxMatchCase: TCheckBox
|
||||||
Left = 320
|
Left = 320
|
||||||
Height = 17
|
Height = 22
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 72
|
Width = 98
|
||||||
Caption = 'Match case'
|
Caption = 'Match case'
|
||||||
OnClick = CheckBoxMatchCaseClick
|
OnClick = CheckBoxMatchCaseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -861,13 +861,41 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.dlgReplaceReplace(Sender: TObject);
|
procedure TForm1.dlgReplaceReplace(Sender: TObject);
|
||||||
var
|
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
|
begin
|
||||||
if(frEntireScope in dlgReplace.Options)then Options:= [ssoEntireScope];
|
Y:= False;
|
||||||
if(frMatchCase in dlgReplace.Options)then Options:= Options + [ssoMatchCase];
|
SOptions:= [];
|
||||||
if(frWholeWord in dlgReplace.Options)then Options:= Options + [ssoWholeWord];
|
if(frMatchCase in dlgReplace.Options)then SOptions:= [ssoMatchCase];
|
||||||
if(frReplaceAll in dlgReplace.Options)then Options:= Options + [ssoReplaceAll];
|
if(frWholeWord in dlgReplace.Options)then SOptions+= [ssoWholeWord];
|
||||||
CurrScript.SynEdit.SearchReplace(dlgReplace.FindText, dlgReplace.ReplaceText, Options);
|
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;
|
end;
|
||||||
|
|
||||||
procedure TForm1.EditSearchChange(Sender: TObject);
|
procedure TForm1.EditSearchChange(Sender: TObject);
|
||||||
|
Loading…
Reference in New Issue
Block a user