Added "use count" in style manager

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1225 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-06-04 16:49:10 +00:00
parent 48ec96fbc0
commit 7a354e7889
4 changed files with 41 additions and 18 deletions

View File

@ -95,6 +95,7 @@
this.pictureBoxPreview = new System.Windows.Forms.PictureBox();
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
this.openFileDialogImport = new System.Windows.Forms.OpenFileDialog();
this.columnHeaderUseCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStripStyles.SuspendLayout();
this.groupBoxStyles.SuspendLayout();
this.groupBoxProperties.SuspendLayout();
@ -122,6 +123,7 @@
this.columnHeaderName,
this.columnHeaderFontName,
this.columnHeaderFontSize,
this.columnHeaderUseCount,
this.columnHeaderPrimaryColor,
this.columnHeaderOutline});
this.listViewStyles.ContextMenuStrip = this.contextMenuStripStyles;
@ -130,7 +132,7 @@
this.listViewStyles.Location = new System.Drawing.Point(6, 19);
this.listViewStyles.MultiSelect = false;
this.listViewStyles.Name = "listViewStyles";
this.listViewStyles.Size = new System.Drawing.Size(445, 283);
this.listViewStyles.Size = new System.Drawing.Size(543, 283);
this.listViewStyles.TabIndex = 0;
this.listViewStyles.UseCompatibleStateImageBehavior = false;
this.listViewStyles.View = System.Windows.Forms.View.Details;
@ -206,7 +208,7 @@
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(797, 509);
this.buttonCancel.Location = new System.Drawing.Point(895, 569);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 5;
@ -218,7 +220,7 @@
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(716, 509);
this.buttonOK.Location = new System.Drawing.Point(814, 569);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 4;
@ -238,7 +240,7 @@
this.groupBoxStyles.Controls.Add(this.listViewStyles);
this.groupBoxStyles.Location = new System.Drawing.Point(12, 12);
this.groupBoxStyles.Name = "groupBoxStyles";
this.groupBoxStyles.Size = new System.Drawing.Size(457, 338);
this.groupBoxStyles.Size = new System.Drawing.Size(555, 338);
this.groupBoxStyles.TabIndex = 0;
this.groupBoxStyles.TabStop = false;
this.groupBoxStyles.Text = "Styles";
@ -247,7 +249,7 @@
//
this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonImport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonImport.Location = new System.Drawing.Point(6, 311);
this.buttonImport.Location = new System.Drawing.Point(104, 311);
this.buttonImport.Name = "buttonImport";
this.buttonImport.Size = new System.Drawing.Size(82, 21);
this.buttonImport.TabIndex = 5;
@ -260,7 +262,7 @@
//
this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCopy.Location = new System.Drawing.Point(94, 311);
this.buttonCopy.Location = new System.Drawing.Point(192, 311);
this.buttonCopy.Name = "buttonCopy";
this.buttonCopy.Size = new System.Drawing.Size(82, 21);
this.buttonCopy.TabIndex = 1;
@ -272,7 +274,7 @@
//
this.buttonRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonRemoveAll.Location = new System.Drawing.Point(358, 311);
this.buttonRemoveAll.Location = new System.Drawing.Point(456, 311);
this.buttonRemoveAll.Name = "buttonRemoveAll";
this.buttonRemoveAll.Size = new System.Drawing.Size(92, 21);
this.buttonRemoveAll.TabIndex = 4;
@ -284,7 +286,7 @@
//
this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonAdd.Location = new System.Drawing.Point(182, 311);
this.buttonAdd.Location = new System.Drawing.Point(280, 311);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(82, 21);
this.buttonAdd.TabIndex = 2;
@ -296,7 +298,7 @@
//
this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonRemove.Location = new System.Drawing.Point(270, 311);
this.buttonRemove.Location = new System.Drawing.Point(368, 311);
this.buttonRemove.Name = "buttonRemove";
this.buttonRemove.Size = new System.Drawing.Size(82, 21);
this.buttonRemove.TabIndex = 3;
@ -315,9 +317,9 @@
this.groupBoxProperties.Controls.Add(this.groupBoxColors);
this.groupBoxProperties.Controls.Add(this.groupBoxAlignment);
this.groupBoxProperties.Controls.Add(this.groupBoxFont);
this.groupBoxProperties.Location = new System.Drawing.Point(475, 12);
this.groupBoxProperties.Location = new System.Drawing.Point(573, 12);
this.groupBoxProperties.Name = "groupBoxProperties";
this.groupBoxProperties.Size = new System.Drawing.Size(397, 491);
this.groupBoxProperties.Size = new System.Drawing.Size(397, 551);
this.groupBoxProperties.TabIndex = 3;
this.groupBoxProperties.TabStop = false;
this.groupBoxProperties.Text = "Properties";
@ -787,7 +789,7 @@
this.groupBoxPreview.Controls.Add(this.pictureBoxPreview);
this.groupBoxPreview.Location = new System.Drawing.Point(12, 356);
this.groupBoxPreview.Name = "groupBoxPreview";
this.groupBoxPreview.Size = new System.Drawing.Size(457, 147);
this.groupBoxPreview.Size = new System.Drawing.Size(555, 207);
this.groupBoxPreview.TabIndex = 2;
this.groupBoxPreview.TabStop = false;
this.groupBoxPreview.Text = "Preview";
@ -797,15 +799,19 @@
this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16);
this.pictureBoxPreview.Name = "pictureBoxPreview";
this.pictureBoxPreview.Size = new System.Drawing.Size(451, 128);
this.pictureBoxPreview.Size = new System.Drawing.Size(549, 188);
this.pictureBoxPreview.TabIndex = 0;
this.pictureBoxPreview.TabStop = false;
//
// columnHeaderUseCount
//
this.columnHeaderUseCount.Text = "Used#";
//
// SubStationAlphaStyles
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(884, 542);
this.ClientSize = new System.Drawing.Size(982, 602);
this.Controls.Add(this.groupBoxProperties);
this.Controls.Add(this.groupBoxStyles);
this.Controls.Add(this.buttonCancel);
@ -915,5 +921,6 @@
private System.Windows.Forms.ToolStripMenuItem removeAllToolStripMenuItem;
private System.Windows.Forms.Button buttonImport;
private System.Windows.Forms.OpenFileDialog openFileDialogImport;
private System.Windows.Forms.ColumnHeader columnHeaderUseCount;
}
}

