コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them. Most
        /// subclasses should override.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case kfragRoot:
                // assume the root object has been loaded.
                base.Display(vwenv, hvo, frag);
                vwenv.AddObj(khvoNewItem, this, kfragEditRow);
                break;

            case kfragEditRow:
                AddEditRow(vwenv, hvo);
                break;

            case kfragListItem:
                if (hvo != khvoNewItem)
                {
                    base.Display(vwenv, hvo, frag);
                }
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
        /// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
        /// this should not be case, but experience trumps theory every time.  :-) :-(
        /// </summary>
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            if (hvo == 0)
            {
                return;
            }

            ISilDataAccess da    = vwenv.DataAccess;
            int            count = da.get_VecSize(hvo, tag);

            for (int i = 0; i < count; ++i)
            {
                vwenv.AddObj(da.get_VecItem(hvo, tag, i), this, VectorReferenceView.kfragTargetObj);
                vwenv.AddSeparatorBar();
            }
            vwenv.AddObj(PossibilityVectorReferenceView.khvoFake, this, VectorReferenceView.kfragTargetObj);
        }
コード例 #3
0
        /// <summary>
        /// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
        /// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
        /// this should not be case, but experience trumps theory every time.  :-) :-(
        /// </summary>
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            ISilDataAccess da    = vwenv.DataAccess;
            int            count = da.get_VecSize(hvo, tag);

            // Show everything in the sequence including current element from the main display.
            for (int i = 0; i < count; ++i)
            {
                int hvoItem = da.get_VecItem(hvo, tag, i);
                vwenv.AddObj(hvoItem, this, VectorReferenceView.kfragTargetObj);
                vwenv.AddSeparatorBar();
            }
        }
コード例 #4
0
        /// <summary>
        /// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
        /// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
        /// this should not be case, but experience trumps theory every time.  :-) :-(
        /// </summary>
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            ISilDataAccess da    = vwenv.DataAccess;
            int            count = da.get_VecSize(hvo, tag);

            // Tree Branches consist of everything FOLLOWING the first element which is the Tree root.
            for (int i = 1; i < count; ++i)
            {
                vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
                             VectorReferenceView.kfragTargetObj);
                vwenv.AddSeparatorBar();
            }
        }
コード例 #5
0
        /// <summary>
        /// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
        /// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
        /// this should not be case, but experience trumps theory every time.  :-) :-(
        /// </summary>
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            CheckDisposed();
            ISilDataAccess da    = vwenv.DataAccess;
            int            count = da.get_VecSize(hvo, tag);

            for (int i = 0; i < count; ++i)
            {
                vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
                             VectorReferenceView.kfragTargetObj);
                vwenv.AddSeparatorBar();
            }
        }
コード例 #6
0
		/// <summary>
		/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
		/// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
		/// this should not be case, but experience trumps theory every time.  :-) :-(
		/// </summary>
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			CheckDisposed();

			ISilDataAccess da = vwenv.DataAccess;
			int count = da.get_VecSize(hvo, tag);
			// Tree Branches consist of everything FOLLOWING the first element which is the Tree root.
			for (int i = 1; i < count; ++i)
			{
				vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
					VectorReferenceView.kfragTargetObj);
				vwenv.AddSeparatorBar();
			}
		}
コード例 #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override of DisplayVec
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void DisplayVec(IVwEnv vwenv, int paraHvo, int tag, int frag)
        {
            CheckDisposed();

            if (tag == StTxtParaTags.kflidTranslations && frag == (int)ScrFrags.kfrBtTranslationStatus)
            {
                IStTxtPara para = Cache.ServiceLocator.GetInstance <IStTxtParaRepository>().GetObject(paraHvo);
                vwenv.AddObj(GetTranslationForPara(paraHvo), this, frag);
            }
            else
            {
                base.DisplayVec(vwenv, paraHvo, tag, frag);
            }
        }
コード例 #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override of DisplayVec
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            CheckDisposed();

            if (tag == (int)StTxtPara.StTxtParaTags.kflidTranslations &&
                frag == (int)ScrFrags.kfrBtTranslationStatus)
            {
                vwenv.AddObj(GetTranslationForPara(hvo), this, frag);
            }

            else
            {
                base.DisplayVec(vwenv, hvo, tag, frag);
            }
        }
コード例 #9
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Handles displaying the vector of words with commas except after the last
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="tag"></param>
        /// <param name="frag"></param>
        /// -----------------------------------------------------------------------------------
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            Debug.Assert(frag == kfragWords);
            ISilDataAccess sda    = vwenv.DataAccess;
            int            cwords = sda.get_VecSize(hvo, ktagWords);

            for (int i = 0; i < cwords; i++)
            {
                vwenv.AddObj(sda.get_VecItem(hvo, ktagWords, i), this, kfragName);
                if (i != cwords - 1)
                {
                    vwenv.AddString(m_tssComma);
                }
            }
        }
コード例 #10
0
            public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
            {
                CheckDisposed();
                ISilDataAccess da    = vwenv.DataAccess;
                int            count = da.get_VecSize(hvo, tag);

                for (int i = 0; i < count; ++i)
                {
                    if (i != 0)
                    {
                        vwenv.AddSeparatorBar();
                    }
                    vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
                                 PhoneEnvReferenceView.kFragEnvironmentObj);
                }
            }
コード例 #11
0
            public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
            {
                CheckDisposed();

                switch (frag)
                {
                case kfragMorph:                         // The bundle of 4 lines representing a morpheme.
                    ISilDataAccess sda    = vwenv.DataAccess;
                    int            cmorph = sda.get_VecSize(hvo, tag);
                    for (int i = 0; i < cmorph; ++i)
                    {
                        int hvoMorph = sda.get_VecItem(hvo, tag, i);
                        vwenv.AddObj(hvoMorph, this, i == 0 ? kfragFirstMorph : kfragMorph);
                    }
                    break;
                }
            }
コード例 #12
0
        /// <summary>
        /// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
        /// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
        /// this should not be case, but experience trumps theory every time.  :-) :-(
        /// </summary>
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            ISilDataAccess da    = vwenv.DataAccess;
            int            count = da.get_VecSize(hvo, tag);

            // Show everything in the collection except the current element from the main display.
            for (int i = 0; i < count; ++i)
            {
                int hvoItem = da.get_VecItem(hvo, tag, i);
                if (m_displayParent != null && hvoItem == m_displayParent.Hvo)
                {
                    continue;
                }
                vwenv.AddObj(hvoItem, this, VectorReferenceView.kfragTargetObj);
                vwenv.AddSeparatorBar();
            }
        }
コード例 #13
0
        public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
        {
            switch (frag)
            {
            case kfragInput:
                // input context cell
                foreach (var ctxt in m_rule.InputOS)
                {
                    vwenv.Props = m_ctxtProps;
                    vwenv.OpenTableCell(1, 1);
                    vwenv.OpenParagraph();
                    vwenv.AddObj(ctxt.Hvo, this, kfragContext);
                    vwenv.CloseParagraph();
                    vwenv.CloseTableCell();
                }
                break;

            default:
                base.DisplayVec(vwenv, hvo, tag, frag);
                break;
            }
        }
コード例 #14
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the notes paragraph.
        /// </summary>
        /// <param name="vwenv">The vwenv.</param>
        /// <param name="notes">The notes.</param>
        /// <param name="styleProps">The style props.</param>
        /// ------------------------------------------------------------------------------------
        private void CreateNotesParagraph(IVwEnv vwenv, List <int> notes, ITsTextProps styleProps)
        {
            // Don't create a completely empty paragraph. The way the Views system handles such paragraphs
            // doesn't work for a MappedTaggedPara. Also, we want the footnote to take up no height at all
            // if there are none.
            if (notes.Count == 0)
            {
                return;
            }
            vwenv.set_IntProperty((int)FwTextPropType.ktptBaseWs,
                                  (int)FwTextPropVar.ktpvDefault, DefaultWs);
            vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
                                  (int)FwTextPropVar.ktpvEnum, (RightToLeft ? -1 : 0));
            vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                                  (int)FwTextPropVar.ktpvEnum,
                                  RightToLeft ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
            vwenv.Props = styleProps;

            // The body of the paragraph is either editable or not.
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum,
                                  Editable ? (int)TptEditable.ktptIsEditable
                                : (int)TptEditable.ktptNotEditable);

            vwenv.OpenMappedTaggedPara();
            for (int ihvo = 0; ihvo < notes.Count; ihvo++)
            {
                // Optimize JohnT: could make this string once and save it in a member variable.
                if (ihvo != 0)
                {
                    vwenv.AddString(m_cache.TsStrFactory.MakeString("  ", m_cache.DefaultVernWs));
                }
                vwenv.AddObj(notes[ihvo], this, (int)FootnoteFrags.kfrFootnoteWithinPagePara);
            }
            vwenv.CloseParagraph();
        }
コード例 #15
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body
        /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses
        /// need to separate this from applying the properties.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="paraHvo"></param>
        /// <param name="frag"></param>
        /// <param name="fApplyProps"></param>
        /// <param name="contentType"></param>
        /// <param name="vc">The view constructor used to create the paragraphs</param>
        /// ------------------------------------------------------------------------------------
        protected void InsertParagraphBody(IVwEnv vwenv, int paraHvo, int frag, bool fApplyProps,
                                           ContentTypes contentType, StVc vc)
        {
            vc.SetupWsAndDirectionForPara(vwenv, paraHvo);

            if (fApplyProps)
            {
                ApplyParagraphStyleProps(vwenv, paraHvo, vc);
            }

            // This was causing assertions in the layoutmgr
            // TODO (TE-5777): Should be able to do this with an in-memory stylesheet.
            //			if (DisplayTranslation)
            //			{
            //				// display the back translation text as double spaced
            //				vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight,
            //					(int)FwTextPropVar.ktpvRelative, 20000);
            //			}
            // The body of the paragraph is either editable or not.
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
                                  vc.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable);
            // Make the paragraph containing the paragraph contents.
            OpenPara(vwenv, paraHvo);
            // Cause a regenerate when the style changes...this is mainly used for Undo.
            vwenv.NoteDependency(new[] { paraHvo }, new[] { StParaTags.kflidStyleRules }, 1);
            // Insert the label if it is the first paragraph.
            if (vc.Label != null)
            {
                int lev = vwenv.EmbeddingLevel;
                int hvoOuter;
                int ihvoItem;
                int tagOuter;
                vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
                if (ihvoItem == 0)
                {
                    vwenv.AddObj(paraHvo, vc, (int)StTextFrags.kfrLabel);
                }
            }
            if (frag == (int)StTextFrags.kfrFootnotePara)
            {
                int lev = vwenv.EmbeddingLevel;
                int hvoOuter;
                int ihvoItem;
                int tagOuter;
                vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
                // Note a dependency on the footnote options so that the footnote will
                // be refreshed when these are changed.
                // If this is the 1st paragraph in the footnote...
                if (ihvoItem == 0)
                {
                    vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker);
                    vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteReference);
                }
            }

            if (contentType == ContentTypes.kctSimpleBT)
            {
                // If a translation is being shown instead of the paragraph, then show it instead
                // of the text of the paragraph.
                vwenv.AddObj(GetTranslationForPara(paraHvo), vc, (int)StTextFrags.kfrTranslation);
                if (!PrintLayout)
                {
                    // This dependency is here so that the "Missing" prompt will be added to the
                    // view when the first character is typed in the contents. But to solve the
                    // problem with losing the IP when typing (FWR-1415), the dependency is not
                    // added in print layout views. The missing prompt seems less of a problem
                    // than the problem with typing.
                    vwenv.NoteDependency(new[] { paraHvo }, new[] { StTxtParaTags.kflidContents }, 1);
                }
            }
            else if (contentType == ContentTypes.kctSegmentBT)
            {
                vwenv.AddObjVecItems(StTxtParaTags.kflidSegments, vc, (int)StTextFrags.kfrSegmentFreeTranslations);
            }
            else if (!InsertParaContentsUserPrompt(vwenv, paraHvo))
            {
                // Display the text paragraph contents, or its user prompt.
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
            }

            // Display an "end-of-paragraph" marker if needed
            InsertEndOfParaMarks(vwenv, paraHvo);

            vwenv.CloseParagraph();
        }
