2010-10-12 13:17:56 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Nikse.SubtitleEdit.Logic;
|
2010-12-30 20:20:33 +01:00
|
|
|
|
using System.Drawing;
|
2010-10-12 13:17:56 +02:00
|
|
|
|
|
|
|
|
|
namespace Nikse.SubtitleEdit.Forms
|
|
|
|
|
{
|
|
|
|
|
public sealed partial class MatroskaSubtitleChooser : Form
|
|
|
|
|
{
|
|
|
|
|
public MatroskaSubtitleChooser()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
Text = Configuration.Settings.Language.MatroskaSubtitleChooser.Title;
|
|
|
|
|
labelChoose.Text = Configuration.Settings.Language.MatroskaSubtitleChooser.PleaseChoose;
|
|
|
|
|
buttonOK.Text = Configuration.Settings.Language.General.OK;
|
|
|
|
|
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
2010-12-30 20:20:33 +01:00
|
|
|
|
FixLargeFonts();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FixLargeFonts()
|
|
|
|
|
{
|
|
|
|
|
Graphics graphics = this.CreateGraphics();
|
|
|
|
|
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
|
|
|
|
|
if (textSize.Height > buttonOK.Height - 4)
|
|
|
|
|
{
|
|
|
|
|
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
|
|
|
|
|
Utilities.SetButtonHeight(this, newButtonHeight, 1);
|
|
|
|
|
}
|
2010-10-12 13:17:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int SelectedIndex
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return listBox1.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Initialize(List<MatroskaSubtitleInfo> subtitleInfoList)
|
2011-09-28 23:22:51 +02:00
|
|
|
|
{
|
2010-10-12 13:17:56 +02:00
|
|
|
|
foreach (MatroskaSubtitleInfo info in subtitleInfoList)
|
|
|
|
|
{
|
|
|
|
|
string s = string.Format(Configuration.Settings.Language.MatroskaSubtitleChooser.TrackXLanguageYTypeZ, info.TrackNumber, info.Name, info.Language, info.CodecId);
|
|
|
|
|
listBox1.Items.Add(s);
|
|
|
|
|
}
|
|
|
|
|
listBox1.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-28 23:22:51 +02:00
|
|
|
|
internal void Initialize(List<Logic.Mp4.Boxes.Trak> mp4SubtitleTracks)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
foreach (var track in mp4SubtitleTracks)
|
|
|
|
|
{
|
|
|
|
|
i++;
|
2011-10-04 21:42:09 +02:00
|
|
|
|
string handler = track.Mdia.HandlerName;
|
|
|
|
|
if (handler != null && handler.Length > 1)
|
2011-10-06 21:22:35 +02:00
|
|
|
|
handler = " - " + handler;
|
|
|
|
|
string s = string.Format("{0}: {1} - {2}{3}", i, track.Mdia.Mdhd.Iso639ThreeLetterCode, track.Mdia.Mdhd.LanguageString, handler);
|
2011-09-28 23:22:51 +02:00
|
|
|
|
listBox1.Items.Add(s);
|
|
|
|
|
}
|
|
|
|
|
listBox1.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 13:17:56 +02:00
|
|
|
|
private void FormMatroskaSubtitleChooser_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyCode == Keys.Escape)
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonOkClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
}
|
2011-09-28 23:22:51 +02:00
|
|
|
|
|
2011-09-29 08:07:53 +02:00
|
|
|
|
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-12 13:17:56 +02:00
|
|
|
|
}
|
|
|
|
|
}
|