mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 00:28:18 +02:00
cody: dictionary: option to add units to implementation uses section
git-svn-id: trunk@34164 -
This commit is contained in:
parent
947ce90ff5
commit
21848dbdaa
@ -1,12 +1,12 @@
|
||||
object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
Left = 250
|
||||
Height = 305
|
||||
Height = 324
|
||||
Top = 250
|
||||
Width = 543
|
||||
Width = 552
|
||||
ActiveControl = FilterEdit
|
||||
Caption = 'CodyIdentifiersDlg'
|
||||
ClientHeight = 305
|
||||
ClientWidth = 543
|
||||
ClientHeight = 324
|
||||
ClientWidth = 552
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
@ -14,8 +14,8 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 42
|
||||
Top = 257
|
||||
Width = 531
|
||||
Top = 276
|
||||
Width = 540
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -45,7 +45,7 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 63
|
||||
Width = 531
|
||||
Width = 540
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 10
|
||||
@ -64,9 +64,9 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = UnitLabel
|
||||
Left = 6
|
||||
Height = 126
|
||||
Height = 120
|
||||
Top = 89
|
||||
Width = 531
|
||||
Width = 540
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
@ -74,7 +74,7 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
ItemHeight = 0
|
||||
OnClick = ItemsListBoxClick
|
||||
OnSelectionChange = ItemsListBoxSelectionChange
|
||||
ScrollWidth = 529
|
||||
ScrollWidth = 538
|
||||
TabOrder = 2
|
||||
TopIndex = -1
|
||||
end
|
||||
@ -83,7 +83,7 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
AnchorSideBottom.Control = PackageLabel
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 216
|
||||
Top = 210
|
||||
Width = 59
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 1
|
||||
@ -92,10 +92,10 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
end
|
||||
object PackageLabel: TLabel
|
||||
AnchorSideLeft.Control = InfoLabel
|
||||
AnchorSideBottom.Control = ButtonPanel1
|
||||
AnchorSideBottom.Control = AddToImplementationUsesCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 234
|
||||
Top = 228
|
||||
Width = 84
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 1
|
||||
@ -115,4 +115,19 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
||||
OnChange = HideOtherProjectsCheckBoxChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object AddToImplementationUsesCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = PackageLabel
|
||||
AnchorSideBottom.Control = ButtonPanel1
|
||||
Left = 8
|
||||
Height = 22
|
||||
Top = 248
|
||||
Width = 246
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Bottom = 3
|
||||
Caption = 'AddToImplementationUsesCheckBox'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
|
@ -69,6 +69,7 @@ type
|
||||
private
|
||||
FLoadAfterStartInS: integer;
|
||||
FLoadSaveError: string;
|
||||
FPreferImplementationUsesSection: boolean;
|
||||
FSaveIntervalInS: integer;
|
||||
fTimer: TTimer;
|
||||
FIdleConnected: boolean;
|
||||
@ -105,6 +106,8 @@ type
|
||||
procedure EndCritSec;
|
||||
procedure CheckFileAsync(aFilename: string); // check eventually if file exists and delete unit/group
|
||||
property LoadSaveError: string read FLoadSaveError write SetLoadSaveError;
|
||||
property PreferImplementationUsesSection: boolean
|
||||
read FPreferImplementationUsesSection write FPreferImplementationUsesSection;
|
||||
end;
|
||||
|
||||
TCodyIdentifierDlgAction = (
|
||||
@ -115,6 +118,7 @@ type
|
||||
{ TCodyIdentifiersDlg }
|
||||
|
||||
TCodyIdentifiersDlg = class(TForm)
|
||||
AddToImplementationUsesCheckBox: TCheckBox;
|
||||
ButtonPanel1: TButtonPanel;
|
||||
FilterEdit: TEdit;
|
||||
HideOtherProjectsCheckBox: TCheckBox;
|
||||
@ -169,6 +173,7 @@ type
|
||||
CurSrcEdit: TSourceEditorInterface;
|
||||
CurMainFilename: string; // if CurSrcEdit is an include file, then CurMainFilename<>CurSrcEdit.Filename
|
||||
CurMainCode: TCodeBuffer;
|
||||
CurInImplementation: Boolean;
|
||||
|
||||
CurOwner: TObject;
|
||||
CurUnitPath: String; // depends on CurOwner
|
||||
@ -635,6 +640,8 @@ end;
|
||||
procedure TCodyIdentifiersDlg.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
CodyUnitDictionary.PreferImplementationUsesSection:=
|
||||
AddToImplementationUsesCheckBox.Checked;
|
||||
FreeAndNil(FItems);
|
||||
end;
|
||||
|
||||
@ -648,6 +655,10 @@ begin
|
||||
FItems:=TStringList.Create;
|
||||
HideOtherProjectsCheckBox.Checked:=true;
|
||||
HideOtherProjectsCheckBox.Caption:=crsHideUnitsOfOtherProjects;
|
||||
AddToImplementationUsesCheckBox.Caption:=
|
||||
lisAddUnitToImplementationUsesSection;
|
||||
AddToImplementationUsesCheckBox.Hint:=
|
||||
lisIfIdentifierIsAddedToTheImplementationSectionAndNe;
|
||||
|
||||
FJumpButton:=AddButton;
|
||||
FJumpButton.Name:='JumpButton';
|
||||
@ -914,6 +925,13 @@ begin
|
||||
if CurIdentStart<CurIdentEnd then
|
||||
CurIdentifier:=copy(Line,CurIdentStart,CurIdentEnd-CurIdentStart);
|
||||
end;
|
||||
CurInImplementation:=false;
|
||||
if (CurNode<>nil) and (CurTool.FindImplementationNode.StartPos<=CurNode.StartPos)
|
||||
then
|
||||
CurInImplementation:=true;
|
||||
AddToImplementationUsesCheckBox.Enabled:=CurInImplementation;
|
||||
AddToImplementationUsesCheckBox.Checked:=
|
||||
CodyUnitDictionary.PreferImplementationUsesSection;
|
||||
|
||||
CurSrcEdit:=SourceEditorManagerIntf.ActiveEditor;
|
||||
if CurTool<>nil then begin
|
||||
@ -1259,6 +1277,7 @@ var
|
||||
NewUnitCode: TCodeBuffer;
|
||||
NewUnitName: String;
|
||||
CurUnitName: String;
|
||||
UsesNode: TCodeTreeNode;
|
||||
begin
|
||||
if (CurTool=nil) or (NewUnitFilename='') then exit;
|
||||
UpdateTool;
|
||||
@ -1279,9 +1298,22 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
// check if already in uses section
|
||||
UsesNode:=CurTool.FindMainUsesSection;
|
||||
if (UsesNode<>nil) and (CurTool.FindNameInUsesSection(UsesNode,NewUnitName)<>nil)
|
||||
then exit;
|
||||
if CurInImplementation then begin
|
||||
UsesNode:=CurTool.FindImplementationUsesSection;
|
||||
if (UsesNode<>nil) and (CurTool.FindNameInUsesSection(UsesNode,NewUnitName)<>nil)
|
||||
then exit;
|
||||
end;
|
||||
|
||||
// add to uses section
|
||||
debugln(['TCodyIdentifiersDlg.AddToUsesSection adding to uses section']);
|
||||
CodeToolBoss.AddUnitToMainUsesSection(CurMainCode,NewUnitName,'');
|
||||
if CurInImplementation and AddToImplementationUsesCheckBox.Checked then
|
||||
CodeToolBoss.AddUnitToImplementationUsesSection(CurMainCode,NewUnitName,'')
|
||||
else
|
||||
CodeToolBoss.AddUnitToMainUsesSection(CurMainCode,NewUnitName,'');
|
||||
end;
|
||||
|
||||
procedure TCodyIdentifiersDlg.UpdateTool;
|
||||
|
@ -165,6 +165,11 @@ resourcestring
|
||||
crsRefresh = 'Refresh';
|
||||
crsFilter = '(Filter)';
|
||||
crsHideUnitsOfOtherProjects = 'Hide units of other projects';
|
||||
lisAddUnitToImplementationUsesSection = 'Add unit to implementation uses '
|
||||
+'section';
|
||||
lisIfIdentifierIsAddedToTheImplementationSectionAndNe = 'If identifier is '
|
||||
+'added to the implementation section and needed unit needs to be added, '
|
||||
+'add to the uses section of the implementation';
|
||||
crsJumpTo = 'Jump to';
|
||||
crsUseIdentifier = 'Use identifier';
|
||||
crsAndMoreIdentifiers = '... and %s more identifiers';
|
||||
|
@ -585,6 +585,10 @@ msgstr ""
|
||||
msgid "Where"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
@ -593,3 +597,7 @@ msgstr ""
|
||||
msgid "Uses path"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
@ -592,6 +592,10 @@ msgstr "Unit virtuale"
|
||||
msgid "Where"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr "Generale"
|
||||
@ -600,3 +604,7 @@ msgstr "Generale"
|
||||
msgid "Uses path"
|
||||
msgstr "Cammino clausola uses"
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
@ -577,6 +577,10 @@ msgstr ""
|
||||
msgid "Where"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
@ -585,3 +589,7 @@ msgstr ""
|
||||
msgid "Uses path"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
@ -598,6 +598,10 @@ msgstr "Unidade Virtual"
|
||||
msgid "Where"
|
||||
msgstr "Where"
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr "Geral"
|
||||
@ -606,3 +610,7 @@ msgstr "Geral"
|
||||
msgid "Uses path"
|
||||
msgstr "Caminho \"uses\""
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
@ -599,6 +599,10 @@ msgstr "Виртуальный модуль"
|
||||
msgid "Where"
|
||||
msgstr "Расположение"
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr "Общие"
|
||||
@ -607,3 +611,7 @@ msgstr "Общие"
|
||||
msgid "Uses path"
|
||||
msgstr "Цепочка Uses"
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
@ -605,6 +605,10 @@ msgstr "Віртуальний модуль"
|
||||
msgid "Where"
|
||||
msgstr "Розміщення"
|
||||
|
||||
#: codystrconsts.lisaddunittoimplementationusessection
|
||||
msgid "Add unit to implementation uses section"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.liscogeneral
|
||||
msgid "General"
|
||||
msgstr "Загальні"
|
||||
@ -613,3 +617,7 @@ msgstr "Загальні"
|
||||
msgid "Uses path"
|
||||
msgstr "Шлях Uses"
|
||||
|
||||
#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne
|
||||
msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation"
|
||||
msgstr ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user