コード例 #16
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Display a view of the LexEntry (or fragment thereof).
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case (int)VcFrags.kfragHeadWord:
                // This case should stay in sync with
                // LexEntry.LexemeFormMorphTypeAndHomographStatic
                vwenv.OpenParagraph();
                AddHeadwordWithHomograph(vwenv, hvo);
                vwenv.CloseParagraph();
                break;

            case kfragEntryAndVariant:
                var wfb = m_cache.ServiceLocator.GetInstance <IWfiMorphBundleRepository>().GetObject(hvo);
                //int hvoMf = wfb.MorphRA.Hvo;
                //int hvoLexEntry = m_cache.GetOwnerOfObject(hvoMf);
                // if morphbundle morph (entry) is in a variant relationship to the morph bundle sense
                // display its entry headword and variant type information (LT-4053)
                ILexEntryRef ler;
                var          variant = wfb.MorphRA.Owner as ILexEntry;
                if (variant.IsVariantOfSenseOrOwnerEntry(wfb.SenseRA, out ler))
                {
                    // build Headword from sense's entry
                    vwenv.OpenParagraph();
                    vwenv.OpenInnerPile();
                    vwenv.AddObj(wfb.SenseRA.EntryID, this, (int)VcFrags.kfragHeadWord);
                    vwenv.CloseInnerPile();
                    vwenv.OpenInnerPile();
                    // now add variant type info
                    vwenv.AddObj(ler.Hvo, this, kfragVariantTypes);
                    vwenv.CloseInnerPile();
                    vwenv.CloseParagraph();
                    break;
                }

                // build Headword even though we aren't in a variant relationship.
                vwenv.AddObj(variant.Hvo, this, (int)VcFrags.kfragHeadWord);
                break;

            case kfragVariantTypes:
                ler = m_cache.ServiceLocator.GetInstance <ILexEntryRefRepository>().GetObject(hvo);
                bool fNeedInitialPlus = true;
                vwenv.OpenParagraph();
                foreach (var let in ler.VariantEntryTypesRS.Where(let => let.ClassID == LexEntryTypeTags.kClassId))
                {
                    // just concatenate them together separated by comma.
                    ITsString tssVariantTypeRevAbbr = let.ReverseAbbr.BestAnalysisAlternative;
                    if (tssVariantTypeRevAbbr != null && tssVariantTypeRevAbbr.Length > 0)
                    {
                        if (fNeedInitialPlus)
                        {
                            vwenv.AddString(TsStringUtils.MakeString("+", m_cache.DefaultUserWs));
                        }
                        else
                        {
                            vwenv.AddString(TsStringUtils.MakeString(",", m_cache.DefaultUserWs));
                        }
                        vwenv.AddString(tssVariantTypeRevAbbr);
                        fNeedInitialPlus = false;
                    }
                }
                vwenv.CloseParagraph();
                break;

            case kfragFormForm:                     // form of MoForm
                vwenv.AddStringAltMember(MoFormTags.kflidForm, m_wsActual, this);
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
コード例 #17
0
ファイル: FootnoteVc.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch (frag)
			{
				case (int)FootnoteFrags.kfrScripture:
				{
					vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
						new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
					vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
					break;
				}
				case (int)FootnoteFrags.kfrRootInPageSeq:
				{
					int tag = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor,
						"Scripture", "FootnotesOnPage",
						(int)CellarModuleDefns.kcptReferenceSequence).Tag;
					// Get the list of footnotes to display
					int[] hvos = m_cache.GetVectorProperty(hvo, tag, true);
					if (hvos.Length > 0)
					{
						int ownerHvo = m_cache.GetOwnerOfObject(hvos[0]);
						// The ownerHvo should be the HVO of the book
						vwenv.NoteDependency(new int[] { ownerHvo },
							new int[] { (int)ScrBook.ScrBookTags.kflidFootnotes }, 1);
					}
					vwenv.AddObjVec(tag, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
					break;
				}
				case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
				{
					// Note a dependency on the footnote options so that the footnote will
					// be refreshed when these are changed.
					int[] depHvos = { hvo };
					int[] depTags = { StFootnote.ktagFootnoteOptions };
					vwenv.NoteDependency(depHvos, depTags, 1);

					// Insert the marker and reference
					vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
					vwenv.AddObj(hvo,  this,(int)StTextFrags.kfrFootnoteReference);

					// Insert (we hope only one) paragraph contents.
					vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
						(int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
					break;
				}
				case (int) FootnoteFrags.kfrFootnoteParaWithinPagePara:
				{
					if (!InsertParaContentsUserPrompt(vwenv, hvo))
					{
						// Display the text paragraph contents, or its user prompt.
						vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
					}
					break;
				}
				case (int)FootnoteFrags.kfrBook:
				{
					vwenv.OpenDiv();
					vwenv.AddObjVecItems((int)ScrBook.ScrBookTags.kflidFootnotes, this,
						(int)StTextFrags.kfrFootnote);
					vwenv.CloseDiv();
					break;
				}
				case (int)StTextFrags.kfrFootnoteMarker:
				{
					ScrFootnote footnote = new ScrFootnote(Cache, hvo);
					if (footnote.DisplayFootnoteMarker)
						DisplayFootnoteMarker(vwenv, footnote);
					break;
				}
				case (int)StTextFrags.kfrFootnoteReference:
				{
					ITsStrFactory tsStrFactory = TsStrFactoryClass.Create();
					ITsPropsFactory tpf = TsPropsFactoryClass.Create();
					ITsTextProps ttp = tpf.MakeProps(ScrStyleNames.FootnoteTargetRef, m_wsDefault, 0);

					ScrFootnote footnote = new ScrFootnote(m_cache, hvo);
					string footnoteRef = footnote.GetReference(m_wsDefault);
					ITsString tssRef = tsStrFactory.MakeStringWithPropsRgch(footnoteRef,
						footnoteRef.Length, ttp);
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddString(tssRef);
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
コード例 #18
0
ファイル: DraftViewVc.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override of DisplayVec
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			CheckDisposed();

			if (tag == (int)StTxtPara.StTxtParaTags.kflidTranslations &&
				frag == (int)ScrFrags.kfrBtTranslationStatus)
			{
				vwenv.AddObj(GetTranslationForPara(hvo), this, frag);
			}

			else
				base.DisplayVec(vwenv, hvo, tag, frag);
		}
コード例 #19
0
ファイル: InterlinVc.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Add a display of the category of hvoAnalysis.
		/// If choiceOffset is -1, display the current analysis writing systems, otherwise,
		/// display the one indicated (choiceIndex is an index into line choices).
		/// When choice index is not -1, hvoAnalysis may not be the current object.
		/// In that case, we invoke AddObj with a special flid which results in a recursive
		/// call to this, but with the correct current object.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvoAnalysis"></param>
		protected void AddAnalysisPos(IVwEnv vwenv, int hvoAnalysis, int hvoCurrent, int choiceIndex)
		{
			IWfiAnalysis wa = m_coRepository.GetObject(hvoAnalysis) as IWfiAnalysis;
			int hvoPos = wa.CategoryRA != null ? wa.CategoryRA.Hvo : 0;
			SetColor(vwenv, LabelRGBFor(choiceIndex));
			if (hvoPos == 0)
			{
				vwenv.OpenParagraph();
				vwenv.NoteDependency(new int[] {hvoAnalysis},
					new int[] {WfiAnalysisTags.kflidCategory}, 1);
				vwenv.AddString(m_tssMissingAnalysisPos);
				vwenv.CloseParagraph();
			}
			else if (choiceIndex < 0)
			{
				vwenv.AddObjProp(WfiAnalysisTags.kflidCategory, this, kfragCategory);
			}
			else
			{
			if (hvoCurrent == hvoAnalysis)
				vwenv.AddObjProp(WfiAnalysisTags.kflidCategory, this, kfragLineChoices + choiceIndex);
			else
				vwenv.AddObj(hvoAnalysis, this, kfragAnalysisCategoryChoices + choiceIndex); // causes recursive call with right hvoCurrent
			}
		}
コード例 #20
0
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			switch (frag)
			{
				case kfragInput:
					// input context cell
					foreach (var ctxt in m_rule.InputOS)
					{
						vwenv.Props = m_ctxtProps;
						vwenv.OpenTableCell(1, 1);
						vwenv.OpenParagraph();
						vwenv.AddObj(ctxt.Hvo, this, kfragContext);
						vwenv.CloseParagraph();
						vwenv.CloseTableCell();
					}
					break;

				default:
					base.DisplayVec(vwenv, hvo, tag, frag);
					break;
			}
		}
コード例 #21
0
ファイル: LexEntryUi.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Display a view of the LexEntry (or fragment thereof).
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case (int)VcFrags.kfragHeadWord:
					// This case should stay in sync with
					// LexEntry.LexemeFormMorphTypeAndHomographStatic
					vwenv.OpenParagraph();
					AddHeadwordWithHomograph(vwenv, hvo);
					vwenv.CloseParagraph();
					break;
				case kfragEntryAndVariant:
					var wfb = m_cache.ServiceLocator.GetInstance<IWfiMorphBundleRepository>().GetObject(hvo);
					//int hvoMf = wfb.MorphRA.Hvo;
					//int hvoLexEntry = m_cache.GetOwnerOfObject(hvoMf);
					// if morphbundle morph (entry) is in a variant relationship to the morph bundle sense
					// display its entry headword and variant type information (LT-4053)
					ILexEntryRef ler;
					var variant = wfb.MorphRA.Owner as ILexEntry;
					if (variant.IsVariantOfSenseOrOwnerEntry(wfb.SenseRA, out ler))
					{
						// build Headword from sense's entry
						vwenv.OpenParagraph();
						vwenv.OpenInnerPile();
						vwenv.AddObj(wfb.SenseRA.EntryID, this, (int)VcFrags.kfragHeadWord);
						vwenv.CloseInnerPile();
						vwenv.OpenInnerPile();
						// now add variant type info
						vwenv.AddObj(ler.Hvo, this, kfragVariantTypes);
						vwenv.CloseInnerPile();
						vwenv.CloseParagraph();
						break;
					}

					// build Headword even though we aren't in a variant relationship.
					vwenv.AddObj(variant.Hvo, this, (int)VcFrags.kfragHeadWord);
					break;
				case kfragVariantTypes:
					ler = m_cache.ServiceLocator.GetInstance<ILexEntryRefRepository>().GetObject(hvo);
					bool fNeedInitialPlus = true;
					vwenv.OpenParagraph();
					foreach (var let in ler.VariantEntryTypesRS.Where(let => let.ClassID == LexEntryTypeTags.kClassId))
					{
						// just concatenate them together separated by comma.
						ITsString tssVariantTypeRevAbbr = let.ReverseAbbr.BestAnalysisAlternative;
						if (tssVariantTypeRevAbbr != null && tssVariantTypeRevAbbr.Length > 0)
						{
							if (fNeedInitialPlus)
								vwenv.AddString(TsStringUtils.MakeTss("+", m_cache.DefaultUserWs));
							else
								vwenv.AddString(TsStringUtils.MakeTss(",", m_cache.DefaultUserWs));
							vwenv.AddString(tssVariantTypeRevAbbr);
							fNeedInitialPlus = false;
						}
					}
					vwenv.CloseParagraph();
					break;
				case kfragFormForm: // form of MoForm
					vwenv.AddStringAltMember(MoFormTags.kflidForm, m_wsActual, this);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
コード例 #22
0
ファイル: InterlinVc.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// NOTE: this routine is ignorant of calling context, so caller must provide NoteDependency to the possibleVariant and the sense
		/// (e.g. vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
		///  vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="possibleVariant"></param>
		/// <param name="sense"></param>
		/// <param name="spec"></param>
		/// <param name="inflType"></param>
		/// <returns>true if there was anything to display </returns>
		internal bool DisplayLexGlossWithInflType(IVwEnv vwenv, ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec,
			ILexEntryInflType inflType)
		{
			int iLineChoice = m_lineChoices.IndexOf(spec);
			ILexEntryRef ler;
			if (possibleVariant.IsVariantOfSenseOrOwnerEntry(sense, out ler))
			{
				var wsPreferred = GetRealWsOrBestWsForContext(sense.Hvo, spec);
				var wsGloss = Cache.ServiceLocator.WritingSystemManager.Get(wsPreferred);
				var wsUser = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem;
				var testGloss = sense.Gloss.get_String(wsPreferred);
				// don't bother adding anything for an empty gloss.
				if (testGloss.Text != null && testGloss.Text.Length >= 0)
				{
					vwenv.OpenParagraph();
					// see if we have an irregularly inflected form type reference
					var leitFirst =
						ler.VariantEntryTypesRS.Where(
							let => let.ClassID == LexEntryInflTypeTags.kClassId).FirstOrDefault();

					// add any GlossPrepend info
					if (leitFirst != null)
					{
						vwenv.OpenInnerPile();
						// TODO: add dependency to VariantType GlossPrepend/Append names
						vwenv.NoteDependency(new[] { ler.Hvo },
											 new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
						vwenv.OpenParagraph();
						ITsString tssPrepend = null;
						if (inflType != null)
						{
							tssPrepend = MorphServices.AddTssGlossAffix(null, inflType.GlossPrepend, wsGloss, wsUser);
						}
						else
						{
							ITsIncStrBldr sbPrepend;
							ITsIncStrBldr sbAppend;
							JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
															   out sbAppend);
							if (sbPrepend.Text != null)
								tssPrepend = sbPrepend.GetString();
						}
						if (tssPrepend != null)
							vwenv.AddString(tssPrepend);
						vwenv.CloseParagraph();
						vwenv.CloseInnerPile();
					}
					// add gloss of main entry or sense
					{
						vwenv.OpenInnerPile();
						// NOTE: remember to NoteDependency from OuterObject
						vwenv.AddObj(sense.Hvo, this, kfragLineChoices + iLineChoice);
						vwenv.CloseInnerPile();
					}
					// now add variant type info
					if (leitFirst != null)
					{
						vwenv.OpenInnerPile();
						// TODO: add dependency to VariantType GlossPrepend/Append names
						vwenv.NoteDependency(new[] { ler.Hvo },
											 new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
						vwenv.OpenParagraph();
						 ITsString tssAppend = null;
						 if (inflType != null)
						 {
							 tssAppend = MorphServices.AddTssGlossAffix(null, inflType.GlossAppend, wsGloss, wsUser);
						 }
						 else
						 {
							 ITsIncStrBldr sbPrepend;
							 ITsIncStrBldr sbAppend;
							 JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
																out sbAppend);
							 if (sbAppend.Text != null)
								 tssAppend = sbAppend.GetString();
						 }
						{
							// Use AddProp/DisplayVariant to store GlossAppend with m_tssPendingGlossAffix
							// this allows InterlinearExporter to know to export a glsAppend item
							try
							{
								if (tssAppend != null)
									m_tssPendingGlossAffix = tssAppend;
								else
									m_tssPendingGlossAffix = m_tssMissingGlossAppend;

								vwenv.AddProp(ktagGlossAppend, this, 0);
							}
							finally
							{
								m_tssPendingGlossAffix = null;
							}
						}
						vwenv.CloseParagraph();
						vwenv.CloseInnerPile();
					}
					vwenv.CloseParagraph();
					return true;
				}
			}
			return false;
		}
コード例 #23
0
ファイル: ConstChartBody.cs プロジェクト: sillsdev/WorldPad
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			switch (frag)
			{
				case kfragBundleVec:
					int[] ccas = m_cache.GetVectorProperty(hvo, tag, false);
					for (int i = 0; i < ccas.Length; i++)
					{
					if (i < ccas.Length - 1)
					{
						// Give whatever box we make 5 points of separation from whatever follows.
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
							(int)FwTextPropVar.ktpvMilliPoint, 5000);
					}
						vwenv.AddObj(ccas[i], this, kfragBundle);
					}
					break;
				case kfragClauseLabels: // hvo is cmIndirectAnnotation pointing at a group of rows (at least one).
					// Enhance JohnT: this assumes it is always a contiguous list.
					ISilDataAccess sda = vwenv.DataAccess;
					int chvo = sda.get_VecSize(hvo, kflidAppliesTo);
					int hvoFirst = sda.get_VecItem(hvo, kflidAppliesTo, 0);
					vwenv.AddObj(hvoFirst, this, kfragComment);
					if (chvo == 1)
						break;
					vwenv.AddString(m_cache.MakeAnalysisTss("-"));
					int hvoLast = sda.get_VecItem(hvo, kflidAppliesTo, chvo - 1);
					vwenv.AddObj(hvoLast, this, kfragComment);
					break;
				default:
					base.DisplayVec(vwenv, hvo, tag, frag);
					break;
			}
		}
