1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -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=""/> <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>

View File

@ -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

View File

@ -1,9 +1,9 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#18#1#6'Height'#3'-'#2#3'Top'#3#233#0#5'Wi' 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#218#1#6'Height'#3'-'#2#3'Top'#3#246#0#5'W'
+'dth'#3#219#2#13'ActiveControl'#7#11'ScriptPanel'#7'Caption'#6#17'THA FUKING' +'idth'#3#219#2#13'ActiveControl'#7#11'ScriptPanel'#7'Caption'#6#17'THA FUKIN'
+' MUFASA'#12'ClientHeight'#3#25#2#11'ClientWidth'#3#219#2#10'KeyPreview'#9#4 +'G MUFASA'#12'ClientHeight'#3#20#2#11'ClientWidth'#3#219#2#10'KeyPreview'#9#4
+'Menu'#7#9'MainMenu1'#7'OnClose'#7#9'FormClose'#8'OnCreate'#7#10'FormCreate' +'Menu'#7#9'MainMenu1'#7'OnClose'#7#9'FormClose'#8'OnCreate'#7#10'FormCreate'
+#9'OnDestroy'#7#11'FormDestroy'#10'OnShortCut'#7#13'FormShortCuts'#8'Positio' +#9'OnDestroy'#7#11'FormDestroy'#10'OnShortCut'#7#13'FormShortCuts'#8'Positio'
+'n'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#7'Visible'#9#0#8'TToolBa' +'n'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#7'Visible'#9#0#8'TToolBa'
@ -44,36 +44,36 @@ LazarusResources.Add('TForm1','FORMDATA',[
+'Save'#4'Left'#2'/'#4'Hint'#6#4'Save'#3'Top'#2#2#6'Action'#7#16'ActionSaveSc' +'Save'#4'Left'#2'/'#4'Hint'#6#4'Save'#3'Top'#2#2#6'Action'#7#16'ActionSaveSc'
+'ript'#0#0#11'TToolButton'#10'TB_SaveAll'#4'Left'#2'F'#4'Hint'#6#8'Save all' +'ript'#0#0#11'TToolButton'#10'TB_SaveAll'#4'Left'#2'F'#4'Hint'#6#8'Save all'
+#3'Top'#2#2#6'Action'#7#13'ActionSaveAll'#7'Enabled'#8#0#0#0#10'TStatusBar'#9 +#3'Top'#2#2#6'Action'#7#13'ActionSaveAll'#7'Enabled'#8#0#0#0#10'TStatusBar'#9
+'StatusBar'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#2#2#5'Width'#3#219#2#6'Panel' +'StatusBar'#4'Left'#2#0#6'Height'#2#21#3'Top'#3#255#1#5'Width'#3#219#2#6'Pan'
+'s'#14#1#5'Width'#2'<'#0#1#4'Text'#6#8'Untitled'#5'Width'#3#150#0#0#1#5'Widt' +'els'#14#1#5'Width'#2'<'#0#1#4'Text'#6#8'Untitled'#5'Width'#3#150#0#0#1#5'Wi'
+'h'#2'2'#0#0#11'SimplePanel'#8#0#0#6'TPanel'#9'PanelMemo'#4'Left'#2#0#6'Heig' +'dth'#2'2'#0#0#11'SimplePanel'#8#0#0#6'TPanel'#9'PanelMemo'#4'Left'#2#0#6'He'
+'ht'#3#154#0#3'Top'#3'h'#1#5'Width'#3#219#2#5'Align'#7#8'alBottom'#7'Anchors' +'ight'#3#151#0#3'Top'#3'h'#1#5'Width'#3#219#2#5'Align'#7#8'alBottom'#7'Ancho'
+#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#12'ClientHeight'#3#154#0#11 +'rs'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#12'ClientHeight'#3#151#0
+'ClientWidth'#3#219#2#8'TabOrder'#2#2#0#5'TMemo'#5'Memo1'#4'Left'#2#1#6'Heig' +#11'ClientWidth'#3#219#2#8'TabOrder'#2#2#0#5'TMemo'#5'Memo1'#4'Left'#2#1#6'H'
+'ht'#3#152#0#3'Top'#2#1#5'Width'#3#217#2#5'Align'#7#8'alClient'#7'Anchors'#11 +'eight'#3#149#0#3'Top'#2#1#5'Width'#3#217#2#5'Align'#7#8'alClient'#7'Anchors'
+#6'akLeft'#7'akRight'#8'akBottom'#0#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrd' +#11#6'akLeft'#7'akRight'#8'akBottom'#0#10'ScrollBars'#7#10'ssAutoBoth'#8'Tab'
+'er'#2#0#0#0#0#9'TSplitter'#19'SplitterMemoSynedit'#6'Cursor'#7#8'crVSplit'#4 +'Order'#2#0#0#0#0#9'TSplitter'#19'SplitterMemoSynedit'#6'Cursor'#7#8'crVSpli'
+'Left'#2#0#6'Height'#2#5#3'Top'#3'c'#1#5'Width'#3#219#2#5'Align'#7#8'alBotto' +'t'#4'Left'#2#0#6'Height'#2#5#3'Top'#3'c'#1#5'Width'#3#219#2#5'Align'#7#8'al'
+'m'#12'ResizeAnchor'#7#8'akBottom'#0#0#6'TPanel'#11'ScriptPanel'#4'Left'#2#0 +'Bottom'#12'ResizeAnchor'#7#8'akBottom'#0#0#6'TPanel'#11'ScriptPanel'#4'Left'
+#6'Height'#3'K'#1#3'Top'#2#24#5'Width'#3#219#2#5'Align'#7#8'alClient'#10'Bev' +#2#0#6'Height'#3'K'#1#3'Top'#2#24#5'Width'#3#219#2#5'Align'#7#8'alClient'#10
+'elOuter'#7#6'bvNone'#7'Caption'#6#11'ScriptPanel'#12'ClientHeight'#3'K'#1#11 +'BevelOuter'#7#6'bvNone'#7'Caption'#6#11'ScriptPanel'#12'ClientHeight'#3'K'#1
+'ClientWidth'#3#219#2#8'TabOrder'#2#4#0#12'TPageControl'#12'PageControl1'#4 +#11'ClientWidth'#3#219#2#8'TabOrder'#2#4#0#12'TPageControl'#12'PageControl1'
+'Left'#2#0#6'Height'#3'('#1#3'Top'#2#0#5'Width'#3#219#2#5'Align'#7#8'alClien' +#4'Left'#2#0#6'Height'#3'('#1#3'Top'#2#0#5'Width'#3#219#2#5'Align'#7#8'alCli'
+'t'#6'Images'#7#17'Mufasa_Image_List'#9'PopupMenu'#7#8'TabPopup'#8'TabOrder' +'ent'#6'Images'#7#17'Mufasa_Image_List'#9'PopupMenu'#7#8'TabPopup'#8'TabOrde'
+#2#0#8'OnChange'#7#18'PageControl1Change'#10'OnChanging'#7#20'PageControl1Ch' +'r'#2#0#8'OnChange'#7#18'PageControl1Change'#10'OnChanging'#7#20'PageControl'
+'anging'#14'OnContextPopup'#7#24'PageControl1ContextPopup'#10'OnDragDrop'#7 +'1Changing'#14'OnContextPopup'#7#24'PageControl1ContextPopup'#10'OnDragDrop'
+#20'PageControl1DragDrop'#10'OnDragOver'#7#20'PageControl1DragOver'#11'OnMou' +#7#20'PageControl1DragDrop'#10'OnDragOver'#7#20'PageControl1DragOver'#11'OnM'
+'seDown'#7#21'PageControl1MouseDown'#0#0#6'TPanel'#11'SearchPanel'#4'Left'#2 +'ouseDown'#7#21'PageControl1MouseDown'#0#0#6'TPanel'#11'SearchPanel'#4'Left'
+#0#6'Height'#2'#'#3'Top'#3'('#1#5'Width'#3#219#2#5'Align'#7#8'alBottom'#10'B' +#2#0#6'Height'#2'#'#3'Top'#3'('#1#5'Width'#3#219#2#5'Align'#7#8'alBottom'#10
,'evelOuter'#7#7'bvSpace'#12'ClientHeight'#2'#'#11'ClientWidth'#3#219#2#8'Tab' ,'BevelOuter'#7#7'bvSpace'#12'ClientHeight'#2'#'#11'ClientWidth'#3#219#2#8'Ta'
+'Order'#2#1#7'Visible'#8#0#12'TLabeledEdit'#17'LabeledEditSearch'#4'Left'#2 +'bOrder'#2#1#7'Visible'#8#0#12'TLabeledEdit'#17'LabeledEditSearch'#4'Left'#2
+'h'#6'Height'#2#21#3'Top'#2#6#5'Width'#3#174#0#10'AutoSelect'#8' EditLabel.A' +'h'#6'Height'#2#27#3'Top'#2#6#5'Width'#3#174#0#10'AutoSelect'#8' EditLabel.A'
+'nchorSideLeft.Control'#7#17'LabeledEditSearch'#31'EditLabel.AnchorSideTop.C' +'nchorSideLeft.Control'#7#17'LabeledEditSearch'#31'EditLabel.AnchorSideTop.C'
+'ontrol'#7#17'LabeledEditSearch'#28'EditLabel.AnchorSideTop.Side'#7#9'asrCen' +'ontrol'#7#17'LabeledEditSearch'#28'EditLabel.AnchorSideTop.Side'#7#9'asrCen'
+'ter!EditLabel.AnchorSideRight.Control'#7#17'LabeledEditSearch"EditLabel.Anc' +'ter!EditLabel.AnchorSideRight.Control'#7#17'LabeledEditSearch"EditLabel.Anc'
+'horSideBottom.Control'#7#17'LabeledEditSearch'#14'EditLabel.Left'#2'I'#16'E' +'horSideBottom.Control'#7#17'LabeledEditSearch'#14'EditLabel.Left'#2'A'#16'E'
+'ditLabel.Height'#2#14#13'EditLabel.Top'#2#9#15'EditLabel.Width'#2#28#17'Edi' +'ditLabel.Height'#2#18#13'EditLabel.Top'#2#10#15'EditLabel.Width'#2'$'#17'Ed'
+'tLabel.Caption'#6#6'Find: '#21'EditLabel.ParentColor'#8#13'LabelPosition'#7 +'itLabel.Caption'#6#6'Find: '#21'EditLabel.ParentColor'#8#13'LabelPosition'#7
+#6'lpLeft'#8'TabOrder'#2#0#8'OnChange'#7#16'EditSearchChange'#7'OnEnter'#7#22 +#6'lpLeft'#8'TabOrder'#2#0#8'OnChange'#7#16'EditSearchChange'#7'OnEnter'#7#22
+'LabeledEditSearchEnter'#6'OnExit'#7#21'LabeledEditSearchExit'#9'OnKeyDown'#7 +'LabeledEditSearchEnter'#6'OnExit'#7#21'LabeledEditSearchExit'#9'OnKeyDown'#7
+#24'LabeledEditSearchKeyDown'#10'OnKeyPress'#7#25'LabeledEditSearchKeyPress' +#24'LabeledEditSearchKeyDown'#10'OnKeyPress'#7#25'LabeledEditSearchKeyPress'
@ -144,7 +144,7 @@ LazarusResources.Add('TForm1','FORMDATA',[
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0 +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#9'NumGlyphs'#2#0#7'OnClick'#7#22'SpeedButto' +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#9'NumGlyphs'#2#0#7'OnClick'#7#22'SpeedButto'
+'nSearchClick'#0#0#9'TCheckBox'#17'CheckBoxMatchCase'#4'Left'#3'@'#1#6'Heigh' +'nSearchClick'#0#0#9'TCheckBox'#17'CheckBoxMatchCase'#4'Left'#3'@'#1#6'Heigh'
+'t'#2#17#3'Top'#2#6#5'Width'#2'H'#7'Caption'#6#10'Match case'#7'OnClick'#7#22 +'t'#2#22#3'Top'#2#6#5'Width'#2'b'#7'Caption'#6#10'Match case'#7'OnClick'#7#22
+'CheckBoxMatchCaseClick'#8'TabOrder'#2#1#0#0#0#0#9'TMainMenu'#9'MainMenu1'#4 +'CheckBoxMatchCaseClick'#8'TabOrder'#2#1#0#0#0#0#9'TMainMenu'#9'MainMenu1'#4
+'left'#3#16#2#0#9'TMenuItem'#8'MenuFile'#7'Caption'#6#4'File'#13'SubMenuImag' +'left'#3#16#2#0#9'TMenuItem'#8'MenuFile'#7'Caption'#6#4'File'#13'SubMenuImag'
+'es'#7#17'Mufasa_Image_List'#0#9'TMenuItem'#11'MenuItemNew'#6'Action'#7#15'A' +'es'#7#17'Mufasa_Image_List'#0#9'TMenuItem'#11'MenuItemNew'#6'Action'#7#15'A'

View File

@ -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);