1
0
mirror of synced 2024-11-15 00:43:50 +00:00

Added support for Wildchars

This commit is contained in:
Mark van Renswoude 2009-05-01 08:44:18 +00:00
parent 88aa236a62
commit a1762e05e8
11 changed files with 186 additions and 45 deletions

Binary file not shown.

View File

@ -101,6 +101,7 @@ type
function CreateStyleVisitor(): TBaseSwStyleVisitor; virtual; function CreateStyleVisitor(): TBaseSwStyleVisitor; virtual;
function AllowEmptyResult(): Boolean; virtual; abstract; function AllowEmptyResult(): Boolean; virtual; abstract;
function Wildchars(): Boolean; virtual; abstract;
function ColorsEnabled(): Boolean; virtual; function ColorsEnabled(): Boolean; virtual;
function GetBaseItemList(): TBaseSwItemList; virtual; function GetBaseItemList(): TBaseSwItemList; virtual;
@ -116,6 +117,7 @@ type
procedure LoadSettings(); virtual; procedure LoadSettings(); virtual;
procedure SaveSettings(); virtual; procedure SaveSettings(); virtual;
procedure SettingsChanged(); virtual;
procedure DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState); virtual; procedure DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState); virtual;
protected protected
@ -241,6 +243,7 @@ end;
procedure TfrmBaseSwDialog.LoadSettings(); procedure TfrmBaseSwDialog.LoadSettings();
begin begin
cmbSearch.Items.Assign(MRUList); cmbSearch.Items.Assign(MRUList);
SettingsChanged();
end; end;
@ -249,6 +252,13 @@ begin
end; end;
procedure TfrmBaseSwDialog.SettingsChanged();
begin
FInputFilter.Wildchars := Wildchars;
FSubFilter.Wildchars := Wildchars;
end;
procedure TfrmBaseSwDialog.UpdateItemActions(); procedure TfrmBaseSwDialog.UpdateItemActions();
begin begin
end; end;

View File

@ -9,6 +9,7 @@ unit BaseSwFilters;
interface interface
uses uses
Classes, Classes,
Masks,
BaseSwObjects; BaseSwObjects;
@ -29,10 +30,16 @@ type
TBaseSwItemSimpleFilter = class(TBaseSwItemFilter) TBaseSwItemSimpleFilter = class(TBaseSwItemFilter)
private private
FFilter: String; FFilter: String;
FFilterMask: TMask;
FWildchars: Boolean;
function GetFilterMask(): TMask;
procedure SetFilter(const Value: String); procedure SetFilter(const Value: String);
protected
property FilterMask: TMask read GetFilterMask;
public public
property Filter: String read FFilter write SetFilter; property Filter: String read FFilter write SetFilter;
property Wildchars: Boolean read FWildchars write FWildchars;
end; end;
@ -71,18 +78,48 @@ end;
{ TBaseSwItemSimpleFilter } { TBaseSwItemSimpleFilter }
procedure TBaseSwItemSimpleFilter.SetFilter(const Value: String); function TBaseSwItemSimpleFilter.GetFilterMask(): TMask;
begin begin
FFilter := LowerCase(Value); if not Assigned(FFilterMask) then
FFilterMask := TMask.Create('*' + FFilter + '*');
Result := FFilterMask;
end;
procedure TBaseSwItemSimpleFilter.SetFilter(const Value: String);
var
newValue: string;
begin
newValue := LowerCase(Value);
if newValue <> FFilter then
begin
FFilter := newValue;
FreeAndNil(FFilterMask);
end;
end; end;
{ TBaseSwItemSimpleNameFilter } { TBaseSwItemSimpleNameFilter }
procedure TBaseSwItemSimpleNameFilter.VisitItem(const AItem: TBaseSwItem); procedure TBaseSwItemSimpleNameFilter.VisitItem(const AItem: TBaseSwItem);
var
matches: Boolean;
itemName: string;
begin begin
if (Length(Filter) > 0) and if Length(Filter) > 0 then
(AnsiPos(Filter, LowerCase(AItem.Name)) = 0) then begin
itemName := LowerCase(AItem.Name);
if Wildchars then
matches := FilterMask.Matches(itemName)
else
matches := (AnsiPos(Filter, itemName) > 0);
if not matches then
FilterItem(AItem); FilterItem(AItem);
end; end;
end;
end. end.

