Fixed: Issue #137
Fixed: Issue #142 Fixed: Issue #143 Fixed: Issue #155
This commit is contained in:
parent
ada3ea50e4
commit
be20ec1c0f
@ -165,7 +165,9 @@
|
|||||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||||
</VersionInfoKeys>
|
</VersionInfoKeys> <Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages>
|
||||||
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<StarTeamAssociation></StarTeamAssociation>
|
<StarTeamAssociation></StarTeamAssociation>
|
||||||
<StarTeamNonRelativeFiles></StarTeamNonRelativeFiles>
|
<StarTeamNonRelativeFiles></StarTeamNonRelativeFiles>
|
||||||
|
@ -202,10 +202,23 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
OnClick = PickColor
|
OnClick = PickColor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object btnDefault: TButton
|
||||||
|
Left = 8
|
||||||
|
Top = 135
|
||||||
|
Width = 109
|
||||||
|
Height = 25
|
||||||
|
Caption = 'Reset to &default'
|
||||||
|
TabOrder = 2
|
||||||
|
OnClick = btnDefaultClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object tsAbout: TTabSheet
|
object tsAbout: TTabSheet
|
||||||
Caption = 'About...'
|
Caption = 'About...'
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
|
ExplicitLeft = 0
|
||||||
|
ExplicitTop = 0
|
||||||
|
ExplicitWidth = 0
|
||||||
|
ExplicitHeight = 0
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
287
|
287
|
||||||
181)
|
181)
|
||||||
@ -334,7 +347,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object dlgColor: TColorDialog
|
object dlgColor: TColorDialog
|
||||||
Options = [cdFullOpen]
|
Options = [cdFullOpen]
|
||||||
Left = 12
|
Left = 260
|
||||||
Top = 176
|
Top = 160
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,6 +21,7 @@ type
|
|||||||
TfrmUnSwConfiguration = class(TForm)
|
TfrmUnSwConfiguration = class(TForm)
|
||||||
btnCancel: TButton;
|
btnCancel: TButton;
|
||||||
btnDataModuleColor: TButton;
|
btnDataModuleColor: TButton;
|
||||||
|
btnDefault: TButton;
|
||||||
btnFormColor: TButton;
|
btnFormColor: TButton;
|
||||||
btnOk: TButton;
|
btnOk: TButton;
|
||||||
btnProjectColor: TButton;
|
btnProjectColor: TButton;
|
||||||
@ -39,6 +40,7 @@ type
|
|||||||
tsAbout: TTabSheet;
|
tsAbout: TTabSheet;
|
||||||
tsGeneral: TTabSheet;
|
tsGeneral: TTabSheet;
|
||||||
|
|
||||||
|
procedure btnDefaultClick(Sender: TObject);
|
||||||
procedure chkCustomColorClick(Sender: TObject);
|
procedure chkCustomColorClick(Sender: TObject);
|
||||||
procedure lblBugReportClick(Sender: TObject);
|
procedure lblBugReportClick(Sender: TObject);
|
||||||
procedure PickColor(Sender: TObject);
|
procedure PickColor(Sender: TObject);
|
||||||
@ -116,6 +118,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmUnSwConfiguration.btnDefaultClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if MessageBox(Self.Handle, 'Are you sure you want to revert the color ' +
|
||||||
|
'settings? This action can not be undone.',
|
||||||
|
'Reset to default', MB_YESNO or MB_ICONQUESTION) = ID_YES then
|
||||||
|
begin
|
||||||
|
Settings.ResetDefaults(True);
|
||||||
|
Settings.Save();
|
||||||
|
LoadSettings();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.chkCustomColorClick(Sender: TObject);
|
procedure TfrmUnSwConfiguration.chkCustomColorClick(Sender: TObject);
|
||||||
const
|
const
|
||||||
Colors: array[Boolean] of TColor = (clBtnFace, clWindow);
|
Colors: array[Boolean] of TColor = (clBtnFace, clWindow);
|
||||||
|
@ -51,7 +51,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object pnlSearch: TPanel
|
object pnlSearch: TPanel
|
||||||
Left = 4
|
Left = 4
|
||||||
Top = 4
|
Top = 24
|
||||||
Width = 304
|
Width = 304
|
||||||
Height = 25
|
Height = 25
|
||||||
Align = alTop
|
Align = alTop
|
||||||
@ -60,22 +60,24 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
DesignSize = (
|
DesignSize = (
|
||||||
304
|
304
|
||||||
25)
|
25)
|
||||||
object edtSearch: TEdit
|
object cmbSearch: TComboBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 304
|
Width = 304
|
||||||
Height = 21
|
Height = 21
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
|
ItemHeight = 13
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnChange = edtSearchChange
|
OnChange = cmbSearchChange
|
||||||
OnKeyDown = edtSearchKeyDown
|
OnKeyDown = cmbSearchKeyDown
|
||||||
|
OnKeyPress = cmbSearchKeyPress
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object lstUnits: TListBox
|
object lstUnits: TListBox
|
||||||
Left = 4
|
Left = 4
|
||||||
Top = 29
|
Top = 49
|
||||||
Width = 304
|
Width = 304
|
||||||
Height = 274
|
Height = 254
|
||||||
Style = lbVirtualOwnerDraw
|
Style = lbVirtualOwnerDraw
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ItemHeight = 20
|
ItemHeight = 20
|
||||||
@ -86,6 +88,28 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
OnDblClick = lstUnitsDblClick
|
OnDblClick = lstUnitsDblClick
|
||||||
OnDrawItem = lstUnitsDrawItem
|
OnDrawItem = lstUnitsDrawItem
|
||||||
end
|
end
|
||||||
|
object pnlSubFilters: TPanel
|
||||||
|
Left = 4
|
||||||
|
Top = 4
|
||||||
|
Width = 304
|
||||||
|
Height = 20
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
TabOrder = 2
|
||||||
|
Visible = False
|
||||||
|
DesignSize = (
|
||||||
|
304
|
||||||
|
20)
|
||||||
|
object lblSubFilters: TLabel
|
||||||
|
Left = 0
|
||||||
|
Top = 1
|
||||||
|
Width = 305
|
||||||
|
Height = 13
|
||||||
|
Anchors = [akLeft, akTop, akRight]
|
||||||
|
AutoSize = False
|
||||||
|
Caption = 'frm '#187' Dialog '#187
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object pnlButtons: TPanel
|
object pnlButtons: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -176,8 +200,8 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ilsTypes: TImageList
|
object ilsTypes: TImageList
|
||||||
Left = 8
|
Left = 16
|
||||||
Top = 32
|
Top = 264
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
494C010105000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
494C010105000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
||||||
0000000000003600000028000000400000003000000001002000000000000030
|
0000000000003600000028000000400000003000000001002000000000000030
|
||||||
@ -583,8 +607,8 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
000000000000}
|
000000000000}
|
||||||
end
|
end
|
||||||
object alMain: TActionList
|
object alMain: TActionList
|
||||||
Left = 36
|
Left = 44
|
||||||
Top = 32
|
Top = 264
|
||||||
object actSelectAll: TAction
|
object actSelectAll: TAction
|
||||||
Caption = 'Select &All'
|
Caption = 'Select &All'
|
||||||
ShortCut = 16449
|
ShortCut = 16449
|
||||||
@ -617,20 +641,20 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
ShortCut = 49165
|
ShortCut = 49165
|
||||||
OnExecute = actOpenPropertiesExecute
|
OnExecute = actOpenPropertiesExecute
|
||||||
end
|
end
|
||||||
object actMRUNext: TAction
|
|
||||||
Caption = 'actMRUNext'
|
|
||||||
ShortCut = 16422
|
|
||||||
OnExecute = actMRUNextExecute
|
|
||||||
end
|
|
||||||
object actMRUPrior: TAction
|
object actMRUPrior: TAction
|
||||||
Caption = 'actMRUPrior'
|
Caption = 'actMRUPrior'
|
||||||
ShortCut = 16424
|
ShortCut = 16422
|
||||||
OnExecute = actMRUPriorExecute
|
OnExecute = actMRUPriorExecute
|
||||||
end
|
end
|
||||||
|
object actMRUNext: TAction
|
||||||
|
Caption = 'actMRUNext'
|
||||||
|
ShortCut = 16424
|
||||||
|
OnExecute = actMRUNextExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object pmnUnits: TPopupMenu
|
object pmnUnits: TPopupMenu
|
||||||
Left = 64
|
Left = 72
|
||||||
Top = 32
|
Top = 264
|
||||||
object pmnUnitsSelectAll: TMenuItem
|
object pmnUnitsSelectAll: TMenuItem
|
||||||
Action = actSelectAll
|
Action = actSelectAll
|
||||||
end
|
end
|
||||||
|
@ -53,8 +53,9 @@ type
|
|||||||
chkForms: TCheckBox;
|
chkForms: TCheckBox;
|
||||||
chkProjectSource: TCheckBox;
|
chkProjectSource: TCheckBox;
|
||||||
chkUnits: TCheckBox;
|
chkUnits: TCheckBox;
|
||||||
edtSearch: TEdit;
|
cmbSearch: TComboBox;
|
||||||
ilsTypes: TImageList;
|
ilsTypes: TImageList;
|
||||||
|
lblSubFilters: TLabel;
|
||||||
lstUnits: TListBox;
|
lstUnits: TListBox;
|
||||||
pmnUnits: TPopupMenu;
|
pmnUnits: TPopupMenu;
|
||||||
pmnUnitsOpenFolder: TMenuItem;
|
pmnUnitsOpenFolder: TMenuItem;
|
||||||
@ -69,7 +70,9 @@ type
|
|||||||
pnlIncludeTypes: TPanel;
|
pnlIncludeTypes: TPanel;
|
||||||
pnlMain: TPanel;
|
pnlMain: TPanel;
|
||||||
pnlSearch: TPanel;
|
pnlSearch: TPanel;
|
||||||
|
pnlSubFilters: TPanel;
|
||||||
sbStatus: TStatusBar;
|
sbStatus: TStatusBar;
|
||||||
|
procedure cmbSearchKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
|
||||||
procedure actMRUNextExecute(Sender: TObject);
|
procedure actMRUNextExecute(Sender: TObject);
|
||||||
procedure actMRUPriorExecute(Sender: TObject);
|
procedure actMRUPriorExecute(Sender: TObject);
|
||||||
@ -78,8 +81,8 @@ type
|
|||||||
procedure actSelectAllExecute(Sender: TObject);
|
procedure actSelectAllExecute(Sender: TObject);
|
||||||
procedure actSelectInvertExecute(Sender: TObject);
|
procedure actSelectInvertExecute(Sender: TObject);
|
||||||
procedure btnConfigurationClick(Sender: TObject);
|
procedure btnConfigurationClick(Sender: TObject);
|
||||||
procedure edtSearchChange(Sender: TObject);
|
procedure cmbSearchChange(Sender: TObject);
|
||||||
procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure cmbSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
procedure FormResize(Sender: TObject);
|
procedure FormResize(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
|
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
|
||||||
@ -92,13 +95,16 @@ type
|
|||||||
FUnitList: TUnSwUnitList;
|
FUnitList: TUnSwUnitList;
|
||||||
FActiveUnit: TUnSwUnit;
|
FActiveUnit: TUnSwUnit;
|
||||||
FFormsOnly: Boolean;
|
FFormsOnly: Boolean;
|
||||||
FMRUIndex: Integer;
|
|
||||||
FMRUList: TStrings;
|
FMRUList: TStrings;
|
||||||
|
FMRUIndex: Integer;
|
||||||
|
FSubFilters: TStringList;
|
||||||
|
|
||||||
FTypeFilteredList: TUnSwUnitList;
|
FTypeFilteredList: TUnSwUnitList;
|
||||||
|
FSubFilteredList: TUnSwUnitList;
|
||||||
FInputFilteredList: TUnSwUnitList;
|
FInputFilteredList: TUnSwUnitList;
|
||||||
|
|
||||||
FTypeFilter: TUnSwUnitTypeFilter;
|
FTypeFilter: TUnSwUnitTypeFilter;
|
||||||
|
FSubFilter: TUnSwUnitSimpleFilter;
|
||||||
FInputFilter: TUnSwUnitSimpleFilter;
|
FInputFilter: TUnSwUnitSimpleFilter;
|
||||||
|
|
||||||
FStyleVisitor: TUnSwStyleVisitor;
|
FStyleVisitor: TUnSwStyleVisitor;
|
||||||
@ -110,6 +116,10 @@ type
|
|||||||
function GetActiveUnits(): TUnSwUnitList;
|
function GetActiveUnits(): TUnSwUnitList;
|
||||||
procedure SelectMRUItem();
|
procedure SelectMRUItem();
|
||||||
|
|
||||||
|
function PushFilter(const AFilter: String): Boolean;
|
||||||
|
procedure PopFilter();
|
||||||
|
procedure UpdateSubFilters();
|
||||||
|
|
||||||
procedure LoadSettings();
|
procedure LoadSettings();
|
||||||
procedure SaveSettings();
|
procedure SaveSettings();
|
||||||
public
|
public
|
||||||
@ -125,7 +135,7 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
|
|
||||||
UnSwConfiguration,
|
UnSwConfiguration,
|
||||||
UnSwSettings;
|
UnSwSettings, Dialogs;
|
||||||
|
|
||||||
type
|
type
|
||||||
TUnSwOpenVisitor = class(TInterfacedObject, IUnSwVisitor)
|
TUnSwOpenVisitor = class(TInterfacedObject, IUnSwVisitor)
|
||||||
@ -295,19 +305,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrmUnSwDialog.InternalExecute(): TUnSwUnitList;
|
function TfrmUnSwDialog.InternalExecute(): TUnSwUnitList;
|
||||||
|
type
|
||||||
|
TUnSwUnitSimpleFilterClass = class of TUnSwUnitSimpleFilter;
|
||||||
|
|
||||||
var
|
var
|
||||||
iIndex: Integer;
|
iIndex: Integer;
|
||||||
|
pClass: TUnSwUnitSimpleFilterClass;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
FSubFilters := TStringList.Create();
|
||||||
FTypeFilteredList := TUnSwUnitList.Create();
|
FTypeFilteredList := TUnSwUnitList.Create();
|
||||||
|
FSubFilteredList := TUnSwUnitList.Create();
|
||||||
FInputFilteredList := TUnSwUnitList.Create();
|
FInputFilteredList := TUnSwUnitList.Create();
|
||||||
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
|
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
|
||||||
|
|
||||||
if FFormsOnly then
|
if FFormsOnly then
|
||||||
FInputFilter := TUnSwUnitSimpleFormNameFilter.Create(FInputFilteredList)
|
pClass := TUnSwUnitSimpleFormNameFilter
|
||||||
else
|
else
|
||||||
FInputFilter := TUnSwUnitSimpleNameFilter.Create(FInputFilteredList);
|
pClass := TUnSwUnitSimpleNameFilter;
|
||||||
|
|
||||||
|
FSubFilter := pClass.Create(FSubFilteredList);
|
||||||
|
FInputFilter := pClass.Create(FInputFilteredList);
|
||||||
|
|
||||||
try
|
try
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
@ -323,14 +343,18 @@ begin
|
|||||||
try
|
try
|
||||||
if Self.ShowModal() = mrOk then
|
if Self.ShowModal() = mrOk then
|
||||||
begin
|
begin
|
||||||
iIndex := FMRUList.IndexOf(edtSearch.Text);
|
if Length(Trim(cmbSearch.Text)) > 0 then
|
||||||
|
begin
|
||||||
|
iIndex := FMRUList.IndexOf(cmbSearch.Text);
|
||||||
if iIndex > -1 then
|
if iIndex > -1 then
|
||||||
FMRUList.Delete(iIndex);
|
FMRUList.Delete(iIndex);
|
||||||
|
|
||||||
while FMRUList.Count >= 10 do
|
while FMRUList.Count >= 10 do
|
||||||
FMRUList.Delete(Pred(FMRUList.Count));
|
FMRUList.Delete(Pred(FMRUList.Count));
|
||||||
|
|
||||||
FMRUList.Insert(0, edtSearch.Text);
|
FMRUList.Insert(0, cmbSearch.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
Result := GetActiveUnits();
|
Result := GetActiveUnits();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -340,9 +364,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
FreeAndNil(FInputFilter);
|
FreeAndNil(FInputFilter);
|
||||||
|
FreeAndNil(FSubFilter);
|
||||||
FreeAndNil(FTypeFilter);
|
FreeAndNil(FTypeFilter);
|
||||||
|
FreeAndNil(FSubFilteredList);
|
||||||
FreeAndNil(FInputFilteredList);
|
FreeAndNil(FInputFilteredList);
|
||||||
FreeAndNil(FTypeFilteredList);
|
FreeAndNil(FTypeFilteredList);
|
||||||
|
FreeAndNil(FSubFilters);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -356,7 +383,7 @@ var
|
|||||||
begin
|
begin
|
||||||
activeUnits := GetActiveUnits();
|
activeUnits := GetActiveUnits();
|
||||||
|
|
||||||
FInputFilteredList.Clone(FTypeFilteredList);
|
FInputFilteredList.Clone(FSubFilteredList);
|
||||||
FInputFilteredList.AcceptVisitor(FInputFilter);
|
FInputFilteredList.AcceptVisitor(FInputFilter);
|
||||||
|
|
||||||
lstUnits.Count := FInputFilteredList.Count;
|
lstUnits.Count := FInputFilteredList.Count;
|
||||||
@ -450,9 +477,58 @@ begin
|
|||||||
else
|
else
|
||||||
FTypeFilteredList.Sort(SortByType);
|
FTypeFilteredList.Sort(SortByType);
|
||||||
|
|
||||||
|
UpdateSubFilters();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.PopFilter();
|
||||||
|
begin
|
||||||
|
if FSubFilters.Count > 0 then
|
||||||
|
begin
|
||||||
|
FSubFilters.Delete(Pred(FSubFilters.Count));
|
||||||
|
UpdateSubFilters();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.UpdateSubFilters();
|
||||||
|
var
|
||||||
|
iFilter: Integer;
|
||||||
|
sFilters: String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FSubFilteredList.Clone(FTypeFilteredList);
|
||||||
|
|
||||||
|
if FSubFilters.Count > 0 then
|
||||||
|
begin
|
||||||
|
for iFilter := 0 to Pred(FSubFilters.Count) do
|
||||||
|
begin
|
||||||
|
sFilters := sFilters + FSubFilters[iFilter] + ' '#187' ';
|
||||||
|
FSubFilter.Filter := FSubFilters[iFilter];
|
||||||
|
FSubFilteredList.AcceptVisitor(FSubFilter);
|
||||||
|
end;
|
||||||
|
|
||||||
|
lblSubFilters.Caption := Trim(sFilters);
|
||||||
|
pnlSubFilters.Visible := True;
|
||||||
|
end else
|
||||||
|
pnlSubFilters.Visible := False;
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TfrmUnSwDialog.PushFilter(const AFilter: String): Boolean;
|
||||||
|
var
|
||||||
|
sFilter: String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
sFilter := Trim(AFilter);
|
||||||
|
Result := (Length(sFilter) > 0) and (FSubFilters.IndexOf(AFilter) = -1);
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
FSubFilters.Add(AFilter);
|
||||||
|
UpdateSubFilters();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TfrmUnSwDialog.GetActiveUnits(): TUnSwUnitList;
|
function TfrmUnSwDialog.GetActiveUnits(): TUnSwUnitList;
|
||||||
var
|
var
|
||||||
itemIndex: Integer;
|
itemIndex: Integer;
|
||||||
@ -500,7 +576,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
FMRUList := dialogSettings.MRUList;
|
FMRUList := dialogSettings.MRUList;
|
||||||
FMRUIndex := -1;
|
cmbSearch.Items.Assign(FMRUList);
|
||||||
|
|
||||||
Self.ClientWidth := dialogSettings.Width;
|
Self.ClientWidth := dialogSettings.Width;
|
||||||
Self.ClientHeight := dialogSettings.Height;
|
Self.ClientHeight := dialogSettings.Height;
|
||||||
@ -559,16 +635,9 @@ end;
|
|||||||
|
|
||||||
procedure TfrmUnSwDialog.SelectMRUItem();
|
procedure TfrmUnSwDialog.SelectMRUItem();
|
||||||
begin
|
begin
|
||||||
if (FMRUIndex < -1) or (FMRUIndex > Pred(FMRUList.Count)) then
|
cmbSearch.ItemIndex := FMRUIndex;
|
||||||
exit;
|
ActiveControl := cmbSearch;
|
||||||
|
cmbSearch.SelectAll();
|
||||||
if FMRUIndex = -1 then
|
|
||||||
edtSearch.Text := ''
|
|
||||||
else
|
|
||||||
edtSearch.Text := FMRUList[FMRUIndex];
|
|
||||||
|
|
||||||
ActiveControl := edtSearch;
|
|
||||||
edtSearch.SelectAll();
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.actMRUNextExecute(Sender: TObject);
|
procedure TfrmUnSwDialog.actMRUNextExecute(Sender: TObject);
|
||||||
@ -622,19 +691,46 @@ begin
|
|||||||
lstUnits.Invalidate();
|
lstUnits.Invalidate();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.edtSearchChange(Sender: TObject);
|
procedure TfrmUnSwDialog.cmbSearchChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FInputFilter.Filter := edtSearch.Text;
|
FInputFilter.Filter := cmbSearch.Text;
|
||||||
UpdateList();
|
UpdateList();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.edtSearchKeyDown(Sender: TObject; var Key: Word;
|
procedure TfrmUnSwDialog.cmbSearchKeyDown(Sender: TObject; var Key: Word;
|
||||||
Shift: TShiftState);
|
Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
|
if not cmbSearch.DroppedDown then
|
||||||
if ((Shift = []) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) or
|
if ((Shift = []) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) or
|
||||||
((Shift = [ssCtrl]) and (Key in [VK_HOME, VK_END])) or
|
((Shift = [ssCtrl]) and (Key in [VK_HOME, VK_END])) or
|
||||||
((Shift = [ssShift]) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) then
|
((Shift = [ssShift]) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) then
|
||||||
|
begin
|
||||||
lstUnits.Perform(WM_KEYDOWN, Key, 0);
|
lstUnits.Perform(WM_KEYDOWN, Key, 0);
|
||||||
|
Key := 0;
|
||||||
|
end else if Shift = [ssCtrl] then
|
||||||
|
case Key of
|
||||||
|
VK_TAB:
|
||||||
|
begin
|
||||||
|
if PushFilter(cmbSearch.Text) then
|
||||||
|
cmbSearch.Text := '';
|
||||||
|
|
||||||
|
Key := 0;
|
||||||
|
end;
|
||||||
|
VK_BACK:
|
||||||
|
begin
|
||||||
|
cmbSearch.Text := '';
|
||||||
|
FInputFilter.Filter := '';
|
||||||
|
PopFilter();
|
||||||
|
Key := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.cmbSearchKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
begin
|
||||||
|
// Ctrl-Backspace
|
||||||
|
if Key = #127 then
|
||||||
|
Key := #0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject);
|
procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject);
|
||||||
|
@ -91,7 +91,7 @@ type
|
|||||||
constructor Create();
|
constructor Create();
|
||||||
destructor Destroy(); override;
|
destructor Destroy(); override;
|
||||||
|
|
||||||
procedure ResetDefaults();
|
procedure ResetDefaults(const AColorsOnly: Boolean = False);
|
||||||
procedure Save();
|
procedure Save();
|
||||||
|
|
||||||
property Colors: TUnSwColorSettings read FColors write FColors;
|
property Colors: TUnSwColorSettings read FColors write FColors;
|
||||||
@ -199,8 +199,7 @@ end;
|
|||||||
|
|
||||||
procedure TUnSwDialogSettings.Load(const ARegistry: TRegistry);
|
procedure TUnSwDialogSettings.Load(const ARegistry: TRegistry);
|
||||||
var
|
var
|
||||||
eSort: TUnSwDialogSort;
|
iSort: Integer;
|
||||||
iSort: Integer absolute eSort;
|
|
||||||
sMRU: String;
|
sMRU: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -226,18 +225,17 @@ begin
|
|||||||
ReadIntegerDef(ARegistry, FWidth, 'Width');
|
ReadIntegerDef(ARegistry, FWidth, 'Width');
|
||||||
ReadIntegerDef(ARegistry, FHeight, 'Height');
|
ReadIntegerDef(ARegistry, FHeight, 'Height');
|
||||||
|
|
||||||
// The 'absolute' acts as an implicit typecast
|
iSort := Integer(FSort);
|
||||||
eSort := FSort;
|
|
||||||
ReadIntegerDef(ARegistry, iSort, 'Sort');
|
ReadIntegerDef(ARegistry, iSort, 'Sort');
|
||||||
FSort := eSort;
|
FSort := TUnSwDialogSort(iSort);
|
||||||
|
|
||||||
if ARegistry.ValueExists('MRU') then
|
if ARegistry.ValueExists(GetKeyName('MRU')) then
|
||||||
begin
|
begin
|
||||||
SetLength(sMRU, ARegistry.GetDataSize('MRU'));
|
SetLength(sMRU, ARegistry.GetDataSize(GetKeyName('MRU')));
|
||||||
if Length(sMRU) > 0 then
|
if Length(sMRU) > 0 then
|
||||||
begin
|
begin
|
||||||
ARegistry.ReadBinaryData('MRU', PChar(sMRU)^, Length(sMRU));
|
ARegistry.ReadBinaryData(GetKeyName('MRU'), PChar(sMRU)^, Length(sMRU));
|
||||||
FMRUList.Text := sMRU;
|
FMRUList.Text := Trim(sMRU);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -260,9 +258,9 @@ begin
|
|||||||
if FMRUList.Count > 0 then
|
if FMRUList.Count > 0 then
|
||||||
begin
|
begin
|
||||||
sMRU := FMRUList.Text;
|
sMRU := FMRUList.Text;
|
||||||
ARegistry.WriteBinaryData('MRU', PChar(sMRU)^, Length(sMRU));
|
ARegistry.WriteBinaryData(GetKeyName('MRU'), PChar(sMRU)^, Length(sMRU));
|
||||||
end else
|
end else
|
||||||
ARegistry.DeleteValue('MRU');
|
ARegistry.DeleteValue(GetKeyName('MRU'));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -298,6 +296,7 @@ begin
|
|||||||
FFormsDialog := TUnSwDialogSettings.Create('Forms');
|
FFormsDialog := TUnSwDialogSettings.Create('Forms');
|
||||||
FUnitsDialog := TUnSwDialogSettings.Create('Units');
|
FUnitsDialog := TUnSwDialogSettings.Create('Units');
|
||||||
ResetDefaults();
|
ResetDefaults();
|
||||||
|
Load();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TUnSwSettings.Destroy();
|
destructor TUnSwSettings.Destroy();
|
||||||
@ -310,7 +309,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TUnSwSettings.ResetDefaults();
|
procedure TUnSwSettings.ResetDefaults(const AColorsOnly: Boolean);
|
||||||
procedure ResetDialog(const ADialog: TUnSwDialogSettings);
|
procedure ResetDialog(const ADialog: TUnSwDialogSettings);
|
||||||
begin
|
begin
|
||||||
ADialog.IncludeDataModules := True;
|
ADialog.IncludeDataModules := True;
|
||||||
@ -323,8 +322,11 @@ procedure TUnSwSettings.ResetDefaults();
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if not AColorsOnly then
|
||||||
|
begin
|
||||||
ResetDialog(FFormsDialog);
|
ResetDialog(FFormsDialog);
|
||||||
ResetDialog(FUnitsDialog);
|
ResetDialog(FUnitsDialog);
|
||||||
|
end;
|
||||||
|
|
||||||
FColors.Enabled := True;
|
FColors.Enabled := True;
|
||||||
FColors.DataModules := RGB( 35, 120, 35); // Green
|
FColors.DataModules := RGB( 35, 120, 35); // Green
|
||||||
|
Loading…
Reference in New Issue
Block a user