Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Src/LexText/Interlinear/ITextStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Src/LexText/Interlinear/ITextStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,13 @@
<value>Media </value>
<comment>there is a trailing space</comment>
</data>
<data name="ksMediaNotFound" xml:space="preserve">
<value>Media not found: check Info tab for file name</value>
<comment>Used when a media filepath is specified, but the file doesn't exist. Ensure translation of "Info" matches translation used for the tab label.</comment>
</data>
<data name="ksNoMedia" xml:space="preserve">
<value>No Media</value>
<comment>Used when no there is no media filepath specified.</comment>
</data>
<data name="ksBeginTimeOffset" xml:space="preserve">
<value>Begin</value>
Expand Down
49 changes: 35 additions & 14 deletions Src/LexText/Interlinear/InterlinVc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,21 +1004,42 @@ private ITsString MakeLabel(string labelText)
return tssLabel;
}

private void AddNoMediaMessage(IVwEnv vwenv, ITsString tssMediaLabel, bool lineAndSegSameDir, bool lineAndUserSameDir)
private void AddNoMediaMessage(IVwEnv vwenv, ITsString tssMediaLabel, bool lineAndSegSameDir, bool lineAndUserSameDir, string mediaFile)
{
var defUserWs = m_cache.DefaultUserWs;

// Build "No Media" message.
// Use normal label settings, except make it italic instead of bold.
var tssNoMediaMessage = MakeUiElementString(
ITextStrings.ksNoMedia, defUserWs,
propsBldr =>
{
propsBldr.SetIntPropValues(
(int)FwTextPropType.ktptItalic,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
});
bool isFilePathSpecified = !string.IsNullOrEmpty(mediaFile);
ITsString tssFilePath = null;
ITsString tssNoMediaMessage;

if (isFilePathSpecified)
{
tssFilePath = TsStringUtils.MakeString(mediaFile, defUserWs);
// We have a media filepath, but file was not found. Build media not found message.
// Use normal label settings, except make it italic instead of bold.
tssNoMediaMessage = MakeUiElementString(
ITextStrings.ksMediaNotFound, defUserWs,
propsBldr =>
{
propsBldr.SetIntPropValues(
(int)FwTextPropType.ktptItalic,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
});
}
else
{
// No media filepath was given. Build no media message.
// Use normal label settings, except make it italic instead of bold.
tssNoMediaMessage = MakeUiElementString(
ITextStrings.ksNoMedia, defUserWs,
propsBldr =>
{
propsBldr.SetIntPropValues(
(int)FwTextPropType.ktptItalic,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
});
}

// If the line WS and segment WS are not the same direction, OR the line WS and user WS
// are not the same direction, but not both, then we need to insert pieces in reverse
Expand Down Expand Up @@ -1099,7 +1120,7 @@ protected virtual void AddMedia(IVwEnv vwenv, int hvoSeg, int lineChoiceIndex)
vwenv.OpenParagraph();
bool lineAndSegSameDir = IsWsRtl(wssOptions[0]) == IsWsRtl(wsForSeg);
bool lineAndUserSameDir = (IsWsRtl(wssOptions[0]) == IsWsRtl(defUserWs));
AddNoMediaMessage(vwenv, tssMediaLabel, lineAndSegSameDir, lineAndUserSameDir);
AddNoMediaMessage(vwenv, tssMediaLabel, lineAndSegSameDir, lineAndUserSameDir, mediaFile);
vwenv.CloseParagraph();
vwenv.CloseDiv();
return;
Expand Down
Loading