Retain boxed manuscript titles with normal Office contrast
This commit is contained in:
parent
a657ebf3c1
commit
b12dafa1aa
@ -56,19 +56,12 @@ namespace PlotDirector.WordAddIn
|
||||
displayed[id] = value;
|
||||
}
|
||||
|
||||
public bool CanOpenBook(Office.IRibbonControl control) => adapter()?.HasRibbonBook == true;
|
||||
// Non-breaking padding keeps the native group wide even before Word reports a title.
|
||||
private static string TitleLabel(string title)
|
||||
public void RestoreTitle(Office.IRibbonControl control, string text)
|
||||
{
|
||||
const int width = 58;
|
||||
if (title.Length <= width) return title.PadRight(width, '\u00a0');
|
||||
var end = char.IsHighSurrogate(title[width - 2]) ? width - 2 : width - 1;
|
||||
return title.Substring(0, end) + "…";
|
||||
ui?.InvalidateControl(control.Id);
|
||||
}
|
||||
|
||||
public string GetBook(Office.IRibbonControl control) => TitleLabel(GetBookTip(control));
|
||||
public string GetChapter(Office.IRibbonControl control) => TitleLabel(GetChapterTip(control));
|
||||
public string GetScene(Office.IRibbonControl control) => TitleLabel(GetSceneTip(control));
|
||||
public bool CanOpenBook(Office.IRibbonControl control) => adapter()?.HasRibbonBook == true;
|
||||
public string GetBookTip(Office.IRibbonControl control) => adapter()?.RibbonBook ?? "No linked book";
|
||||
public string GetChapterTip(Office.IRibbonControl control) => adapter()?.RibbonChapter ?? "Chapter unverified";
|
||||
public string GetSceneTip(Office.IRibbonControl control) => adapter()?.RibbonScene ?? "Scene unverified";
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
<tabs>
|
||||
<tab id="PlotDirectorTab" label="PlotDirector">
|
||||
<group id="PlotDirectorManuscript" label="Manuscript">
|
||||
<labelControl id="PlotDirectorBook" getLabel="GetBook" getSupertip="GetBookTip" />
|
||||
<labelControl id="PlotDirectorChapter" getLabel="GetChapter" getSupertip="GetChapterTip" />
|
||||
<labelControl id="PlotDirectorScene" getLabel="GetScene" getSupertip="GetSceneTip" />
|
||||
<editBox id="PlotDirectorBook" label="Book" getText="GetBookTip" getSupertip="GetBookTip" onChange="RestoreTitle" sizeString="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" />
|
||||
<editBox id="PlotDirectorChapter" label="Chapter" getText="GetChapterTip" getSupertip="GetChapterTip" onChange="RestoreTitle" sizeString="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" />
|
||||
<editBox id="PlotDirectorScene" label="Scene" getText="GetSceneTip" getSupertip="GetSceneTip" onChange="RestoreTitle" sizeString="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" />
|
||||
</group>
|
||||
<group id="PlotDirectorWriting" label="Writing">
|
||||
<button id="PlotDirectorContext" label="Writing Context" size="large" imageMso="ReadingMode" onAction="OpenContext" getEnabled="CanOpenBook" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user