Exemple #1
0
        internal void Initialize(Logic.Subtitle subtitle, string fileName)
        {
            _subtitle            = subtitle;
            _fileName            = fileName;
            textBoxText.ReadOnly = true;
            comboBoxTimeCodeSeperator.SelectedIndex = 0;
            GeneratePreview();

            comboBoxEncoding.Items.Clear();
            int encodingSelectedIndex = 0;

            comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName);
            foreach (EncodingInfo ei in Encoding.GetEncodings())
            {
                if (ei.Name != Encoding.UTF8.BodyName)
                {
                    if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047)
                    {
                        comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName);
                        if (ei.Name == Configuration.Settings.General.DefaultEncoding)
                        {
                            encodingSelectedIndex = comboBoxEncoding.Items.Count - 1;
                        }
                    }
                }
            }
            comboBoxEncoding.SelectedIndex = encodingSelectedIndex;
        }
        internal void Initialize(Logic.Subtitle subtitle, int firstSelectedIndex)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Paragraph p in subtitle.Paragraphs)
            {
                sb.AppendLine(p.Text);
            }

            string watermark = ReadWaterMark(sb.ToString().Trim());

            LabelWatermark.Text = string.Format("Watermark: {0}", watermark);
            if (watermark.Length == 0)
            {
                buttonRemove.Enabled = false;
                textBoxWatermark.Focus();
            }
            else
            {
                groupBoxGenerate.Enabled = false;
                buttonOK.Focus();
            }

            _firstSelectedIndex = firstSelectedIndex;
            Paragraph current = subtitle.GetParagraphOrDefault(_firstSelectedIndex);

            if (current != null)
            {
                radioButtonCurrentLine.Text = radioButtonCurrentLine.Text + " " + current.Text.Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString);
            }
            else
            {
                radioButtonCurrentLine.Enabled = false;
            }
        }
        public DCinemaPropertiesInterop(Subtitle _subtitle, string _videoFileName)
        {
            InitializeComponent();

            var l = Configuration.Settings.Language.DCinemaProperties;
            Text = l.Title;
            labelSubtitleID.Text = l.SubtitleId;
            labelMovieTitle.Text = l.MovieTitle;
            labelReelNumber.Text = l.ReelNumber;
            labelLanguage.Text = l.Language;
            groupBoxFont.Text = l.Font;
            labelFontId.Text = l.FontId;
            labelFontUri.Text = l.FontUri;
            labelFontColor.Text = l.FontColor;
            buttonFontColor.Text = l.ChooseColor;
            labelEffect.Text = l.FontEffect;
            labelEffectColor.Text = l.FontEffectColor;
            buttonFontEffectColor.Text = l.ChooseColor;
            labelFontSize.Text = l.FontSize;

            this._subtitle = _subtitle;
            this._videoFileName = _videoFileName;

            foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
            {
                comboBoxLanguage.Items.Add(x.EnglishName);
            }
            comboBoxLanguage.Sorted = true;

            var ss = Configuration.Settings.SubtitleSettings;
            if (!string.IsNullOrEmpty(ss.CurrentDCinemaSubtitleId))
            {
                textBoxSubtitleID.Text = ss.CurrentDCinemaSubtitleId;
                textBoxMovieTitle.Text = ss.CurrentDCinemaMovieTitle;
                int number;
                if (int.TryParse(ss.CurrentDCinemaReelNumber, out number))
                {
                    if (numericUpDownReelNumber.Minimum <= number && numericUpDownReelNumber.Maximum >= number)
                        numericUpDownReelNumber.Value = number;
                }
                comboBoxLanguage.Text = ss.CurrentDCinemaLanguage;
                textBoxFontID.Text = ss.CurrentDCinemaFontId;
                textBoxFontUri.Text = ss.CurrentDCinemaFontUri;
                panelFontColor.BackColor = ss.CurrentDCinemaFontColor;
                if (ss.CurrentDCinemaFontEffect == "border")
                    comboBoxFontEffect.SelectedIndex = 1;
                else if (ss.CurrentDCinemaFontEffect == "shadow")
                    comboBoxFontEffect.SelectedIndex = 2;
                else
                    comboBoxFontEffect.SelectedIndex = 0;
                panelFontEffectColor.BackColor = ss.CurrentDCinemaFontEffectColor;
                numericUpDownFontSize.Value = ss.CurrentDCinemaFontSize;
                if (numericUpDownTopBottomMargin.Minimum <= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin &&
                   numericUpDownTopBottomMargin.Maximum >= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin)
                    numericUpDownTopBottomMargin.Value = Configuration.Settings.SubtitleSettings.DCinemaBottomMargin;
                else
                    numericUpDownTopBottomMargin.Value = 8;
            }
            FixLargeFonts();
        }
