IDE: "Rename Identifier": show replaced lines in result. Made optional

git-svn-id: trunk@39571 -
This commit is contained in:
martin 2012-12-17 15:26:04 +00:00
parent ebf47da8a1
commit d03f885981
5 changed files with 57 additions and 26 deletions

View File

@ -17,19 +17,19 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
LCLVersion = '1.1'
object CurrentGroupBox: TGroupBox
Left = 6
Height = 114
Height = 121
Top = 6
Width = 448
Align = alClient
BorderSpacing.Around = 6
Caption = 'CurrentGroupBox'
ClientHeight = 97
ClientHeight = 103
ClientWidth = 444
Constraints.MinHeight = 100
TabOrder = 0
object CurrentListBox: TListBox
Left = 6
Height = 85
Height = 91
Top = 6
Width = 432
Align = alClient
@ -38,34 +38,38 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
ItemHeight = 0
ScrollWidth = 430
TabOrder = 0
TopIndex = -1
end
end
object NewGroupBox: TGroupBox
Left = 6
Height = 84
Top = 126
Height = 103
Top = 133
Width = 448
Align = alBottom
AutoSize = True
BorderSpacing.Around = 6
Caption = 'NewGroupBox'
ClientHeight = 67
ClientHeight = 85
ClientWidth = 444
TabOrder = 1
object NewEdit: TEdit
AnchorSideLeft.Control = NewGroupBox
AnchorSideTop.Control = ShowResultCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = NewGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 25
Top = 36
Height = 23
Top = 56
Width = 432
Align = alTop
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 0
Text = 'NewEdit'
end
object RenameCheckBox: TCheckBox
Left = 6
Height = 24
Height = 19
Top = 6
Width = 432
Align = alTop
@ -74,23 +78,38 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
OnChange = RenameCheckBoxChange
TabOrder = 1
end
object ShowResultCheckBox: TCheckBox
AnchorSideLeft.Control = NewGroupBox
AnchorSideTop.Control = RenameCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = NewGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 31
Width = 432
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'ShowResultCheckBox'
TabOrder = 2
end
end
object ScopeGroupBox: TGroupBox
Left = 6
Height = 244
Top = 216
Height = 220
Top = 242
Width = 448
Align = alBottom
AutoSize = True
BorderSpacing.Around = 6
Caption = 'ScopeGroupBox'
ClientHeight = 227
ClientHeight = 202
ClientWidth = 444
TabOrder = 2
object ScopeCommentsCheckBox: TCheckBox
Left = 6
Height = 24
Top = 197
Height = 19
Top = 177
Width = 432
Align = alTop
BorderSpacing.Around = 6
@ -99,7 +118,7 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
end
object ScopeRadioGroup: TRadioGroup
Left = 6
Height = 125
Height = 106
Top = 6
Width = 432
Align = alTop
@ -115,7 +134,7 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 108
ClientHeight = 88
ClientWidth = 428
Items.Strings = (
'in current unit'
@ -127,19 +146,19 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
end
object ExtraFilesGroupBox: TGroupBox
Left = 6
Height = 54
Top = 137
Height = 53
Top = 118
Width = 432
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'ExtraFilesGroupBox'
ClientHeight = 37
ClientHeight = 35
ClientWidth = 428
TabOrder = 2
object ExtraFilesEdit: TEdit
Left = 6
Height = 25
Height = 23
Top = 6
Width = 416
Align = alTop
@ -151,8 +170,8 @@ object FindRenameIdentifierDialog: TFindRenameIdentifierDialog
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 28
Top = 466
Height = 26
Top = 468
Width = 448
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True

View File

@ -46,6 +46,7 @@ type
TFindRenameIdentifierDialog = class(TForm)
ButtonPanel1: TButtonPanel;
ShowResultCheckBox: TCheckBox;
CurrentGroupBox: TGroupBox;
CurrentListBox: TListBox;
ExtraFilesEdit: TEdit;
@ -146,6 +147,8 @@ begin
FindRenameIdentifierDialog.SetIdentifier(Filename,Position);
FindRenameIdentifierDialog.AllowRename:=AllowRename;
FindRenameIdentifierDialog.RenameCheckBox.Checked:=SetRenameActive and AllowRename;
if Options<>nil then
FindRenameIdentifierDialog.ShowResultCheckBox.Checked:=Options.RenameShowResult and AllowRename;
Result:=FindRenameIdentifierDialog.ShowModal;
if Result=mrOk then
if Options<>nil then
@ -525,6 +528,7 @@ begin
ButtonPanel1.CancelButton.Caption:=lisCancel;
NewGroupBox.Caption:=lisFRIRenameTo;
RenameCheckBox.Caption:=lisRename;
RenameCheckBox.Caption:=lisRenameShowResult;
ScopeCommentsCheckBox.Caption:=lisFRISearchInCommentsToo;
ScopeGroupBox.Caption:=lisFRISearchWhere;
ScopeRadioGroup.Caption:=dlgScope;
@ -554,6 +558,7 @@ procedure TFindRenameIdentifierDialog.UpdateRename;
begin
RenameCheckBox.Enabled:=AllowRename;
NewEdit.Enabled:=RenameCheckBox.Checked and RenameCheckBox.Enabled;
ShowResultCheckBox.Enabled:=RenameCheckBox.Checked and RenameCheckBox.Enabled;
if NewEdit.Enabled then
ButtonPanel1.OKButton.Caption:=lisFRIRenameAllReferences
else
@ -614,6 +619,7 @@ begin
RenameCheckBox.Checked:=Options.Rename;
ExtraFilesEdit.Text:=StringListToText(Options.ExtraFiles,';',true);
NewEdit.Text:=Options.RenameTo;
ShowResultCheckBox.Checked:=Options.RenameShowResult;
ScopeCommentsCheckBox.Checked:=Options.SearchInComments;
case Options.Scope of
frCurrentUnit: ScopeRadioGroup.ItemIndex:=0;
@ -632,6 +638,7 @@ begin
if ExtraFilesGroupBox.Enabled then
SplitString(ExtraFilesEdit.Text,';',Options.ExtraFiles,true);
Options.RenameTo:=NewEdit.Text;
Options.RenameShowResult := ShowResultCheckBox.Checked;
Options.SearchInComments:=ScopeCommentsCheckBox.Checked;
if ScopeRadioGroup.Enabled then
case ScopeRadioGroup.ItemIndex of

View File

@ -51,6 +51,7 @@ resourcestring
lisRemove = 'Remove';
lisBtnRemove = '&Remove';
lisRename = 'Rename';
lisRenameShowResult = 'Show list of renamed Identifiers';
lisReplace = 'Replace';
lisBtnReplace = '&Replace';
lisBtnDlgReplace = '&Replace ...';

View File

@ -10742,8 +10742,9 @@ begin
finally
OpenEditorsOnCodeToolChange:=OldChange;
end;
Result:=ShowIdentifierReferences(DeclarationUnitInfo.Source,
DeclarationCaretXY,PascalReferences);
if Options.RenameShowResult then
Result:=ShowIdentifierReferences(DeclarationUnitInfo.Source,
DeclarationCaretXY,PascalReferences);
end;
// show result

View File

@ -50,6 +50,7 @@ type
Rename: boolean;
RenameTo: string;
SearchInComments: boolean;
RenameShowResult: boolean;
Scope: TFindRenameScope;
ExtraFiles: TStrings;
constructor Create;
@ -292,6 +293,7 @@ begin
Rename:=XMLConfig.GetValue(Path+'Rename/Value',false);
RenameTo:=XMLConfig.GetValue(Path+'Rename/Identifier','');
SearchInComments:=XMLConfig.GetValue(Path+'SearchInComments/Value',true);
RenameShowResult:=XMLConfig.GetValue(Path+'RenameShowResult/Value',true);
Scope:=FindRenameScopeNameToScope(XMLConfig.GetValue(Path+'Scope/Value',
FindRenameScopeNames[frAllOpenProjectsAndPackages]));
LoadStringList(XMLConfig,ExtraFiles,Path+'ExtraFiles/');
@ -305,6 +307,7 @@ begin
XMLConfig.SetDeleteValue(Path+'Rename/Value',Rename,false);
XMLConfig.SetDeleteValue(Path+'Rename/Identifier',RenameTo,'');
XMLConfig.SetDeleteValue(Path+'SearchInComments/Value',SearchInComments,true);
XMLConfig.SetDeleteValue(Path+'RenameShowResult/Value',RenameShowResult,true);
XMLConfig.SetDeleteValue(Path+'Scope/Value',FindRenameScopeNames[Scope],
FindRenameScopeNames[frAllOpenProjectsAndPackages]);
SaveStringList(XMLConfig,ExtraFiles,Path+'ExtraFiles/');