public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch(frag)
{
case 1:
{
// The top-level.
// Enhance JohnT: add a property setting to make the key bold
// Roughly, vwenv.set_IntProperty(ktptBold, ktpvEnum, kttvForceOn);
// If we can get an hvo and flid, display that property of that object.
int flid = 0;
if (hvo != 0)
{
flid = m_cp.FlidFor(m_index, hvo);
}
if (flid != 0)
{
// Warning (JohnT): this option not yet tested...
vwenv.AddStringProp(flid, this);
return;
}
else
{
// Otherwise display a literal string straight from the policy object.
vwenv.AddString(m_cp.KeyFor(m_index, hvo));
}
if (m_fExpanded)
{
vwenv.AddLazyVecItems(m_ni.ListFlid, this, 2);
}
break;
}
case 2:
{
// One line of context.
// Figure the index of this object in the next object out (the root).
int hvoOuter, tagOuter, ihvo;
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1,
out hvoOuter, out tagOuter, out ihvo);
int ichKey = m_ni.ContextStringStartOffset(ihvo, hvo);
int cchKey = m_ni.ContextStringLength(ihvo, hvo);
// Enhance JohnT: make the alignment position a function of window width.
// Enhance JohnT: change background if this is the selected context line.
vwenv.OpenConcPara(ichKey, ichKey + cchKey,
VwConcParaOpts.kcpoDefault,
72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
int flidKey = m_ni.ContextStringFlid(ihvo, hvo);
if (flidKey == 0)
{
// Not tested yet.
vwenv.AddString(m_ni.ContextString(ihvo, hvo));
}
else
{
vwenv.AddStringProp(flidKey, this);
}
vwenv.CloseParagraph();
break;
}
}
}
}