コード例 #24
0
ファイル: FootnoteVc.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case (int)StTextFrags.kfrFootnote:
					{
						// FWR-1640: Make the sequence of footnote paragraphs non-editable
						// since we only allow one para per footnote. This will cause
						// pasting multiple paragraphs to work correctly.
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						base.Display(vwenv, hvo, frag);
						break;
					}
				case (int)FootnoteFrags.kfrScripture:
				{
					vwenv.NoteDependency(new int[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo },
						new int[] { (int)ScriptureTags.kflidScriptureBooks }, 1);
					vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
					break;
				}
				case (int)FootnoteFrags.kfrRootInPageSeq:
				{
					vwenv.AddObjVec(ScrBookTags.kflidFootnotes, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
					break;
				}
				case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
				{
					// Insert the marker and reference
					vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
					vwenv.AddObj(hvo,  this,(int)StTextFrags.kfrFootnoteReference);

					// Insert (we hope only one) paragraph contents.
					vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
					break;
				}
				case (int) FootnoteFrags.kfrFootnoteParaWithinPagePara:
				{
					if (!InsertParaContentsUserPrompt(vwenv, hvo))
					{
						// Display the text paragraph contents, or its user prompt.
						vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
					}
					break;
				}
				case (int)FootnoteFrags.kfrBook:
				{
					vwenv.OpenDiv();
					vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this,
						(int)StTextFrags.kfrFootnote);
					vwenv.CloseDiv();
					break;
				}
				case (int)StTextFrags.kfrFootnoteReference:
				{
					DisplayFootnoteReference(vwenv, hvo);
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
コード例 #25
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them. Most
		/// subclasses should override.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRoot:
					// assume the root object has been loaded.
					base.Display(vwenv, hvo, frag);
					vwenv.AddObj(khvoNewItem, this, kfragEditRow);
					break;
				case kfragEditRow:
					AddEditRow(vwenv, hvo);
					break;
				case kfragListItem:
					if (hvo != khvoNewItem)
						base.Display(vwenv, hvo, frag);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
コード例 #26
0
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			switch (frag)
			{
				case kfragInput:
					// input context cell
					int[] ctxtHvos = m_cache.GetVectorProperty(hvo, tag, false);
					foreach (int ctxtHvo in ctxtHvos)
					{
						vwenv.Props = m_ctxtProps;
						vwenv.OpenTableCell(1, 1);
						vwenv.OpenParagraph();
						vwenv.AddObj(ctxtHvo, this, kfragContext);
						vwenv.CloseParagraph();
						vwenv.CloseTableCell();
					}
					break;

				default:
					base.DisplayVec(vwenv, hvo, tag, frag);
					break;
			}
		}
コード例 #27
0
		/// <summary>
		/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
		/// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
		/// this should not be case, but experience trumps theory every time.  :-) :-(
		/// </summary>
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			ISilDataAccess da = vwenv.DataAccess;
			int count = da.get_VecSize(hvo, tag);
			for (int i = 0; i < count; ++i)
			{
				vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
					VectorReferenceView.kfragTargetObj);
				vwenv.AddSeparatorBar();
			}
		}
コード例 #28
0
ファイル: StVc.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Insert the body of a paragraph. This is normally (with fApplyProps true) the body
		/// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses
		/// need to separate this from applying the properties.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// <param name="fApplyProps"></param>
		/// <param name="contentType"></param>
		/// <param name="vc">The view constructor used to create the paragraphs</param>
		/// ------------------------------------------------------------------------------------
		protected void InsertParagraphBody(IVwEnv vwenv, int hvo, int frag, bool fApplyProps,
			ContentTypes contentType, StVc vc)
		{
			vc.SetupWsAndDirectionForPara(vwenv, hvo);

			if (fApplyProps)
				ApplyParagraphStyleProps(vwenv, hvo, vc);

			// This was causing assertions in the layoutmgr
			// TODO (TE-5777): Should be able to do this with an in-memory stylesheet.
			//			if (DisplayTranslation)
			//			{
			//				// display the back translation text as double spaced
			//				vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight,
			//					(int)FwTextPropVar.ktpvRelative, 20000);
			//			}
			// The body of the paragraph is either editable or not.
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
				(int)FwTextPropVar.ktpvEnum,
				vc.Editable ? (int)TptEditable.ktptIsEditable
				: (int)TptEditable.ktptNotEditable);
			// Make the paragraph containing the paragraph contents.
			OpenPara(vwenv, hvo);
			// Cause a regenerate when the style changes...this is mainly used for Undo.
			vwenv.NoteDependency(new int[] {hvo},
				new int[] {(int)StPara.StParaTags.kflidStyleRules}, 1);
			// Insert the label if it is the first paragraph.
			if (vc.Label != null)
			{
				int lev = vwenv.EmbeddingLevel;
				int hvoOuter;
				int ihvoItem;
				int tagOuter;
				vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
				if (ihvoItem == 0)
					vwenv.AddObj(hvo, vc, (int)StTextFrags.kfrLabel);
			}
			if (frag == (int)StTextFrags.kfrFootnotePara)
			{
				int lev = vwenv.EmbeddingLevel;
				int hvoOuter;
				int ihvoItem;
				int tagOuter;
				vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
				// Note a dependency on the footnote options so that the footnote will
				// be refreshed when these are changed.
				int[] depHvos = { hvoOuter };
				int[] depTags = { StFootnote.ktagFootnoteOptions };
				vwenv.NoteDependency(depHvos, depTags, 1);
				// If this is the 0th paragraph in the footnote...
				if (ihvoItem == 0)
				{
					vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker);
					vwenv.AddObj(hvoOuter, /*vc.Parent != null ? vc.Parent :*/ vc,
						(int)StTextFrags.kfrFootnoteReference);
				}
			}

			if (contentType == ContentTypes.kctSimpleBT)
			{
				// If a translation is being shown instead of the paragraph, then show it instead
				// of the text of the paragraph.
				int transHvo = GetTranslationForPara(hvo);
				vwenv.AddObj(transHvo, vc, (int)StTextFrags.kfrTranslation);
				vwenv.NoteDependency(new int[] {hvo},
					new int[] {(int)StTxtPara.StTxtParaTags.kflidContents}, 1);
			}
			else if (contentType == ContentTypes.kctSegmentBT)
			{
				InsertBtSegments(vc, vwenv, hvo);
			}
			else if (!InsertParaContentsUserPrompt(vwenv, hvo))
			{
				// Display the text paragraph contents, or its user prompt.
				vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
			}

			// Display an "end-of-paragraph" marker if needed
			InsertEndOfParaMarks(vwenv, hvo);

			vwenv.CloseParagraph();
		}
コード例 #29
0
ファイル: TeNotesVc.cs プロジェクト: sillsdev/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays the annotation fragment.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void DisplayAnnotationFragment(IVwEnv vwenv, int hvo)
		{
			IScrScriptureNote ann = m_cache.ServiceLocator.GetInstance<IScrScriptureNoteRepository>().GetObject(hvo);
			bool isExpanded = (m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]);
			int hvoFirstResponse = ann.ResponsesOS.Count > 0 ? ann.ResponsesOS[0].Hvo : 0;
			bool responseExpanded = m_expandTable.ContainsKey(hvoFirstResponse) && m_expandTable[hvoFirstResponse];

			// put the separator at the top of the note
			InsertNoteSeparator(vwenv);

			// Open a table to display the first line of the annotation.
			VwLength vlTable; // we use this to specify that the table takes 100% of the width.
			vlTable.nVal = 10000;
			vlTable.unit = VwUnit.kunPercent100;

			int borderThickness = 2000;
			int columnCount = 9;
			VwFramePosition framePos = VwFramePosition.kvfpVoid;
			if (ann.Hvo == SelectedNoteHvo)
			{
				columnCount = 7;
				framePos = (ann.ResponsesOS.Count == 0 || !isExpanded || !responseExpanded) ?
					VwFramePosition.kvfpBox : (VwFramePosition.kvfpAbove | VwFramePosition.kvfpVsides);
			}

			vwenv.OpenTable(columnCount,
				vlTable, // Table uses 100% of available width.
				borderThickness,
				VwAlignment.kvaLeft, // Default alignment.
				framePos,
				//VwFramePosition.kvfpBox,
				//VwRule.kvrlAll, // rule lines between cells
				VwRule.kvrlNone,
				0, //No space between cells.
				0, //No padding inside cells.
				false);

			vwenv.NoteDependency(new int[] { hvo, hvo }, new int[]{m_expansionTag,
				ScrScriptureNoteTags.kflidResponses}, 2);

			// Specify column widths. The first argument is the number of columns,
			// not a column index.
			VwLength vlColumn;
			if (ann.Hvo != SelectedNoteHvo)
			{
				vlColumn.nVal = borderThickness;
				vlColumn.unit = VwUnit.kunPoint1000;
				vwenv.MakeColumns(1, vlColumn);
			}
			vlColumn.nVal = 13000;
			vlColumn.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(2, vlColumn);
			vlColumn.nVal = 60000;
			vlColumn.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(1, vlColumn);
			vlColumn.nVal = 2;
			vlColumn.unit = VwUnit.kunRelative;
			vwenv.MakeColumns(1, vlColumn); // Column for the CONNOT categories
			vlColumn.nVal = 12000;
			vlColumn.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when showing quote
			vlColumn.nVal = 3;
			vlColumn.unit = VwUnit.kunRelative;
			vwenv.MakeColumns(1, vlColumn); // Column for the quote when collapsed
			vlColumn.nVal = 12000;
			vlColumn.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when not showing quote
			if (ann.Hvo != SelectedNoteHvo)
			{
				vlColumn.nVal = borderThickness;
				vlColumn.unit = VwUnit.kunPoint1000;
				vwenv.MakeColumns(1, vlColumn);
			}
			vwenv.OpenTableBody();

			DisplayAnnotation(vwenv, ann, isExpanded);

			// Only display the responses if this note is expanded and has responses.
			if (!isExpanded || ann.ResponsesOS.Count == 0)
			{
				// Close table
				vwenv.CloseTableBody();
				vwenv.CloseTable();
				return;
			}

			vwenv.NoteDependency(new int[] { ann.ResponsesOS.ToHvoArray()[0] },
				new int[] { m_expansionTag }, 1);
			OpenTableRow(vwenv, ann);

			// Display empty first cell
			vwenv.OpenTableCell(1, 1);
			vwenv.CloseTableCell();

			// Display expand box (+/-) in the second cell
			vwenv.OpenTableCell(1, 1);
			vwenv.AddObj(ann.ResponsesOS.ToHvoArray()[0], this, (int)NotesFrags.kfrExpansion);
			vwenv.CloseTableCell();

			// Display response label in the remaining cells
			vwenv.OpenTableCell(1, 5);
			vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddString(m_responseLabel);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();
			CloseTableRow(vwenv, ann);

			// Close table
			vwenv.CloseTableBody();
			vwenv.CloseTable();

			if (responseExpanded)
			{
				vwenv.AddObjVecItems((int)ScrScriptureNoteTags.kflidResponses,
					this, (int)NotesFrags.kfrResponse);
			}
		}