View File

@ -35,7 +35,7 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration
338) 338)
object chkAllowEmptyResults: TCheckBox object chkAllowEmptyResults: TCheckBox
Left = 0 Left = 0
Top = 320 Top = 300
Width = 273 Width = 273
Height = 17 Height = 17
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -46,7 +46,7 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration
Left = 0 Left = 0
Top = 29 Top = 29
Width = 296 Width = 296
Height = 280 Height = 264
Style = lbVirtual Style = lbVirtual
Align = alTop Align = alTop
ItemHeight = 16 ItemHeight = 16
@ -85,6 +85,15 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration
Action = actRemove Action = actRemove
end end
end end
object chkWildchars: TCheckBox
Left = 0
Top = 320
Width = 273
Height = 17
Anchors = [akLeft, akBottom]
Caption = 'Allow &wildchars in search criteria'
TabOrder = 3
end
end end
object tsAbout: TTabSheet object tsAbout: TTabSheet
Caption = 'About...' Caption = 'About...'

View File

@ -33,6 +33,7 @@ type
btnDefault: TButton; btnDefault: TButton;
btnOk: TButton; btnOk: TButton;
chkAllowEmptyResults: TCheckBox; chkAllowEmptyResults: TCheckBox;
chkWildchars: TCheckBox;
dlgColor: TColorDialog; dlgColor: TColorDialog;
ilsFilters: TImageList; ilsFilters: TImageList;
imgAbout: TImage; imgAbout: TImage;
@ -116,13 +117,15 @@ end;
procedure TfrmCmpSwConfiguration.LoadSettings(); procedure TfrmCmpSwConfiguration.LoadSettings();
begin begin
chkAllowEmptyResults.Checked := Settings.AllowEmptyResult; chkAllowEmptyResults.Checked := Settings.Filter.AllowEmptyResult;
chkWildchars.Checked := Settings.Filter.Wildchars;
end; end;
procedure TfrmCmpSwConfiguration.SaveSettings(); procedure TfrmCmpSwConfiguration.SaveSettings();
begin begin
Settings.AllowEmptyResult := chkAllowEmptyResults.Checked; Settings.Filter.AllowEmptyResult := chkAllowEmptyResults.Checked;
Settings.Filter.Wildchars := chkWildchars.Checked;
Settings.Save(); Settings.Save();
end; end;
@ -157,7 +160,7 @@ begin
try try
if TfrmCmpSwFilterConfiguration.Execute(newGroup) then if TfrmCmpSwFilterConfiguration.Execute(newGroup) then
begin begin
newGroup.Collection := Settings.Filter; newGroup.Collection := Settings.FilterGroups;
RefreshFilters(); RefreshFilters();
end; end;
finally finally
@ -219,21 +222,21 @@ end;
procedure TfrmCmpSwConfiguration.RefreshFilters(); procedure TfrmCmpSwConfiguration.RefreshFilters();
begin begin
lbFilters.Count := Settings.Filter.Count; lbFilters.Count := Settings.FilterGroups.Count;
end; end;
procedure TfrmCmpSwConfiguration.lbFiltersData(Control: TWinControl; Index: Integer; var Data: String); procedure TfrmCmpSwConfiguration.lbFiltersData(Control: TWinControl; Index: Integer; var Data: String);
begin begin
if (Index >= 0) and (Index < Settings.Filter.Count) then if (Index >= 0) and (Index < Settings.FilterGroups.Count) then
Data := Settings.Filter[Index].Name; Data := Settings.FilterGroups[Index].Name;
end; end;
procedure TfrmCmpSwConfiguration.lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject); procedure TfrmCmpSwConfiguration.lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject);
begin begin
if (Index >= 0) and (Index < Settings.Filter.Count) then if (Index >= 0) and (Index < Settings.FilterGroups.Count) then
DataObject := Settings.Filter[Index]; DataObject := Settings.FilterGroups[Index];
end; end;

View File

