Esempio n. 1
0
        protected override void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
            }

            m_rhs = null;

            if (m_ctxtProps != null)
            {
                Marshal.ReleaseComObject(m_ctxtProps);
                m_ctxtProps = null;
            }
            if (m_charProps != null)
            {
                Marshal.ReleaseComObject(m_charProps);
                m_charProps = null;
            }
            if (m_arrow != null)
            {
                Marshal.ReleaseComObject(m_arrow);
                m_arrow = null;
            }
            if (m_slash != null)
            {
                Marshal.ReleaseComObject(m_slash);
                m_slash = null;
            }
            if (m_underscore != null)
            {
                Marshal.ReleaseComObject(m_underscore);
                m_underscore = null;
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case kfragRHS:
                m_rhs = m_cache.ServiceLocator.GetInstance <IPhSegRuleRHSRepository>().GetObject(hvo);
                var rule = m_rhs.OwningRule;
                if (rule.Disabled)
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
                }

                int arrowWidth, slashWidth, underscoreWidth, charHeight;
                vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
                int maxCharHeight = charHeight;
                vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
                maxCharHeight = Math.Max(charHeight, maxCharHeight);
                vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
                maxCharHeight = Math.Max(charHeight, maxCharHeight);

                int dmpx, spaceHeight;
                vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

                int maxNumLines   = GetMaxNumLines();
                int maxCtxtHeight = maxNumLines * spaceHeight;

                int maxHeight   = Math.Max(maxCharHeight, maxCtxtHeight);
                int charOffset  = maxHeight;
                int ctxtPadding = maxHeight - maxCtxtHeight;

                VwLength tableLen;
                tableLen.nVal = 10000;
                tableLen.unit = VwUnit.kunPercent100;
                vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);

                VwLength ctxtLen;
                ctxtLen.nVal = 1;
                ctxtLen.unit = VwUnit.kunRelative;
                VwLength charLen;
                charLen.unit = VwUnit.kunPoint1000;
                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = arrowWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = slashWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = underscoreWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                vwenv.OpenTableBody();
                vwenv.OpenTableRow();

                // LHS cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                vwenv.AddObjProp(m_cache.MetaDataCacheAccessor.GetFieldId2(PhSegRuleRHSTags.kClassId, "OwningRule", false), this, kfragRule);
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // arrow cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_arrow);
                vwenv.CloseTableCell();

                // RHS cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rhs.StrucChangeOS.Count > 0)
                {
                    vwenv.AddObjVecItems(PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
                }
                else
                {
                    vwenv.NoteDependency(new[] { hvo }, new[] { PhSegRuleRHSTags.kflidStrucChange }, 1);
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // slash cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_slash);
                vwenv.CloseTableCell();

                // left context cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rhs.LeftContextOA != null)
                {
                    vwenv.AddObjProp(PhSegRuleRHSTags.kflidLeftContext, this, kfragContext);
                }
                else
                {
                    vwenv.NoteDependency(new[] { hvo }, new[] { PhSegRuleRHSTags.kflidLeftContext }, 1);
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(PhSegRuleRHSTags.kflidLeftContext, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // underscore cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_underscore);
                vwenv.CloseTableCell();

                // right context cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rhs.RightContextOA != null)
                {
                    vwenv.AddObjProp(PhSegRuleRHSTags.kflidRightContext, this, kfragContext);
                }
                else
                {
                    vwenv.NoteDependency(new[] { hvo }, new[] { PhSegRuleRHSTags.kflidRightContext }, 1);
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(PhSegRuleRHSTags.kflidRightContext, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();
                break;

            case kfragRule:
                if (m_rhs.OwningRule.StrucDescOS.Count > 0)
                {
                    vwenv.AddObjVecItems(PhSegmentRuleTags.kflidStrucDesc, this, kfragContext);
                }
                else
                {
                    OpenSingleLinePile(vwenv, GetMaxNumLines(), false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(PhSegmentRuleTags.kflidStrucDesc, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
Esempio n. 3
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            CheckDisposed();
            switch (frag)
            {
            case kfragRHS:
                m_rhs = new PhSegRuleRHS(m_cache, hvo);
                IPhRegularRule rule = new PhRegularRule(m_cache, m_rhs.OwnerHVO);

                int arrowWidth, slashWidth, underscoreWidth, charHeight;
                vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
                int maxCharHeight = charHeight;
                vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
                maxCharHeight = Math.Max(charHeight, maxCharHeight);
                vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
                maxCharHeight = Math.Max(charHeight, maxCharHeight);

                int dmpx, spaceHeight;
                vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

                int maxNumLines   = MaxNumLines;
                int maxCtxtHeight = maxNumLines * spaceHeight;

                int maxHeight   = Math.Max(maxCharHeight, maxCtxtHeight);
                int charOffset  = maxHeight;
                int ctxtPadding = maxHeight - maxCtxtHeight;

                VwLength tableLen;
                tableLen.nVal = 10000;
                tableLen.unit = VwUnit.kunPercent100;
                vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);

                VwLength ctxtLen;
                ctxtLen.nVal = 1;
                ctxtLen.unit = VwUnit.kunRelative;
                VwLength charLen;
                charLen.unit = VwUnit.kunPoint1000;
                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = arrowWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = slashWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                charLen.nVal = underscoreWidth + 4000;
                vwenv.MakeColumns(1, charLen);

                vwenv.MakeColumns(1, ctxtLen);

                vwenv.OpenTableBody();
                vwenv.OpenTableRow();

                // LHS cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                vwenv.AddObjProp(m_cache.GetFlid(hvo, null, "OwningRule"), this, kfragRule);
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // arrow cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_arrow);
                vwenv.CloseTableCell();

                // RHS cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_cache.GetVectorSize(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange) > 0)
                {
                    vwenv.AddObjVecItems((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
                }
                else
                {
                    OpenContextPile(vwenv, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
                    CloseContextPile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // slash cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_slash);
                vwenv.CloseTableCell();

                // left context cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_cache.GetObjProperty(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext) != 0)
                {
                    vwenv.AddObjProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext, this, kfragContext);
                }
                else
                {
                    OpenContextPile(vwenv, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext, this, kfragEmpty);
                    CloseContextPile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // underscore cell
                vwenv.Props = m_charProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_underscore);
                vwenv.CloseTableCell();

                // right context cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_cache.GetObjProperty(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext) != 0)
                {
                    vwenv.AddObjProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext, this, kfragContext);
                }
                else
                {
                    OpenContextPile(vwenv, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext, this, kfragEmpty);
                    CloseContextPile(vwenv, false);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();
                break;

            case kfragRule:
                if (m_cache.GetVectorSize(hvo, (int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc) > 0)
                {
                    vwenv.AddObjVecItems((int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc, this, kfragContext);
                }
                else
                {
                    OpenContextPile(vwenv, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp((int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc, this, kfragEmpty);
                    CloseContextPile(vwenv, false);
                }
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
Esempio n. 4
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRHS:
					m_rhs = m_cache.ServiceLocator.GetInstance<IPhSegRuleRHSRepository>().GetObject(hvo);
					var rule = m_rhs.OwningRule;
					if (rule.Disabled)
					{
						vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
					}

					int arrowWidth, slashWidth, underscoreWidth, charHeight;
					vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
					int maxCharHeight = charHeight;
					vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);
					vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);

					int dmpx, spaceHeight;
					vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

					int maxNumLines = GetMaxNumLines();
					int maxCtxtHeight = maxNumLines * spaceHeight;

					int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
					int charOffset = maxHeight;
					int ctxtPadding = maxHeight - maxCtxtHeight;

					VwLength tableLen;
					tableLen.nVal = 10000;
					tableLen.unit = VwUnit.kunPercent100;
					vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;
					VwLength charLen;
					charLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = arrowWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = slashWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = underscoreWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					// LHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					vwenv.AddObjProp(m_cache.MetaDataCacheAccessor.GetFieldId2(PhSegRuleRHSTags.kClassId, "OwningRule", false), this, kfragRule);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// arrow cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_arrow);
					vwenv.CloseTableCell();

					// RHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rhs.StrucChangeOS.Count > 0)
					{
						vwenv.AddObjVecItems(PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
					}
					else
					{
						vwenv.NoteDependency(new[] {hvo}, new[] {PhSegRuleRHSTags.kflidStrucChange}, 1);
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// slash cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_slash);
					vwenv.CloseTableCell();

					// left context cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rhs.LeftContextOA != null)
					{
						vwenv.AddObjProp(PhSegRuleRHSTags.kflidLeftContext, this, kfragContext);
					}
					else
					{
						vwenv.NoteDependency(new[] { hvo }, new[] { PhSegRuleRHSTags.kflidLeftContext }, 1);
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(PhSegRuleRHSTags.kflidLeftContext, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// underscore cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_underscore);
					vwenv.CloseTableCell();

					// right context cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rhs.RightContextOA != null)
					{
						vwenv.AddObjProp(PhSegRuleRHSTags.kflidRightContext, this, kfragContext);
					}
					else
					{
						vwenv.NoteDependency(new[] { hvo }, new[] { PhSegRuleRHSTags.kflidRightContext }, 1);
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(PhSegRuleRHSTags.kflidRightContext, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();
					break;

				case kfragRule:
					if (m_rhs.OwningRule.StrucDescOS.Count > 0)
					{
						vwenv.AddObjVecItems(PhSegmentRuleTags.kflidStrucDesc, this, kfragContext);
					}
					else
					{
						OpenSingleLinePile(vwenv, GetMaxNumLines(), false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(PhSegmentRuleTags.kflidStrucDesc, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					break;

				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
Esempio n. 5
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();
			switch (frag)
			{
				case kfragRHS:
					m_rhs = new PhSegRuleRHS(m_cache, hvo);
					IPhRegularRule rule = new PhRegularRule(m_cache, m_rhs.OwnerHVO);

					int arrowWidth, slashWidth, underscoreWidth, charHeight;
					vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
					int maxCharHeight = charHeight;
					vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);
					vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);

					int dmpx, spaceHeight;
					vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

					int maxNumLines = MaxNumLines;
					int maxCtxtHeight = maxNumLines * spaceHeight;

					int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
					int charOffset = maxHeight;
					int ctxtPadding = maxHeight - maxCtxtHeight;

					VwLength tableLen;
					tableLen.nVal = 10000;
					tableLen.unit = VwUnit.kunPercent100;
					vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;
					VwLength charLen;
					charLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = arrowWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = slashWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = underscoreWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					// LHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					vwenv.AddObjProp(m_cache.GetFlid(hvo, null, "OwningRule"), this, kfragRule);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// arrow cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_arrow);
					vwenv.CloseTableCell();

					// RHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_cache.GetVectorSize(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange) > 0)
					{
						vwenv.AddObjVecItems((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
					}
					else
					{
						OpenContextPile(vwenv, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
						CloseContextPile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// slash cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_slash);
					vwenv.CloseTableCell();

					// left context cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_cache.GetObjProperty(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext) != 0)
					{
						vwenv.AddObjProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext, this, kfragContext);
					}
					else
					{
						OpenContextPile(vwenv, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidLeftContext, this, kfragEmpty);
						CloseContextPile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// underscore cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_underscore);
					vwenv.CloseTableCell();

					// right context cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_cache.GetObjProperty(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext) != 0)
					{
						vwenv.AddObjProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext, this, kfragContext);
					}
					else
					{
						OpenContextPile(vwenv, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidRightContext, this, kfragEmpty);
						CloseContextPile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();
					break;

				case kfragRule:
					if (m_cache.GetVectorSize(hvo, (int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc) > 0)
					{
						vwenv.AddObjVecItems((int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc, this, kfragContext);
					}
					else
					{
						OpenContextPile(vwenv, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp((int)PhRegularRule.PhSegmentRuleTags.kflidStrucDesc, this, kfragEmpty);
						CloseContextPile(vwenv, false);
					}
					break;

				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
Esempio n. 6
0
		protected override void Dispose(bool disposing)
		{
			if (IsDisposed)
				return;

			if (disposing)
			{
			}

			m_rhs = null;

			if (m_ctxtProps != null)
			{
				Marshal.ReleaseComObject(m_ctxtProps);
				m_ctxtProps = null;
			}
			if (m_charProps != null)
			{
				Marshal.ReleaseComObject(m_charProps);
				m_charProps = null;
			}
			if (m_arrow != null)
			{
				Marshal.ReleaseComObject(m_arrow);
				m_arrow = null;
			}
			if (m_slash != null)
			{
				Marshal.ReleaseComObject(m_slash);
				m_slash = null;
			}
			if (m_underscore != null)
			{
				Marshal.ReleaseComObject(m_underscore);
				m_underscore = null;
			}

			base.Dispose(disposing);
		}