コード例 #30
0
ファイル: InterlinVc.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Displays a MorphBundle, setting the colors of its parts.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo">WfiMorphBundle</param>
		private void DisplayMorphBundle(IVwEnv vwenv, int hvo)
		{
			IWfiMorphBundle wmb = null;
			if (hvo != 0)
				wmb = m_wmbRepository.GetObject(hvo);
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.OpenInnerPile();
			int first = m_lineChoices.FirstMorphemeIndex;
			int last = m_lineChoices.LastMorphemeIndex;
			IMoForm mf = null;
			if (wmb != null)
				mf = wmb.MorphRA;
			if (vwenv is CollectorEnv && mf != null)
			{
				// Collectors are given an extra initial chance to 'collect' the morph type, if any.
				vwenv.AddObjProp(WfiMorphBundleTags.kflidMorph,
					this, kfragMorphType);

			}
			for (int i = first; i <= last; i++)
			{
				InterlinLineSpec spec = m_lineChoices[i];
				SetColor(vwenv, LabelRGBFor(spec));
				switch (spec.Flid)
				{
					case InterlinLineChoices.kflidMorphemes:
						if (wmb == null)
						{
							vwenv.AddString(m_tssMissingMorph);
						}
						else if (mf == null)
						{
							// displaying morphemes should be
							int ws = 0;
							if (wmb.MorphRA != null)
							{
								Debug.Assert(spec.StringFlid == MoFormTags.kflidForm);
								ws = GetRealWsOrBestWsForContext(wmb.MorphRA.Hvo, spec);
							}
							// If no morph, use the form of the morph bundle (and the entry is of
							// course missing)
							if (ws == 0)
							{
								ws = WritingSystemServices.ActualWs(m_cache, spec.WritingSystem, wmb.Hvo,
									WfiMorphBundleTags.kflidForm);
							}
							vwenv.AddStringAltMember(
								WfiMorphBundleTags.kflidForm, ws, this);
						}
						else
						{
							// Got a morph, show it.
							vwenv.AddObjProp(WfiMorphBundleTags.kflidMorph,
								this, kfragMorphFormChoices + i);
							// And the LexEntry line.
						}
						break;
					case InterlinLineChoices.kflidLexEntries:
						if (mf == null)
						{
							if (hvo != 0)
								vwenv.NoteDependency(new int[] { hvo }, new int[] { WfiMorphBundleTags.kflidMorph }, 1);
							vwenv.AddString(m_tssMissingEntry);
						}
						else
						{
							int ws = GetRealWsOrBestWsForContext(mf.Hvo, spec);
							if (ws == 0)
								ws = spec.WritingSystem;
							LexEntryVc vcEntry = new LexEntryVc(m_cache);
							vcEntry.WritingSystemCode = ws;
							vwenv.AddObj(hvo, vcEntry, LexEntryVc.kfragEntryAndVariant);
						}
						break;
					case InterlinLineChoices.kflidLexGloss:
						int flid = 0;
						if (wmb != null)
						{
							vwenv.NoteDependency(new[] { wmb.Hvo }, new[] { WfiMorphBundleTags.kflidMorph }, 1);
							vwenv.NoteDependency(new[] { wmb.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
							vwenv.NoteDependency(new[] { hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
							if (wmb.SenseRA == null)
							{
								if (ShowDefaultSense && wmb.DefaultSense != null && UsingGuess)
								{
									flid = wmb.Cache.MetaDataCacheAccessor.GetFieldId2(WfiMorphBundleTags.kClassId,
										"DefaultSense", false);
								}
							}
							else
							{
								flid = WfiMorphBundleTags.kflidSense;
								if (wmb.MorphRA != null &&
									DisplayLexGlossWithInflType(vwenv, wmb.MorphRA.Owner as ILexEntry, wmb.SenseRA, spec, wmb.InflTypeRA))
								{
									break;
								}

							}
						}

						if (flid == 0)
							vwenv.AddString(m_tssMissingSense);
						else
							vwenv.AddObjProp(flid, this, kfragLineChoices + i);
						break;

					case InterlinLineChoices.kflidLexPos:
						// LexPOS line:
						int hvoMsa = 0;
						if (wmb != null && wmb.MsaRA != null)
							hvoMsa = wmb.MsaRA.Hvo;
						if (hvoMsa == 0)
						{
							if (hvo != 0)
								vwenv.NoteDependency(new int[] { hvo }, new int[] { WfiMorphBundleTags.kflidMsa }, 1);
							vwenv.AddString(m_tssMissingMsa);
						}
						else
						{
							// Use a special view constructor that knows how to display the
							// interlinear view of whatever kind of MSA it is.
							// Enhance JohnT: ideally we would have one of these VCs for each writing system,
							// perhaps stored in the InterlinLineSpec. Currently displaying multiple Wss of LexPos
							// is not useful, though it is possible.
							// Enhancement RickM: we set the m_msaVc.DefaultWs to the selected writing system
							//		of each LexPos line in interlinear. This is used extract the LexPos abbreviation
							//		for the specific writing system.
							m_msaVc.DefaultWs = spec.WritingSystem;
							vwenv.AddObjProp(WfiMorphBundleTags.kflidMsa,
								m_msaVc, (int)VcFrags.kfragInterlinearAbbr);
						}
						break;
				}
			}
			vwenv.CloseInnerPile();
		}
コード例 #31
0
ファイル: TeNotesVc.cs プロジェクト: sillsdev/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays an annotation expanded or contracted
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="ann"></param>
		/// <param name="expanded"></param>
		/// ------------------------------------------------------------------------------------
		private void DisplayAnnotation(IVwEnv vwenv, IScrScriptureNote ann, bool expanded)
		{
			#region First row has status, ref, category, & quote
			SetBackgroundColorForNote(ann, vwenv);

			OpenTableRow(vwenv, ann);

			// Display expand box (+/-) in the first cell
			//InsertNoteSeparator(vwenv);
			vwenv.OpenTableCell(1, 1);
			vwenv.AddObj(ann.Hvo, this, (int)NotesFrags.kfrExpansion);
			vwenv.CloseTableCell();

			// Display status in the second cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);

			if (ann.AnnotationType == NoteType.CheckingError)
			{
				// When the annotation is a checking error, we don't want clicking on the status
				// to change the status. Therefore, make the min and max the same.
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, 0, 0);
			}
			else
			{
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, (int)NoteStatus.Open, (int)NoteStatus.Closed);
			}
			vwenv.CloseTableCell();

			// Display reference in the third cell and make it readonly.
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvDefault, 0);
			vwenv.OpenParagraph();
			vwenv.AddProp((int)CmBaseAnnotationTags.kflidBeginRef, this, (int)NotesFrags.kfrScrRef);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category in the fourth (and possibly fifth and sixth) cell(s)
			vwenv.OpenTableCell(1, expanded ? 3 : 1);
			IStTxtPara quotePara = ann.QuoteOA[0];
			bool fQuoteParaRtoL = IsParaRightToLeft(quotePara);

			// Conc paragraphs don't work well for R-to-L: If the text doesn't fit, it will
			// show the trailing text rather than the leading text.
			if (fQuoteParaRtoL || expanded)
				vwenv.OpenParagraph();
			else
				vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddObjVec((int)ScrScriptureNoteTags.kflidCategories, this,
				(int)NotesFrags.kfrConnotCategory);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category chooser button in the penultimate or last cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
				(int)FwTextPropVar.ktpvMilliPoint, 2000);

			vwenv.AddPicture(m_picChooser, -(int)NotesFrags.kfrConnotCategory, 0, 0);
			vwenv.CloseTableCell();

			// If not expanded, display the quote in the last cell
			if (!expanded)
			{
				vwenv.OpenTableCell(1, 1);
				SetupWsAndDirectionForPara(vwenv, quotePara.Hvo);
				if (fQuoteParaRtoL)
					vwenv.OpenParagraph(); // Conc paragraphs don't work well for R-to-L
				else
					vwenv.OpenConcPara(0, 0, 0, 0);
				vwenv.AddString(quotePara.Contents);
				vwenv.CloseParagraph();
				vwenv.CloseTableCell();
			}

			CloseTableRow(vwenv, ann);
			#endregion

			if (!expanded)
				return;

			#region Second through fifth rows
			bool fRegularAnnotation = ann.AnnotationType != NoteType.CheckingError;
			//Second row has quote
			DisplayExpandableAnnotation(vwenv, ann,
				(int)ScrScriptureNoteTags.kflidQuote,
				ann.QuoteOA.Hvo, ann.QuoteOA,
				fRegularAnnotation ? m_quoteLabel : m_detailsLabel, !fRegularAnnotation);

			// Third row has discussion
			DisplayExpandableAnnotation(vwenv, ann,
				ScrScriptureNoteTags.kflidDiscussion,
				ann.DiscussionOA.Hvo, ann.DiscussionOA,
				fRegularAnnotation ? m_discussionLabel : m_messageLabel, !fRegularAnnotation);

			// Fourth row has recommendation (i.e. suggestion)
			DisplayExpandableAnnotation(vwenv, ann,
				ScrScriptureNoteTags.kflidRecommendation,
				ann.RecommendationOA.Hvo, ann.RecommendationOA, m_suggestionLabel);

			// Fifth row has resolution
			DisplayExpandableAnnotation(vwenv, ann,
				ScrScriptureNoteTags.kflidResolution,
				ann.ResolutionOA.Hvo, ann.ResolutionOA, m_resolutionLabel);

			#endregion

			#region Sixth row has author
			SetBackgroundColorForNote(ann, vwenv);
			OpenTableRow(vwenv, ann);

			// Display empty first and second cell
			vwenv.OpenTableCell(1, 2);
			vwenv.CloseTableCell();

			// Display author in third cell
			vwenv.OpenTableCell(1, 3);
			vwenv.OpenParagraph();
			SetDisabledColorForNote(vwenv);
			vwenv.AddString(m_authorLabel);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			CloseTableRow(vwenv, ann);
			#endregion

			#region Seventh row has dates
			SetBackgroundColorForNote(ann, vwenv);
			OpenTableRow(vwenv, ann);

			// Display empty first and second cell
			vwenv.OpenTableCell(1, 2);
			vwenv.CloseTableCell();

			// Display date created in third cell
			vwenv.OpenTableCell(1, 1);
			vwenv.OpenParagraph();
			vwenv.AddString(m_createdLabel);
			vwenv.AddTimeProp(CmAnnotationTags.kflidDateCreated, 0);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display date modified in fourth/fifth cells
			vwenv.OpenTableCell(1, 2);
			vwenv.OpenParagraph();
			vwenv.AddString(m_modifiedLabel);
			vwenv.AddTimeProp(CmAnnotationTags.kflidDateModified, 0);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display date resolved in last two cells
			vwenv.OpenTableCell(1, 2);
			vwenv.OpenParagraph();
			if (ann.ResolutionStatus == NoteStatus.Closed)
			{
				SetDisabledColorForNote(vwenv);
				vwenv.AddString(m_resolvedLabel);
				// TODO (TE-4039) This date is incorrect
				//vwenv.AddTimeProp(ScrScriptureNote.ScrScriptureNoteTags.kflidDateResolved, 0);
			}
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			CloseTableRow(vwenv, ann);
			#endregion
		}
コード例 #32
0
ファイル: InterlinVc.cs プロジェクト: bbriggs/FieldWorks
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			CheckDisposed();

			switch (frag)
			{
			case kfragSegFf: // freeform annotations. (Cf override in InterlinPrintVc)
					{
						// Note that changes here may need to be refleced in FreeformAdder's code
						// for selecting a newly created annotation.
						AddFreeformAnnotations(vwenv, hvo);
						break;
					}
				default:
				if (frag >= kfragWordGlossWs && frag < kfragWordGlossWs + m_WsList.AnalysisWsIds.Length)
				{
					// Displaying one ws of all the glosses of an analysis, separated by commas.
					vwenv.OpenParagraph();
					IWfiAnalysis wa = m_coRepository.GetObject(hvo) as IWfiAnalysis;
					int i = 0;
					foreach (IWfiGloss gloss in wa.MeaningsOC)
					{
						if (i != 0)
							vwenv.AddString(CommaSpaceString);
						vwenv.AddObj(gloss.Hvo, this, frag);
						i++;
					}
					vwenv.CloseParagraph();
				}
				else
				{
					base.DisplayVec (vwenv, hvo, tag, frag);
				}
				break;
			}
		}
コード例 #33
0
 protected override void DisplayObjectProperty(IVwEnv vwenv, int hvo)
 {
     vwenv.NoteDependency(new int[] { m_hvoOwner }, new int[] { m_flid }, 1);
     vwenv.AddObj(hvo, this, AtomicReferenceView.kFragObjName);
 }