View File

@ -86,8 +86,9 @@ namespace Nikse.SubtitleEdit.Forms
listViewStyles.Columns[0].Text = l.Name;
listViewStyles.Columns[1].Text = l.FontName;
listViewStyles.Columns[2].Text = l.FontSize;
listViewStyles.Columns[3].Text = l.Primary;
listViewStyles.Columns[4].Text = l.Outline;
listViewStyles.Columns[3].Text = l.UseCount;
listViewStyles.Columns[4].Text = l.Primary;
listViewStyles.Columns[5].Text = l.Outline;
groupBoxProperties.Text = l.Properties;
labelStyleName.Text = l.Name;
groupBoxFont.Text = l.FontSize;
@ -131,7 +132,7 @@ namespace Nikse.SubtitleEdit.Forms
Text = l.TitleSubstationAlpha;
buttonOutlineColor.Text = l.Tertiary;
buttonBackColor.Text = l.Back;
listViewStyles.Columns[4].Text = l.Back;
listViewStyles.Columns[5].Text = l.Back;
checkBoxFontUnderline.Visible = false;
}
@ -153,6 +154,8 @@ namespace Nikse.SubtitleEdit.Forms
numericUpDownOutline.Left = radioButtonOutline.Left + radioButtonOutline.Width + 5;
labelShadow.Left = numericUpDownOutline.Left + numericUpDownOutline.Width + 5;
numericUpDownShadowWidth.Left = labelShadow.Left + labelShadow.Width + 5;
listViewStyles.Columns[5].Width = -2;
}
void RefreshTimerTick(object sender, EventArgs e)
@ -325,6 +328,17 @@ namespace Nikse.SubtitleEdit.Forms
subItem = new ListViewItem.ListViewSubItem(item, ssaStyle.FontSize.ToString());
item.SubItems.Add(subItem);
int count = 0;
foreach (Paragraph p in _subtitle.Paragraphs)
{
if (string.IsNullOrEmpty(p.Extra) && ssaStyle.Name.TrimStart('*') == "Default")
count++;
else if (ssaStyle.Name.TrimStart('*').ToLower() == p.Extra.TrimStart('*').ToLower())
count++;
}
subItem = new ListViewItem.ListViewSubItem(item, count.ToString());
item.SubItems.Add(subItem);
subItem = new ListViewItem.ListViewSubItem(item, string.Empty);
subItem.BackColor = ssaStyle.Primary;
item.SubItems.Add(subItem);
@ -1153,7 +1167,7 @@ namespace Nikse.SubtitleEdit.Forms
private void SubStationAlphaStyles_ResizeEnd(object sender, EventArgs e)
{
listViewStyles.Columns[4].Width = -2;
listViewStyles.Columns[5].Width = -2;
GeneratePreview();
}

View File

@ -1433,6 +1433,7 @@ can edit in same subtitle file (collaboration)",
Font = "Font",
FontName = "Font name",
FontSize = "Font size",
UseCount = "Used",
Primary = "Primary",
Secondary = "Secondary",
Tertiary = "Tertiary",

View File

@ -1394,6 +1394,7 @@
public string Font { get; set; }
public string FontName { get; set; }
public string FontSize { get; set; }
public string UseCount { get; set; }
public string Primary { get; set; }
public string Secondary { get; set; }
public string Tertiary { get; set; }