@ -71,9 +71,11 @@ type
function AllowEmptyResult(): Boolean; override; function AllowEmptyResult(): Boolean; override;
function ColorsEnabled(): Boolean; override; function ColorsEnabled(): Boolean; override;
function Wildchars(): Boolean; override;
procedure LoadSettings(); override; procedure LoadSettings(); override;
procedure SaveSettings(); override; procedure SaveSettings(); override;
procedure SettingsChanged(); override;
procedure DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState); override; procedure DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState); override;
procedure UpdateClassFilter(); procedure UpdateClassFilter();
@ -252,7 +254,7 @@ begin
FFilterCheckBoxes := TObjectList.Create(); FFilterCheckBoxes := TObjectList.Create();
FOtherGroup := TCmpSwFilterGroup.Create(nil); FOtherGroup := TCmpSwFilterGroup.Create(nil);
try try
ClassFilter.Groups := Settings.Filter; ClassFilter.Groups := Settings.FilterGroups;
FOtherGroup.Name := 'Other'; FOtherGroup.Name := 'Other';
FOtherGroup.Enabled := False; FOtherGroup.Enabled := False;
@ -503,7 +505,7 @@ end;
function TfrmCmpSwDialog.AllowEmptyResult(): Boolean; function TfrmCmpSwDialog.AllowEmptyResult(): Boolean;
begin begin
Result := Settings.AllowEmptyResult; Result := Settings.Filter.AllowEmptyResult;
end; end;
@ -513,6 +515,12 @@ begin
end; end;
function TfrmCmpSwDialog.Wildchars(): Boolean;
begin
Result := Settings.Filter.Wildchars;
end;
procedure TfrmCmpSwDialog.SortExecute(Sender: TObject); procedure TfrmCmpSwDialog.SortExecute(Sender: TObject);
begin begin
(Sender as TAction).Checked := True; (Sender as TAction).Checked := True;
@ -546,9 +554,16 @@ procedure TfrmCmpSwDialog.btnConfigurationClick(Sender: TObject);
begin begin
if TfrmCmpSwConfiguration.Execute() then if TfrmCmpSwConfiguration.Execute() then
begin begin
SettingsChanged();
UpdateClassFilter(); UpdateClassFilter();
UpdateSubFilters(); UpdateSubFilters();
end; end;
end; end;
procedure TfrmCmpSwDialog.SettingsChanged;
begin
inherited;
end;
end. end.

View File

