unit miscVideoControl;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, VidGrab, ExtCtrls, Menus;

type
  TfrmVideoControl = class(TForm)
    btnClose: TButton;
    chkFlipVertically: TCheckBox;
    chkFlipHorizontally: TCheckBox;
    chkExternalTrigger: TCheckBox;
    chkEmulateTrigger: TCheckBox;
    procedure btnCloseClick(Sender: TObject);
    procedure chkFlipVerticallyClick(Sender: TObject);
    procedure chkFlipHorizontallyClick(Sender: TObject);
    procedure chkExternalTriggerClick(Sender: TObject);
    procedure chkEmulateTriggerClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
  public
    procedure RefreshControls;
  end;

var
  frmVideoControl: TfrmVideoControl;

implementation

uses MainForm;

{$R *.DFM}

procedure TfrmVideoControl.RefreshControls;
begin
   chkFlipVertically.Enabled := frmMainForm.VideoGrabber.IsVideoControlModeAvailable (vc_FlipVertical);
   chkFlipHorizontally.Enabled := frmMainForm.VideoGrabber.IsVideoControlModeAvailable (vc_FlipHorizontal);
   chkExternalTrigger.Enabled := frmMainForm.VideoGrabber.IsVideoControlModeAvailable (vc_ExternalTriggerEnable);
   chkEmulateTrigger.Enabled := frmMainForm.VideoGrabber.IsVideoControlModeAvailable (vc_Trigger);

   chkFlipVertically.Checked := frmMainForm.VideoGrabber.GetVideoControlMode (vc_FlipVertical);
   chkFlipHorizontally.Checked := frmMainForm.VideoGrabber.GetVideoControlMode (vc_FlipHorizontal);
   chkExternalTrigger.Checked := frmMainForm.VideoGrabber.GetVideoControlMode (vc_ExternalTriggerEnable);
   chkEmulateTrigger.Checked := frmMainForm.VideoGrabber.GetVideoControlMode (vc_Trigger);
end;

procedure TfrmVideoControl.FormShow(Sender: TObject);
begin
   RefreshControls();
end;

procedure TfrmVideoControl.chkFlipVerticallyClick(Sender: TObject);
begin
   frmMainForm.VideoGrabber.SetVideoControlMode2 (vc_FlipVertical, chkFlipVertically.Checked);
end;

procedure TfrmVideoControl.chkFlipHorizontallyClick(Sender: TObject);
begin
   frmMainForm.VideoGrabber.SetVideoControlMode2 (vc_FlipHorizontal, chkFlipHorizontally.Checked);
end;

procedure TfrmVideoControl.chkExternalTriggerClick(Sender: TObject);
begin
   frmMainForm.VideoGrabber.SetVideoControlMode2 (vc_ExternalTriggerEnable, chkExternalTrigger.Checked);
end;

procedure TfrmVideoControl.chkEmulateTriggerClick(Sender: TObject);
begin
   frmMainForm.VideoGrabber.SetVideoControlMode2 (vc_Trigger, chkEmulateTrigger.Checked);
end;

procedure TfrmVideoControl.btnCloseClick(Sender: TObject);
begin
   Close;
end;

end.
