mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 12:29:30 +02:00
IDE: improved View units dialog. patch by Flavio Etrusco. fixes #15751
git-svn-id: trunk@25658 -
This commit is contained in:
parent
bee80b1936
commit
11d073d94e
@ -3,162 +3,67 @@ object ViewUnitDialog: TViewUnitDialog
|
||||
Height = 301
|
||||
Top = 280
|
||||
Width = 378
|
||||
HelpContext = 0
|
||||
ActiveControl = Edit
|
||||
Align = alNone
|
||||
AllowDropFiles = False
|
||||
AutoScroll = True
|
||||
AutoSize = False
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSizeable
|
||||
Caption = 'View Project Units'
|
||||
ChildSizing.LeftRightSpacing = 0
|
||||
ChildSizing.TopBottomSpacing = 0
|
||||
ChildSizing.HorizontalSpacing = 0
|
||||
ChildSizing.VerticalSpacing = 0
|
||||
ChildSizing.ControlsPerLine = 0
|
||||
ClientHeight = 301
|
||||
ClientWidth = 378
|
||||
DockSite = False
|
||||
DragKind = dkDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
Font.Height = 0
|
||||
Font.Style = []
|
||||
FormStyle = fsNormal
|
||||
ParentBiDiMode = True
|
||||
ParentFont = False
|
||||
Position = poScreenCenter
|
||||
ShowInTaskBar = stDefault
|
||||
UseDockManager = False
|
||||
LCLVersion = '0.9.27'
|
||||
WindowState = wsNormal
|
||||
LCLVersion = '0.9.29'
|
||||
object Edit: TEdit
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 366
|
||||
HelpContext = 0
|
||||
Align = alTop
|
||||
Anchors = [akRight]
|
||||
Anchors = [akLeft]
|
||||
AutoSize = False
|
||||
AutoSelect = False
|
||||
BorderSpacing.Left = 0
|
||||
BorderSpacing.Top = 0
|
||||
BorderSpacing.Right = 0
|
||||
BorderSpacing.Bottom = 0
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||
BorderSpacing.CellAlignVertical = ccaFill
|
||||
CharCase = ecNormal
|
||||
DragCursor = crDrag
|
||||
DragMode = dmManual
|
||||
EchoMode = emNormal
|
||||
Enabled = True
|
||||
MaxLength = -1
|
||||
ParentBidiMode = True
|
||||
OnChange = EditChange
|
||||
OnEnter = EditEnter
|
||||
OnKeyDown = EditKeyDown
|
||||
ParentFont = True
|
||||
ParentShowHint = True
|
||||
PasswordChar = #0
|
||||
ReadOnly = False
|
||||
TabStop = True
|
||||
TabOrder = 1
|
||||
Visible = True
|
||||
end
|
||||
object Listbox: TListBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = MultiSelectCheckBox
|
||||
Left = 6
|
||||
Height = 182
|
||||
Height = 212
|
||||
Top = 37
|
||||
Width = 366
|
||||
HelpContext = 0
|
||||
Align = alClient
|
||||
Anchors = [akBottom]
|
||||
BorderSpacing.Left = 0
|
||||
BorderSpacing.Top = 0
|
||||
BorderSpacing.Right = 0
|
||||
BorderSpacing.Bottom = 0
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||
BorderSpacing.CellAlignVertical = ccaFill
|
||||
BorderStyle = bsSingle
|
||||
ClickOnSelChange = False
|
||||
Columns = 0
|
||||
DragCursor = crDrag
|
||||
DragKind = dkDrag
|
||||
DragMode = dmManual
|
||||
ExtendedSelect = True
|
||||
Enabled = True
|
||||
IntegralHeight = False
|
||||
ItemHeight = 0
|
||||
MultiSelect = False
|
||||
OnClick = ListboxClick
|
||||
OnDblClick = OKButtonClick
|
||||
OnKeyDown = ListboxKeyDown
|
||||
ParentBidiMode = True
|
||||
ParentShowHint = True
|
||||
ParentFont = True
|
||||
Sorted = False
|
||||
Style = lbStandard
|
||||
PopupMenu = popListBox
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
TopIndex = -1
|
||||
Visible = True
|
||||
end
|
||||
object MultiSelectCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 225
|
||||
Width = 366
|
||||
HelpContext = 0
|
||||
Align = alBottom
|
||||
AllowGrayed = False
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 0
|
||||
BorderSpacing.Top = 0
|
||||
BorderSpacing.Right = 0
|
||||
BorderSpacing.Bottom = 0
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||
BorderSpacing.CellAlignVertical = ccaFill
|
||||
Caption = 'Multi Select'
|
||||
Checked = False
|
||||
DragCursor = crDrag
|
||||
DragKind = dkDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
OnClick = MultiselectCheckBoxClick
|
||||
ParentColor = True
|
||||
ParentFont = True
|
||||
ParentShowHint = True
|
||||
ParentBidiMode = True
|
||||
State = cbUnchecked
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
UseOnChange = False
|
||||
Visible = True
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 48
|
||||
Top = 253
|
||||
Height = 40
|
||||
Top = 255
|
||||
Width = 366
|
||||
HelpContext = 0
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
ButtonOrder = boDefault
|
||||
TabOrder = 3
|
||||
DefaultButton = pbOK
|
||||
TabOrder = 2
|
||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||
ShowGlyphs = [pbOK, pbCancel, pbClose, pbHelp]
|
||||
Visible = True
|
||||
end
|
||||
object popListBox: TPopupMenu
|
||||
left = 144
|
||||
top = 112
|
||||
object mniMultiSelect: TMenuItem
|
||||
AutoCheck = True
|
||||
Caption = 'Multi Select'
|
||||
OnClick = MultiselectCheckBoxClick
|
||||
end
|
||||
object mniSort: TMenuItem
|
||||
Caption = 'Sort'
|
||||
OnClick = mniSortClick
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
uses
|
||||
SysUtils, Classes, Math, Controls, Forms, Dialogs, Buttons, StdCtrls,
|
||||
LazarusIdeStrConsts, LCLType, LCLIntf, LMessages, IDEWindowIntf, IDEContextHelpEdit,
|
||||
ExtCtrls, ButtonPanel;
|
||||
ExtCtrls, ButtonPanel, Menus, StrUtils;
|
||||
|
||||
type
|
||||
TViewUnitsEntry = class
|
||||
@ -58,11 +58,14 @@ type
|
||||
ButtonPanel: TButtonPanel;
|
||||
Edit: TEdit;
|
||||
ListBox: TListBox;
|
||||
MultiSelectCheckBox: TCheckBox;
|
||||
mniMultiSelect: TMenuItem;
|
||||
mniSort: TMenuItem;
|
||||
popListBox: TPopupMenu;
|
||||
procedure EditChange(Sender: TObject);
|
||||
procedure EditEnter(Sender: TObject);
|
||||
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
procedure mniSortClick(Sender: TObject);
|
||||
Procedure OKButtonClick(Sender :TObject);
|
||||
Procedure CancelButtonClick(Sender :TObject);
|
||||
procedure ListboxClick(Sender: TObject);
|
||||
@ -93,9 +96,9 @@ begin
|
||||
ViewUnitDialog:=TViewUnitDialog.Create(nil);
|
||||
try
|
||||
ViewUnitDialog.Caption:=Caption;
|
||||
ViewUnitDialog.MultiselectCheckBox.Enabled := AllowMultiSelect;
|
||||
ViewUnitDialog.MultiselectCheckBox.Checked := CheckMultiSelect;
|
||||
ViewUnitDialog.ListBox.MultiSelect:=ViewUnitDialog.MultiselectCheckBox.Checked;
|
||||
ViewUnitDialog.mniMultiselect.Enabled := AllowMultiSelect;
|
||||
ViewUnitDialog.mniMultiselect.Checked := CheckMultiSelect;
|
||||
ViewUnitDialog.ListBox.MultiSelect := ViewUnitDialog.mniMultiselect.Enabled;
|
||||
with ViewUnitDialog.ListBox.Items do begin
|
||||
BeginUpdate;
|
||||
Clear;
|
||||
@ -110,7 +113,7 @@ begin
|
||||
for i:=0 to Entries.Count-1 do begin
|
||||
TViewUnitsEntry(Entries.Objects[i]).Selected:=ViewUnitDialog.ListBox.Selected[i];
|
||||
end;
|
||||
CheckMultiSelect := ViewUnitDialog.MultiselectCheckBox.Checked;
|
||||
CheckMultiSelect := ViewUnitDialog.mniMultiselect.Checked;
|
||||
end;
|
||||
finally
|
||||
ViewUnitDialog.Free;
|
||||
@ -123,9 +126,9 @@ var
|
||||
begin
|
||||
// Items can be unsorted => use simple traverse
|
||||
Result := -1;
|
||||
Text := LowerCase(Text);
|
||||
Text := AnsiLowerCase(Text);
|
||||
for i := StartIndex +1 to Items.Count - 1 do
|
||||
if Pos(Text, LowerCase(Items[i])) >= 1 then
|
||||
if AnsiContainsText(Items[i], Text) then
|
||||
begin
|
||||
Result := i;
|
||||
break;
|
||||
@ -149,7 +152,7 @@ constructor TViewUnitDialog.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
IDEDialogLayoutList.ApplyLayout(Self,450,300);
|
||||
MultiSelectCheckBox.Caption := dlgMultiSelect;
|
||||
mniMultiSelect.Caption := dlgMultiSelect;
|
||||
|
||||
ButtonPanel.OKButton.OnClick := @OKButtonClick;
|
||||
ButtonPanel.CancelButton.OnClick := @CancelButtonClick;
|
||||
@ -167,6 +170,44 @@ begin
|
||||
ShowContextHelpForIDE(Self);
|
||||
end;
|
||||
|
||||
procedure TViewUnitDialog.mniSortClick(Sender: TObject);
|
||||
var
|
||||
TmpList: TStringList;
|
||||
i: Integer;
|
||||
SelName: String;
|
||||
begin
|
||||
TmpList := TStringList.Create;
|
||||
try
|
||||
TmpList.Assign(ListBox.Items);
|
||||
if ListBox.MultiSelect then
|
||||
begin
|
||||
for i := 0 to ListBox.Count -1 do
|
||||
if ListBox.Selected[i] then
|
||||
TmpList.Objects[i] := TObject(-1);
|
||||
end;
|
||||
TmpList.Sort;
|
||||
if ListBox.ItemIndex >= 0 then
|
||||
SelName := ListBox.Items[ListBox.ItemIndex]
|
||||
else
|
||||
SelName := '';
|
||||
ListBox.Items := TmpList;
|
||||
if SelName <> '' then
|
||||
begin
|
||||
ListBox.ItemIndex := TmpList.IndexOf(SelName);
|
||||
ListBox.MakeCurrentVisible;
|
||||
end;
|
||||
if ListBox.MultiSelect then
|
||||
begin
|
||||
ListBox.ClearSelection;
|
||||
for i := 0 to TmpList.Count -1 do
|
||||
if TmpList.Objects[i] <> nil then
|
||||
ListBox.Selected[i] := True;
|
||||
end;
|
||||
finally
|
||||
TmpList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TViewUnitDialog.EditKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
|
||||
@ -190,7 +231,12 @@ procedure TViewUnitDialog.EditKeyDown(Sender: TObject; var Key: Word;
|
||||
begin
|
||||
case Key of
|
||||
VK_UP: MoveItemIndex(-1);
|
||||
VK_DOWN: MoveItemIndex(1);
|
||||
VK_DOWN:
|
||||
begin
|
||||
MoveItemIndex(1);
|
||||
// Avoid switching to next control in TabOrder in gtk2
|
||||
Key := 0;
|
||||
end;
|
||||
VK_NEXT: MoveItemIndex(PageCount);
|
||||
VK_PRIOR: MoveItemIndex(-PageCount);
|
||||
VK_RETURN: OKButtonClick(nil);
|
||||
@ -237,7 +283,7 @@ end;
|
||||
|
||||
procedure TViewUnitDialog.MultiselectCheckBoxClick(Sender :TObject);
|
||||
begin
|
||||
ListBox.Multiselect := MultiselectCheckBox.Checked;
|
||||
ListBox.Multiselect := mniMultiSelect.Checked;
|
||||
end;
|
||||
|
||||
procedure TViewUnitDialog.FocusEdit;
|
||||
|
Loading…
Reference in New Issue
Block a user