@ -34,11 +34,24 @@ type
end; end;
TCmpSwSettings = class(TObject) TCmpSwFilterSettings = class(TBaseSwSettings)
private private
FAllowEmptyResult: Boolean; FAllowEmptyResult: Boolean;
FWildchars: Boolean;
protected
procedure Load(const ARegistry: TRegistry); override;
procedure Save(const ARegistry: TRegistry); override;
public
property AllowEmptyResult: Boolean read FAllowEmptyResult write FAllowEmptyResult;
property Wildchars: Boolean read FWildchars write FWildchars;
end;
TCmpSwSettings = class(TObject)
private
FDialog: TCmpSwDialogSettings; FDialog: TCmpSwDialogSettings;
FFilter: TCmpSwFilterGroups; FFilter: TCmpSwFilterSettings;
FFilterGroups: TCmpSwFilterGroups;
FRegistryKey: String; FRegistryKey: String;
protected protected
@ -56,9 +69,9 @@ type
procedure ResetDefaults(); procedure ResetDefaults();
procedure Save(); procedure Save();
property AllowEmptyResult: Boolean read FAllowEmptyResult write FAllowEmptyResult;
property Dialog: TCmpSwDialogSettings read FDialog write FDialog; property Dialog: TCmpSwDialogSettings read FDialog write FDialog;
property Filter: TCmpSwFilterGroups read FFilter; property Filter: TCmpSwFilterSettings read FFilter;
property FilterGroups: TCmpSwFilterGroups read FFilterGroups;
end; end;
function Settings(): TCmpSwSettings; function Settings(): TCmpSwSettings;
@ -139,6 +152,21 @@ begin
end; end;
{ TCmpSwFilterSettings }
procedure TCmpSwFilterSettings.Load(const ARegistry: TRegistry);
begin
ReadBoolDef(ARegistry, FAllowEmptyResult, 'AllowEmptyResult');
ReadBoolDef(ARegistry, FWildchars, 'Wildchars');
end;
procedure TCmpSwFilterSettings.Save(const ARegistry: TRegistry);
begin
WriteBool(ARegistry, FAllowEmptyResult, 'AllowEmptyResult');
WriteBool(ARegistry, FWildchars, 'Wildchars');
end;
{ TCmpSwSettings } { TCmpSwSettings }
constructor TCmpSwSettings.Create(); constructor TCmpSwSettings.Create();
begin begin
@ -148,7 +176,8 @@ begin
'\ComponentSwitcher'; '\ComponentSwitcher';
FDialog := TCmpSwDialogSettings.Create(); FDialog := TCmpSwDialogSettings.Create();
FFilter := TCmpSwFilterGroups.Create(); FFilter := TCmpSwFilterSettings.Create();
FFilterGroups := TCmpSwFilterGroups.Create();
ResetDefaults(); ResetDefaults();
Load(); Load();
@ -157,6 +186,7 @@ end;
destructor TCmpSwSettings.Destroy(); destructor TCmpSwSettings.Destroy();
begin begin
FreeAndNil(FFilterGroups);
FreeAndNil(FFilter); FreeAndNil(FFilter);
FreeAndNil(FDialog); FreeAndNil(FDialog);
@ -177,7 +207,8 @@ begin
if OpenKey(FRegistryKey, False) then if OpenKey(FRegistryKey, False) then
begin begin
FDialog.Load(ideRegistry); FDialog.Load(ideRegistry);
LoadFilter('\Filter', Filter); FFilter.Load(ideRegistry);
LoadFilter('\Filter', FilterGroups);
CloseKey(); CloseKey();
end; end;
@ -189,14 +220,15 @@ end;
procedure TCmpSwSettings.ResetDefaults(); procedure TCmpSwSettings.ResetDefaults();
begin begin
AllowEmptyResult := True; Filter.AllowEmptyResult := True;
Filter.Wildchars := True;
Dialog.Width := 350; Dialog.Width := 350;
Dialog.Height := 530; Dialog.Height := 530;
{ Fill default groups } { Fill default groups }
Filter.Clear(); FilterGroups.Clear();
with Filter.Add() do with FilterGroups.Add() do
begin begin
Name := 'Actions'; Name := 'Actions';
@ -205,7 +237,7 @@ begin
Visible := True; Visible := True;
end; end;
with Filter.Add() do with FilterGroups.Add() do
begin begin
Name := 'Menu items'; Name := 'Menu items';
@ -213,7 +245,7 @@ begin
Visible := True; Visible := True;
end; end;
with Filter.Add() do with FilterGroups.Add() do
begin begin
Name := 'Dataset fields'; Name := 'Dataset fields';
@ -222,7 +254,7 @@ begin
Visible := True; Visible := True;
end; end;
with Filter.Add() do with FilterGroups.Add() do
begin begin
Name := 'DevEx Grid columns'; Name := 'DevEx Grid columns';
@ -245,7 +277,8 @@ begin
if OpenKey(FRegistryKey, True) then if OpenKey(FRegistryKey, True) then
begin begin
FDialog.Save(ideRegistry); FDialog.Save(ideRegistry);
SaveFilter('\Filter', Filter); FFilter.Save(ideRegistry);
SaveFilter('\Filter', FilterGroups);
CloseKey(); CloseKey();
end; end;

View File

