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