コード例 #34
0
ファイル: InterlinVc.cs プロジェクト: bbriggs/FieldWorks
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
#if __MonoCS__
		// TODO-Linux: Randomly m_tsf seem to have been Release.
		// eg Marshal.ReleaseComObject(m_tsf);
		// However the Dispose method isn't called (which calls the Release)
		// Currently unsure what is doing this need to find out - very concerning
		// Hack - just recreate a new TsStrFactory each time... for now
		// seems to stop the problem.
		m_tsf = TsStrFactoryClass.Create();
#endif
			CheckDisposed();
			if (hvo == 0)
				return;		// Can't do anything without an hvo (except crash -- see LT-9348).

#if DEBUG
			//TimeRecorder.Begin("Display");
#endif
			switch (frag)
			{
			case kfragStText:	// new root object for InterlinDocChild.
				SetupRealVernWsForDisplay(WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph,
					hvo, StTextTags.kflidParagraphs));
				vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this, kfragInterlinPara);
				break;
			case kfragInterlinPara: // Whole StTxtPara. This can be the root fragment in DE view.
				if (vwenv.DataAccess.get_VecSize(hvo, StTxtParaTags.kflidSegments) == 0)
				{
					vwenv.NoteDependency(new int[] { hvo }, new int[] { StTxtParaTags.kflidSegments }, 1);
					vwenv.AddString(m_tssEmptyPara);
				}
				else
				{
					PreferredVernWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph, hvo, StTxtParaTags.kflidSegments);
					// Include the plain text version of the paragraph?
					vwenv.AddLazyVecItems(StTxtParaTags.kflidSegments, this, kfragParaSegment);
				}
				break;
			case kfragParaSegment:
				// Don't put anything in this segment if it is a 'label' segment (typically containing a verse
				// number for TE).
				var seg = m_segRepository.GetObject(hvo);
				if (seg.IsLabel)
					break;
				// This puts ten points between segments. There's always 5 points below each line of interlinear;
				// if there are no freeform annotations another 5 points makes 10 between segments.
				// If there are freeforms, we need the full 10 points after the last of them.
				var haveFreeform = seg.FreeTranslation != null || seg.LiteralTranslation != null || seg.NotesOS.Count > 0;
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, !haveFreeform ? 5000 : 10000);
				vwenv.OpenDiv();
				// Enhance JohnT: determine what the overall direction of the paragraph should
				// be and set it.
				if (m_mpBundleHeight == 0)
				{
					// First time...figure it out.
					int dmpx, dmpyAnal, dmpyVern;
					vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
					vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
					m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
				}
				// The interlinear bundles are not editable.
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
					(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
				if (m_fRtl)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
						(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
					vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
						(int)FwTextPropVar.ktpvEnum, (int) FwTextAlign.ktalRight);
				}
				vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
					(int)SpellingModes.ksmDoNotCheck);
				vwenv.OpenParagraph();
				AddSegmentReference(vwenv, hvo);	// Calculate and display the segment reference.
				AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
				vwenv.AddObjVecItems(SegmentTags.kflidAnalyses, this, kfragBundle);
				// JohnT, 1 Feb 2008. Took this out as I can see no reason for it; AddObjVecItems handles
				// the dependency already. Adding it just means that any change to the forms list
				// regenerates a higher level than needed, which contributes to a great deal of scrolling
				// and flashing (LT-7470).
				// Originally added by Eric in revision 72 on the trunk as part of handling phrases.
				// Eric can't see any reason we need it now, either. If you find a need to re-insert it,
				// please document carefully the reasons it is needed and what bad consequences follow
				// from removing it.
				//vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagSegmentForms }, 1);
				vwenv.CloseParagraph();
				// We'd get the same visual effect from just calling AddFreeformAnnotations here. But then a regenerate
				// such as happens when hiding or showing a prompt has to redisplay the whole segment. This initially
				// makes it lazy, then the lazy stuff gets expanded. In the process we may get undesired scrolling (LT-12248).
				// So we insert another layer of object, allowing just the freeforms to be regenerated.
				var flidSelf = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
				vwenv.AddObjProp(flidSelf, this, kfragFreeformBundle);
				vwenv.CloseDiv();
				break;
			case kfragFreeformBundle:
				AddFreeformAnnotations(vwenv, hvo);
				break;
			case kfragBundle: // One annotated word bundle; hvo is the IAnalysis object.
				// checking AllowLayout (especially in context of Undo/Redo make/break phrase)
				// helps prevent us from rebuilding the display until we've finished
				// reconstructing the data and cache. Otherwise we can crash.
				if (m_rootsite != null && !m_rootsite.AllowLayout)
					return;
				AddWordBundleInternal(hvo, vwenv);
				break;
			case kfragIsolatedAnalysis: // This one is used for an isolated HVO that is surely an analysis.
			{
				var wa = m_analRepository.GetObject(hvo);
				vwenv.AddObj(wa.Owner.Hvo, this, kfragWordformForm);
				if (m_fShowMorphBundles)
					vwenv.AddObj(hvo, this, kfragAnalysisMorphs);

				int chvoGlosses = wa.MeaningsOC.Count;
				for (int i = 0; i < m_WsList.AnalysisWsIds.Length; ++i)
				{
					SetColor(vwenv, LabelRGBFor(m_lineChoices.IndexOf(InterlinLineChoices.kflidWordGloss,
						m_WsList.AnalysisWsIds[i])));
					if (chvoGlosses == 0)
					{
						// There are no glosses, display something indicating it is missing.
						vwenv.AddProp(ktagAnalysisMissingGloss, this, kfragAnalysisMissingGloss);
					}
					else
					{
						vwenv.AddObjVec(WfiAnalysisTags.kflidMeanings, this, kfragWordGlossWs + i);
					}
				}
				AddAnalysisPos(vwenv, hvo, hvo, -1);
			}
				break;
			case kfragAnalysisMorphs:
				int cmorphs = 0;
				ICmObject co = m_coRepository.GetObject(hvo);
				if (co is IWfiAnalysis)
					cmorphs = (co as IWfiAnalysis).MorphBundlesOS.Count;
				// We really want a variable for this...there have been pathological cases where
				// m_fHaveOpenedParagraph changed during the construction of the paragraph, and we want to be
				// sure to close the paragraph if we opened it.
				var openedParagraph = !m_fHaveOpenedParagraph;
				if (openedParagraph)
					vwenv.OpenParagraph();
				if (cmorphs == 0)
				{
					DisplayMorphBundle(vwenv, 0);
				}
				else
				{
					vwenv.AddObjVecItems(WfiAnalysisTags.kflidMorphBundles, this, kfragMorphBundle);
				}
				if (openedParagraph)
					vwenv.CloseParagraph();
				break;
			case kfragMorphType: // for export only at present, display the
				vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPossibiltyAnalysisName);
				break;
			case kfragPossibiltyAnalysisName:
				vwenv.AddStringAltMember(CmPossibilityTags.kflidName, m_cache.DefaultAnalWs, this);
				break;

			case kfragMorphBundle: // the lines of morpheme information (hvo is a WfiMorphBundle)
				// Make an 'inner pile' to contain the bundle of morph information.
				// Give it 10 points of separation from whatever follows.
				DisplayMorphBundle(vwenv, hvo);
				break;
			case kfragSingleInterlinearAnalysisWithLabels:
				/*
				// This puts ten points between segments. There's always 5 points below each line of interlinear;
				// if there are no freeform annotations another 5 points makes 10 between segments.
				// If there are freeforms, we need the full 10 points after the last of them.
				int cfreeform = vwenv.get_DataAccess().get_VecSize(hvo, ktagSegFF);
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, cfreeform == 0 ? 5000 : 10000);
				*/
				vwenv.OpenDiv();
				DisplaySingleInterlinearAnalysisWithLabels(vwenv, hvo);
				vwenv.CloseDiv();
				break;
			// This frag is used to display a single interlin analysis that is always left-aligned, even for RTL languages
			case kfragSingleInterlinearAnalysisWithLabelsLeftAlign:
				vwenv.OpenDiv();
				vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, m_leftPadding);
				vwenv.OpenParagraph();
				vwenv.OpenInnerPile();
				DisplaySingleInterlinearAnalysisWithLabels(vwenv, hvo);
				vwenv.CloseInnerPile();
				vwenv.CloseParagraph();
				vwenv.CloseDiv();
				break;
			//case kfragDefaultSense: // Some default sense
			//	// NB: If the hvo is zero, then we need to go back to the normal missing sense display, after all.
			//	// (hvo isn't zero, even for cases where there isn't even a default value.)
			//	if (hvo > 0)
			//	{
			//		// Show default sense, in some other 'guess' color.
			//		SetGuessing(vwenv, false);
			//		foreach (int wsId in m_WsList.AnalysisWsIds)
			//			vwenv.AddStringAltMember(LexSenseTags.kflidGloss,
			//				wsId, this);
			//	}
			//	else
			//	{
			//		// Give up and show the missing sense row.
			//		vwenv.AddString(m_tssMissingSense);
			//	}
			//	break;
			case kfragWordformForm: // The form of a WviWordform.
				vwenv.AddStringAltMember(WfiWordformTags.kflidForm,
					m_wsVernForDisplay, this);
				break;
			case kfragPrefix:
				vwenv.AddUnicodeProp(MoMorphTypeTags.kflidPrefix, m_wsVernForDisplay, this);
				break;
			case kfragPostfix:
				vwenv.AddUnicodeProp(MoMorphTypeTags.kflidPostfix, m_wsVernForDisplay, this);
				break;
			case kfragSenseName: // The name (gloss) of a LexSense.
				foreach (int wsId in m_WsList.AnalysisWsIds)
					vwenv.AddStringAltMember(LexSenseTags.kflidGloss,
						wsId, this);
				break;
			case kfragCategory: // the category of a WfiAnalysis, a part of speech;
				// display the Abbreviation property inherited from CmPossibility.
				foreach(var wsId in m_WsList.AnalysisWsIds)
				{
					vwenv.AddStringAltMember(CmPossibilityTags.kflidAbbreviation, wsId, this);
				}
				break;
			default:
				if (frag >= kfragWordGlossWs && frag < kfragWordGlossWs + m_WsList.AnalysisWsIds.Length)
				{
					// Displaying one ws of the  form of a WfiGloss.
					int ws = m_WsList.AnalysisWsIds[frag - kfragWordGlossWs];
					vwenv.AddStringAltMember(WfiGlossTags.kflidForm, ws, this);
				}
				else if (frag >= kfragLineChoices && frag < kfragLineChoices + m_lineChoices.Count)
				{
					var spec = m_lineChoices[frag - kfragLineChoices];
					var ws = GetRealWsOrBestWsForContext(hvo, spec);
					vwenv.AddStringAltMember(spec.StringFlid, ws, this);
				}
				else if (frag >= kfragAnalysisCategoryChoices && frag < kfragAnalysisCategoryChoices + m_lineChoices.Count)
				{
					AddAnalysisPos(vwenv, hvo, hvo, frag - kfragAnalysisCategoryChoices);
				}
				else if (frag >= kfragMorphFormChoices && frag < kfragMorphFormChoices + m_lineChoices.Count)
				{
					InterlinLineSpec spec = m_lineChoices[frag - kfragMorphFormChoices];
					int wsActual = GetRealWsOrBestWsForContext(hvo, spec);
					DisplayMorphForm(vwenv, hvo, wsActual);
				}
				else if (frag >= kfragSegFfChoices && frag < kfragSegFfChoices + m_lineChoices.Count)
				{
					AddFreeformComment(vwenv, hvo, frag - kfragSegFfChoices);
				}
				else
				{
					throw new Exception("Bad fragment ID in InterlinVc.Display");
				}
				break;
		}
#if DEBUG
			//TimeRecorder.End("Display");
#endif
		}