@ -4,7 +4,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
BorderIcons = [biSystemMenu] BorderIcons = [biSystemMenu]
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'UnitSwitcher Configuration' Caption = 'UnitSwitcher Configuration'
ClientHeight = 272 ClientHeight = 286
ClientWidth = 303 ClientWidth = 303
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@ -16,15 +16,15 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
Position = poScreenCenter Position = poScreenCenter
DesignSize = ( DesignSize = (
303 303
272) 286)
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object pcConfiguration: TPageControl object pcConfiguration: TPageControl
Left = 4 Left = 4
Top = 4 Top = 4
Width = 295 Width = 295
Height = 231 Height = 245
ActivePage = tsAbout ActivePage = tsGeneral
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0 TabOrder = 0
object tsGeneral: TTabSheet object tsGeneral: TTabSheet
@ -204,11 +204,11 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
end end
object btnDefault: TButton object btnDefault: TButton
Left = 8 Left = 8
Top = 167 Top = 183
Width = 109 Width = 109
Height = 25 Height = 25
Caption = 'Reset to &default' Caption = 'Reset to &default'
TabOrder = 2 TabOrder = 4
OnClick = btnDefaultClick OnClick = btnDefaultClick
end end
object chkAllowEmptyResults: TCheckBox object chkAllowEmptyResults: TCheckBox
@ -217,6 +217,14 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
Width = 273 Width = 273
Height = 17 Height = 17
Caption = 'Allow &empty results' Caption = 'Allow &empty results'
TabOrder = 2
end
object chkWildchars: TCheckBox
Left = 8
Top = 156
Width = 273
Height = 17
Caption = 'Allow &wildchars in search criteria'
TabOrder = 3 TabOrder = 3
end end
end end
@ -225,7 +233,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
ImageIndex = 1 ImageIndex = 1
DesignSize = ( DesignSize = (
287 287
203) 217)
object imgAbout: TImage object imgAbout: TImage
Left = 8 Left = 8
Top = 8 Top = 8
@ -311,7 +319,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
end end
object lblBugReport: TLabel object lblBugReport: TLabel
Left = 56 Left = 56
Top = 177 Top = 191
Width = 75 Width = 75
Height = 13 Height = 13
Cursor = crHandPoint Cursor = crHandPoint
@ -327,7 +335,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
end end
object lblShortcutKeys: TLabel object lblShortcutKeys: TLabel
Left = 56 Left = 56
Top = 162 Top = 176
Width = 127 Width = 127
Height = 13 Height = 13
Cursor = crHandPoint Cursor = crHandPoint
@ -345,7 +353,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
end end
object btnCancel: TButton object btnCancel: TButton
Left = 224 Left = 224
Top = 241 Top = 255
Width = 75 Width = 75
Height = 25 Height = 25
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -356,7 +364,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
end end
object btnOk: TButton object btnOk: TButton
Left = 143 Left = 143
Top = 241 Top = 255
Width = 75 Width = 75
Height = 25 Height = 25
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]

View File

@ -28,6 +28,7 @@ type
btnUnitColor: TButton; btnUnitColor: TButton;
chkAllowEmptyResults: TCheckBox; chkAllowEmptyResults: TCheckBox;
chkCustomColor: TCheckBox; chkCustomColor: TCheckBox;
chkWildchars: TCheckBox;
dlgColor: TColorDialog; dlgColor: TColorDialog;
imgAbout: TImage; imgAbout: TImage;
lblBugReport: TLabel; lblBugReport: TLabel;
@ -122,6 +123,7 @@ begin
lblProjectColor.Font.Color := Settings.Colors.ProjectSource; lblProjectColor.Font.Color := Settings.Colors.ProjectSource;
lblUnitColor.Font.Color := Settings.Colors.Units; lblUnitColor.Font.Color := Settings.Colors.Units;
chkAllowEmptyResults.Checked := Settings.Filter.AllowEmptyResult; chkAllowEmptyResults.Checked := Settings.Filter.AllowEmptyResult;
chkWildchars.Checked := Settings.Filter.Wildchars;
end; end;
@ -133,6 +135,7 @@ begin
Settings.Colors.ProjectSource := lblProjectColor.Font.Color; Settings.Colors.ProjectSource := lblProjectColor.Font.Color;
Settings.Colors.Units := lblUnitColor.Font.Color; Settings.Colors.Units := lblUnitColor.Font.Color;
Settings.Filter.AllowEmptyResult := chkAllowEmptyResults.Checked; Settings.Filter.AllowEmptyResult := chkAllowEmptyResults.Checked;
Settings.Filter.Wildchars := chkWildchars.Checked;
Settings.Save(); Settings.Save();
end; end;

View File

