mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 23:19:50 +02:00
Cody/Dictionary: Ability to temporarily show more identifiers in the list
This commit is contained in:
parent
bdef51f335
commit
69aa026bac
@ -68,9 +68,12 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
|
|||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.Bottom = 1
|
BorderSpacing.Bottom = 1
|
||||||
|
ClickOnSelChange = False
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
|
OnClick = ItemsListBoxClick
|
||||||
OnContextPopup = ItemsListBoxContextPopup
|
OnContextPopup = ItemsListBoxContextPopup
|
||||||
OnDblClick = ItemsListBoxDblClick
|
OnDblClick = ItemsListBoxDblClick
|
||||||
|
OnKeyDown = ItemsListBoxKeyDown
|
||||||
OnSelectionChange = ItemsListBoxSelectionChange
|
OnSelectionChange = ItemsListBoxSelectionChange
|
||||||
PopupMenu = PopupMenu1
|
PopupMenu = PopupMenu1
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
|
@ -172,6 +172,9 @@ type
|
|||||||
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure HideOtherProjectsCheckBoxChange(Sender: TObject);
|
procedure HideOtherProjectsCheckBoxChange(Sender: TObject);
|
||||||
|
procedure ItemsListBoxKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
procedure ItemsListBoxClick(Sender: TObject);
|
||||||
procedure ItemsListBoxDblClick(Sender: TObject);
|
procedure ItemsListBoxDblClick(Sender: TObject);
|
||||||
procedure ItemsListBoxSelectionChange(Sender: TObject; {%H-}User: boolean);
|
procedure ItemsListBoxSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||||
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
||||||
@ -956,6 +959,9 @@ begin
|
|||||||
ItemsListBox.ItemIndex:=i-1;
|
ItemsListBox.ItemIndex:=i-1;
|
||||||
Key := 0;
|
Key := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Key <> 0 then
|
||||||
|
ItemsListBoxKeyDown(Sender, Key, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodyIdentifiersDlg.FormDestroy(Sender: TObject);
|
procedure TCodyIdentifiersDlg.FormDestroy(Sender: TObject);
|
||||||
@ -1014,6 +1020,32 @@ begin
|
|||||||
IdleConnected:=true;
|
IdleConnected:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCodyIdentifiersDlg.ItemsListBoxKeyDown(Sender: TObject;
|
||||||
|
var Key: Word; Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
if (Key = VK_RETURN) and (Shift = []) then
|
||||||
|
begin
|
||||||
|
if FindSelectedIdentifier = nil then
|
||||||
|
begin
|
||||||
|
MaxItems := MaxItems + CodyOptions.UDMaxListItems;
|
||||||
|
Key := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCodyIdentifiersDlg.ItemsListBoxClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
lClickPos: TPoint;
|
||||||
|
begin
|
||||||
|
// ignore clicks in empty area
|
||||||
|
lClickPos := ItemsListBox.ScreenToClient(Mouse.CursorPos);
|
||||||
|
if ItemsListBox.ItemAtPos(lClickPos, true) < 0 then exit;
|
||||||
|
|
||||||
|
// if a special item "show more" is clicked
|
||||||
|
if (ItemsListBox.ItemIndex >= 0) and (FindSelectedIdentifier = nil) then
|
||||||
|
MaxItems := MaxItems + CodyOptions.UDMaxListItems;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCodyIdentifiersDlg.ItemsListBoxDblClick(Sender: TObject);
|
procedure TCodyIdentifiersDlg.ItemsListBoxDblClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
lClickPos: TPoint;
|
lClickPos: TPoint;
|
||||||
@ -1243,8 +1275,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
sl.Add(s);
|
sl.Add(s);
|
||||||
end;
|
end;
|
||||||
if Found>sl.Count then
|
if Found > sl.Count then
|
||||||
sl.Add(Format(crsAndMoreIdentifiers, [IntToStr(Found-sl.Count)]));
|
begin
|
||||||
|
if Found - sl.Count > CodyOptions.UDMaxListItems then
|
||||||
|
sl.Add(Format(crsShowMoreIdentifiers, [CodyOptions.UDMaxListItems, Found - sl.Count]))
|
||||||
|
else
|
||||||
|
sl.Add(Format(crsShowRemainingIdentifiers, [Found - sl.Count]));
|
||||||
|
end;
|
||||||
|
|
||||||
ItemsListBox.Items.Assign(sl);
|
ItemsListBox.Items.Assign(sl);
|
||||||
if Found>0 then
|
if Found>0 then
|
||||||
|
@ -182,7 +182,8 @@ resourcestring
|
|||||||
crsShowOnlyIdentifiersContainingFilterText = 'Show only identifiers '
|
crsShowOnlyIdentifiersContainingFilterText = 'Show only identifiers '
|
||||||
+'containing filter text';
|
+'containing filter text';
|
||||||
crsUseIdentifier = '&Use identifier';
|
crsUseIdentifier = '&Use identifier';
|
||||||
crsAndMoreIdentifiers = '... and %s more identifiers';
|
crsShowMoreIdentifiers = '... click to show %d more (up to %d left)';
|
||||||
|
crsShowRemainingIdentifiers = '... click to show remaining (up to %d left)';
|
||||||
crsContextUseIdentifier = 'Use "%s"';
|
crsContextUseIdentifier = 'Use "%s"';
|
||||||
crsContextJumpTo = 'Jump to "%s"';
|
crsContextJumpTo = 'Jump to "%s"';
|
||||||
crsContextDeleteUnit = 'Delete unit "%s"';
|
crsContextDeleteUnit = 'Delete unit "%s"';
|
||||||
|
Loading…
Reference in New Issue
Block a user