Imports Stax
Imports Stax.UI
Imports Stax.AppFramework

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class VirtualDubEncoderOptionsForm
    Inherits ExtendedForm

#Region " Designer "
    Friend WithEvents SmartTagProvider As Stax.UI.Design.SmartTagProvider
    Friend WithEvents TipProvider As Stax.UI.TipProvider
    Friend WithEvents cbUseVirtualDub As System.Windows.Forms.CheckBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents cbPasses As System.Windows.Forms.ComboBox
    Friend WithEvents bOK As System.Windows.Forms.Button
    Friend WithEvents bHelp As System.Windows.Forms.Button
    Friend WithEvents LineControl1 As Stax.UI.LineControl
    Friend WithEvents bCodecInfo As System.Windows.Forms.Button
    Friend WithEvents nudPercent As System.Windows.Forms.NumericUpDown
    Friend WithEvents cbQualityMode As System.Windows.Forms.CheckBox
    Friend WithEvents lAimedQuality As System.Windows.Forms.Label
    Friend WithEvents bCancel As System.Windows.Forms.Button

    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.SmartTagProvider = New Stax.UI.Design.SmartTagProvider
        Me.TipProvider = New Stax.UI.TipProvider(Me.components)
        Me.cbUseVirtualDub = New System.Windows.Forms.CheckBox
        Me.cbPasses = New System.Windows.Forms.ComboBox
        Me.bCodecInfo = New System.Windows.Forms.Button
        Me.cbQualityMode = New System.Windows.Forms.CheckBox
        Me.nudPercent = New System.Windows.Forms.NumericUpDown
        Me.Label1 = New System.Windows.Forms.Label
        Me.bOK = New System.Windows.Forms.Button
        Me.bCancel = New System.Windows.Forms.Button
        Me.bHelp = New System.Windows.Forms.Button
        Me.LineControl1 = New Stax.UI.LineControl
        Me.lAimedQuality = New System.Windows.Forms.Label
        CType(Me.TipProvider, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.nudPercent, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'cbUseVirtualDub
        '
        Me.cbUseVirtualDub.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cbUseVirtualDub.AutoSize = True
        Me.cbUseVirtualDub.Location = New System.Drawing.Point(12, 67)
        Me.cbUseVirtualDub.Name = "cbUseVirtualDub"
        Me.cbUseVirtualDub.Size = New System.Drawing.Size(219, 17)
        Me.cbUseVirtualDub.TabIndex = 2
        Me.cbUseVirtualDub.Text = "Use VirtualDub instead of VirtualDubMod"
        Me.TipProvider.SetTipText(Me.cbUseVirtualDub, "VirtualDub has very limited audio support.")
        '
        'cbPasses
        '
        Me.cbPasses.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cbPasses.FormattingEnabled = True
        Me.cbPasses.Location = New System.Drawing.Point(58, 12)
        Me.cbPasses.Name = "cbPasses"
        Me.cbPasses.Size = New System.Drawing.Size(46, 21)
        Me.cbPasses.TabIndex = 1
        Me.TipProvider.SetTipName(Me.cbPasses, "Passes")
        Me.TipProvider.SetTipText(Me.cbPasses, "Multi pass is useful for very low bitrate encodes and allows to hit a exact file " & _
                "size.")
        '
        'bCodecInfo
        '
        Me.bCodecInfo.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bCodecInfo.Location = New System.Drawing.Point(56, 118)
        Me.bCodecInfo.Name = "bCodecInfo"
        Me.bCodecInfo.Size = New System.Drawing.Size(75, 24)
        Me.bCodecInfo.TabIndex = 10
        Me.bCodecInfo.Text = "Codec Info"
        Me.TipProvider.SetTipText(Me.bCodecInfo, "Displays the codecs about dialog.")
        '
        'cbQualityMode
        '
        Me.cbQualityMode.AutoSize = True
        Me.cbQualityMode.Location = New System.Drawing.Point(12, 44)
        Me.cbQualityMode.Name = "cbQualityMode"
        Me.cbQualityMode.Size = New System.Drawing.Size(88, 17)
        Me.cbQualityMode.TabIndex = 13
        Me.cbQualityMode.Text = "Quality Mode"
        Me.TipProvider.SetTipText(Me.cbQualityMode, "In Quality Mode bitrate related features are disabled.")
        Me.cbQualityMode.UseVisualStyleBackColor = True
        '
        'nudPercent
        '
        Me.nudPercent.Increment = New Decimal(New Integer() {5, 0, 0, 0})
        Me.nudPercent.Location = New System.Drawing.Point(263, 13)
        Me.nudPercent.Maximum = New Decimal(New Integer() {200, 0, 0, 0})
        Me.nudPercent.Name = "nudPercent"
        Me.nudPercent.Size = New System.Drawing.Size(46, 20)
        Me.nudPercent.TabIndex = 12
        Me.nudPercent.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        Me.TipProvider.SetTipName(Me.nudPercent, "Aimed Quality")
        Me.TipProvider.SetTipText(Me.nudPercent, "Adjusts the target file size or image size after the compressibility check. Optim" & _
                "al settings vary between different codecs, codec settings and individual quality" & _
                " requirements.")
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(12, 15)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(44, 13)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Passes:"
        '
        'bOK
        '
        Me.bOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.bOK.Location = New System.Drawing.Point(234, 118)
        Me.bOK.Name = "bOK"
        Me.bOK.Size = New System.Drawing.Size(75, 24)
        Me.bOK.TabIndex = 7
        Me.bOK.Text = "OK"
        '
        'bCancel
        '
        Me.bCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.bCancel.Location = New System.Drawing.Point(315, 118)
        Me.bCancel.Name = "bCancel"
        Me.bCancel.Size = New System.Drawing.Size(75, 24)
        Me.bCancel.TabIndex = 8
        Me.bCancel.Text = "Cancel"
        '
        'bHelp
        '
        Me.bHelp.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bHelp.Location = New System.Drawing.Point(137, 118)
        Me.bHelp.Name = "bHelp"
        Me.bHelp.Size = New System.Drawing.Size(75, 24)
        Me.bHelp.TabIndex = 9
        Me.bHelp.Text = "Help"
        Me.bHelp.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
        '
        'LineControl1
        '
        Me.LineControl1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.LineControl1.Location = New System.Drawing.Point(13, 102)
        Me.LineControl1.Name = "LineControl1"
        Me.LineControl1.Size = New System.Drawing.Size(377, 10)
        Me.LineControl1.TabIndex = 6
        Me.LineControl1.TabStop = False
        '
        'lAimedQuality
        '
        Me.lAimedQuality.AutoSize = True
        Me.lAimedQuality.Location = New System.Drawing.Point(134, 15)
        Me.lAimedQuality.Name = "lAimedQuality"
        Me.lAimedQuality.Size = New System.Drawing.Size(119, 13)
        Me.lAimedQuality.TabIndex = 14
        Me.lAimedQuality.Text = "Aimed Quality (percent):"
        '
        'VirtualDubEncoderOptionsForm
        '
        Me.AcceptButton = Me.bOK
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.bCancel
        Me.ClientSize = New System.Drawing.Size(402, 154)
        Me.Controls.Add(Me.lAimedQuality)
        Me.Controls.Add(Me.cbQualityMode)
        Me.Controls.Add(Me.nudPercent)
        Me.Controls.Add(Me.bCodecInfo)
        Me.Controls.Add(Me.LineControl1)
        Me.Controls.Add(Me.bHelp)
        Me.Controls.Add(Me.bCancel)
        Me.Controls.Add(Me.bOK)
        Me.Controls.Add(Me.cbPasses)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.cbUseVirtualDub)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.HelpButton = True
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "VirtualDubEncoderOptionsForm"
        Me.ShowIcon = False
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "VirtualDubEncoderOptionsForm"
        CType(Me.TipProvider, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.nudPercent, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
#End Region

    Private Encoder As VirtualDubEncoder

    Public Sub New(ByVal e As VirtualDubEncoder)
        InitializeComponent()
        Encoder = e
        Text = e.Name

        For i As Integer = 1 To e.SupportedPasses
            cbPasses.Items.Add(i)
        Next

        nudPercent.Value = e.AutoCompCheckValue
        cbPasses.SelectedItem = e.Passes
        cbUseVirtualDub.Checked = e.UseVirtualDub
        cbQualityMode.Checked = e.QualityMode
    End Sub

    Private Sub bOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bOK.Click
        Encoder.Passes = CInt(cbPasses.SelectedItem)
        Encoder.UseVirtualDub = cbUseVirtualDub.Checked
        Encoder.AutoCompCheckValue = CInt(nudPercent.Value)
        Encoder.QualityMode = cbQualityMode.Checked
    End Sub

    Private Sub bHelp_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bHelp.Click
        HelpForm.ShowDialog(Text, TipProvider.GetTips, Nothing)
    End Sub

    Private Sub VirtualDubEncoderOptionsForm_ActivatedFirstTime() Handles Me.ActivatedFirstTime
        If Not s.StringList.Contains(Me.GetType.FullName) Then
            bHelp.PerformClick()
            s.StringList.Add(Me.GetType.FullName)
        End If
    End Sub

    Private Sub bAbout_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bCodecInfo.Click
        VFW.ShowAboutDialog(Encoder.FourCC, Handle)
    End Sub

    Private Sub cbQualityMode_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbQualityMode.CheckedChanged
        If cbQualityMode.Checked Then
            cbPasses.SelectedIndex = 0
        End If

        nudPercent.Enabled = Not cbQualityMode.Checked
        cbPasses.Enabled = Not cbQualityMode.Checked
    End Sub
End Class