Exemple #4
0
        public DCinemaPropertiesInterop(Subtitle _subtitle, string _videoFileName)
        {
            InitializeComponent();

            var l = Configuration.Settings.Language.DCinemaProperties;

            Text = l.Title;
            labelSubtitleID.Text       = l.SubtitleId;
            labelMovieTitle.Text       = l.MovieTitle;
            labelReelNumber.Text       = l.ReelNumber;
            labelLanguage.Text         = l.Language;
            groupBoxFont.Text          = l.Font;
            labelFontId.Text           = l.FontId;
            labelFontUri.Text          = l.FontUri;
            labelFontColor.Text        = l.FontColor;
            buttonFontColor.Text       = l.ChooseColor;
            labelEffect.Text           = l.FontEffect;
            labelEffectColor.Text      = l.FontEffectColor;
            buttonFontEffectColor.Text = l.ChooseColor;
            labelFontSize.Text         = l.FontSize;

            if (!string.IsNullOrEmpty(l.TopBottomMargin)) //TODO: Remove in SE 3.4
            {
                labelTopBottomMargin.Text = l.TopBottomMargin;
                labelZPosition.Text       = l.ZPosition;
                labelZPositionHelp.Text   = l.ZPositionHelp;
            }
            if (!string.IsNullOrEmpty(l.FadeUpTime)) //TODO: Remove in SE 3.4
            {
                labelFadeUpTime.Text   = l.FadeUpTime;
                labelFadeDownTime.Text = l.FadeDownTime;
            }

            this._subtitle      = _subtitle;
            this._videoFileName = _videoFileName;

            foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
            {
                comboBoxLanguage.Items.Add(x.EnglishName);
            }
            comboBoxLanguage.Sorted = true;

            var ss = Configuration.Settings.SubtitleSettings;

            if (!string.IsNullOrEmpty(ss.CurrentDCinemaSubtitleId))
            {
                textBoxSubtitleID.Text = ss.CurrentDCinemaSubtitleId;
                textBoxMovieTitle.Text = ss.CurrentDCinemaMovieTitle;
                int number;
                if (int.TryParse(ss.CurrentDCinemaReelNumber, out number))
                {
                    if (numericUpDownReelNumber.Minimum <= number && numericUpDownReelNumber.Maximum >= number)
                    {
                        numericUpDownReelNumber.Value = number;
                    }
                }
                comboBoxLanguage.Text    = ss.CurrentDCinemaLanguage;
                textBoxFontID.Text       = ss.CurrentDCinemaFontId;
                textBoxFontUri.Text      = ss.CurrentDCinemaFontUri;
                panelFontColor.BackColor = ss.CurrentDCinemaFontColor;
                if (ss.CurrentDCinemaFontEffect == "border")
                {
                    comboBoxFontEffect.SelectedIndex = 1;
                }
                else if (ss.CurrentDCinemaFontEffect == "shadow")
                {
                    comboBoxFontEffect.SelectedIndex = 2;
                }
                else
                {
                    comboBoxFontEffect.SelectedIndex = 0;
                }
                panelFontEffectColor.BackColor = ss.CurrentDCinemaFontEffectColor;
                numericUpDownFontSize.Value    = ss.CurrentDCinemaFontSize;
                if (numericUpDownTopBottomMargin.Minimum <= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin &&
                    numericUpDownTopBottomMargin.Maximum >= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin)
                {
                    numericUpDownTopBottomMargin.Value = Configuration.Settings.SubtitleSettings.DCinemaBottomMargin;
                }
                else
                {
                    numericUpDownTopBottomMargin.Value = 8;
                }

                if (numericUpDownFadeUp.Minimum <= Configuration.Settings.SubtitleSettings.DCinemaFadeUpTime &&
                    numericUpDownFadeUp.Maximum >= Configuration.Settings.SubtitleSettings.DCinemaFadeUpTime)
                {
                    numericUpDownFadeUp.Value = Configuration.Settings.SubtitleSettings.DCinemaFadeUpTime;
                }
                else
                {
                    numericUpDownFadeUp.Value = 5;
                }

                if (numericUpDownFadeDown.Minimum <= Configuration.Settings.SubtitleSettings.DCinemaFadeDownTime &&
                    numericUpDownFadeDown.Maximum >= Configuration.Settings.SubtitleSettings.DCinemaFadeDownTime)
                {
                    numericUpDownFadeDown.Value = Configuration.Settings.SubtitleSettings.DCinemaFadeDownTime;
                }
                else
                {
                    numericUpDownFadeUp.Value = 5;
                }

                decimal zPosition = (decimal)Configuration.Settings.SubtitleSettings.DCinemaZPosition;
                if (numericUpDownZPosition.Minimum <= zPosition &&
                    numericUpDownZPosition.Maximum >= zPosition)
                {
                    numericUpDownZPosition.Value = zPosition;
                }
                else
                {
                    numericUpDownZPosition.Value = 0;
                }
            }
            FixLargeFonts();
        }