vbAccelerator - Contents of code file: frmBitmapStripDialog.frm

VERSION 5.00
Begin VB.Form frmBitmapStripDialog 
   Caption         =   "Bitmap Strip Export Options"
   ClientHeight    =   4455
   ClientLeft      =   4680
   ClientTop       =   3855
   ClientWidth     =   6585
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmBitmapStripDialog.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4455
   ScaleWidth      =   6585
   Begin VB.CommandButton cmdClear 
      Caption         =   "&Reset"
      Height          =   375
      Left            =   4500
      TabIndex        =   11
      Top             =   780
      Width           =   1155
   End
   Begin VB.CommandButton cmdPick 
      Caption         =   "&Pick..."
      Height          =   375
      Left            =   3300
      TabIndex        =   10
      Top             =   780
      Width           =   1155
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   3900
      TabIndex        =   7
      Top             =   3960
      Width           =   1275
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   5220
      TabIndex        =   6
      Top             =   3960
      Width           =   1275
   End
   Begin VB.PictureBox picPreview 
      AutoRedraw      =   -1  'True
      Height          =   2475
      Left            =   60
      ScaleHeight     =   161
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   429
      TabIndex        =   5
      Top             =   1440
      Width           =   6495
   End
   Begin VB.ComboBox cboEndFrame 
      Height          =   315
      Left            =   1500
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   420
      Width           =   1755
   End
   Begin VB.ComboBox cboStartFrame 
      Height          =   315
      Left            =   1500
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   60
      Width           =   1755
   End
   Begin VB.Label lblColour 
      BorderStyle     =   1  'Fixed Single
      Caption         =   " (Not Set)"
      Height          =   315
      Left            =   1500
      TabIndex        =   9
      Top             =   780
      Width           =   1755
   End
   Begin VB.Label lblNewBackColour 
      BackStyle       =   0  'Transparent
      Caption         =   " &New Back Colour:"
      Height          =   255
      Left            =   60
      TabIndex        =   8
      Top             =   840
      Width           =   1395
   End
   Begin VB.Label lblPreview 
      BackStyle       =   0  'Transparent
      Caption         =   " Pre&view:"
      Height          =   255
      Left            =   60
      TabIndex        =   4
      Top             =   1200
      Width           =   6315
   End
   Begin VB.Label lblEndFrame 
      BackStyle       =   0  'Transparent
      Caption         =   " En&d Frame"
      Height          =   255
      Left            =   60
      TabIndex        =   3
      Top             =   480
      Width           =   1395
   End
   Begin VB.Label lblStartFrame 
      BackStyle       =   0  'Transparent
      Caption         =   " &Start Frame:"
      Height          =   255
      Left            =   60
      TabIndex        =   1
      Top             =   120
      Width           =   1395
   End
End
Attribute VB_Name = "frmBitmapStripDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_bLoaded As Boolean
Private m_bCancel As Boolean
Private m_bDisablePreviewGeneration As Boolean
Private m_cAVI As cAVIFrameExtract
Private m_lStartFrame As Long
Private m_lEndFrame As Long
Private m_oBackColor As OLE_COLOR

Private Sub pShowFrames()
Dim i As Long
   m_bDisablePreviewGeneration = True
   For i = 0 To m_cAVI.FrameCount - 1
      cboStartFrame.AddItem i + 1
      cboEndFrame.AddItem i + 1
   Next i
   cboStartFrame.ListIndex = 0
   cboEndFrame.ListIndex = cboEndFrame.ListCount - 1
   m_bDisablePreviewGeneration = False
   pShowPreview
End Sub

Private Sub pShowPreview()
   If Not (m_bDisablePreviewGeneration) Then
      picPreview.Cls
      
      If (m_oBackColor <> -1) Then
         picPreview.Line (0, 0)-(m_cAVI.Width, m_cAVI.Height *
          (cboEndFrame.ListIndex - cboStartFrame.ListIndex + 1)), m_oBackColor,
          BF
      End If
      
      Dim i As Long
      Dim y As Long
      For i = cboStartFrame.ListIndex + 1 To cboEndFrame.ListIndex + 1
         m_cAVI.DrawFrame picPreview.hdc, i, 0, y, , , (m_oBackColor <> -1)
         y = y + m_cAVI.Height
      Next i
      
      picPreview.Refresh
   End If
End Sub

Public Property Get NewBackColor() As OLE_COLOR
   NewBackColor = m_oBackColor
End Property

Public Property Get StartFrame() As Long
   StartFrame = m_lStartFrame
End Property
Public Property Get EndFrame() As Long
   EndFrame = m_lEndFrame
End Property

Public Property Let AVI(cAVI As cAVIFrameExtract)
   Set m_cAVI = cAVI
   If (m_bLoaded) Then
      pShowFrames
   End If
End Property

Public Property Get Cancelled() As Boolean
   Cancelled = m_bCancel
End Property

Private Sub cboEndFrame_Click()
   pShowPreview
End Sub

Private Sub cboStartFrame_Click()
   pShowPreview
End Sub

Private Sub cmdCancel_Click()
   Unload Me
End Sub

Private Sub cmdClear_Click()
   lblColour.BackColor = vbButtonFace
   lblColour.Caption = " (Not Set)"
   m_oBackColor = -1
   pShowPreview
End Sub

Private Sub cmdOK_Click()
   m_lStartFrame = cboStartFrame.ListIndex + 1
   m_lEndFrame = cboEndFrame.ListIndex + 1
   m_bCancel = False
   Unload Me
End Sub

Private Sub cmdPick_Click()
Dim cD As New cCommonDialog
Dim oColor As OLE_COLOR
   oColor = cD.TranslateColor(lblNewBackColour.BackColor)
   If (cD.VBChooseColor( _
      oColor, , True, , Me.hWnd)) Then
      lblColour.BackColor = oColor
      lblColour.Caption = ""
      m_oBackColor = oColor
      pShowPreview
   End If
End Sub

Private Sub Form_Load()
   m_bLoaded = True
   m_bCancel = True
   m_oBackColor = -1
   pShowFrames
End Sub

Private Sub Form_Resize()
Dim lTop As Long
   On Error Resume Next
   lTop = Me.ScaleHeight - (cmdOK.Height + 2 * Screen.TwipsPerPixelY)
   cmdOK.Move Me.ScaleWidth - cmdOK.Width - cmdCancel.Width - 4 *
    Screen.TwipsPerPixelX, lTop
   cmdCancel.Move Me.ScaleWidth - cmdCancel.Width - 2 * Screen.TwipsPerPixelX,
    lTop
   lTop = lTop - 2 * Screen.TwipsPerPixelY
   picPreview.Move picPreview.Left, picPreview.TOp, _
      Me.ScaleWidth - picPreview.Left * 2, _
      lTop - picPreview.TOp
   pShowPreview
End Sub