Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
9
Добавлен:
17.04.2013
Размер:
4 Кб
Скачать
unit Fliccomp;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes,
  Graphics, Controls, Forms, Dialogs, ExtCtrls;

type
  TFlicPlayer = class(TCustomPanel)
  private     { Private-Deklarationen }
    AAHandle : Integer;
    FFileName: String;  {Name der FLI-Datei}
    FAutoPlay: Boolean; {Bei True wird FLI gestartet}
    FFrames  : LongInt; {Anzahl der Einzelbilder}

    Procedure SetFileName(AFileName: String);
    Procedure SetAutoPlay(AAutoPlay: Boolean);
    Procedure SetPosition(APosition: LongInt);
    Function  GetPosition: LongInt;
  protected
    { Protected-Deklarationen }
  public                  
    { Public-Deklarationen }

  published
    { Published-Deklarationen }
    Procedure Play;
    Procedure Stop;
    Procedure Pause;
    Procedure Next;
    Procedure Previous;

    Property Frames   : LongInt Read FFrames;
    Property Position : LongInt Read GetPosition Write SetPosition;

  published  { Wird im ObjectInspector angezeigt }
   {Properties des Vorfahren, die dort "nur" public oder protected
    waren auch im ObjectInspektor anzeigen = sichtbar machen       }
    Property BevelInner;
    Property BevelOuter;
    Property BevelWidth;
    Property BorderStyle;
    Property BorderWidth;
    Property Color;
    Property Enabled;
    Property ParentColor;
    Property ParentShowHint;
    Property ShowHint;
    Property Visible;

    Property OnClick;{Eine Schnittstelle fьr den Programmierer schaffen}

   {Eigene Eigenschaften}
    Property FileName : String  Read FFileName Write SetFileName;
    Property AutoPlay : Boolean Read FAutoPlay Write SetAutoPlay;
  end;

procedure Register;

implementation

  Uses AAProcs;

  Procedure TFlicPlayer.SetFileName(AFileName: String);
  Const FirstTime : Boolean = True;
  Var   Rand      : Integer;
  Begin
    If FirstTime Then AAOpen;
    FirstTime := False;
    Rand := BorderWidth;
    If BevelInner <> bvNone Then Rand := Rand + BevelWidth;
    If BevelOuter <> bvNone Then Rand := Rand + BevelWidth;
    AAUnLoad(AAHandle);
    If FileExists(AFileName) Then
    Begin
      FFileName := ExpandFileName(AFileName);
      AAHandle  := AAPLoad(AFileName, Self);
      AASetParm(AAHandle, AA_X,Rand, 0);
      AASetParm(AAHandle, AA_Y,Rand, 0);
      Width     := AAGetParm(AAHandle, AA_WIDTH)  + 2 * Rand;
      Height    := AAGetParm(AAHandle, AA_HEIGHT) + 2 * Rand;
      FFrames   := AAGetParm(AAHandle, AA_FRAMES);
      If FAutoPlay Then AAPlay(AAHandle);
    End Else FFileName := '';
  End;

  Procedure TFlicPlayer.SetAutoPlay(AAutoPlay: Boolean);
  Begin
     FAutoPlay := AAutoPlay;
     If AAutoPlay Then AAPlay(AAHandle)
                  Else AAStop(AAHandle);
  End;

  Procedure TFlicPlayer.SetPosition(APosition: LongInt);
  Begin
    aaSetParm(AAHandle, AA_Position, 0, APosition);{Bildnummer setzen}
  End;

  Function TFlicPlayer.GetPosition: LongInt;
  Begin
    Result := aaGetParm(AAHandle, AA_POSITION);  {Aktuelle Bildnummer}
  End;

  Procedure TFlicPlayer.Play;
  Begin
      AAPlay(AAHandle);
  End;

  Procedure TFlicPlayer.Stop;
  Begin
      AAStop(AAHandle);
  End;

  Procedure TFlicPlayer.Pause;
  Begin
      AAPause(AAHandle);
  End;

  Procedure TFlicPlayer.Next;
  Begin
    If Position < Frames-1 Then Position := Position +1
                           Else Position := 0;
  End;

  Procedure TFlicPlayer.Previous;
  Begin
    If Position > 0 Then Position := Position - 1
                    Else Position := Frames - 1;
   End;

  procedure Register;
  begin
    RegisterComponents('Flics', [TFlicPlayer]);
  end;

end.
Соседние файлы в папке FLIPLAYR
  • #
    17.04.2013141 Кб9AAPLAY.DLL
  • #
    17.04.20133 Кб9AAPROCS.DCU
  • #
    17.04.20135 Кб9AAPROCS.PAS
  • #
    17.04.20136 Кб9FLICCOMP.DCU
  • #
    17.04.20134 Кб9FLICCOMP.PAS
  • #
    17.04.2013227 б9PLAYER.DPR
  • #
    17.04.20135 Кб9PLAYER1.DCU
  • #
    17.04.20132 Кб9PLAYER1.DFM
  • #
    17.04.20132 Кб9PLAYER1.PAS
  • #
    17.04.2013161 б9PROJECT1.DPR