Imports Stax
Imports Stax.UI
Imports Stax.AppFramework

Public Class DMFMuxerForm
    Inherits ExtendedForm

#Region " Designer "

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents SmartTagProvider As Stax.UI.Design.SmartTagProvider
    Friend WithEvents bOK As System.Windows.Forms.Button
    Friend WithEvents bCancel As System.Windows.Forms.Button
    Friend WithEvents SubtitleControl As StaxRip.SubtitleControl
    Friend WithEvents bTools As System.Windows.Forms.Button
    Friend WithEvents cmsTools As System.Windows.Forms.ContextMenuStrip
    Friend WithEvents ShowCommandLineToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents InfoToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents HelpToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents ToolStripItemExtender As Stax.UI.Design.ToolStripItemExtender

    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.bOK = New System.Windows.Forms.Button
        Me.bCancel = New System.Windows.Forms.Button
        Me.SmartTagProvider = New Stax.UI.Design.SmartTagProvider
        Me.SubtitleControl = New StaxRip.SubtitleControl
        Me.bTools = New System.Windows.Forms.Button
        Me.cmsTools = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.ShowCommandLineToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.InfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.HelpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
        Me.ToolStripItemExtender = New Stax.UI.Design.ToolStripItemExtender
        Me.cmsTools.SuspendLayout()
        CType(Me.ToolStripItemExtender, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        '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(323, 128)
        Me.bOK.Name = "bOK"
        Me.bOK.Size = New System.Drawing.Size(75, 24)
        Me.bOK.TabIndex = 0
        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(404, 128)
        Me.bCancel.Name = "bCancel"
        Me.bCancel.Size = New System.Drawing.Size(75, 24)
        Me.bCancel.TabIndex = 1
        Me.bCancel.Text = "Cancel"
        '
        'SubtitleControl
        '
        Me.SubtitleControl.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.SubtitleControl.Location = New System.Drawing.Point(12, 12)
        Me.SubtitleControl.Name = "SubtitleControl"
        Me.SubtitleControl.Size = New System.Drawing.Size(467, 110)
        Me.SubtitleControl.TabIndex = 2
        '
        'bTools
        '
        Me.bTools.Location = New System.Drawing.Point(223, 128)
        Me.bTools.Name = "bTools"
        Me.bTools.Size = New System.Drawing.Size(75, 24)
        Me.bTools.TabIndex = 9
        Me.bTools.Text = "Tools"
        Me.bTools.UseVisualStyleBackColor = True
        '
        'cmsTools
        '
        Me.cmsTools.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ShowCommandLineToolStripMenuItem, Me.InfoToolStripMenuItem, Me.HelpToolStripMenuItem})
        Me.cmsTools.Name = "cmsTools"
        Me.cmsTools.Size = New System.Drawing.Size(196, 70)
        '
        'ShowCommandLineToolStripMenuItem
        '
        Me.ToolStripItemExtender.SetKeyData(Me.ShowCommandLineToolStripMenuItem, System.Windows.Forms.Keys.F5)
        Me.ShowCommandLineToolStripMenuItem.Name = "ShowCommandLineToolStripMenuItem"
        Me.ShowCommandLineToolStripMenuItem.Size = New System.Drawing.Size(195, 22)
        Me.ShowCommandLineToolStripMenuItem.Text = "Show Command Line..."
        '
        'InfoToolStripMenuItem
        '
        Me.ToolStripItemExtender.SetKeyData(Me.InfoToolStripMenuItem, System.Windows.Forms.Keys.F2)
        Me.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem"
        Me.InfoToolStripMenuItem.Size = New System.Drawing.Size(195, 22)
        Me.InfoToolStripMenuItem.Text = "Info..."
        '
        'HelpToolStripMenuItem
        '
        Me.ToolStripItemExtender.SetKeyData(Me.HelpToolStripMenuItem, System.Windows.Forms.Keys.F1)
        Me.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"
        Me.HelpToolStripMenuItem.Size = New System.Drawing.Size(195, 22)
        Me.HelpToolStripMenuItem.Text = "Help"
        '
        'ToolStripItemExtender
        '
        Me.ToolStripItemExtender.Owner = Me
        '
        'DMFMuxerForm
        '
        Me.AcceptButton = Me.bOK
        Me.CancelButton = Me.bCancel
        Me.ClientSize = New System.Drawing.Size(491, 164)
        Me.Controls.Add(Me.SubtitleControl)
        Me.Controls.Add(Me.bTools)
        Me.Controls.Add(Me.bCancel)
        Me.Controls.Add(Me.bOK)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.HelpButton = True
        Me.KeyPreview = True
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "DMFMuxerForm"
        Me.ShowIcon = False
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "DivX Container Configuration"
        Me.cmsTools.ResumeLayout(False)
        CType(Me.ToolStripItemExtender, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Muxer As DMFMuxer

    Public Sub New(ByVal muxer As DMFMuxer)
        MyBase.New()
        InitializeComponent()
        Me.Muxer = muxer
        SubtitleControl.IDX = muxer.IDX
    End Sub

    Private Sub bOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bOK.Click
        Muxer.IDX = SubtitleControl.IDX
    End Sub

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

    Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click
        Dim f As New HelpForm()
        f.Document.WriteStart(Text)
        f.Document.WriteParagraph("DivXMux is the muxer of the [[http://en.wikipedia.org/wiki/Container_format|DivX Media Format]].")
        f.Document.WriteTips(SubtitleControl.TipProvider.GetTips)
        f.Show()
    End Sub

    Private Sub InfoToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles InfoToolStripMenuItem.Click
        Muxer.ShowInfoDialog()
    End Sub

    Private Sub ShowCommandLineToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ShowCommandLineToolStripMenuItem.Click
        g.ShowCommandLinePreview(Muxer.GetCommandLine)
    End Sub

    Private Sub bTools_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bTools.Click
        cmsTools.Show(bTools, 0, bTools.Height)
    End Sub

    Private Sub bTools_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles bTools.Paint
        ButtonHelp.DrawDropDownGlyph(bTools, e.Graphics, HorizontalAlignment.Right)
    End Sub
End Class