コード例 #35
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them.
        /// Scripture Footnotes are displayed by displaying each footnote's reference and text.
        /// The text is displayed using the standard view constructor for StText.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case (int)StTextFrags.kfrFootnote:
            {
                // FWR-1640: Make the sequence of footnote paragraphs non-editable
                // since we only allow one para per footnote. This will cause
                // pasting multiple paragraphs to work correctly.
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                base.Display(vwenv, hvo, frag);
                break;
            }

            case (int)FootnoteFrags.kfrScripture:
            {
                vwenv.NoteDependency(new int[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo },
                                     new int[] { (int)ScriptureTags.kflidScriptureBooks }, 1);
                vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
                break;
            }

            case (int)FootnoteFrags.kfrRootInPageSeq:
            {
                vwenv.AddObjVec(ScrBookTags.kflidFootnotes, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
            {
                // Insert the marker and reference
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteReference);

                // Insert (we hope only one) paragraph contents.
                vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteParaWithinPagePara:
            {
                if (!InsertParaContentsUserPrompt(vwenv, hvo))
                {
                    // Display the text paragraph contents, or its user prompt.
                    vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                }
                break;
            }

            case (int)FootnoteFrags.kfrBook:
            {
                vwenv.OpenDiv();
                vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this,
                                     (int)StTextFrags.kfrFootnote);
                vwenv.CloseDiv();
                break;
            }

            case (int)StTextFrags.kfrFootnoteReference:
            {
                DisplayFootnoteReference(vwenv, hvo);
                break;
            }

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
コード例 #36
0
ファイル: FootnoteVc.cs プロジェクト: sillsdev/WorldPad
		private void CreateNotesParagraph(IVwEnv vwenv, List<int> notes, ITsTextProps styleProps)
		{
			// Don't create a completely empty paragraph. The way the Views system handles such paragraphs
			// doesn't work for a MappedTaggedPara. Also, we want the footnote to take up no height at all
			// if there are none.
			if (notes.Count == 0)
				return;
			vwenv.set_IntProperty((int)FwTextPropType.ktptBaseWs,
				(int)FwTextPropVar.ktpvDefault, DefaultWs);
			vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
				(int)FwTextPropVar.ktpvEnum, (RightToLeft ? -1 : 0));
			vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
				(int)FwTextPropVar.ktpvEnum,
				RightToLeft ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
			vwenv.Props = styleProps;

			// The body of the paragraph is either editable or not.
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
				(int)FwTextPropVar.ktpvEnum,
				Editable ? (int)TptEditable.ktptIsEditable
				: (int)TptEditable.ktptNotEditable);

			vwenv.OpenMappedTaggedPara();
			for (int ihvo = 0; ihvo < notes.Count; ihvo++)
			{
				// Optimize JohnT: could make this string once and save it in a member variable.
				if (ihvo != 0)
					vwenv.AddString(m_cache.MakeVernTss("  "));
				vwenv.AddObj(notes[ihvo], this, (int)FootnoteFrags.kfrFootnoteWithinPagePara);
			}
			vwenv.CloseParagraph();
		}
コード例 #37
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case kfragRule:
                m_rule = m_cache.ServiceLocator.GetInstance <IPhMetathesisRuleRepository>().GetObject(hvo);
                if (m_rule.Disabled)
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
                }

                int maxNumLines = GetMaxNumLines();

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

                VwLength ctxtLen;
                ctxtLen.nVal = 1;
                ctxtLen.unit = VwUnit.kunRelative;

                int resultx, inputx, dmpy;
                vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
                vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
                VwLength headerLen;
                headerLen.nVal = Math.Max(resultx, inputx) + 8000;
                headerLen.unit = VwUnit.kunPoint1000;

                vwenv.MakeColumns(1, headerLen);
                vwenv.MakeColumns(4, ctxtLen);

                vwenv.OpenTableBody();

                vwenv.OpenTableRow();

                vwenv.OpenTableCell(1, 1);
                vwenv.CloseTableCell();

                // left context header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_leftEnvStr);
                vwenv.CloseTableCell();

                // switch header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 2);
                vwenv.AddString(m_switchStr);
                vwenv.CloseTableCell();

                // right context header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_rightEnvStr);
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.OpenTableRow();

                // input header cell
                vwenv.Props = m_rowHeaderProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_inputStr);
                vwenv.CloseTableCell();

                // input left context cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftEnvIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = 0; i < m_rule.LeftEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input left switch cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftSwitchIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagLeftSwitch, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }

                    if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
                    {
                        for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                        {
                            vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                        }
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input right switch cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightSwitchIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagRightSwitch, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
                    {
                        for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                        {
                            vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                        }
                    }

                    for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input right context cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightEnvIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagRightEnv, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.OpenTableRow();

                // input result header cell
                vwenv.Props = m_rowHeaderProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_resultStr);
                vwenv.CloseTableCell();

                // result left context cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftEnvIndex != -1)
                {
                    for (int i = 0; i < m_rule.LeftEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result right switch cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightSwitchIndex != -1)
                {
                    for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
                {
                    for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result left switch cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();

                if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
                {
                    for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                if (m_rule.LeftSwitchIndex != -1)
                {
                    for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result right context cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightEnvIndex != -1)
                {
                    for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.CloseTableBody();

                vwenv.CloseTable();
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
コード例 #38
0
        private void RegurgitateIVwEnvCall(StoredMethod storedMethod)
        {
            int tag;
            int frag;
            IVwViewConstructor vc;

            switch (storedMethod.MethodType)
            {
            case DecoratorMethodTypes.AddObj:
                var hvo = (int)storedMethod.ParamArray[0];
                vc   = (IVwViewConstructor)storedMethod.ParamArray[1];
                frag = (int)storedMethod.ParamArray[2];
                m_vwEnv.AddObj(hvo, vc, frag);
                break;

            case DecoratorMethodTypes.AddObjProp:
                tag  = (int)storedMethod.ParamArray[0];
                vc   = (IVwViewConstructor)storedMethod.ParamArray[1];
                frag = (int)storedMethod.ParamArray[2];
                m_vwEnv.AddObjProp(tag, vc, frag);
                break;

            case DecoratorMethodTypes.AddObjVec:
                tag  = (int)storedMethod.ParamArray[0];
                vc   = (IVwViewConstructor)storedMethod.ParamArray[1];
                frag = (int)storedMethod.ParamArray[2];
                m_vwEnv.AddObjVec(tag, vc, frag);
                break;

            case DecoratorMethodTypes.AddObjVecItems:
                tag  = (int)storedMethod.ParamArray[0];
                vc   = (IVwViewConstructor)storedMethod.ParamArray[1];
                frag = (int)storedMethod.ParamArray[2];
                m_vwEnv.AddObjVecItems(tag, vc, frag);
                break;

            case DecoratorMethodTypes.AddString:
                var tsStr = (ITsString)storedMethod.ParamArray[0];
                m_vwEnv.AddString(tsStr);
                break;

            case DecoratorMethodTypes.AddStringProp:
                tag = (int)storedMethod.ParamArray[0];
                vc  = (IVwViewConstructor)storedMethod.ParamArray[1];
                m_vwEnv.AddStringProp(tag, vc);
                break;

            case DecoratorMethodTypes.CloseParagraph:
                m_vwEnv.CloseParagraph();
                break;

            case DecoratorMethodTypes.CloseTableCell:
                m_vwEnv.CloseTableCell();
                break;

            case DecoratorMethodTypes.NoteDependency:
                var _rghvo = (int[])storedMethod.ParamArray[0];
                var _rgtag = (int[])storedMethod.ParamArray[1];
                var chvo   = (int)storedMethod.ParamArray[2];
                m_vwEnv.NoteDependency(_rghvo, _rgtag, chvo);
                break;

            case DecoratorMethodTypes.OpenParagraph:
                m_vwEnv.OpenParagraph();
                break;

            case DecoratorMethodTypes.OpenTableCell:
                var nRows = (int)storedMethod.ParamArray[0];
                var nCols = (int)storedMethod.ParamArray[1];
                m_vwEnv.OpenTableCell(nRows, nCols);
                break;

            case DecoratorMethodTypes.SetIntProperty:
                var tpt    = (int)storedMethod.ParamArray[0];
                var tpv    = (int)storedMethod.ParamArray[1];
                var nValue = (int)storedMethod.ParamArray[2];
                m_vwEnv.set_IntProperty(tpt, tpv, nValue);
                break;

            case DecoratorMethodTypes.PropsSetter:
                var value = (ITsTextProps)storedMethod.ParamArray[0];
                m_vwEnv.Props = value;
                break;

            default:
                Debug.Assert(false, "Unknown DecoratorMethodType!");
                break;
            }
        }
コード例 #39
0
			public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
			{
				CheckDisposed();

				ISilDataAccess da = vwenv.DataAccess;
				switch (frag)
				{
					default:
					{
						Debug.Assert(false, "Unrecognized fragment.");
						break;
					}
					case ReversalIndexEntrySliceView.kFragIndices:
					{
						// hvo here is the sense.
						int countRows = da.get_VecSize(hvo, tag);
						Debug.Assert(countRows == m_usedIndices.Count, "Mismatched number of indices.");
						for (int i = 0; i < countRows; ++i)
						{
							vwenv.OpenTableRow();

							int idxHvo = da.get_VecItem(hvo, tag, i);
							vwenv.AddObj(idxHvo, this, ReversalIndexEntrySliceView.kFragIndexMain);

							vwenv.CloseTableRow();
						}
						break;
					}
					case ReversalIndexEntrySliceView.kFragEntries:
					{
						int wsHvo = 0;
						foreach (IReversalIndex idx in m_usedIndices)
						{
							if (idx.Hvo == hvo)
							{
								wsHvo = idx.WritingSystemRAHvo;
								break;
							}
						}
						Debug.Assert(wsHvo > 0, "Could not find writing system.");
						int wsOldDefault = this.DefaultWs;
						this.DefaultWs = wsHvo;

						// hvo here is a reversal index.
						int countEntries = da.get_VecSize(hvo, ReversalIndexEntrySliceView.kFlidEntries);
						for (int j = 0; j < countEntries; ++j)
						{
							if (j != 0)
								vwenv.AddSeparatorBar();
							int entryHvo = da.get_VecItem(hvo, ReversalIndexEntrySliceView.kFlidEntries, j);
							vwenv.AddObj(entryHvo, this, ReversalIndexEntrySliceView.kFragEntryForm);
						}

						this.DefaultWs = wsOldDefault;
						break;
					}
				}
			}
コード例 #40
0
 protected override void DisplayObjectProperty(IVwEnv vwenv, int hvo)
 {
     vwenv.AddObj(hvo, this, AtomicReferenceView.kFragObjName);
 }
コード例 #41
0
ファイル: StVc.cs プロジェクト: sillsdev/WorldPad
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body
        /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses
        /// need to separate this from applying the properties.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// <param name="fApplyProps"></param>
        /// <param name="contentType"></param>
        /// <param name="vc">The view constructor used to create the paragraphs</param>
        /// ------------------------------------------------------------------------------------
        protected void InsertParagraphBody(IVwEnv vwenv, int hvo, int frag, bool fApplyProps,
                                           ContentTypes contentType, StVc vc)
        {
            vc.SetupWsAndDirectionForPara(vwenv, hvo);

            if (fApplyProps)
            {
                ApplyParagraphStyleProps(vwenv, hvo, vc);
            }

            // This was causing assertions in the layoutmgr
            // TODO (TE-5777): Should be able to do this with an in-memory stylesheet.
            //			if (DisplayTranslation)
            //			{
            //				// display the back translation text as double spaced
            //				vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight,
            //					(int)FwTextPropVar.ktpvRelative, 20000);
            //			}
            // The body of the paragraph is either editable or not.
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum,
                                  vc.Editable ? (int)TptEditable.ktptIsEditable
                                : (int)TptEditable.ktptNotEditable);
            // Make the paragraph containing the paragraph contents.
            OpenPara(vwenv, hvo);
            // Cause a regenerate when the style changes...this is mainly used for Undo.
            vwenv.NoteDependency(new int[] { hvo },
                                 new int[] { (int)StPara.StParaTags.kflidStyleRules }, 1);
            // Insert the label if it is the first paragraph.
            if (vc.Label != null)
            {
                int lev = vwenv.EmbeddingLevel;
                int hvoOuter;
                int ihvoItem;
                int tagOuter;
                vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
                if (ihvoItem == 0)
                {
                    vwenv.AddObj(hvo, vc, (int)StTextFrags.kfrLabel);
                }
            }
            if (frag == (int)StTextFrags.kfrFootnotePara)
            {
                int lev = vwenv.EmbeddingLevel;
                int hvoOuter;
                int ihvoItem;
                int tagOuter;
                vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem);
                // Note a dependency on the footnote options so that the footnote will
                // be refreshed when these are changed.
                int[] depHvos = { hvoOuter };
                int[] depTags = { StFootnote.ktagFootnoteOptions };
                vwenv.NoteDependency(depHvos, depTags, 1);
                // If this is the 0th paragraph in the footnote...
                if (ihvoItem == 0)
                {
                    vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker);
                    vwenv.AddObj(hvoOuter, /*vc.Parent != null ? vc.Parent :*/ vc,
                                 (int)StTextFrags.kfrFootnoteReference);
                }
            }

            if (contentType == ContentTypes.kctSimpleBT)
            {
                // If a translation is being shown instead of the paragraph, then show it instead
                // of the text of the paragraph.
                int transHvo = GetTranslationForPara(hvo);
                vwenv.AddObj(transHvo, vc, (int)StTextFrags.kfrTranslation);
                vwenv.NoteDependency(new int[] { hvo },
                                     new int[] { (int)StTxtPara.StTxtParaTags.kflidContents }, 1);
            }
            else if (contentType == ContentTypes.kctSegmentBT)
            {
                InsertBtSegments(vc, vwenv, hvo);
            }
            else if (!InsertParaContentsUserPrompt(vwenv, hvo))
            {
                // Display the text paragraph contents, or its user prompt.
                vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
            }

            // Display an "end-of-paragraph" marker if needed
            InsertEndOfParaMarks(vwenv, hvo);

            vwenv.CloseParagraph();
        }
コード例 #42
0
			public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
			{
				CheckDisposed();
				ISilDataAccess da = vwenv.DataAccess;
				int count = da.get_VecSize(hvo, tag);
				for (int i = 0; i < count; ++i)
				{
					if (i != 0)
						vwenv.AddSeparatorBar();
					vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
						PhoneEnvReferenceView.kFragEnvironmentObj);
				}
			}
コード例 #43
0
			public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
			{
				CheckDisposed();

				switch (frag)
				{
					case kfragMorph: // The bundle of 4 lines representing a morpheme.
						ISilDataAccess sda = vwenv.DataAccess;
						int cmorph = sda.get_VecSize(hvo, tag);
						for (int i = 0; i < cmorph; ++i)
						{
							int hvoMorph = sda.get_VecItem(hvo, tag, i);
							vwenv.AddObj(hvoMorph, this, i == 0 ? kfragFirstMorph : kfragMorph);
						}
						break;
				}
			}
コード例 #44
0
		/// <summary>
		/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
		/// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
		/// this should not be case, but experience trumps theory every time.  :-) :-(
		/// </summary>
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			ISilDataAccess da = vwenv.DataAccess;
			int count = da.get_VecSize(hvo, tag);
			// Show everything in the collection except the current element from the main display.
			for (int i = 0; i < count; ++i)
			{
				int hvoItem = da.get_VecItem(hvo, tag, i);
				if (m_displayParent != null && hvoItem == m_displayParent.Hvo)
					continue;
				vwenv.AddObj(hvoItem, this,	VectorReferenceView.kfragTargetObj);
				vwenv.AddSeparatorBar();
			}
		}
