protected override bool OnRightMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot)
{
Slice slice = FindParentSlice();
Debug.Assert(slice != null);
if (slice != null)
{
// Make sure we are a current slice so we are a colleague so we can enable menu items.
if (slice != slice.ContainingDataTree.CurrentSlice)
slice.ContainingDataTree.CurrentSlice = slice;
}
if (ShowContextMenu == null)
return base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot);
else
{
IVwSelection sel = RootBox.MakeSelAt(pt.X, pt.Y,
new SIL.Utils.Rect(rcSrcRoot.Left, rcSrcRoot.Top, rcSrcRoot.Right, rcSrcRoot.Bottom),
new SIL.Utils.Rect(rcDstRoot.Left, rcDstRoot.Top, rcDstRoot.Right, rcDstRoot.Bottom),
false);
if (sel == null)
return base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot); // no object, so quit and let base handle it
int index;
int hvo, tag, prev; // dummies.
IVwPropertyStore vps; // dummy
// Level 0 would give info about ktagText and the hvo of the dummy line object.
// Level 1 gives info about which line object it is in the root.
sel.PropInfo(false, 0, out hvo, out tag, out index, out prev, out vps); // using level 1 for an msa should return the slot it belongs in
#if MaybeSomeDayToTryAndGetRemoveMsaCorrectForCircumfixes
int indexSlot;
int hvoSlot, tagSlot, prevSlot; // dummies.
IVwPropertyStore vpsSlot; // dummy
sel.PropInfo(false, 1, out hvoSlot, out tagSlot, out indexSlot, out prevSlot, out vpsSlot);
int classSlot = Cache.GetClassOfObject(hvoSlot);
if (classSlot == FDO.Ling.MoInflAffixSlot.kClassId)
m_hvoSlot = hvoSlot;
#endif
m_obj = Cache.ServiceLocator.GetObject(hvo);
ShowContextMenu(this, new InflAffixTemplateEventArgs(this, this.m_xnSpec, pt, tag));
return true; // we've handled it
}
}