private void button2StyleSubs2_Click(object sender, EventArgs e)
 {
     styleDialogSubs.Style = styleSubs2;
     styleDialogSubs.Title = "Subs2 Style";
     styleDialogSubs.ShowDialog();
     styleSubs2 = styleDialogSubs.Style;
 }
        public DialogSubtitleStyle()
        {
            InitializeComponent();

            comboBoxMiscEncoding.Items.AddRange(StyleEncoding.getDefaultList().ToArray());
            comboBoxMiscEncoding.SelectedIndex = 1;

            style = new InfoStyle();
            updateGUI();
        }
        /// <summary>
        /// Format a single style (Subs1 or Subs2) for the .ass dialog text.
        /// </summary>
        private string formatSingleStyle(string name, InfoStyle style)
        {
            int italic      = 0;
            int bold        = 0;
            int underline   = 0;
            int strikeOut   = 0;
            int bolderStyle = 1;

            if (style.Font.Italic)
            {
                italic = -1;
            }

            if (style.Font.Bold)
            {
                bold = -1;
            }

            if (style.Font.Underline)
            {
                underline = -1;
            }

            if (style.Font.Strikeout)
            {
                strikeOut = -1;
            }

            if (style.OpaqueBox)
            {
                bolderStyle = 3;
            }

            // Example:
            // Style: Subs1,Meiryo,18,&H00F9EDFF,&H0000FFFF,&H3C2B0E17,&HA0000000,0,0,0,0,84,100,0,0,1,2,1,2,10,10,15,1
            string styleStr = String.Format("Style: {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22}\n",
                                            name,                                                                   // {0} Name
                                            style.Font.Name,                                                        // {1} Fontname
                                            style.Font.Size,                                                        // {2} Fontsize
                                            UtilsSubs.formatAssColor(style.ColorPrimary, style.OpacityPrimary),     // {3} PrimaryColour
                                            UtilsSubs.formatAssColor(style.ColorSecondary, style.OpacitySecondary), // {4} SecondaryColour
                                            UtilsSubs.formatAssColor(style.ColorOutline, style.OpacityOutline),     // {5} OutlineColour
                                            UtilsSubs.formatAssColor(style.ColorShadow, style.OpacityShadow),       // {6} BackColour
                                            bold,                                                                   // {7} Bold
                                            italic,                                                                 // {8} Italic
                                            underline,                                                              // {9} Underline
                                            strikeOut,                                                              // {10} StrikeOut
                                            style.ScaleX,                                                           // {11} ScaleX
                                            style.ScaleY,                                                           // {12} ScaleY
                                            style.Spacing,                                                          // {13} Spacing
                                            style.Rotation,                                                         // {14} Angle
                                            bolderStyle,                                                            // {15} BorderStyle
                                            style.Outline,                                                          // {16} Outline
                                            style.Shadow,                                                           // {17} Shadow
                                            style.Alignment,                                                        // {18} Alignment
                                            style.MarginLeft,                                                       // {19} MarginL
                                            style.MarginRight,                                                      // {20} MarginR
                                            style.MarginVertical,                                                   // {21} MarginV
                                            style.Encoding.Num);                                                    // {22} Encoding

            return(styleStr);
        }