⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmmixctl.pas

📁 一套及时通讯的原码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{========================================================================}
{=                (c) 1995-98 SwiftSoft Ronald Dittrich                 =}
{========================================================================}
{=                          All Rights Reserved                         =}
{========================================================================}
{=  D 01099 Dresden             = Fax.: +49 (0)351-8037944              =}
{=  Loewenstr.7a                = info@swiftsoft.de                     =}
{========================================================================}
{=  Actual versions on http://www.swiftsoft.de/mmtools.html             =}
{========================================================================}
{=  This code is for reference purposes only and may not be copied or   =}
{=  distributed in any format electronic or otherwise except one copy   =}
{=  for backup purposes.                                                =}
{=                                                                      =}
{=  No Delphi Component Kit or Component individually or in a collection=}
{=  subclassed or otherwise from the code in this unit, or associated   =}
{=  .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed     =}
{=  without express permission from SwiftSoft.                          =}
{=                                                                      =}
{=  For more licence informations please refer to the associated        =}
{=  HelpFile.                                                           =}
{========================================================================}
{=  $Date: 06.03.98 - 18:21:18 $                                        =}
{========================================================================}
unit MMMixCtl;

{$C FIXED PRELOAD PERMANENT}

{$I COMPILER.INC}

{.$DEFINE _MMDEBUG}

interface

uses
{$IFDEF WIN32}
    Windows,
{$ELSE}
    WinTypes,
    WinProcs,
{$ENDIF}
    Forms,
    Messages,
    Classes,
    SysUtils,
    StdCtrls,
    ExtCtrls,
    Controls,
    MMObj,
    MMRegs,
    MMUtils,
    MMMath,
    MMObsrv,
    MMMixer,
    MMSlider,
    MMCCon,
    MMSpin,
    MMPanel,
    MMWheel,
    MMDevice,
    MMMeter,
    MMLevel
    {$IFDEF _MMDEBUG}
    ,MMDebug
    {$ENDIF}
    ;

type
    TMMIdChangedEvent = procedure of object;

    {-- TMMControlLink --------------------------------------------------}
    TMMControlLink  = class(TMMObserver)
    private
        FControl   : TMMCustomMixerControl;
        FOnChange  : TNotifyEvent;
        FOnIdChange: TMMIdChangedEvent;

        procedure SetControl(Value: TMMCustomMixerControl);

    protected
        procedure Notify(Data: TObject); override;

    public
        property Control: TMMCustomMixerControl read FControl write SetControl;
        property OnChange: TNotifyEvent read FOnChange write FOnChange;
        property OnIdChange: TMMIdChangedEvent read FOnIdChange write FOnIdChange;
    end;

{$IFNDEF BUILD_ACTIVEX}
    TMMCaptionLinkComponent = TMMComponent;
{$ELSE}
    TMMCaptionLinkComponent = TWinControl;
{$ENDIF}

    {-- TMMCaptionLink --------------------------------------------------}
    TMMCaptionLink  = class(TMMObserver)
    private
        FComponent : TMMCaptionLinkComponent;
        FItem      : TMMItemIndex;
        FShort     : Boolean;
        FOnChange  : TNotifyEvent;

        procedure SetComponent(Value: TMMCaptionLinkComponent);
        procedure SetItem(Value: TMMItemIndex);
        procedure SetShort(Value: Boolean);
        function  GetTitle: string;
        procedure RemoveObserver;
        procedure AddObserver;

    protected
        procedure Changed; virtual;
        procedure DoChange; dynamic;
        procedure Notify(Data: TObject); override;

    public
        constructor Create;

        property Component: TMMCaptionLinkComponent read FComponent write SetComponent;
        property Item: TMMItemIndex read FItem write SetItem;
        property Short: Boolean read FShort write SetShort;
        property Title: string read GetTitle;
        property OnChange: TNotifyEvent read FOnChange write FOnChange;
    end;

    EMMCaptionLinkError   = class(Exception)
    end;

const
   MaxSteps                  = 32;

var
   MixerSliderControlClasses: TMMControlClasses = [ccFader,ccNumber,ccSlider,ccTime];
   MixerWheelControlClasses : TMMControlClasses = [ccFader,ccNumber,ccSlider,ccTime];
   SwitchControlClasses     : TMMControlClasses = [ccList,ccSwitch];
   ConnectorControlClasses  : TMMControlClasses = [ccFader,ccMeter,ccNumber,ccSlider,ccTime];

type
    {-- TMMCustomMixerSlider --------------------------------------------}
    TMMCustomMixerSlider = class(TMMCustomSlider)
    private
        FLink       : TMMControlLink;
        FStep       : Extended;
        FChannel    : TMMChannel;
        FItem       : TMMItemIndex;
        FEnabled    : Boolean;

        function  GetControl: TMMCustomMixerControl;
        procedure SetControl(Value: TMMCustomMixerControl);
        procedure ControlChange(Sender: TObject);
        procedure Change; override;
        procedure SetupSlider;
        procedure UpdateValue;
        procedure UpdateControl;
        procedure SetChannel(Value: TMMChannel);
        procedure SetItem(Value: TMMItemIndex);
        procedure SetEnabled(Value: Boolean);
    protected
        procedure Loaded; override;
        procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    public
        constructor Create(AOwner: TComponent); override;
        destructor  Destroy; override;
    protected
        property Control: TMMCustomMixerControl read GetControl write SetControl;
        property Channel: TMMChannel read FChannel write SetChannel default chBoth;
        property Item: TMMItemIndex read FItem write SetItem default NoItem;
        property Enabled read FEnabled write SetEnabled default True;
    end;

    {-- TMMMixerSlider --------------------------------------------------}
    TMMMixerSlider  = class(TMMCustomMixerSlider)
    public
        property MinValue;
        property MaxValue;

    published
        property OnEnter;
        property OnExit;
        property OnKeyDown;
        property OnKeyPress;
        property OnKeyUp;
        property OnChange;
        property OnTrack;
        property OnTrackEnd;
        property OnDrawThumb;
        property OnDrawGroove;

        property Control;
        property Channel;
        property Item;
        property Logarithmic;
        property Sensitivity;
        property Enabled;

        property Visible;
        property Color;
        property ParentShowHint;
        property PopupMenu;
        property ShowHint;
        property TabStop;
        property TabOrder;
        property Width;
        property Height;
        property Bevel;
        property Groove;
        property FocusAction;
        property FocusColor;
        property GrooveColor;
        property ThumbColor;
        property DisabledColor;

        property HandCursor;
        property Orientation;
        property GrooveSize;
        property GrooveStyle;
        property ThumbWidth;
        property ThumbHeight;
        property ThumbStyle;

        property Scale;
        property ScalePosition;
        property ScaleDistance;

        property PicLeft;
        property PicRight;
        property Position;

{ !!! Please check this out: probably these properties are likely
      to appear in VCL version too }
{$IFDEF BUILD_ACTIVEX}
        property LineSize;
        property PageSize;
        property ThumbBorder;
        property ThumbCursor;
{$ENDIF}
    end;

    {-- TMMCustomMixerWheel ---------------------------------------------}
    TMMCustomMixerWheel = class(TMMCustomWheel)
    private
        FLink       : TMMControlLink;
        FStep       : Extended;
        FChannel    : TMMChannel;
        FItem       : TMMItemIndex;
        FEnabled    : Boolean;

        function  GetControl: TMMCustomMixerControl;
        procedure SetControl(Value: TMMCustomMixerControl);
        procedure ControlChange(Sender: TObject);
        procedure Change; override;
        procedure SetupWheel;
        procedure UpdateValue;
        procedure UpdateControl;
        procedure SetChannel(Value: TMMChannel);
        procedure SetItem(Value: TMMItemIndex);
        procedure SetEnabled(Value: Boolean);
    protected
        procedure Loaded; override;
        procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    public
        constructor Create(AOwner: TComponent); override;
        destructor  Destroy; override;
    protected
        property Control: TMMCustomMixerControl read GetControl write SetControl;
        property Channel: TMMChannel read FChannel write SetChannel default chBoth;
        property Item: TMMItemIndex read FItem write SetItem default NoItem;
        property Enabled read FEnabled write SetEnabled default True;
    end;

    {-- TMMMixerWheel ---------------------------------------------------}
    TMMMixerWheel = class(TMMCustomMixerWheel)
    public
        property MinValue;
        property MaxValue;

    published
        property Control;
        property Channel;
        property Item;
        property Enabled;

        property OnEnter;
        property OnExit;
        property OnKeyDown;
        property OnKeyPress;
        property OnKeyUp;
        property OnChange;
        property OnDrawHandle;

        property Bevel;
        property Visible;
        property Color;
        property ParentShowHint;
        property PopupMenu;
        property ShowHint;
        property TabStop default True;
        property TabOrder;
        property Width;
        property Height;
        property AutoSize;
        property BackBmp;
        property StartAngle;
        property EndAngle;
        property HandleColor;
        property FocusedColor;
        property UpDown;
        property ScrollSize;
        property LineStep;
        property PageStep;
        property FocusAction;
        property Scale;
        property Radius;
        property HandleStyle;
        property HandleSize;
        property HandleMargin;
        property FrameSpace;
        property ScaleMargin;
        property Value;
    end;

    {-- TMMCustomMixerCheckBox ------------------------------------------}
    TMMCustomMixerCheckBox  = class(TCustomCheckBox)
    private
        FLink         : TMMControlLink;
        FChannel      : TMMChannel;
        FItem         : TMMItemIndex;
        FAutoCap      : Boolean;
        FShort        : Boolean;
        FItemLine     : TMMAudioLine;
        FItemObserver : TMMObserver;
        FEnabled      : Boolean;

        function  GetControl: TMMCustomMixerControl;
        procedure SetControl(Value: TMMCustomMixerControl);
        procedure ControlChange(Sender: TObject);
        procedure SetupCheck;
        procedure UpdateValue;
        procedure UpdateControl;
        procedure SetChannel(Value: TMMChannel);
        procedure SetItem(Value: TMMItemIndex);
        procedure SetAutoCap(Value: Boolean);
        procedure SetShort(Value: Boolean);
        procedure SetItemLine(Value: TMMAudioLine);
        procedure ItemNotify(Sender, Data: TObject);
        function  StoreItem: Boolean;
        function  StoreCaption: Boolean;
        procedure SetEnabled(Value: Boolean);

    protected
        procedure Click; override;
        procedure Loaded; override;
        procedure Notification(AComponent: TComponent; Operation: TOperation); override;

    public
        constructor Create(AOwner: TComponent); override;
        destructor  Destroy; override;

    protected
        property Control: TMMCustomMixerControl read GetControl write SetControl;
        property Channel: TMMChannel read FChannel write SetChannel default chBoth;
        property Item: TMMItemIndex read FItem write SetItem stored StoreItem;
        property AutoCaption: Boolean read FAutoCap write SetAutoCap default True;
        property Short: Boolean read FShort write SetShort default True;
        property ItemLine: TMMAudioLine read FItemLine write SetItemLine;
        property Enabled read FEnabled write SetEnabled default True;
        property Caption stored StoreCaption;
    end;

    {-- TMMMixerCheckBox ------------------------------------------------}
    TMMMixerCheckBox  = class(TMMCustomMixerCheckBox)
    published
        property OnDragDrop;
        property OnDragOver;
        property OnEndDrag;
        property OnEnter;
        property OnExit;
        property OnKeyDown;
        property OnKeyPress;
        property OnKeyUp;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
        property OnStartDrag;
        property OnClick;

        property Control;
        property Channel;
        property Item;
        property AutoCaption;
        property Short;
        property ItemLine;
        property Enabled;
        property Caption;

        property Alignment;
        property Color;
        property Ctl3D;
        property DragCursor;
        property DragMode;
        property Font;
        property ParentColor;
        property ParentCtl3D;
        property ParentFont;
        property ParentShowHint;
        property PopupMenu;
        property ShowHint;
        property TabOrder;
        property TabStop;

⌨️ 快捷键说明

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