mmdspprops.pas

来自「P2P即时通讯源码(DELPHI编写)」· PAS 代码 · 共 81 行

PAS
81
字号
unit MMDSPProps;

{$I COMPILER.INC}

interface

uses
    Windows,
    SysUtils,
    Classes,
{$IFDEF DELPHI6}
    DesignIntf,
    DesignEditors,
{$ELSE}
    DsgnIntf,
{$ENDIF}
    MMDSPObj;

type
   {-- TMMDSPComponentInputEditor ---------------------------------------------}
   TMMDSPComponentInputEditor = class(TComponentProperty)
   private
       FSelected : TMMDSPComponent;

   protected
      CheckProc: TGetStrProc;
      procedure CheckComponent(const Value: string); virtual;

   public
      property Selected: TMMDSPComponent read FSelected;
      procedure GetValues(Proc: TGetStrProc); override;
   end;

   {-- TMMDSPComponentOutputEditor --------------------------------------------}
   TMMDSPComponentOutputEditor = class(TMMDSPComponentInputEditor)
   protected
       procedure CheckComponent(const Value: string); override;
   end;

implementation

{== TMMDSPComponentInputEditor ================================================}
procedure TMMDSPComponentInputEditor.CheckComponent(const Value: string);
var
   Component: TComponent;
begin
   {$IFDEF WIN32}
   Component := Designer.GetComponent(Value);
   {$ELSE}
   Component := Designer.Form.FindComponent(Value);
   {$ENDIF}
   if (Component.Name <> '') and
       Selected.CanConnectInput(Component) then
       CheckProc(Value);
end;

{-- TMMDSPComponentInputEditor ------------------------------------------------}
procedure TMMDSPComponentInputEditor.GetValues(Proc: TGetStrProc);
begin
   FSelected := GetComponent(0) as TMMDSPComponent;
   CheckProc := Proc;
   inherited GetValues(CheckComponent);
end;

{== TMMDSPComponentOutputEditor ===============================================}
procedure TMMDSPComponentOutputEditor.CheckComponent(const Value: string);
var
   Component: TComponent;
begin
   {$IFDEF WIN32}
   Component := Designer.GetComponent(Value);
   {$ELSE}
   Component := Designer.Form.FindComponent(Value);
   {$ENDIF}
   if (Component.Name <> '') and
       Selected.CanConnectOutput(Component) then
       CheckProc(Value);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?