📄 psiantifreezebase.pas
字号:
unit PsiAntiFreezeBase;
//******************************************************************************
// The original software is under
// Copyright (c) 1993 - 2000, Chad Z. Hower (Kudzu)
// and the Indy Pit Crew - http://www.nevrona.com/Indy/
//
// Amended : November 2000, by Michael M. Michalak MACS for use with
// MorphTek.com Inc Peer to Peer Open Source Components - http://www.morphtek.com
//
//******************************************************************************
interface
uses
Classes,
PsiBaseComponent;
type
TPsiAntiFreezeBase = class(TPsiBaseComponent)
protected
FActive: boolean;
FApplicationHasPriority: boolean;
FIdleTimeOut: Integer;
FOnlyWhenIdle: Boolean;
public
constructor Create(AOwner: TComponent); override;
class procedure DoProcess(const AIdle: boolean = true; const AOverride: boolean = false);
destructor Destroy; override;
procedure Process; virtual; abstract;
published
property Active: boolean read FActive write FActive;
property ApplicationHasPriority: Boolean read FApplicationHasPriority
write FApplicationHasPriority;
property IdleTimeOut: integer read FIdleTimeOut write FIdleTimeOut;
property OnlyWhenIdle: Boolean read FOnlyWhenIdle write FOnlyWhenIdle;
end;
var
GAntiFreeze: TPsiAntiFreezeBase = nil;
implementation
uses
PsiGlobal,
PsiResourceStrings,
SysUtils;
{ TPsiAntiFreezeBase }
constructor TPsiAntiFreezeBase.Create(AOwner: TComponent);
begin
inherited;
if assigned(GAntiFreeze) then begin
raise Exception.Create(RSOnlyOneAntiFreeze);
end;
FActive := True;
FApplicationHasPriority := True;
IdleTimeOut := 250;
if not (csDesigning in ComponentState) then begin
GAntiFreeze := Self;
end;
end;
destructor TPsiAntiFreezeBase.Destroy;
begin
GAntiFreeze := nil;
inherited;
end;
class procedure TPsiAntiFreezeBase.DoProcess(const AIdle: boolean = true;
const AOverride: boolean = false);
begin
// InMainThread - Only process if calling client is in the main thread
if (GAntiFreeze <> nil) and InMainThread then begin
if ((GAntiFreeze.OnlyWhenIdle = false) or AIdle or AOverride) and GAntiFreeze.Active then begin
GAntiFreeze.Process;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -