📄 utypes.pas
字号:
unit uTypes;
interface
uses Windows, Menus;
type
PPluginData = ^TPluginData;
TPluginData = record
Name : string;
FileName : string;
OnQuit : Boolean;
OnGotFocus : Boolean;
OnLostFocus : Boolean;
Next : PPluginData;
end;
TPlugins = class
private
fTop : PPluginData;
fLast : PPluginData;
function GetItem(Index : Integer) : PPluginData;
public
Count : Integer;
property Items[Index: Integer]: PPluginData read GetItem;
procedure Clear;
procedure Add(nwp : TPluginData);
constructor Create;
destructor Destroy; override;
end;
TPluginMI = class(TMenuItem)
public
plugin : string;
evname : string;
end;
TPluginInit = function(OwnerApp : Integer) : Integer; stdcall;
TIntResult = function : integer; stdcall;
TBoolResult = function : boolean; stdcall;
TStrResult = function(str : pChar) : integer; stdcall;
TPlgMsgNum = procedure(num : Longint); stdcall;
TPlgProc = procedure; stdcall;
TPlgFlags = function : Longint; stdcall;
// The following are used to initialise the plugins interface...
// They are used to pass callback references...
pdLongInt = function : Longint; stdcall;
pcLongInt = procedure(Index : Longint; dwProc : pdLongInt); stdcall;
pdBuffer_A = function(Buffer : PChar; var BufferSize : Longint) : Boolean; stdcall;
pcBuffer_A = procedure(Index : Longint; dwProc : pdBuffer_A); stdcall;
pdTwoInt_A = function(LI1, LI2 : Longint) : Boolean; stdcall;
pcTwoInt_A = procedure(Index : Longint; dwProc : pdTwoInt_A); stdcall;
pdTwoInt_B = function(var LI1, LI2 : Longint) : Boolean; stdcall;
pcTwoInt_B = procedure(Index : Longint; dwProc : pdTwoInt_B); stdcall;
pdMenuItem = function(PluginName, Caption, EventProc : PChar; Menu, Position : Integer) : Boolean; stdcall;
pcMenuItem = procedure(Index : Longint; dwProc : pdMenuItem); stdcall;
pdUIItem = function(PluginName, Caption, EventProc, ShortCut : PChar; Container, Position, Data : Integer) : Boolean; stdcall;
pcUIItem = procedure(Index : Longint; dwProc : pdUIItem); stdcall;
pdBoolean = function : Boolean; stdcall;
pcBoolean = procedure(Index : Longint; dwProc : pdBoolean); stdcall;
type
TLineBreak = (lbNoChange, lbWindows, lbUNIX, lbMac);
implementation
procedure TPlugins.Clear;
var
it : PPluginData;
ni : PPluginData;
begin
it := fTop;
while(it <> nil) do
begin
ni := it^.Next;
Dispose(it);
it := ni;
end;
fTop := nil;
fLast := nil;
Count := 0;
end;
procedure TPlugins.Add(nwp : TPluginData);
var
ni : PPluginData;
begin
ni := New(PPluginData);
ni^.Name := nwp.Name;
ni^.FileName := nwp.FileName;
ni^.OnQuit := nwp.OnQuit;
ni^.OnGotFocus := nwp.OnGotFocus;
ni^.OnLostFocus := nwp.OnLostFocus;
ni^.Next := nil;
if fTop <> nil then
begin
fLast^.Next := ni;
fLast := ni;
end else
begin
fTop := ni;
fLast := ni;
end;
Inc(Count);
end;
constructor TPlugins.Create;
begin
fTop := nil;
fLast := nil;
Count := 0;
end;
destructor TPlugins.Destroy;
begin
Clear;
inherited Destroy;
end;
function TPlugins.GetItem(Index : Integer) : PPluginData;
var
n : Integer;
p : PPluginData;
begin
p := fTop;
for n := 1 to Index do
p := p^.Next;
Result := p;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -