mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Merge pull request #904 from ivandrofly/patch-4
Use copy constructor instead re-calling GetSsaStyle()
This commit is contained in:
commit
f66a785ee0
@ -625,7 +625,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
{
|
||||
string styleName = listViewStyles.SelectedItems[0].Text;
|
||||
SsaStyle oldStyle = GetSsaStyle(styleName);
|
||||
SsaStyle style = GetSsaStyle(styleName);
|
||||
SsaStyle style = new SsaStyle(oldStyle); // Copy contructor
|
||||
style.Name = string.Format(Configuration.Settings.Language.SubStationAlphaStyles.CopyOfY, styleName);
|
||||
|
||||
if (GetSsaStyle(style.Name).LoadedFromHeader)
|
||||
@ -1295,4 +1295,4 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -49,6 +49,35 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
LoadedFromHeader = false;
|
||||
}
|
||||
|
||||
public SsaStyle(SsaStyle ssaStyle)
|
||||
{
|
||||
Name = ssaStyle.Name;
|
||||
FontName = ssaStyle.FontName;
|
||||
FontSize = ssaStyle.FontSize;
|
||||
|
||||
Italic = ssaStyle.Italic;
|
||||
Bold = ssaStyle.Bold;
|
||||
Underline = ssaStyle.Underline;
|
||||
|
||||
Primary = ssaStyle.Primary;
|
||||
Secondary = ssaStyle.Secondary;
|
||||
Tertiary = ssaStyle.Tertiary;
|
||||
Outline = ssaStyle.Outline;
|
||||
Background = ssaStyle.Background;
|
||||
|
||||
ShadowWidth = ssaStyle.ShadowWidth;
|
||||
OutlineWidth = ssaStyle.OutlineWidth;
|
||||
|
||||
Alignment = ssaStyle.Alignment;
|
||||
MarginLeft = ssaStyle.MarginLeft;
|
||||
MarginRight = ssaStyle.MarginRight;
|
||||
MarginVertical = ssaStyle.MarginVertical;
|
||||
|
||||
BorderStyle = ssaStyle.BorderStyle;
|
||||
RawLine = ssaStyle.RawLine;
|
||||
LoadedFromHeader = ssaStyle.LoadedFromHeader;
|
||||
}
|
||||
|
||||
internal string ToRawSsa(string styleFormat)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
@ -173,4 +202,4 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return s.Substring(0, s.Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user