コード例 #45
0
ファイル: FootnoteVc.cs プロジェクト: sillsdev/WorldPad
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them.
        /// Scripture Footnotes are displayed by displaying each footnote's reference and text.
        /// The text is displayed using the standard view constructor for StText.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            CheckDisposed();

            switch (frag)
            {
            case (int)FootnoteFrags.kfrScripture:
            {
                vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
                                     new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
                vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
                break;
            }

            case (int)FootnoteFrags.kfrRootInPageSeq:
            {
                int tag = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor,
                                                                  "Scripture", "FootnotesOnPage",
                                                                  (int)CellarModuleDefns.kcptReferenceSequence).Tag;
                // Get the list of footnotes to display
                int[] hvos = m_cache.GetVectorProperty(hvo, tag, true);
                if (hvos.Length > 0)
                {
                    int ownerHvo = m_cache.GetOwnerOfObject(hvos[0]);
                    // The ownerHvo should be the HVO of the book
                    vwenv.NoteDependency(new int[] { ownerHvo },
                                         new int[] { (int)ScrBook.ScrBookTags.kflidFootnotes }, 1);
                }
                vwenv.AddObjVec(tag, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
            {
                // Note a dependency on the footnote options so that the footnote will
                // be refreshed when these are changed.
                int[] depHvos = { hvo };
                int[] depTags = { StFootnote.ktagFootnoteOptions };
                vwenv.NoteDependency(depHvos, depTags, 1);

                // Insert the marker and reference
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteReference);

                // Insert (we hope only one) paragraph contents.
                vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
                                     (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteParaWithinPagePara:
            {
                if (!InsertParaContentsUserPrompt(vwenv, hvo))
                {
                    // Display the text paragraph contents, or its user prompt.
                    vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
                }
                break;
            }

            case (int)FootnoteFrags.kfrBook:
            {
                vwenv.OpenDiv();
                vwenv.AddObjVecItems((int)ScrBook.ScrBookTags.kflidFootnotes, this,
                                     (int)StTextFrags.kfrFootnote);
                vwenv.CloseDiv();
                break;
            }

            case (int)StTextFrags.kfrFootnoteMarker:
            {
                ScrFootnote footnote = new ScrFootnote(Cache, hvo);
                if (footnote.DisplayFootnoteMarker)
                {
                    DisplayFootnoteMarker(vwenv, footnote);
                }
                break;
            }

            case (int)StTextFrags.kfrFootnoteReference:
            {
                ITsStrFactory   tsStrFactory = TsStrFactoryClass.Create();
                ITsPropsFactory tpf          = TsPropsFactoryClass.Create();
                ITsTextProps    ttp          = tpf.MakeProps(ScrStyleNames.FootnoteTargetRef, m_wsDefault, 0);

                ScrFootnote footnote    = new ScrFootnote(m_cache, hvo);
                string      footnoteRef = footnote.GetReference(m_wsDefault);
                ITsString   tssRef      = tsStrFactory.MakeStringWithPropsRgch(footnoteRef,
                                                                               footnoteRef.Length, ttp);
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                vwenv.AddString(tssRef);
                break;
            }

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
コード例 #46
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRule:
					m_rule = m_cache.ServiceLocator.GetInstance<IPhMetathesisRuleRepository>().GetObject(hvo);
					if (m_rule.Disabled)
					{
						vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
					}

					int maxNumLines = GetMaxNumLines();

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

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;

					int resultx, inputx, dmpy;
					vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
					vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
					VwLength headerLen;
					headerLen.nVal = Math.Max(resultx, inputx) + 8000;
					headerLen.unit = VwUnit.kunPoint1000;

					vwenv.MakeColumns(1, headerLen);
					vwenv.MakeColumns(4, ctxtLen);

					vwenv.OpenTableBody();

					vwenv.OpenTableRow();

					vwenv.OpenTableCell(1, 1);
					vwenv.CloseTableCell();

					// left context header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_leftEnvStr);
					vwenv.CloseTableCell();

					// switch header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 2);
					vwenv.AddString(m_switchStr);
					vwenv.CloseTableCell();

					// right context header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_rightEnvStr);
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.OpenTableRow();

					// input header cell
					vwenv.Props = m_rowHeaderProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_inputStr);
					vwenv.CloseTableCell();

					// input left context cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftEnvIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = 0; i < m_rule.LeftEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input left switch cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftSwitchIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagLeftSwitch, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);

						if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
						{
							for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
								vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
						}
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input right switch cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightSwitchIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagRightSwitch, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
						{
							for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
								vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
						}

						for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input right context cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightEnvIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagRightEnv, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.OpenTableRow();

					// input result header cell
					vwenv.Props = m_rowHeaderProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_resultStr);
					vwenv.CloseTableCell();

					// result left context cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftEnvIndex != -1)
					{
						for (int i = 0; i < m_rule.LeftEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result right switch cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightSwitchIndex != -1)
					{
						for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
					{
						for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result left switch cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();

					if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
					{
						for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					if (m_rule.LeftSwitchIndex != -1)
					{
						for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result right context cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightEnvIndex != -1)
					{
						for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.CloseTableBody();

					vwenv.CloseTable();
					break;

				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
コード例 #47
0
ファイル: DraftViewVc.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override of DisplayVec
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void DisplayVec(IVwEnv vwenv, int paraHvo, int tag, int frag)
		{
			CheckDisposed();

			if (tag == StTxtParaTags.kflidTranslations && frag == (int)ScrFrags.kfrBtTranslationStatus)
			{
				IStTxtPara para = Cache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraHvo);
				vwenv.AddObj(GetTranslationForPara(paraHvo), this, frag);
			}
			else
				base.DisplayVec(vwenv, paraHvo, tag, frag);
		}
コード例 #48
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();

				ISilDataAccess da = vwenv.DataAccess;
				switch (frag)
				{
					default:
					{
						Debug.Assert(false, "Unrecognized fragment.");
						break;
					}
					case ReversalIndexEntrySliceView.kFragMainObject:
					{
						// The hvo here is for the sense.

						// We use a table to display
						// encodings in column one and the strings in column two.
						// The table uses 100% of the available width.
						VwLength vlTable;
						vlTable.nVal = 10000;
						vlTable.unit = VwUnit.kunPercent100;
						// The width of the writing system column is determined from the width of the
						// longest one which will be displayed.
						int dxs;	// Width of displayed string.
						int dys;	// Height of displayed string (not used here).
						int dxsMax = 0;	// Max width required.
						ISilDataAccess silDaCache = vwenv.DataAccess;
						IVwCacheDa vwCache = silDaCache as IVwCacheDa;
						foreach (IReversalIndex idx in m_usedIndices)
						{
							vwenv.get_StringWidth(silDaCache.get_StringProp(idx.WritingSystemRAHvo, (int)LgWritingSystem.LgWritingSystemTags.kflidAbbr),
								m_ttpLabel,
								out dxs,
								out dys);
							dxsMax = Math.Max(dxsMax, dxs);
						}
						VwLength vlColWs; // 5-pt space plus max label width.
						vlColWs.nVal = dxsMax + 5000;
						vlColWs.unit = VwUnit.kunPoint1000;
						// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
						// The Main column is relative and uses the rest of the space.
						VwLength vlColMain;
						vlColMain.nVal = 1;
						vlColMain.unit = VwUnit.kunRelative;

						vwenv.OpenTable(2, // Two columns.
							vlTable, // Table uses 100% of available width.
							0, // Border thickness.
							VwAlignment.kvaLeft, // Default alignment.
							VwFramePosition.kvfpVoid, // No border.
							VwRule.kvrlNone, // No rules between cells.
							0, // No forced space between cells.
							0, // No padding inside cells.
							false);
						// Specify column widths. The first argument is the number of columns,
						// not a column index. The writing system column only occurs at all if its
						// width is non-zero.
						vwenv.MakeColumns(1, vlColWs);
						vwenv.MakeColumns(1, vlColMain);

						vwenv.OpenTableBody();
						// Do vector of rows. Each row essentially is a reversal index, but shows other information.
						vwenv.AddObjVec(ReversalIndexEntrySliceView.kFlidIndices, this, ReversalIndexEntrySliceView.kFragIndices);
						vwenv.CloseTableBody();
						vwenv.CloseTable();
						break;
					}
					case ReversalIndexEntrySliceView.kFragIndexMain:
					{
						// First cell has writing system abbreviation displayed using m_ttpLabel.
						int wsHvo = 0;
						foreach (ReversalIndex idx in m_usedIndices)
						{
							if (idx.Hvo == hvo)
							{
								wsHvo = idx.WritingSystemRAHvo;
								break;
							}
						}
						Debug.Assert(wsHvo > 0, "Could not find writing system.");

						int wsOldDefault = this.DefaultWs;
						this.DefaultWs = wsHvo;

						// Cell 1 shows the ws abbreviation.
						vwenv.OpenTableCell(1,1);
						vwenv.Props = m_ttpLabel;
						vwenv.AddObj(wsHvo, this, ReversalIndexEntrySliceView.kFragWsAbbr);
						vwenv.CloseTableCell();

						// Second cell has the contents for the reversal entries.
						vwenv.OpenTableCell(1,1);
						// This displays the field flush right for RTL data, but gets arrow keys to
						// behave reasonably.  See comments on LT-5287.
						IWritingSystem lgws = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(this.DefaultWs);
						if (lgws != null && lgws.RightToLeft)
						{
							vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
								(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
						}
						vwenv.OpenParagraph();
						// Do vector of entries in the second column.
						vwenv.AddObjVec(ReversalIndexEntrySliceView.kFlidEntries, this, ReversalIndexEntrySliceView.kFragEntries);
						vwenv.CloseParagraph();
						vwenv.CloseTableCell();

						this.DefaultWs = wsOldDefault;
						break;
					}
					case ReversalIndexEntrySliceView.kFragEntryForm:
					{
						vwenv.AddStringAltMember((int)ReversalIndexEntry.ReversalIndexEntryTags.kflidReversalForm,
							this.DefaultWs, this);
						int hvoCurrent = vwenv.CurrentObject();
						if (hvoCurrent > 0)
						{
							IReversalIndexEntry rie = ReversalIndexEntry.CreateFromDBObject(m_cache, hvoCurrent);
							Debug.Assert(rie != null);
							int[] rgWs = m_cache.LangProject.GetReversalIndexWritingSystems(rie.Hvo, false);
							int wsAnal = m_cache.DefaultAnalWs;
							ITsIncStrBldr tisb = TsIncStrBldrClass.Create();
							tisb.SetIntPropValues((int)FwTextPropType.ktptWs,
								(int)FwTextPropVar.ktpvDefault, wsAnal);
							tisb.SetIntPropValues((int)FwTextPropType.ktptEditable,
								(int)FwTextPropVar.ktpvEnum,
								(int)TptEditable.ktptNotEditable);
							tisb.Append(" [");
							int cstr = 0;
							ITsTextProps ttpBase = null;
							for (int i = 0; i < rgWs.Length; ++i)
							{
								int ws = rgWs[i];
								if (ws == this.DefaultWs)
									continue;
								string sForm = rie.ReversalForm.GetAlternative(ws);
								if (sForm != null && sForm.Length != 0)
								{
									if (cstr > 0)
										tisb.Append(", ");
									++cstr;
									string sWs = m_cache.GetMultiUnicodeAlt(ws,
										(int)LgWritingSystem.LgWritingSystemTags.kflidAbbr, wsAnal,
										"LgWritingSystem_Abbr");
									if (sWs != null && sWs.Length != 0)
									{
										ITsString tssWs = m_tsf.MakeStringWithPropsRgch(sWs, sWs.Length, m_ttpLabel);
										tisb.AppendTsString(tssWs);
										// We have to totally replace the properties set by m_ttpLabel.  The
										// simplest way is to create another ITsString with the simple base
										// property of only the default analysis writing system.
										if (ttpBase == null)
										{
											ITsPropsBldr tpbBase = TsPropsBldrClass.Create();
											tpbBase.SetIntPropValues((int)FwTextPropType.ktptWs,
												(int)FwTextPropVar.ktpvDefault, wsAnal);
											ttpBase = tpbBase.GetTextProps();
										}
										ITsString tssSpace = m_tsf.MakeStringWithPropsRgch(" ", 1, ttpBase);
										tisb.AppendTsString(tssSpace);
									}
									tisb.SetIntPropValues((int)FwTextPropType.ktptWs,
										(int)FwTextPropVar.ktpvDefault, ws);
									tisb.Append(sForm);
									tisb.SetIntPropValues((int)FwTextPropType.ktptWs,
										(int)FwTextPropVar.ktpvDefault, wsAnal);
								}
							}
							if (cstr > 0)
							{
								tisb.Append("]");
								ITsString tss = tisb.GetString();
								vwenv.AddString(tss);
							}
						}
						break;
					}
					case ReversalIndexEntrySliceView.kFragWsAbbr:
					{
						vwenv.AddString(da.get_StringProp(hvo, (int)LgWritingSystem.LgWritingSystemTags.kflidAbbr));
						break;
					}
				}
			}
コード例 #49
0
		/// <summary>
		/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
		/// work better than calling vwenv.AddObjVecItems() in Display().  Theoretically
		/// this should not be case, but experience trumps theory every time.  :-) :-(
		/// </summary>
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			ISilDataAccess da = vwenv.DataAccess;
			int count = da.get_VecSize(hvo, tag);
			// Show everything in the sequence including current element from the main display.
			for (int i = 0; i < count; ++i)
			{
				int hvoItem = da.get_VecItem(hvo, tag, i);
				vwenv.AddObj(hvoItem, this,	VectorReferenceView.kfragTargetObj);
				vwenv.AddSeparatorBar();
			}
		}
コード例 #50
0
		protected override void DisplayObjectProperty(IVwEnv vwenv, int hvo)
		{
			vwenv.NoteDependency(new int[] {m_hvoOwner}, new int[] {m_flid}, 1);
			vwenv.AddObj(hvo, this, AtomicReferenceView.kFragObjName);
		}
コード例 #51
0
		protected override void DisplayObjectProperty(IVwEnv vwenv, int hvo)
		{
			vwenv.AddObj(hvo, this, AtomicReferenceView.kFragObjName);
		}
コード例 #52
0
ファイル: RelatedWords.cs プロジェクト: sillsdev/WorldPad
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Handles displaying the vector of words with commas except after the last
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="tag"></param>
		/// <param name="frag"></param>
		/// -----------------------------------------------------------------------------------
		public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
		{
			CheckDisposed();

			Debug.Assert(frag == kfragWords);
			ISilDataAccess sda = vwenv.DataAccess;
			int cwords = sda.get_VecSize(hvo, ktagWords);
			for (int i = 0; i < cwords; i++)
			{
				vwenv.AddObj(sda.get_VecItem(hvo, ktagWords, i), this, kfragName);
				if (i != cwords - 1)
					vwenv.AddString(m_tssComma);
			}
		}
コード例 #53
0
        /// <summary>
        /// The main entry point to do the work of the original method.
        /// </summary>
        internal void Display(ref ITsString tssDelayedNumber)
        {
            MainCallerDisplayCommand dispInfo;

            if (!m_viewConstructor.CanGetMainCallerDisplayCommand(m_frag, out dispInfo))
            {
                // Shouldn't be possible, but just in case...
                Debug.Assert(true, "No MainCallerDisplayCommand!");
                return;
            }

            XmlNode listDelimitNode;             // has the list seps attrs like 'sep'
            XmlNode specialAttrsNode;            // has the more exotic ones like 'excludeHvo'

            listDelimitNode = specialAttrsNode = dispInfo.MainNode;
            // 'inheritSeps' attr means to use the 'caller' (the part ref node)
            // to get the separator information.
            if (XmlUtils.GetOptionalBooleanAttributeValue(listDelimitNode, "inheritSeps", false))
            {
                listDelimitNode = dispInfo.Caller;
            }
            //
            // 1. get number of items in vector
            //
            var chvo = m_sda.get_VecSize(m_hvo, m_flid);

            if (chvo == 0)
            {
                // We may want to do something special for empty vectors.  See LT-9687.
                ProcessEmptyVector(m_vwEnv, m_hvo, m_flid);
                return;
            }
            //
            // 2. for each item in the vector,
            //		a) print leading number if desired.
            //		b) call AddObj
            //		c) print separator if desired and needed
            //
            int[] rghvo = GetVector(m_sda, m_hvo, m_flid);
            Debug.Assert(chvo == rghvo.Length);
            //
            // Define some special boolean flags.
            //
            // Note that we deliberately don't use the listDelimitNode here.
            // These three props are not currently configurable, and they belong on the 'seq' element,
            // not the part ref.
            var fCheckForEmptyItems = XmlUtils.GetOptionalBooleanAttributeValue(specialAttrsNode,
                                                                                "checkForEmptyItems", false);
            string exclude    = XmlUtils.GetOptionalAttributeValue(specialAttrsNode, "excludeHvo", null);
            var    fFirstOnly = XmlUtils.GetOptionalBooleanAttributeValue(specialAttrsNode, "firstOnly", false);

            XmlAttribute xaNum;
            var          fNumber = SetNumberFlagIncludingSingleOption(listDelimitNode, chvo, out xaNum);

            ApplySortingIfSpecified(rghvo, specialAttrsNode);

            // Determine if sequence should be filtered by a stored list of Guids.
            // Note that if we filter, we replace rghvo with the filtered list.
            if (m_viewConstructor.ShouldFilterByGuid)
            {              // order by vector item type guids
                // Don't reorder LexEntry VisibleComplexFormBackRefs vector if the user overrode it manually.
                var obj = m_cache.ServiceLocator.GetObject(m_hvo);
                if (obj is ILexEntry)
                {
                    var lexEntry = obj as ILexEntry;
                    if (m_flid == m_cache.MetaDataCacheAccessor.GetFieldId("LexEntry", "VisibleComplexFormBackRefs", false))
                    {
                        if (!VirtualOrderingServices.HasVirtualOrdering(lexEntry, "VisibleComplexFormBackRefs"))
                        {
                            chvo = ApplyFilterToSequence(ref rghvo);
                        }
                    }
                    else
                    {
                        chvo = ApplyFilterToSequence(ref rghvo);
                    }
                }
                else
                {
                    chvo = ApplyFilterToSequence(ref rghvo);
                }
            }

            // Check whether the user wants the grammatical information to appear only once, preceding any
            // sense numbers, if there is only one set of grammatical information, and all senses refer to
            // it.  See LT-9663.
            var childFrag            = m_frag;
            var fSingleGramInfoFirst = false;

            if (m_flid == LexEntryTags.kflidSenses)
            {
                fSingleGramInfoFirst = XmlUtils.GetOptionalBooleanAttributeValue(listDelimitNode, "singlegraminfofirst", false);
            }

            // This groups senses by placing graminfo before the number, and omitting it if the same as the
            // previous sense in the entry.  This isn't yet supported by the UI, but may well be requested in
            // the future.  (See LT-9663.)
            //bool fGramInfoBeforeNumber = XmlUtils.GetOptionalBooleanAttributeValue(listDelimitNode, "graminfobeforenumber", false);

            // Setup text properties for any numbering
            int          wsEng        = m_cache.WritingSystemFactory.GetWsFromStr(strEng);
            ITsTextProps ttpNum       = null;
            var          fDelayNumber = false;

            if (fNumber)
            {
                ttpNum       = SetNumberTextProperties(wsEng, listDelimitNode);
                fDelayNumber = XmlUtils.GetOptionalBooleanAttributeValue(specialAttrsNode, "numdelay", false);
            }

            // A vector may be conditionally configured to display its objects as separate paragraphs
            // in dictionary (document) configuration.  See LT-9667.
            var fShowAsParagraphsInInnerPile = XmlUtils.GetOptionalBooleanAttributeValue(listDelimitNode,
                                                                                         "showasindentedpara", false);
            // We have (this is probably bad) two ways to do this. The better one is setting the flowType to divInPara.
            // When we do this for a vector, and configure properties that require us to insert numbering and so forth,
            // we currently force a paragraph for each item. It's too hard otherwise to get the numbers etc. into the paragraph.
            // This means that the X_AsPara layout which the configure dialog causes to be invoked when setting up sense-as-para
            // has to be configured NOT to make a paragraph. It also means we can't readily configure a view that has more than one
            // paragraph, except when doing another layer of inserting paragraphs into what is usually a single one. I don't like
            // this much but it does what we need for now and making it better looks very messy.
            var       fShowAsParagraphsInDivInPara = XmlUtils.GetOptionalAttributeValue(listDelimitNode, "flowType", null) == "divInPara";
            ITsString tssBefore  = null;
            string    sParaStyle = null;

            if (fShowAsParagraphsInInnerPile && chvo > 0)
            {
                sParaStyle = XmlUtils.GetOptionalAttributeValue(listDelimitNode, "style");
                tssBefore  = SetBeforeString(specialAttrsNode, listDelimitNode);
                // We need a line break here to force the inner pile of paragraphs to begin at
                // the margin, rather than somewhere in the middle of the line.
                m_vwEnv.AddString(m_cache.TsStrFactory.MakeString(StringUtils.kChHardLB.ToString(),
                                                                  m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle));
                m_vwEnv.OpenInnerPile();
            }
            else if (fShowAsParagraphsInDivInPara)
            {
                sParaStyle = XmlUtils.GetOptionalAttributeValue(listDelimitNode, "parastyle", "");
            }

            // Setup and run actual internal vector loop
            var tsf            = m_cache.TsStrFactory;
            var xattrSeparator = listDelimitNode.Attributes["sep"];
            var fFirst         = true;     // May actually mean first non-empty.

            for (var ihvo = 0; ihvo < chvo; ++ihvo)
            {
                if (IsExcluded(exclude, ihvo, rghvo))
                {
                    continue;
                }

                if (fCheckForEmptyItems && IsItemEmpty(rghvo[ihvo], childFrag))
                {
                    continue;
                }

                if (fShowAsParagraphsInInnerPile || fShowAsParagraphsInDivInPara)
                {
                    SetupParagraph(sParaStyle, (fFirst ? tssBefore : null), listDelimitNode);
                }

                // This needs to happen AFTER we wet up the paragraph that we want it to be part of
                // and any 'before' stuff that goes ahead of the whole sequence, but BEFORE we add any other stuff to the para.
                if (fFirst && fNumber && fSingleGramInfoFirst)
                {
                    var fAllMsaSame = SetAllMsaSameFlag(chvo, rghvo);
                    if (fAllMsaSame)
                    {
                        DisplayFirstChildPOS(rghvo[0], childFrag);
                    }

                    // Exactly if we put out the grammatical info at the start, we need to NOT put it out
                    // as part of each item. Note that we must not set this flag before we put out the one-and-only
                    // gram info, or that will be suppressed too!
                    m_viewConstructor.ShouldIgnoreGramInfo = fAllMsaSame;
                }

                if (!fShowAsParagraphsInInnerPile && !fShowAsParagraphsInDivInPara)
                {
                    AddSeparatorIfNeeded(fFirst, xattrSeparator, listDelimitNode, wsEng);
                }

                // add the numbering if needed.
                if (fNumber)
                {
                    var sTag = CalculateAndFormatSenseLabel(rghvo, ihvo, xaNum);

                    ITsStrBldr tsb = tsf.GetBldr();
                    tsb.Replace(0, 0, sTag, ttpNum);
                    ITsString tss = tsb.GetString();
                    m_numberPartRef = listDelimitNode;
                    AddNumberingNowOrDelayed(fDelayNumber, tss, out tssDelayedNumber);
                }

                // add the object.
                Debug.Assert(ihvo < rghvo.Length);
                m_vwEnv.AddObj(rghvo[ihvo], m_viewConstructor, childFrag);

                // Close Paragraph if displaying paragraphs
                if (fShowAsParagraphsInInnerPile || fShowAsParagraphsInDivInPara)
                {
                    m_vwEnv.CloseParagraph();
                }

                fFirst = false;
                if (fFirstOnly)
                {
                    break;
                }
            }             // end of sequence 'for' loop

            // Close Inner Pile if displaying paragraphs
            if (fShowAsParagraphsInInnerPile && chvo > 0)
            {
                m_vwEnv.CloseInnerPile();
            }

            // Reset the flag for ignoring grammatical information after the first if it was set
            // earlier in this method.
            if (fSingleGramInfoFirst)
            {
                m_viewConstructor.ShouldIgnoreGramInfo = false;
            }

            // Reset the flag for delaying displaying a number.
            if (m_viewConstructor.DelayNumFlag && m_hvo == m_hvoDelayedNumber)
            {
                m_viewConstructor.DelayNumFlag = false;
                tssDelayedNumber = null;
            }

            // end of Display method
        }