mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Export style now possible from 'SSA/ASS style' window - thx vicgol :)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1735 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
e50f3e4a6b
commit
aec2e40e36
20
src/Forms/SubStationAlphaStyles.Designer.cs
generated
20
src/Forms/SubStationAlphaStyles.Designer.cs
generated
@ -98,6 +98,8 @@
|
||||
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
|
||||
this.openFileDialogImport = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialogStyle = new System.Windows.Forms.SaveFileDialog();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.timerClearStatus = new System.Windows.Forms.Timer(this.components);
|
||||
this.contextMenuStripStyles.SuspendLayout();
|
||||
this.groupBoxStyles.SuspendLayout();
|
||||
this.groupBoxProperties.SuspendLayout();
|
||||
@ -840,11 +842,26 @@
|
||||
//
|
||||
this.saveFileDialogStyle.OverwritePrompt = false;
|
||||
//
|
||||
// labelStatus
|
||||
//
|
||||
this.labelStatus.AutoSize = true;
|
||||
this.labelStatus.Location = new System.Drawing.Point(15, 577);
|
||||
this.labelStatus.Name = "labelStatus";
|
||||
this.labelStatus.Size = new System.Drawing.Size(59, 13);
|
||||
this.labelStatus.TabIndex = 6;
|
||||
this.labelStatus.Text = "labelStatus";
|
||||
//
|
||||
// timerClearStatus
|
||||
//
|
||||
this.timerClearStatus.Interval = 9000;
|
||||
this.timerClearStatus.Tick += new System.EventHandler(this.timerClearStatus_Tick);
|
||||
//
|
||||
// SubStationAlphaStyles
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(982, 602);
|
||||
this.Controls.Add(this.labelStatus);
|
||||
this.Controls.Add(this.groupBoxProperties);
|
||||
this.Controls.Add(this.groupBoxStyles);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
@ -885,6 +902,7 @@
|
||||
this.groupBoxPreview.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -959,5 +977,7 @@
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderUseCount;
|
||||
private System.Windows.Forms.Button buttonExport;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialogStyle;
|
||||
private System.Windows.Forms.Label labelStatus;
|
||||
private System.Windows.Forms.Timer timerClearStatus;
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
labelStatus.Text = string.Empty;
|
||||
Header = subtitle.Header;
|
||||
_format = format;
|
||||
_isSubStationAlpha = _format.FriendlyName == new SubStationAlpha().FriendlyName;
|
||||
@ -308,6 +309,22 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
subItem.BackColor = ssaStyle.Background;
|
||||
else
|
||||
subItem.BackColor = ssaStyle.Outline;
|
||||
subItem.Text = Configuration.Settings.Language.General.Text;
|
||||
subItem.ForeColor = ssaStyle.Primary;
|
||||
try
|
||||
{
|
||||
if (ssaStyle.Bold || ssaStyle.Italic)
|
||||
subItem.Font = new Font(ssaStyle.FontName, subItem.Font.Size, FontStyle.Bold | FontStyle.Italic);
|
||||
else if (ssaStyle.Bold)
|
||||
subItem.Font = new Font(ssaStyle.FontName, subItem.Font.Size, FontStyle.Bold);
|
||||
else if (ssaStyle.Italic)
|
||||
subItem.Font = new Font(ssaStyle.FontName, subItem.Font.Size, FontStyle.Italic);
|
||||
else if (ssaStyle.Italic)
|
||||
subItem.Font = new Font(ssaStyle.FontName, subItem.Font.Size, FontStyle.Regular);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
lv.Items.Add(item);
|
||||
@ -570,7 +587,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
colorDialogSSAStyle.Color = panelPrimaryColor.BackColor;
|
||||
if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
listViewStyles.SelectedItems[0].SubItems[3].BackColor = colorDialogSSAStyle.Color;
|
||||
listViewStyles.SelectedItems[0].SubItems[4].BackColor = colorDialogSSAStyle.Color;
|
||||
listViewStyles.SelectedItems[0].SubItems[5].ForeColor = colorDialogSSAStyle.Color;
|
||||
panelPrimaryColor.BackColor = colorDialogSSAStyle.Color;
|
||||
string name = listViewStyles.SelectedItems[0].Text;
|
||||
SetSsaStyle(name, "primarycolour", GetSsaColorString(colorDialogSSAStyle.Color));
|
||||
@ -1173,6 +1191,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_doUpdate = true;
|
||||
SetControlsFromStyle(style);
|
||||
listViewStyles_SelectedIndexChanged(null, null);
|
||||
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.SubStationAlphaStyles.StyleXImportedFromFileY)) // TODO: Remove in 3.4
|
||||
labelStatus.Text = string.Format(Configuration.Settings.Language.SubStationAlphaStyles.StyleXImportedFromFileY, style.Name, openFileDialogImport.FileName);
|
||||
timerClearStatus.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1209,17 +1231,19 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (saveFileDialogStyle.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (System.IO.File.Exists(saveFileDialogStyle.FileName))
|
||||
{
|
||||
{
|
||||
Encoding encoding = null;
|
||||
var s = new Subtitle();
|
||||
var format = s.LoadSubtitle(saveFileDialogStyle.FileName, out encoding, null);
|
||||
if (format == null)
|
||||
{
|
||||
MessageBox.Show("Not subtitle format: " + _format.Name);
|
||||
return;
|
||||
}
|
||||
else if (format.Name != _format.Name)
|
||||
{
|
||||
MessageBox.Show(string.Format("Cannot save {1} style in {0} file!", format.Name, _format.Name));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1251,6 +1275,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
sb.AppendLine(line);
|
||||
if (stylesOn && line.Replace(" ", string.Empty).Trim().ToLower().StartsWith("style:" + styleName.Replace(" ", string.Empty).Trim().ToLower() + ","))
|
||||
{
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.SubStationAlphaStyles.StyleAlreadyExits, styleName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.IO.File.WriteAllText(saveFileDialogStyle.FileName, sb.ToString(), Encoding.UTF8);
|
||||
}
|
||||
@ -1280,6 +1309,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
System.IO.File.WriteAllText(saveFileDialogStyle.FileName, content, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.SubStationAlphaStyles.StyleXImportedFromFileY)) // TODO: Remove in 3.4
|
||||
labelStatus.Text = string.Format(Configuration.Settings.Language.SubStationAlphaStyles.StyleXExportedToFileY, styleName, saveFileDialogStyle.FileName);
|
||||
timerClearStatus.Start();
|
||||
}
|
||||
|
||||
private void timerClearStatus_Tick(object sender, EventArgs e)
|
||||
{
|
||||
timerClearStatus.Stop();
|
||||
labelStatus.Text = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -129,4 +129,7 @@
|
||||
<metadata name="saveFileDialogStyle.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>529, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timerClearStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>685, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -2052,6 +2052,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
textWriter.WriteAttributeString("Text", oc.Text);
|
||||
textWriter.WriteAttributeString("Width", oc.Width.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteAttributeString("Height", oc.Height.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteAttributeString("MarginTop", oc.MarginTop.ToString(CultureInfo.InvariantCulture));
|
||||
foreach (NOcrPoint op in oc.LinesForeground)
|
||||
{
|
||||
textWriter.WriteStartElement("Point", "");
|
||||
@ -2095,6 +2096,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var oc = new NOcrChar(node.Attributes["Text"].Value);
|
||||
oc.Width = Convert.ToInt32(node.Attributes["Width"].Value, CultureInfo.InvariantCulture);
|
||||
oc.Height = Convert.ToInt32(node.Attributes["Height"].Value, CultureInfo.InvariantCulture);
|
||||
oc.MarginTop = Convert.ToInt32(node.Attributes["MarginTop"].Value, CultureInfo.InvariantCulture);
|
||||
foreach (XmlNode pointNode in node.SelectNodes("Point"))
|
||||
{
|
||||
var op = new NOcrPoint(DecodePoint(pointNode.Attributes["Start"].Value), DecodePoint(pointNode.Attributes["End"].Value));
|
||||
|
1
src/Forms/VobSubOcrNOcrCharacter.Designer.cs
generated
1
src/Forms/VobSubOcrNOcrCharacter.Designer.cs
generated
@ -134,6 +134,7 @@
|
||||
this.textBoxCharacters.Name = "textBoxCharacters";
|
||||
this.textBoxCharacters.Size = new System.Drawing.Size(107, 20);
|
||||
this.textBoxCharacters.TabIndex = 22;
|
||||
this.textBoxCharacters.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxCharacters_KeyDown);
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
|
@ -25,6 +25,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int _imageHeight;
|
||||
int _mx;
|
||||
int _my;
|
||||
bool _warningNoNotForegroundLinesShown = false;
|
||||
|
||||
public VobSubOcrNOcrCharacter()
|
||||
{
|
||||
@ -77,9 +78,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_vobSubForm = vobSubForm;
|
||||
_additions = additions;
|
||||
_nocrChar = new NOcrChar();
|
||||
_nocrChar.MarginTop = character.Y;
|
||||
_imageWidth = character.Bitmap.Width;
|
||||
_imageHeight = character.Bitmap.Height;
|
||||
_drawLineOn = false;
|
||||
_warningNoNotForegroundLinesShown = false;
|
||||
|
||||
buttonShrinkSelection.Visible = showShrink;
|
||||
|
||||
@ -161,9 +164,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
MessageBox.Show("No foreground lines!");
|
||||
return;
|
||||
}
|
||||
if (listBoxlinesBackground.Items.Count == 0)
|
||||
if (listBoxlinesBackground.Items.Count == 0 && !_warningNoNotForegroundLinesShown)
|
||||
{
|
||||
MessageBox.Show("No not-foreground lines!");
|
||||
_warningNoNotForegroundLinesShown = true;
|
||||
return;
|
||||
}
|
||||
if (textBoxCharacters.Text.Length == 0)
|
||||
@ -333,5 +337,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ShowOcrPoints();
|
||||
}
|
||||
|
||||
private void textBoxCharacters_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
buttonOK_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ E-mail: mailto:nikse.dk@gmail.com</AboutText1>
|
||||
<ConvertOptions>Konverter indstillinger</ConvertOptions>
|
||||
<RemoveFormatting>Fjern formaterings- tags</RemoveFormatting>
|
||||
<RemoveTextForHI>fjerne tekst for høre-hæmmede</RemoveTextForHI>
|
||||
<OverwriteOriginalFiles>Overskriv originale filer (kun hvis format ikke ændres)</OverwriteOriginalFiles>
|
||||
<ReDoCasing>Sæt store/små bogstaver</ReDoCasing>
|
||||
<Convert>Konverter</Convert>
|
||||
<NothingToConvert>Intet at konvertere!</NothingToConvert>
|
||||
@ -154,6 +155,9 @@ E-mail: mailto:nikse.dk@gmail.com</AboutText1>
|
||||
<ConvertedX>Konverteret ({0})</ConvertedX>
|
||||
<Settings>Indstillinger</Settings>
|
||||
<AutoBalance>Auto-balancer linjer</AutoBalance>
|
||||
<ScanFolder>Scan mappe...</ScanFolder>
|
||||
<ScanningFolder>Scanner {0} og undermapper for undertekster...</ScanningFolder>
|
||||
<Recursive>Medtag undermapper</Recursive>
|
||||
</BatchConvert>
|
||||
<Beamer>
|
||||
<Title>Undertekst fremviser</Title>
|
||||
@ -1587,6 +1591,9 @@ Fortsæt?</SubtitleAppendPrompt>
|
||||
<ImportStyleFromFile>Importer style fra fil...</ImportStyleFromFile>
|
||||
<ExportStyleToFile>Export style til fil...</ExportStyleToFile>
|
||||
<ChooseStyle>Vælg style der skal importeres</ChooseStyle>
|
||||
<StyleAlreadyExits>Style findes allerede: {0}</StyleAlreadyExits>
|
||||
<StyleXExportedToFileY>Style '{0}' eksporteret til '{1}'</StyleXExportedToFileY>
|
||||
<StyleXImportedFromFileY>Style '{0}' importeret fra '{1}'</StyleXImportedFromFileY>
|
||||
</SubStationAlphaStyles>
|
||||
<PointSync>
|
||||
<Title>Punkt synkronisering</Title>
|
||||
|
@ -267,7 +267,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
OverwriteOriginalFiles = "Overwrite original files (new extension if format is changed)",
|
||||
ScanFolder = "Scan folder...",
|
||||
ScanningFolder = "Scanning {0} and subfolders for subtitle files...",
|
||||
Recursive = "Resursive",
|
||||
Recursive = "Include sub folders",
|
||||
};
|
||||
|
||||
Beamer = new LanguageStructure.Beamer
|
||||
@ -1847,6 +1847,9 @@ can edit in same subtitle file (collaboration)",
|
||||
ImportStyleFromFile = "Import style from file...",
|
||||
ExportStyleToFile = "Export style to file... (will add style if file already exists)",
|
||||
ChooseStyle = "Choose style to import",
|
||||
StyleAlreadyExits = "Style already exists: {0}",
|
||||
StyleXExportedToFileY = "Style '{0}' exported to file '{1}'",
|
||||
StyleXImportedFromFileY = "Style '{0}' imported from file '{1}'",
|
||||
};
|
||||
|
||||
PointSync = new LanguageStructure.PointSync
|
||||
|
@ -1752,6 +1752,9 @@
|
||||
public string ImportStyleFromFile { get; set; }
|
||||
public string ExportStyleToFile { get; set; }
|
||||
public string ChooseStyle { get; set; }
|
||||
public string StyleAlreadyExits { get; set; }
|
||||
public string StyleXExportedToFileY { get; set; }
|
||||
public string StyleXImportedFromFileY { get; set; }
|
||||
}
|
||||
|
||||
public class PointSync
|
||||
|
@ -8,6 +8,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
public string Text { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public int MarginTop { get; set; }
|
||||
public List<NOcrPoint> LinesForeground { get; private set; }
|
||||
public List<NOcrPoint> LinesBackground { get; private set; }
|
||||
public string Id { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user