Ejemplo n.º 1
0
        private void InitializeListView()
        {
            var styles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);

            listViewStyles.Items.Clear();
            foreach (string style in styles)
            {
                SsaStyle ssaStyle = AdvancedSubStationAlpha.GetSsaStyle(style, _subtitle.Header);
                SubStationAlphaStyles.AddStyle(listViewStyles, ssaStyle, _subtitle, _isSubStationAlpha);
            }
            if (listViewStyles.Items.Count > 0)
            {
                listViewStyles.Items[0].Selected = true;
            }
        }
Ejemplo n.º 2
0
 private void toolStripMenuItemAssStyles_Click(object sender, EventArgs e)
 {
     StylesForm styles = null;
     try
     {
         var format = GetCurrentSubtitleFormat();
         var formatType = format.GetType();
         if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha))
         {
             styles = new SubStationAlphaStyles(_subtitle, format);
             if (styles.ShowDialog(this) == DialogResult.OK)
             {
                 _subtitle.Header = styles.Header;
                 var styleList = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);
                 if (styleList.Count > 0)
                 {
                     for (var i = 0; i < _subtitle.Paragraphs.Count; i++)
                     {
                         var p = _subtitle.Paragraphs[i];
                         if (p.Extra == null || !styleList.Any(s => s.Equals(p.Extra, StringComparison.OrdinalIgnoreCase)))
                         {
                             p.Extra = styleList[0];
                             SubtitleListview1.SetExtraText(i, p.Extra, SubtitleListview1.ForeColor);
                         }
                     }
                 }
             }
         }
         else if (formatType == typeof(TimedText10) || formatType == typeof(ItunesTimedText))
         {
             styles = new TimedTextStyles(_subtitle);
             if (styles.ShowDialog(this) == DialogResult.OK)
             {
                 _subtitle.Header = styles.Header;
             }
         }
     }
     finally
     {
         if (styles != null)
         {
             styles.Dispose();
         }
     }
 }
Ejemplo n.º 3
0
 private void ShowAssSsaStyles()
 {
     SubStationAlphaStyles form = null;
     try
     {
         var assa = new AdvancedSubStationAlpha();
         if (comboBoxSubtitleFormats.Text == assa.Name)
         {
             form = new SubStationAlphaStyles(new Subtitle(), assa);
             form.MakeOnlyOneStyle();
             if (form.ShowDialog(this) == DialogResult.OK)
             {
                 _assStyle = form.Header;
             }
         }
         else
         {
             var ssa = new SubStationAlpha();
             if (comboBoxSubtitleFormats.Text == ssa.Name)
             {
                 form = new SubStationAlphaStyles(new Subtitle(), ssa);
                 if (form.ShowDialog(this) == DialogResult.OK)
                 {
                     _ssaStyle = form.Header;
                 }
             }
         }
     }
     finally
     {
         if (form != null)
         {
             form.Dispose();
         }
     }
 }
 /// <summary>
 /// The button styles click.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void ButtonStylesClick(object sender, EventArgs e)
 {
     SubStationAlphaStyles form = null;
     try
     {
         var assa = new AdvancedSubStationAlpha();
         if (this.comboBoxSubtitleFormats.Text == assa.Name)
         {
             form = new SubStationAlphaStyles(new Subtitle(), assa);
             form.MakeOnlyOneStyle();
             if (form.ShowDialog(this) == DialogResult.OK)
             {
                 this._assStyle = form.Header;
             }
         }
         else
         {
             var ssa = new SubStationAlpha();
             if (this.comboBoxSubtitleFormats.Text == ssa.Name)
             {
                 form = new SubStationAlphaStyles(new Subtitle(), ssa);
                 if (form.ShowDialog(this) == DialogResult.OK)
                 {
                     this._ssaStyle = form.Header;
                 }
             }
         }
     }
     finally
     {
         if (form != null)
         {
             form.Dispose();
         }
     }
 }