easysearchdlg.pas.svn-base
来自「支持自定义语法高亮显示的编辑器控件」· SVN-BASE 代码 · 共 157 行
SVN-BASE
157 行
{*****************************************************}
{ }
{ Find dialog }
{ }
{ Copyright (c) 1992-2002 Altium Limited }
{ All rights reserved. }
{ }
{ http://www.dream-com.com }
{ contact@dream-com.com }
{ }
{*****************************************************}
unit EasySearchDlg;
interface
{$I Easy.inc}
uses
{$IFNDEF EASY_CLX}
Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
{$ELSE}
QControls, QForms, QStdCtrls, QExtCtrls,
{$ENDIF}
SysUtils, Classes,
EasyControls, EasyUtils, EasySettings, EasyBox;
type
TFrmFindDlg = class(TForm)
lbTextToFind: TLabel;
plButtons: TPanel;
btOK: TButton;
btCancel: TButton;
btHelp: TButton;
gbOptions: TGroupBox;
cbCaseSensitive: TCheckBox;
cbWholeWord: TCheckBox;
cbRegularExpr: TCheckBox;
rgScope: TRadioGroup;
rgOrigin: TRadioGroup;
gbDirection: TGroupBox;
rbForward: TRadioButton;
rbBackward: TRadioButton;
cbTextToFind: TEasyHistoryEditor;
procedure FormCreate(Sender: TObject);
procedure btOKClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FDialogSettings : TEasyDialogSettings;
{ Private declarations }
protected
procedure BeforeLoadDialogSettings; virtual;
property DialogSettings : TEasyDialogSettings read FDialogSettings;
public
procedure LoadSettings; virtual;
procedure SaveSettings; virtual;
{ Public declarations }
end;
var
FrmFindDlg: TFrmFindDlg;
implementation
{$IFNDEF EASY_CLX}
{$R *.DFM}
{$ELSE}
{$R *.xfm}
{$ENDIF}
{--------------------------------------------}
procedure TFrmFindDlg.FormCreate(Sender: TObject);
begin
cbTextToFind.FileName := AddSlash(GetTempDir) + 'dialogs.ini';
cbTextToFind.LoadHistory;
LoadSettings;
FDialogSettings := TEasyDialogSettings.Create(self);
BeforeLoadDialogSettings;
FDialogSettings.LoadSettings;
end;
{--------------------------------------------}
procedure TFrmFindDlg.BeforeLoadDialogSettings;
begin
FDialogSettings.Key := 'SearchDlg';
end;
{--------------------------------------------}
procedure TFrmFindDlg.LoadSettings;
begin
with SearchSettings do
begin
cbTextToFind.Text := TextToFind;
cbCaseSensitive.Checked := CaseSensitive;
cbWholeWord.Checked := WholeWordsOnly;
cbRegularExpr.Checked := RegularExpr;
if Direction = srForward then
rbForward.Checked := true
else
rbBackward.Checked := true;
if Scope = scGlobal then
rgScope.ItemIndex := 0
else
rgScope.ItemIndex := 1;
if Origin = sgFromCursor then
rgOrigin.ItemIndex := 0
else
rgOrigin.ItemIndex := 1
end;
end;
{--------------------------------------------}
procedure TFrmFindDlg.btOKClick(Sender: TObject);
begin
SaveSettings;
end;
{--------------------------------------------}
procedure TFrmFindDlg.SaveSettings;
begin
with SearchSettings do
begin
TextToFind := cbTextToFind.Text;
CaseSensitive := cbCaseSensitive.Checked;
WholeWordsOnly := cbWholeWord.Checked;
RegularExpr := cbRegularExpr.Checked;
if rbForward.Checked then
Direction := srForward
else
Direction := srBackward;
if rgScope.ItemIndex = 0 then
Scope := scGlobal
else
Scope := scSelectedText;
if rgOrigin.ItemIndex = 0 then
Origin := sgFromCursor
else
Origin := sgEntireScope;
end;
end;
{--------------------------------------------}
procedure TFrmFindDlg.FormDestroy(Sender: TObject);
begin
{$IFNDEF EASY_CLX}
FDialogSettings.SaveSettings;
{$ENDIF}
end;
initialization
GlobalSearchDialogClass := TFrmFindDlg;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?