@ -93,6 +93,7 @@ type
function AllowEmptyResult(): Boolean; override; function AllowEmptyResult(): Boolean; override;
function ColorsEnabled(): Boolean; override; function ColorsEnabled(): Boolean; override;
function Wildchars(): Boolean; override;
function GetBaseItemList(): TBaseSwItemList; override; function GetBaseItemList(): TBaseSwItemList; override;
function GetItemDisplayName(const AItem: TBaseSwItem): String; override; function GetItemDisplayName(const AItem: TBaseSwItem): String; override;
@ -103,6 +104,7 @@ type
procedure LoadSettings(); override; procedure LoadSettings(); override;
procedure SaveSettings(); override; procedure SaveSettings(); override;
procedure SettingsChanged(); override;
public public
class function Execute(const AUnits: TUnSwUnitList; class function Execute(const AUnits: TUnSwUnitList;
const AFormsOnly: Boolean; const AFormsOnly: Boolean;
@ -653,6 +655,14 @@ begin
end; end;
procedure TfrmUnSwDialog.SettingsChanged();
begin
inherited;
lstItems.Invalidate();
end;
procedure TfrmUnSwDialog.SortExecute(Sender: TObject); procedure TfrmUnSwDialog.SortExecute(Sender: TObject);
begin begin
(Sender as TAction).Checked := True; (Sender as TAction).Checked := True;
@ -708,7 +718,7 @@ end;
procedure TfrmUnSwDialog.btnConfigurationClick(Sender: TObject); procedure TfrmUnSwDialog.btnConfigurationClick(Sender: TObject);
begin begin
if TfrmUnSwConfiguration.Execute() then if TfrmUnSwConfiguration.Execute() then
lstItems.Invalidate(); SettingsChanged();
end; end;
@ -724,6 +734,12 @@ begin
end; end;
function TfrmUnSwDialog.Wildchars(): Boolean;
begin
Result := Settings.Filter.Wildchars;
end;
function TfrmUnSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor; function TfrmUnSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor;
begin begin
Result := TUnSwStyleVisitor.Create(); Result := TUnSwStyleVisitor.Create();

View File

@ -70,11 +70,13 @@ type
TUnSwFilterSettings = class(TBaseSwSettings) TUnSwFilterSettings = class(TBaseSwSettings)
private private
FAllowEmptyResults: Boolean; FAllowEmptyResults: Boolean;
FWildchars: Boolean;
protected protected
procedure Load(const ARegistry: TRegistry); override; procedure Load(const ARegistry: TRegistry); override;
procedure Save(const ARegistry: TRegistry); override; procedure Save(const ARegistry: TRegistry); override;
public public
property AllowEmptyResult: Boolean read FAllowEmptyResults write FAllowEmptyResults; property AllowEmptyResult: Boolean read FAllowEmptyResults write FAllowEmptyResults;
property Wildchars: Boolean read FWildchars write FWildchars;
end; end;
TUnSwResetSetting = (rsColors, rsFilter, rsForms, rsUnits); TUnSwResetSetting = (rsColors, rsFilter, rsForms, rsUnits);
@ -94,7 +96,7 @@ type
constructor Create(); constructor Create();
destructor Destroy(); override; destructor Destroy(); override;
procedure ResetDefaults(const ASettings: TUnSwResetSettings = [rsColors, rsFilter]); procedure ResetDefaults(const ASettings: TUnSwResetSettings = [rsColors, rsFilter, rsForms, rsUnits]);
procedure Save(); procedure Save();
property Colors: TUnSwColorSettings read FColors write FColors; property Colors: TUnSwColorSettings read FColors write FColors;
@ -244,12 +246,14 @@ end;
procedure TUnSwFilterSettings.Load(const ARegistry: TRegistry); procedure TUnSwFilterSettings.Load(const ARegistry: TRegistry);
begin begin
ReadBoolDef(ARegistry, FAllowEmptyResults, 'AllowEmptyResults'); ReadBoolDef(ARegistry, FAllowEmptyResults, 'AllowEmptyResults');
ReadBoolDef(ARegistry, FWildchars, 'Wildchars');
end; end;
procedure TUnSwFilterSettings.Save(const ARegistry: TRegistry); procedure TUnSwFilterSettings.Save(const ARegistry: TRegistry);
begin begin
WriteBool(ARegistry, FAllowEmptyResults, 'AllowEmptyResults'); WriteBool(ARegistry, FAllowEmptyResults, 'AllowEmptyResults');
WriteBool(ARegistry, FWildchars, 'Wildchars');
end; end;
@ -313,7 +317,10 @@ begin
end; end;
if rsFilter in ASettings then if rsFilter in ASettings then
begin
FFilter.AllowEmptyResult := False; FFilter.AllowEmptyResult := False;
FFilter.Wildchars := True;
end;
end; end;
procedure TUnSwSettings.Load(); procedure TUnSwSettings.Load();