Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Displays the specified vwenv.
        /// </summary>
        /// <param name="vwenv">The vwenv.</param>
        /// <param name="hvo">The hvo.</param>
        /// <param name="frag">The frag.</param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            CheckDisposed();

            switch (frag)
            {
            case kfragLazyScripture:
            {
                // The configure method insists on trying to make an initial selection.
                // If there isn't something selectable there, it expands everything.
                vwenv.AddStringProp((int)Scripture.ScriptureTags.kflidChapterVerseSepr, this);
                vwenv.AddLazyVecItems((int)Scripture.ScriptureTags.kflidScriptureBooks, this,
                                      kfragLazyBook);
                break;
            }

            case kfragLazyBook:
            {
                vwenv.AddLazyVecItems((int)ScrBook.ScrBookTags.kflidSections, this,
                                      kfragDummySection);
                break;
            }

            case kfragDummySection:
            {
                vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidHeading, this,
                                 kfragDummyStText);
                vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidContent, this,
                                 kfragDummyStText);
                break;
            }

            case kfragDummyStText:
            {
                vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
                                     m_fParaWithContent ? kfragDummyParaWithContent : kfragDummyPara);
                break;
            }

            case kfragDummyPara:
            {
                // Display each dummy paragraph as a rectangle an inch high, which allows us
                // to accurately predict the height of a known number of them.
                vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch, MiscUtils.kdzmpInch, 0);
                break;
            }

            case kfragDummyParaWithContent:
            {
                vwenv.OpenMappedTaggedPara();
                vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
                vwenv.CloseParagraph();
                break;
            }
            }
        }
Пример #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Adds the current paragraph's contents (either once or thrice, depending on display
 /// flags) and then close the paragraph if necessary.
 /// </summary>
 /// <param name="vwenv">The view environment</param>
 /// ------------------------------------------------------------------------------------
 private void AddParagraphContents(IVwEnv vwenv)
 {
     vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
     if ((m_displayType & DisplayType.kOnlyDisplayContentsOnce) != DisplayType.kOnlyDisplayContentsOnce)
     {
         vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
         vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
     }
     if ((m_displayType & DisplayType.kMappedPara) == DisplayType.kMappedPara)
     {
         vwenv.CloseParagraph();
     }
 }
        /// <summary>
        /// This is the basic method needed for the view constructor.
        /// </summary>
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case VectorReferenceView.kfragTargetVector:
                if (!string.IsNullOrEmpty(TextStyle))
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
                }
                vwenv.OpenParagraph();
                vwenv.AddObjVec(m_flid, this, frag);
                vwenv.CloseParagraph();
                break;

            case VectorReferenceView.kfragTargetObj:
                // Display one object by displaying the fake string property of that object which our special
                // private decorator stores for it.
                vwenv.AddStringProp(PossibilityVectorReferenceView.kflidFake, this);
                break;

            default:
                throw new ArgumentException(
                          "Don't know what to do with the given frag.", "frag");
            }
        }
Пример #4
0
 public override void Display(IVwEnv vwenv, int hvo, int frag)
 {
     CheckDisposed();
     if (m_wsDefault == -1)
     {
         // Set the underlying paragraph to RTL if the first writing system in the
         // string is RTL.
         if (m_cache != null)
         {
             ITsString    tss = m_cache.MainCacheAccessor.get_StringProp(hvo, m_flid);
             ITsTextProps ttp = tss.get_Properties(0);
             int          var;
             int          ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var);
             if (ws != 0)
             {
                 SetParaRTLIfNeeded(vwenv, ws);
             }
         }
         vwenv.AddStringProp(m_flid, this);
     }
     else
     {
         SetParaRTLIfNeeded(vwenv, m_wsDefault);
         vwenv.AddStringAltMember(m_flid, m_wsDefault, this);
     }
 }
Пример #5
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				default:
					break;
				case HelloViewView.kfrText:
					vwenv.AddStringProp(HelloViewView.ktagProp, this);
					break;
			}
		}
Пример #6
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				default:
					break;
				case InterlinearView.kfrText:
					vwenv.OpenParagraph();
					vwenv.AddObjVecItems(InterlinearView.ktagText_Words, this, InterlinearView.kfrWord);
					vwenv.CloseParagraph();
					break;
				case InterlinearView.kfrWord:
					vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
												(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenInnerPile();
					vwenv.AddStringProp(InterlinearView.ktagWord_Form, this);
					vwenv.AddStringProp(InterlinearView.ktagWord_Type, this);
					vwenv.CloseInnerPile();
					break;
			}
		}
Пример #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Display the footnote marker
        /// </summary>
        /// <param name="vwenv">View environment</param>
        /// <param name="footnote">The footnote.</param>
        /// ------------------------------------------------------------------------------------
        protected virtual void DisplayFootnoteMarker(IVwEnv vwenv, IStFootnote footnote)
        {
            // The footnote marker is not editable.
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
            vwenv.AddStringProp(StFootnoteTags.kflidFootnoteMarker, null);

            // add a read-only space after the footnote marker
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
            vwenv.AddString(OneSpaceString);
        }
Пример #8
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            default:
                break;

            case HelloViewView.kfrText:
                vwenv.AddStringProp(HelloViewView.ktagProp, this);
                break;
            }
        }
Пример #9
0
        /// <summary>
        /// All our display method does is to display the name of each item in the fake virtual property.
        /// If it is the active object we are editing, at the relevant position in the relevant owner,
        /// we display the name using the special marker property.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            int hvoParent, tag, ihvo;

            switch (frag)
            {
            case kfragName:
                vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoParent, out tag, out ihvo);
                if (m_fGotFocus && hvo == m_hvoTa && hvoParent == m_hvoParent && ihvo == m_ihvoTa)
                {
                    vwenv.AddStringProp(m_taTagName, this);
                }
                else
                {
                    vwenv.AddStringProp(m_snTagName, this);
                }
                break;

            default:
                throw new Exception("Unexpected fragment ID in TypeAheadSupportVc");
            }
        }
Пример #10
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            default:
                break;

            case InterlinearView.kfrText:
                vwenv.OpenParagraph();
                vwenv.AddObjVecItems(InterlinearView.ktagText_Words, this, InterlinearView.kfrWord);
                vwenv.CloseParagraph();
                break;

            case InterlinearView.kfrWord:
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
                                      (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 10000);
                vwenv.OpenInnerPile();
                vwenv.AddStringProp(InterlinearView.ktagWord_Form, this);
                vwenv.AddStringProp(InterlinearView.ktagWord_Type, this);
                vwenv.CloseInnerPile();
                break;
            }
        }
Пример #11
0
 public override void Display(IVwEnv vwenv, int hvo, int frag)
 {
     // Enhance JohnT: change background if this is the selected slice.
     vwenv.OpenParagraph();
     if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
     {
         vwenv.AddString(m_info.ContentString);
     }
     else
     {
         Debug.Assert(hvo == m_info.Hvo);
         vwenv.AddStringProp(m_info.ContentStringFlid, this);
     }
     vwenv.CloseParagraph();
 }
Пример #12
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Add a column to the header/footer
 /// </summary>
 /// <param name="vwenv"></param>
 /// <param name="align"></param>
 /// <param name="flid"></param>
 /// ------------------------------------------------------------------------------------
 private void AddColumn(IVwEnv vwenv, FwTextAlign align, PubHeader.PubHeaderTags flid)
 {
     vwenv.OpenTableCell(1, 1);
     if (HeaderFooterParaStyle != null && HeaderFooterParaStyle != string.Empty)
     {
         vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
                                  HeaderFooterParaStyle);
     }
     vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                           (int)FwTextPropVar.ktpvEnum, (int)align);
     vwenv.OpenMappedPara();
     vwenv.AddStringProp((int)flid, this);
     vwenv.CloseParagraph();
     vwenv.CloseTableCell();
 }
Пример #13
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Display the footnote marker
        /// </summary>
        /// <param name="vwenv">View environment</param>
        /// ------------------------------------------------------------------------------------
        private void DisplayFootnoteMarker(IVwEnv vwenv)
        {
            // The footnote marker is not editable.
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum,
                                  (int)TptEditable.ktptNotEditable);
            vwenv.AddStringProp((int)StFootnote.StFootnoteTags.kflidFootnoteMarker, null);

            // add a read-only space after the footnote marker
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum,
                                  (int)TptEditable.ktptNotEditable);
            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.Append(" ");
            vwenv.AddString(strBldr.GetString());
        }
Пример #14
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </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 1:                     //The root is an StText, display paragraphs not lazily.
                vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this, 2);
                break;

            case 2:                     // StTxtPara, display contents
                vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
                break;

            default:
                throw new ApplicationException("Unexpected frag in SimpleViewVc");
            }
        }
Пример #15
0
 public override void Display(IVwEnv vwenv, int hvo, int frag)
 {
     // Enhance JohnT: make the alignment position a function of window width.
     // Enhance JohnT: change background if this is the selected context line.
     vwenv.OpenConcPara(m_info.ContextStringStartOffset,
                        m_info.ContextStringStartOffset + m_info.ContextStringLength,
                        VwConcParaOpts.kcpoDefault,
                        72 * 2 * 1000);      // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
     if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
     {
         vwenv.AddString(m_info.ContentString);
     }
     else
     {
         Debug.Assert(hvo == m_info.Hvo);
         vwenv.AddStringProp(m_info.ContentStringFlid, this);
     }
     vwenv.CloseParagraph();
 }
Пример #16
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case AtomicReferenceView.kFragAtomicRef:
                // Display a paragraph with a single item.
                vwenv.OpenParagraph();                                  // vwenv.OpenMappedPara();
                if (!string.IsNullOrEmpty(TextStyle))
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
                }
                vwenv.AddStringProp(PossibilityAtomicReferenceView.kflidFake, this);
                vwenv.CloseParagraph();
                break;

            default:
                throw new ArgumentException(
                          "Don't know what to do with the given frag.", "frag");
            }
        }
Пример #17
0
        /// <summary></summary>
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case (int)SampleFrags.kfrText:
                if (m_fontName != null && m_fontName.Length > 0)
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily, m_fontName);
                }
                // Force to 12 point.
                vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
                                      (int)FwTextPropVar.ktpvMilliPoint, 12000);
                vwenv.OpenDiv();
                vwenv.AddLazyVecItems((int)SampleTags.ktagTextParas, this, (int)SampleFrags.kfrPara);
                vwenv.CloseDiv();
                break;

            case (int)SampleFrags.kfrPara:
                vwenv.AddStringProp((int)SampleTags.ktagParaContents, this);
                break;
            }
        }
Пример #18
0
            public override void Display(IVwEnv vwenv, int hvo, int frag)
            {
                CheckDisposed();
                switch (frag)
                {
                case PhoneEnvReferenceView.kFragEnvironmentObj:
                    vwenv.AddStringProp(PhoneEnvReferenceView.kEnvStringRep, this);
                    break;

                case PhoneEnvReferenceView.kFragEnvironments:
                    vwenv.OpenParagraph();
                    vwenv.AddObjVec(PhoneEnvReferenceView.kMainObjEnvironments, this, frag);
                    vwenv.CloseParagraph();
                    break;

                //case PhoneEnvReferenceView.kFragAnnotation:
                //	break;
                default:
                    throw new ArgumentException(
                              "Don't know what to do with the given frag.", "frag");
                }
            }
Пример #19
0
 public override void Display(IVwEnv vwenv, int hvo, int frag)
 {
     if (m_fMultilingual)
     {
         SetParaRtlIfNeeded(vwenv, m_wsDefault);
         vwenv.AddStringAltMember(m_flid, m_wsDefault, this);
     }
     else
     {
         // Set the underlying paragraph to RTL if the first writing system in the
         // string is RTL.
         if (m_cache != null)
         {
             ITsString    tss = m_cache.DomainDataByFlid.get_StringProp(hvo, m_flid);
             ITsTextProps ttp = tss.get_Properties(0);
             int          var;
             int          ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var);
             if (ws == 0)
             {
                 ws = m_wsDefault;
             }
             if (ws == 0)
             {
                 ws = m_cache.DefaultAnalWs;
             }
             if (ws != 0)
             {
                 SetParaRtlIfNeeded(vwenv, ws);
                 if (m_fShowWsLabel)
                 {
                     DisplayWithWritingSystemLabel(vwenv, ws);
                     return;
                 }
             }
         }
         vwenv.AddStringProp(m_flid, this);
     }
 }
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case kfragRoot:
                // draw a paragraph box but don't add a picture
                using (new VwConstructorServices.ParagraphBoxHelper(vwenv,
                                                                    null))
                {
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
                                          (int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptOffset,
                                          (int)FwTextPropVar.ktpvMilliPoint, -2500);
                    vwenv.AddPicture(m_picture.Picture, ktagPicture, 0, 0);

                    AddParagraphBoxContents(vwenv,
                                            () => vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                                                        (int)FwTextPropVar.ktpvEnum,
                                                                        (int)TptEditable.ktptIsEditable),
                                            () => vwenv.AddStringProp(SimpleRootSiteDataProviderView.kflidSimpleTsString, null));
                }
                break;
            }
        }
Пример #21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays the specified vwenv.
		/// </summary>
		/// <param name="vwenv">The vwenv.</param>
		/// <param name="hvo">The hvo.</param>
		/// <param name="frag">The frag.</param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragScrFootnotes:
					{
						vwenv.AddObjVecItems(ScriptureTags.kflidScriptureBooks, this,
							kfragBookFootnotes);
						break;
					}
				case kfragBookFootnotes:
					{
						vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this,
							kfragFootnote);
						break;
					}
				case kfragFootnote:
					{

						// Display each dummy footnote as a rectangle a half inch high, which allows us
						// to accurately predict the height of a known number of them. Also put in a very
						// short editable string, which we use for some other tests, but should not
						// affect the paragraph height.
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
							(int)FwTextPropVar.ktpvMilliPoint, MiscUtils.kdzmpInch / 10);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint, MiscUtils.kdzmpInch / 5);
						vwenv.OpenParagraph();
						if (m_fWantStrings)
							vwenv.AddStringProp(StFootnoteTags.kflidFootnoteMarker, this);
						vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch / 2, MiscUtils.kdzmpInch / 2, 0);
						vwenv.CloseParagraph();
						break;
					}
			}
		}
Пример #22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// The main method just displays the text with the appropriate properties.
		/// </summary>
		/// <param name="vwenv">The view environment</param>
		/// <param name="hvo">The HVo of the object to display</param>
		/// <param name="frag">The fragment to lay out</param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch (frag)
			{
				case InnerFwListBox.kfragRoot:
					Font f = m_listbox.Font;
					if (m_listbox.StyleSheet == null)
					{
						// Try to get items a reasonable size based on whatever font has been set for the
						// combo as a whole. We don't want to do this if a stylesheet has been set, because
						// it will override the sizes specified in the stylesheet.
						// Enhance JohnT: there are several more properties we could readily copy over
						// from the font, but this is a good start.
						vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
							(int)FwTextPropVar.ktpvMilliPoint, (int)(f.SizeInPoints * 1000));
					}
					// Setting the font family here appears to override the fonts associated with the
					// TsString data.  This causes trouble for non-Microsoft Sans Serif writing systems.
					// See LT-551 for the bug report that revealed this problem.
					//				vwenv.set_StringProperty((int) FwTextPropType.ktptFontFamily,
					//					f.FontFamily.Name);
					vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
						(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(m_listbox.ForeColor));
					DisplayList(vwenv);
					break;
				case InnerFwListBox.kfragItems:
					int index, hvoDummy, tagDummy;
					int clev = vwenv.EmbeddingLevel;
					vwenv.GetOuterObject(clev - 1, out hvoDummy, out tagDummy, out index);
					bool fHighlighted = m_listbox.Owner.IsHighlighted(index);
					if (fHighlighted && m_listbox.ShowHighlight)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
							(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.HighlightText)));
						vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
							(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.Highlight)));
					}
					vwenv.OpenParagraph();
					if (fHighlighted && m_listbox.ShowHighlight)
					{
						// Insert a string that has the foreground color not set, so the foreground color set above can take effect.
						ITsStrBldr bldr = vwenv.DataAccess.get_StringProp(hvo, InnerFwListBox.ktagText).GetBldr();
						bldr.SetIntPropValues(0, bldr.Length, (int) FwTextPropType.ktptForeColor, -1, -1);
						vwenv.AddString(bldr.GetString());
					}
					else
					{
						vwenv.AddStringProp(InnerFwListBox.ktagText, this);
					}
					vwenv.AddString(m_tssBlanks);
					vwenv.CloseParagraph();
					break;
			}
		}
Пример #23
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				if (m_fMultilingual)
				{
					SetParaRtlIfNeeded(vwenv, m_wsDefault);
					vwenv.AddStringAltMember(m_flid, m_wsDefault, this);
				}
				else
				{
					// Set the underlying paragraph to RTL if the first writing system in the
					// string is RTL.
					if (m_cache != null)
					{
						ITsString tss = m_cache.DomainDataByFlid.get_StringProp(hvo, m_flid);
						ITsTextProps ttp = tss.get_Properties(0);
						int var;
						int ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var);
						if (ws == 0)
							ws = m_wsDefault;
						if (ws == 0)
							ws = m_cache.DefaultAnalWs;
						if (ws != 0)
						{
							SetParaRtlIfNeeded(vwenv, ws);
							if (m_fShowWsLabel)
							{
								DisplayWithWritingSystemLabel(vwenv, ws);
								return;
							}
						}
					}
					vwenv.AddStringProp(m_flid, this);
				}
			}
Пример #24
0
            private void DisplayWithWritingSystemLabel(IVwEnv vwenv, int ws)
            {
                ITsString tssLabel = NameOfWs(ws);
                // 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;

                int dxs;                        // Width of displayed string.
                int dys;                        // Height of displayed string (not used here).

                vwenv.get_StringWidth(tssLabel, null, out dxs, out dys);
                VwLength vlColWs;                 // 5-pt space plus max label width.

                vlColWs.nVal = dxs + 5000;
                vlColWs.unit = VwUnit.kunPoint1000;

                // The Main column is relative and uses the rest of the space.
                VwLength vlColMain;

                vlColMain.nVal = 1;
                vlColMain.unit = VwUnit.kunRelative;

                // Enhance JohnT: possibly allow for right-to-left UI by reversing columns?

                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();
                vwenv.OpenTableRow();

                // First cell has writing system abbreviation displayed using m_ttpLabel.
                //vwenv.Props = m_ttpLabel;
                vwenv.OpenTableCell(1, 1);
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                vwenv.AddString(tssLabel);
                vwenv.CloseTableCell();

                // Second cell has the string contents for the alternative.
                // DN version has some property setting, including trailing margin and RTL.
                if (m_fRtlScript)
                {
                    vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
                                          (int)FwTextPropVar.ktpvEnum,
                                          (int)FwTextToggleVal.kttvForceOn);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                                          (int)FwTextPropVar.ktpvEnum,
                                          (int)FwTextAlign.ktalTrailing);
                }
                //if (!m_editable)
                //{
                //    vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
                //        (int)TptEditable.ktptNotEditable);
                //}

                vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddStringProp(m_flid, this);
                vwenv.CloseTableCell();
                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();
            }
Пример #25
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();
				// Enhance JohnT: change background if this is the selected slice.
				vwenv.OpenParagraph();
				if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
				{
					vwenv.AddString(m_info.ContentString);
				}
				else
				{
					Debug.Assert(hvo == m_info.Hvo);
					vwenv.AddStringProp(m_info.ContentStringFlid, this);
				}
				vwenv.CloseParagraph();
			}
Пример #26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			if ((m_displayType & DisplayType.kLiteralStringLabels) != 0)
			{
				ITsStrFactory factory = TsStrFactoryClass.Create();
				vwenv.AddString(factory.MakeString("Label" + m_counter++, m_wsDefault));
			}
			switch(frag)
			{
				case 1: // the root; display the subitems, first using non-lazy view, then lazy one.
					if ((m_displayType & DisplayType.kFootnoteDetailsSeparateParas) == DisplayType.kFootnoteDetailsSeparateParas)
						vwenv.AddObjVecItems(m_flid, this, 10);
					if ((m_displayType & DisplayType.kFootnoteDetailsSinglePara) == DisplayType.kFootnoteDetailsSinglePara)
						vwenv.AddObjVecItems(m_flid, this, 11);
					else
					{
						if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
						{
							vwenv.AddObjVecItems(m_flid, this, 3);
						}
						if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
						{
							vwenv.AddObjVecItems(m_flid, this, 2);
						}
					}
					if ((m_displayType & DisplayType.kTitle) == DisplayType.kTitle)
						vwenv.AddObjProp(SimpleRootsiteTestsConstants.kflidDocTitle, this, 3);
					if (m_displayType == DisplayType.kOuterObjDetails)
						vwenv.AddObjVecItems(m_flid, this, 6);
					break;
				case 2: // An StText, display paragraphs lazily
					if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
						vwenv.AddLazyVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 4);
					vwenv.AddLazyVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
					break;
				case 3: // An StText, display paragraphs not lazily.
					if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
						vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 4);
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
					if ((m_displayType & DisplayType.kDuplicateParagraphs) != 0)
						vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
					break;
				case 4: // StTxtPara, display contents with top margin
					OpenParaIfNeeded(vwenv, hvo);
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
						(int)FwTextPropVar.ktpvMilliPoint, kMarginTop);
					AddParagraphContents(vwenv);
					break;
				case 5: // StTxtPara, display contents without top margin
					OpenParaIfNeeded(vwenv, hvo);
					AddParagraphContents(vwenv);
					break;
				case 6: // StTxtPara, display details of our outer object
					int hvoOuter, tag, ihvo;
					vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoOuter, out tag, out ihvo);
					ITsString tss = TsStringHelper.MakeTSS("Hvo = " + hvoOuter + "; Tag = " + tag + "; Ihvo = " + ihvo,
						m_wsDefault);
					vwenv.AddString(tss);
					break;
				case SimpleRootsiteTestsConstants.kflidDocDivisions:
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidDocDivisions, this,
						SimpleRootsiteTestsConstants.kflidSectionStuff);
					break;
				case SimpleRootsiteTestsConstants.kflidSectionStuff:
					if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
						vwenv.AddObjProp(frag, this, 3);
					if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
						vwenv.AddObjProp(frag, this, 2);
					break;
				case 7: // ScrBook
					vwenv.OpenDiv();
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidDocFootnotes, this, 8);
					vwenv.CloseDiv();
					break;
				case 8: // StFootnote
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this,
						9);
					break;
				case 9: // StTxtPara
					vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
					break;
				case 10:
					// Display a Footnote by displaying its "FootnoteMarker" in a paragraph
					// by itself, followed by the sequence of paragraphs.
					vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidFootnoteMarker, null);
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this,
						9);
					break;
				case 11:
					// Display a Footnote by displaying its "FootnoteMarker" followed by the
					// contents of its first paragraph (similar to the way footnotes are displayed in
					// real life.
					vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 12);
					break;
				case 12: // Footnote paragraph with marker
					vwenv.OpenMappedTaggedPara();
					// The footnote marker is not editable.
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidFootnoteMarker, null);

					// add a read-only space after the footnote marker
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();
					strBldr.Append(" ");
					vwenv.AddString(strBldr.GetString());
					vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
					vwenv.CloseParagraph();
					break;
				default:
					throw new ApplicationException("Unexpected frag in DummyBasicViewVc");
			}
		}
        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;
            }
        }
Пример #28
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				// The property is absolutely arbitrary because the ghost DA ignores it.
				vwenv.AddStringProp(GhostStringSlice.kflidFake, this);
			}
Пример #29
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </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 1: //The root is an StText, display paragraphs not lazily.
					vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this, 2);
					break;
				case 2: // StTxtPara, display contents
					vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
					break;
				default:
					throw new ApplicationException("Unexpected frag in SimpleViewVc");
			}
		}
Пример #30
0
		/// <summary></summary>
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch(frag)
			{
			case (int)SampleFrags.kfrText:
				if (m_fontName != null && m_fontName.Length > 0)
					vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily, m_fontName);
				// Force to 12 point.
				vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
					(int)FwTextPropVar.ktpvMilliPoint, 12000);
				vwenv.OpenDiv();
				vwenv.AddLazyVecItems((int)SampleTags.ktagTextParas, this, (int)SampleFrags.kfrPara);
				vwenv.CloseDiv();
				break;
			case (int)SampleFrags.kfrPara:
				vwenv.AddStringProp((int)SampleTags.ktagParaContents, this);
				break;
			}
		}
Пример #31
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRoot:
					// draw a paragraph box but don't add a picture
					using (new VwConstructorServices.ParagraphBoxHelper(vwenv,
							null))
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
						(int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin);
						vwenv.set_IntProperty((int)FwTextPropType.ktptOffset,
							(int)FwTextPropVar.ktpvMilliPoint, -2500);
						vwenv.AddPicture(m_picture.Picture, ktagPicture, 0, 0);

						AddParagraphBoxContents(vwenv,
							() => vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
																				   (int)FwTextPropVar.ktpvEnum,
																				   (int)TptEditable.ktptIsEditable),
							() => vwenv.AddStringProp(SimpleRootSiteDataProviderView.kflidSimpleTsString, null));
					}
					break;
			}
		}
Пример #32
0
		/// <summary>
		/// This is the basic method needed for the view constructor.
		/// </summary>
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case VectorReferenceView.kfragTargetVector:
					// Check for an empty vector.
					if (hvo == 0 || m_cache.DomainDataByFlid.get_VecSize(hvo, m_flid) == 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
							(int)FwTextPropVar.ktpvDefault,
							(int)ColorUtil.ConvertColorToBGR(Color.Gray));
						vwenv.set_IntProperty((int)FwTextPropType.ktptLeadingIndent,
							(int)FwTextPropVar.ktpvMilliPoint, 18000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvDefault,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
							(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
						//vwenv.AddString(m_cache.MakeUserTss("Click to select -->"));
						if (hvo != 0)
							vwenv.NoteDependency(new[] { hvo }, new[] { m_flid }, 1);
					}
					else
					{
						if (!string.IsNullOrEmpty(TextStyle))
						{
							vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
						}
						vwenv.OpenParagraph();
						vwenv.AddObjVec(m_flid, this, frag);
						vwenv.CloseParagraph();
					}
					break;
				case VectorReferenceView.kfragTargetObj:
					// Display one object from the vector.
					{
						ILgWritingSystemFactory wsf =
							m_cache.WritingSystemFactory;

						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvDefault,
							(int)TptEditable.ktptNotEditable);
						ITsString tss;
						ITsStrFactory tsf = m_cache.TsStrFactory;
						Debug.Assert(hvo != 0);
#if USEBESTWS
					if (m_displayWs != null && m_displayWs.StartsWith("best"))
					{
						// The flid can be a variety of types, so deal with those.
						Debug.WriteLine("Using 'best ws': " + m_displayWs);
						int magicWsId = LgWritingSystem.GetMagicWsIdFromName(m_displayWs);
						int actualWS = m_cache.LanguageProject.ActualWs(magicWsId, hvo, m_flid);
						Debug.WriteLine("Actual ws: " + actualWS.ToString());
					}
					else
					{
#endif
						// Use reflection to get a prebuilt name if we can.  Otherwise
						// settle for piecing together a string.
						Debug.Assert(m_cache != null);
						var obj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						Debug.Assert(obj != null);
						Type type = obj.GetType();
						System.Reflection.PropertyInfo pi = type.GetProperty("TsName",
							System.Reflection.BindingFlags.Instance |
							System.Reflection.BindingFlags.Public |
							System.Reflection.BindingFlags.FlattenHierarchy);
						if (pi != null)
						{
							tss = (ITsString)pi.GetValue(obj, null);
						}
						else
						{
							if (!string.IsNullOrEmpty(m_displayNameProperty))
							{
								pi = type.GetProperty(m_displayNameProperty,
									System.Reflection.BindingFlags.Instance |
									System.Reflection.BindingFlags.Public |
									System.Reflection.BindingFlags.FlattenHierarchy);
							}
							int ws = wsf.GetWsFromStr(obj.SortKeyWs);
							if (ws == 0)
								ws = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle;
							if (pi != null)
							{
								object s = pi.GetValue(obj, null);
								if (s is ITsString)
									tss = (ITsString)s;
								else
									tss = tsf.MakeString((string)s, ws);
							}
							else
							{
								// ShortNameTss sometimes gets PropChanged, so worth letting the view know that's
								// what we're inserting.
								var flid = Cache.MetaDataCacheAccessor.GetFieldId2(obj.ClassID, "ShortNameTSS", true);
								vwenv.AddStringProp(flid, this);
								break;
							}
#if USEBESTWS
						}
#endif
						}
						if (!string.IsNullOrEmpty(TextStyle))
						{
							vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
						}
						vwenv.AddString(tss);
					}
					break;
				default:
					throw new ArgumentException(
						"Don't know what to do with the given frag.", "frag");
			}
		}
Пример #33
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
			default:
				break;
			case kfrBook:
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize, (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 24000);
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
					(int)FwKernelLib.FwTextToggleVal.kttvOn);
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptAlign, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
					(int)FwKernelLib.FwTextAlign.ktalCenter);

				vwenv.AddStringProp(ktagBookName, this);
				vwenv.AddLazyVecItems(ktagBookSections, this, kfrSection);
				break;
			case kfrSection:
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptItalic, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
					(int)FwKernelLib.FwTextToggleVal.kttvOn);
				vwenv.OpenParagraph();
				vwenv.AddStringProp(ktagSectionTitle, this);
				vwenv.AddString(m_tssLeftParen);
				vwenv.AddStringProp(ktagSectionRefs, this);
				vwenv.AddString(m_tssRightParen);
				vwenv.CloseParagraph();
				vwenv.AddLazyVecItems(ktagSectionParas, this, kfrDoublePara);
				break;
			case kfrDoublePara:
				AddDoublePara(vwenv, hvo);
				// Now insert an interlinear version of the paragraph. This is basically editable.
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBackColor,
					(int)FwKernelLib.FwTextPropVar.ktpvDefault, m_colorEditable);
				vwenv.OpenParagraph();
				vwenv.AddObjVecItems(ktagParaBundles, this, kfrBundle);
				vwenv.CloseParagraph();
				break;
			case kfrBundle:
				// Put a little space after each bundle to separate them.
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
					(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 5000);
				vwenv.OpenInnerPile();
				vwenv.AddStringProp(ktagBundleBase, this);

				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold,
					(int)FwKernelLib.FwTextPropVar.ktpvEnum,
					(int)FwKernelLib.FwTextToggleVal.kttvOn);
				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
					(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 13000);
				vwenv.AddStringProp(ktagBundleIdiom, this);

				vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
					(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 8000);
				vwenv.AddStringProp(ktagBundleLing, this);
				vwenv.CloseInnerPile();

				break;
			}
		}
Пример #34
0
            public override void Display(IVwEnv vwenv, int hvo, int frag)
            {
                CheckDisposed();

                vwenv.AddStringProp(Flid, this);
            }
Пример #35
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            default:
                break;

            case kfrBook:
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize, (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 24000);
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
                                      (int)FwKernelLib.FwTextToggleVal.kttvOn);
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptAlign, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
                                      (int)FwKernelLib.FwTextAlign.ktalCenter);

                vwenv.AddStringProp(ktagBookName, this);
                vwenv.AddLazyVecItems(ktagBookSections, this, kfrSection);
                break;

            case kfrSection:
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptItalic, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
                                      (int)FwKernelLib.FwTextToggleVal.kttvOn);
                vwenv.OpenParagraph();
                vwenv.AddStringProp(ktagSectionTitle, this);
                vwenv.AddString(m_tssLeftParen);
                vwenv.AddStringProp(ktagSectionRefs, this);
                vwenv.AddString(m_tssRightParen);
                vwenv.CloseParagraph();
                vwenv.AddLazyVecItems(ktagSectionParas, this, kfrDoublePara);
                break;

            case kfrDoublePara:
                AddDoublePara(vwenv, hvo);
                // Now insert an interlinear version of the paragraph. This is basically editable.
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBackColor,
                                      (int)FwKernelLib.FwTextPropVar.ktpvDefault, m_colorEditable);
                vwenv.OpenParagraph();
                vwenv.AddObjVecItems(ktagParaBundles, this, kfrBundle);
                vwenv.CloseParagraph();
                break;

            case kfrBundle:
                // Put a little space after each bundle to separate them.
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
                                      (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 5000);
                vwenv.OpenInnerPile();
                vwenv.AddStringProp(ktagBundleBase, this);

                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold,
                                      (int)FwKernelLib.FwTextPropVar.ktpvEnum,
                                      (int)FwKernelLib.FwTextToggleVal.kttvOn);
                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
                                      (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 13000);
                vwenv.AddStringProp(ktagBundleIdiom, this);

                vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
                                      (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 8000);
                vwenv.AddStringProp(ktagBundleLing, this);
                vwenv.CloseInnerPile();

                break;
            }
        }
Пример #36
0
		/// <summary>
		/// All our display method does is to display the name of each item in the fake virtual property.
		/// If it is the active object we are editing, at the relevant position in the relevant owner,
		/// we display the name using the special marker property.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			int hvoParent, tag, ihvo;
			switch(frag)
			{
			case kfragName:
				vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoParent, out tag, out ihvo);
				if (m_fGotFocus && hvo == m_hvoTa && hvoParent == m_hvoParent && ihvo == m_ihvoTa)
					vwenv.AddStringProp(m_taTagName, this);
				else
					vwenv.AddStringProp(m_snTagName, this);
				break;
			default:
				throw new Exception("Unexpected fragment ID in TypeAheadSupportVc");
			}
		}
Пример #37
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// The main method just displays the text with the appropriate properties.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
				(int)FwTextPropVar.ktpvDefault, (int)RGB(m_innerTextBox.ForeColor));

			if (m_rtl)
			{
				vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
					(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
			}
			vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
				(int)FwTextPropVar.ktpvEnum, (int)m_innerTextBox.Alignment);

			vwenv.OpenParagraph();
			vwenv.AddStringProp(InnerFwTextBox.ktagText, this);
			if (m_fSaveSize)
			{
				ITsString tss = vwenv.DataAccess.get_StringProp(hvo, InnerFwTextBox.ktagText);
				vwenv.get_StringWidth(tss, null, out m_dxWidth, out m_dyHeight);
			}
			vwenv.CloseParagraph();
		}
Пример #38
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				switch(frag)
				{
					case 1:
					{
						// The top-level.
						// Enhance JohnT: add a property setting to make the key bold
						// Roughly, vwenv.set_IntProperty(ktptBold, ktpvEnum, kttvForceOn);
						// If we can get an hvo and flid, display that property of that object.
						int flid = 0;
						if (hvo != 0)
						{
							flid = m_cp.FlidFor(m_index, hvo);
						}
						if (flid != 0)
						{
							// Warning (JohnT): this option not yet tested...
							vwenv.AddStringProp(flid, this);
							return;
						}
						else
						{
							// Otherwise display a literal string straight from the policy object.
							vwenv.AddString(m_cp.KeyFor(m_index, hvo));
						}

						if (m_fExpanded)
						{
							vwenv.AddLazyVecItems(m_ni.ListFlid, this, 2);
						}
						break;
					}
					case 2:
					{
						// One line of context.

						// Figure the index of this object in the next object out (the root).
						int hvoOuter, tagOuter, ihvo;
						vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1,
							out hvoOuter, out tagOuter, out ihvo);
						int ichKey = m_ni.ContextStringStartOffset(ihvo, hvo);
						int cchKey = m_ni.ContextStringLength(ihvo, hvo);
						// Enhance JohnT: make the alignment position a function of window width.
						// Enhance JohnT: change background if this is the selected context line.
						vwenv.OpenConcPara(ichKey, ichKey + cchKey,
							VwConcParaOpts.kcpoDefault,
							72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
						int flidKey = m_ni.ContextStringFlid(ihvo, hvo);
						if (flidKey == 0)
						{
							// Not tested yet.
							vwenv.AddString(m_ni.ContextString(ihvo, hvo));
						}
						else
						{
							vwenv.AddStringProp(flidKey, this);
						}
						vwenv.CloseParagraph();
						break;
					}
				}
			}
Пример #39
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();
        }
Пример #40
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();
				switch (frag)
				{
				case PhoneEnvReferenceView.kFragEnvironmentObj:
					vwenv.AddStringProp(PhoneEnvReferenceView.kEnvStringRep, this);
					break;
				case PhoneEnvReferenceView.kFragEnvironments:
					vwenv.OpenParagraph();
					vwenv.AddObjVec(PhoneEnvReferenceView.kMainObjEnvironments, this, frag);
					vwenv.CloseParagraph();
					break;
					//case PhoneEnvReferenceView.kFragAnnotation:
					//	break;
				default:
					throw new ArgumentException(
						"Don't know what to do with the given frag.", "frag");
				}
			}
Пример #41
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();
				// Enhance JohnT: make the alignment position a function of window width.
				// Enhance JohnT: change background if this is the selected context line.
				vwenv.OpenConcPara(m_info.ContextStringStartOffset,
					m_info.ContextStringStartOffset + m_info.ContextStringLength,
					VwConcParaOpts.kcpoDefault,
					72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
				if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
				{
					vwenv.AddString(m_info.ContentString);
				}
				else
				{
					Debug.Assert(hvo == m_info.Hvo);
					vwenv.AddStringProp(m_info.ContentStringFlid, this);
				}
				vwenv.CloseParagraph();
			}
Пример #42
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays the specified vwenv.
		/// </summary>
		/// <param name="vwenv">The vwenv.</param>
		/// <param name="hvo">The hvo.</param>
		/// <param name="frag">The frag.</param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch(frag)
			{
				case kfragLazyScripture:
				{
					// The configure method insists on trying to make an initial selection.
					// If there isn't something selectable there, it expands everything.
					vwenv.AddStringProp((int)Scripture.ScriptureTags.kflidChapterVerseSepr, this);
					vwenv.AddLazyVecItems((int)Scripture.ScriptureTags.kflidScriptureBooks, this,
						kfragLazyBook);
					break;
				}
				case kfragLazyBook:
				{
					vwenv.AddLazyVecItems((int)ScrBook.ScrBookTags.kflidSections, this,
						kfragDummySection);
					break;
				}
				case kfragDummySection:
				{
					vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidHeading, this,
						kfragDummyStText);
					vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidContent, this,
						kfragDummyStText);
					break;
				}
				case kfragDummyStText:
				{
					vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
						m_fParaWithContent ? kfragDummyParaWithContent : kfragDummyPara);
					break;
				}
				case kfragDummyPara:
				{
					// Display each dummy paragraph as a rectangle an inch high, which allows us
					// to accurately predict the height of a known number of them.
					vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch, MiscUtils.kdzmpInch, 0);
					break;
				}
				case kfragDummyParaWithContent:
				{
					vwenv.OpenMappedTaggedPara();
					vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
					vwenv.CloseParagraph();
					break;
				}
			}
		}
Пример #43
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;
            }
        }
Пример #44
0
			private void DisplayMorphForm(IVwEnv vwenv, int hvo, int frag, int ws, int choiceIndex)
			{
				int hvoMorphForm = vwenv.DataAccess.get_ObjectProp(hvo, ktagSbMorphForm);

				// Allow editing of the morpheme breakdown line.
				SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));
				// On this line we want an icon only for the first column (and only if it is the first
				// occurrence of the flid).
				bool fWantIcon = m_fIsMorphemeFormEditable && (frag == kfragFirstMorph) && m_choices.IsFirstOccurrenceOfFlid(choiceIndex);
				if (!fWantIcon)
					SetIndentForMissingIcon(vwenv);
				vwenv.OpenParagraph();
				bool fFirstMorphLine = (m_choices.IndexOf(InterlinLineChoices.kflidMorphemes) == choiceIndex);
				if (fWantIcon) // Review JohnT: should we do the 'edit box' for all first columns?
				{
					AddPullDownIcon(vwenv, ktagMorphFormIcon);
					// Create an edit box that stays visible when the user deletes
					// the first morpheme (like the WordGloss box).
					// This is especially useful if the user wants to
					// delete the entire MorphForm line (cf. LT-1621).
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
						(int)FwTextPropVar.ktpvMilliPoint,
						kmpIconMargin);
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
						(int)FwTextPropVar.ktpvMilliPoint,
						2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
						(int)FwTextPropVar.ktpvMilliPoint,
						2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
						(int)FwTextPropVar.ktpvDefault, krgbEditable);
				}
				// Per LT-14891, morpheme form is not editable except for the default vernacular.
				if (m_fIsMorphemeFormEditable && m_choices.IsFirstOccurrenceOfFlid(choiceIndex))
					MakeNextFlowObjectEditable(vwenv);
				else
					MakeNextFlowObjectReadOnly(vwenv);
				vwenv.OpenInnerPile();
				vwenv.OpenParagraph();
				if (fFirstMorphLine)
					vwenv.AddStringProp(ktagSbMorphPrefix, this);
				// This is never missing, but may, or may not, be editable.
				vwenv.AddObjProp(ktagSbMorphForm, this, kfragNamedObjectNameChoices + choiceIndex);
				if (fFirstMorphLine)
					vwenv.AddStringProp(ktagSbMorphPostfix, this);
				// close the special edit box we opened for the first morpheme.
				vwenv.CloseParagraph();
				vwenv.CloseInnerPile();
				vwenv.CloseParagraph();
			}
Пример #45
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;
			}
		}
Пример #46
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();

				vwenv.AddStringProp(m_flidGhost, this);
			}
Пример #47
0
			private void DisplayWithWritingSystemLabel(IVwEnv vwenv, int ws)
			{
				ITsString tssLabel = NameOfWs(ws);
				// 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;

				int dxs;	// Width of displayed string.
				int dys;	// Height of displayed string (not used here).
				vwenv.get_StringWidth(tssLabel, null, out dxs, out dys);
				VwLength vlColWs; // 5-pt space plus max label width.
				vlColWs.nVal = dxs + 5000;
				vlColWs.unit = VwUnit.kunPoint1000;

				// The Main column is relative and uses the rest of the space.
				VwLength vlColMain;
				vlColMain.nVal = 1;
				vlColMain.unit = VwUnit.kunRelative;

				// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?

				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();
				vwenv.OpenTableRow();

				// First cell has writing system abbreviation displayed using m_ttpLabel.
				//vwenv.Props = m_ttpLabel;
				vwenv.OpenTableCell(1, 1);
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
					(int)TptEditable.ktptNotEditable);
				vwenv.AddString(tssLabel);
				vwenv.CloseTableCell();

				// Second cell has the string contents for the alternative.
				// DN version has some property setting, including trailing margin and RTL.
				if (m_fRtlScript)
				{
					vwenv.set_IntProperty((int) FwTextPropType.ktptRightToLeft,
										  (int) FwTextPropVar.ktpvEnum,
										  (int) FwTextToggleVal.kttvForceOn);
					vwenv.set_IntProperty((int) FwTextPropType.ktptAlign,
										  (int) FwTextPropVar.ktpvEnum,
										  (int) FwTextAlign.ktalTrailing);
				}
				//if (!m_editable)
				//{
				//    vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
				//        (int)TptEditable.ktptNotEditable);
				//}

				vwenv.set_IntProperty((int) FwTextPropType.ktptPadTop, (int) FwTextPropVar.ktpvMilliPoint, 2000);
				vwenv.OpenTableCell(1, 1);
				vwenv.AddStringProp(m_flid, this);
				vwenv.CloseTableCell();
				vwenv.CloseTableRow();
				vwenv.CloseTableBody();
				vwenv.CloseTable();
			}
Пример #48
0
			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();
				if (m_wsDefault == -1)
				{
					// Set the underlying paragraph to RTL if the first writing system in the
					// string is RTL.
					if (m_cache != null)
					{
						ITsString tss = m_cache.MainCacheAccessor.get_StringProp(hvo, m_flid);
						ITsTextProps ttp = tss.get_Properties(0);
						int var;
						int ws = ttp.GetIntPropValues((int)FwTextPropType.ktptWs, out var);
						if (ws != 0)
							SetParaRTLIfNeeded(vwenv, ws);
					}
					vwenv.AddStringProp(m_flid, this);
				}
				else
				{
					SetParaRTLIfNeeded(vwenv, m_wsDefault);
					vwenv.AddStringAltMember(m_flid, m_wsDefault, this);
				}
			}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the current paragraph's contents.
		/// </summary>
		/// <param name="vwenv">The view environment</param>
		/// <param name="setParagraphProps"></param>
		/// ------------------------------------------------------------------------------------
		private void AddParagraphBoxContents(IVwEnv vwenv, Action setParagraphProps)
		{
		   AddParagraphBoxContents(vwenv, setParagraphProps, () =>
			   vwenv.AddStringProp(SimpleRootSiteDataProviderView.kflidSimpleTsString, null));
		}
Пример #50
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add a column to the header/footer
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="align"></param>
		/// <param name="flid"></param>
		/// ------------------------------------------------------------------------------------
		private void AddColumn(IVwEnv vwenv, FwTextAlign align, PubHeader.PubHeaderTags flid)
		{
			vwenv.OpenTableCell(1, 1);
			if (HeaderFooterParaStyle != null && HeaderFooterParaStyle != string.Empty)
			{
				vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
					HeaderFooterParaStyle);
			}
			vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
				(int)FwTextPropVar.ktpvEnum, (int)align);
			vwenv.OpenMappedPara();
			vwenv.AddStringProp((int)flid, this);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();
		}
Пример #51
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            if ((m_displayType & DisplayType.kLiteralStringLabels) != 0)
            {
                ITsStrFactory factory = TsStrFactoryClass.Create();
                vwenv.AddString(factory.MakeString("Label" + m_counter++, m_wsDefault));
            }
            switch (frag)
            {
            case 1:                     // the root; display the subitems, first using non-lazy view, then lazy one.
                if ((m_displayType & DisplayType.kBookFootnoteDetailsSeparateParas) == DisplayType.kBookFootnoteDetailsSeparateParas)
                {
                    vwenv.AddObjVecItems(m_flid, this, 10);
                }
                if ((m_displayType & DisplayType.kBookFootnoteDetailsSinglePara) == DisplayType.kBookFootnoteDetailsSinglePara)
                {
                    vwenv.AddObjVecItems(m_flid, this, 11);
                }
                else
                {
                    if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
                    {
                        vwenv.AddObjVecItems(m_flid, this, 3);
                    }
                    if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
                    {
                        vwenv.AddObjVecItems(m_flid, this, 2);
                    }
                }
                if ((m_displayType & DisplayType.kBookTitle) == DisplayType.kBookTitle)
                {
                    vwenv.AddObjProp(ScrBookTags.kflidTitle, this, 3);
                }
                if (m_displayType == DisplayType.kOuterObjDetails)
                {
                    vwenv.AddObjVecItems(m_flid, this, 6);
                }
                break;

            case 2:                     // An StText, display paragraphs lazily
                if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
                {
                    vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this, 4);
                }
                vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this, 5);
                break;

            case 3:                     // An StText, display paragraphs not lazily.
                if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
                {
                    vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, 4);
                }
                vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, 5);
                if ((m_displayType & DisplayType.kDuplicateParagraphs) != 0)
                {
                    vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, 5);
                }
                break;

            case 4:                     // StTxtPara, display contents with top margin
                if ((m_displayType & DisplayType.kMappedPara) == DisplayType.kMappedPara)
                {
                    vwenv.OpenMappedPara();
                }
                vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
                                      (int)FwTextPropVar.ktpvMilliPoint, kMarginTop);
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                if ((m_displayType & DisplayType.kMappedPara) == DisplayType.kMappedPara)
                {
                    vwenv.CloseParagraph();
                }
                break;

            case 5:                     // StTxtPara, display contents without top margin
                                        //vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
                                        //    (int)FwTextPropVar.ktpvMilliPoint, 15000);
                if ((m_displayType & DisplayType.kMappedPara) == DisplayType.kMappedPara)
                {
                    vwenv.OpenMappedPara();
                }
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                if ((m_displayType & DisplayType.kMappedPara) == DisplayType.kMappedPara)
                {
                    vwenv.CloseParagraph();
                }
                break;

            case 6:                     // StTxtPara, display details of our outer object
                int hvoOuter, tag, ihvo;
                vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoOuter, out tag, out ihvo);
                ITsString tss = TsStringHelper.MakeTSS("Hvo = " + hvoOuter + "; Tag = " + tag + "; Ihvo = " + ihvo,
                                                       m_wsDefault);
                vwenv.AddString(tss);
                break;

            case ScrBookTags.kflidSections:
                vwenv.AddObjVecItems(ScrBookTags.kflidSections, this,
                                     ScrSectionTags.kflidContent);
                break;

            case ScrSectionTags.kflidHeading:
            case ScrSectionTags.kflidContent:
                if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
                {
                    vwenv.AddObjProp(frag, this, 3);
                }
                if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
                {
                    vwenv.AddObjProp(frag, this, 2);
                }
                break;

            case 7:                     // ScrBook
                vwenv.OpenDiv();
                vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this, 8);
                vwenv.CloseDiv();
                break;

            case 8:                     // StFootnote
                vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
                                     9);
                break;

            case 9:                     // StTxtPara
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                break;

            case 10:
                // Display a Footnote by displaying its "FootnoteMarker" in a paragraph
                // by itself, followed by the sequence of paragraphs.
                vwenv.AddStringProp(StFootnoteTags.kflidFootnoteMarker, null);
                vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
                                     9);
                break;

            case 11:
                // Display a Footnote by displaying its "FootnoteMarker" followed by the
                // contents of its first paragraph (similar to the way footnotes are displayed in
                // real life.
                vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, 12);
                break;

            case 12:                     // Footnote paragraph with marker
                vwenv.OpenMappedTaggedPara();
                // The footnote marker is not editable.
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);

                // add a read-only space after the footnote marker
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                ITsStrFactory strFactory = TsStrFactoryClass.Create();
                vwenv.AddString(strFactory.MakeString(" ", DefaultWs));
                vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
                vwenv.CloseParagraph();
                break;

            default:
                throw new ApplicationException("Unexpected frag in DummyBasicViewVc");
            }
        }
Пример #52
0
            public override void Display(IVwEnv vwenv, int hvo, int frag)
            {
                switch (frag)
                {
                case 1:
                {
                    // The top-level.
                    // Enhance JohnT: add a property setting to make the key bold
                    // Roughly, vwenv.set_IntProperty(ktptBold, ktpvEnum, kttvForceOn);
                    // If we can get an hvo and flid, display that property of that object.
                    int flid = 0;
                    if (hvo != 0)
                    {
                        flid = m_cp.FlidFor(m_index, hvo);
                    }
                    if (flid != 0)
                    {
                        // Warning (JohnT): this option not yet tested...
                        vwenv.AddStringProp(flid, this);
                        return;
                    }
                    else
                    {
                        // Otherwise display a literal string straight from the policy object.
                        vwenv.AddString(m_cp.KeyFor(m_index, hvo));
                    }

                    if (m_fExpanded)
                    {
                        vwenv.AddLazyVecItems(m_ni.ListFlid, this, 2);
                    }
                    break;
                }

                case 2:
                {
                    // One line of context.

                    // Figure the index of this object in the next object out (the root).
                    int hvoOuter, tagOuter, ihvo;
                    vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1,
                                         out hvoOuter, out tagOuter, out ihvo);
                    int ichKey = m_ni.ContextStringStartOffset(ihvo, hvo);
                    int cchKey = m_ni.ContextStringLength(ihvo, hvo);
                    // Enhance JohnT: make the alignment position a function of window width.
                    // Enhance JohnT: change background if this is the selected context line.
                    vwenv.OpenConcPara(ichKey, ichKey + cchKey,
                                       VwConcParaOpts.kcpoDefault,
                                       72 * 2 * 1000);                  // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
                    int flidKey = m_ni.ContextStringFlid(ihvo, hvo);
                    if (flidKey == 0)
                    {
                        // Not tested yet.
                        vwenv.AddString(m_ni.ContextString(ihvo, hvo));
                    }
                    else
                    {
                        vwenv.AddStringProp(flidKey, this);
                    }
                    vwenv.CloseParagraph();
                    break;
                }
                }
            }
Пример #53
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them.
        /// </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:
                ITsString  tssWord       = vwenv.DataAccess.get_StringProp(hvo, ktagCf);
                ITsStrBldr tsbSdRelation = m_tssSdRelation.GetBldr();
                ITsStrBldr tsbLexRel     = m_tssLexRelation.GetBldr();
                if (tssWord != null && tssWord.Length > 0)
                {
                    int ich = tsbSdRelation.Text.IndexOf("{0}");
                    if (ich >= 0)
                    {
                        tsbSdRelation.ReplaceTsString(ich, ich + 3, tssWord);
                    }
                    ich = tsbLexRel.Text.IndexOf("{0}");
                    if (ich >= 0)
                    {
                        tsbLexRel.ReplaceTsString(ich, ich + 3, tssWord);
                    }
                }
                int cDomains = vwenv.DataAccess.get_VecSize(hvo, ktagDomains);
                int cLexRels = vwenv.DataAccess.get_VecSize(hvo, ktagLexRels);
                Debug.Assert(cDomains > 0 || cLexRels > 0);
                if (cDomains > 0)
                {
                    vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                          (int)FwTextPropVar.ktpvEnum,
                                          (int)TptEditable.ktptNotEditable);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          6000);
                    vwenv.OpenParagraph();
                    vwenv.AddString(tsbSdRelation.GetString());
                    vwenv.CloseParagraph();
                    vwenv.AddLazyVecItems(ktagDomains, this, kfragEntryList);
                }
                if (cLexRels > 0)
                {
                    vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                          (int)FwTextPropVar.ktpvEnum,
                                          (int)TptEditable.ktptNotEditable);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
                                          (int)FwTextPropVar.ktpvMilliPoint, 6000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
                                          (int)FwTextPropVar.ktpvMilliPoint, 6000);
                    vwenv.OpenParagraph();
                    vwenv.AddString(tsbLexRel.GetString());
                    vwenv.CloseParagraph();
                    vwenv.AddLazyVecItems(ktagLexRels, this, kfragEntryList);
                }
                break;

            case kfragEntryList:
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                vwenv.OpenParagraph();
                vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)FwTextToggleVal.kttvForceOn);
                vwenv.AddStringProp(ktagName, this);
                vwenv.AddString(m_tssColon);
                vwenv.AddObjVec(ktagWords, this, kfragWords);
                vwenv.CloseParagraph();
                break;

            case kfragName:
                vwenv.AddStringProp(ktagName, this);
                break;

            default:
                throw new Exception("bad case in RelatedWordsVc.Display");
            }
        }
Пример #54
0
 public override void Display(IVwEnv vwenv, int hvo, int frag)
 {
     // The property is absolutely arbitrary because the ghost DA ignores it.
     vwenv.AddStringProp(GhostStringSlice.kflidFake, this);
 }
Пример #55
0
		/// <summary>
		/// The hvo is for a Wfic (CmBaseAnnotation).
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvoWfic"></param>
		internal override void AddExtraTwficRows(IVwEnv vwenv, int hvoWfic)
		{
			SetTrailingAlignmentIfNeeded(vwenv, hvoWfic);
			vwenv.AddStringProp(TextTagAnnotFlid, this);
		}
Пример #56
0
		/// <summary>
		/// Displays Analysis using DisplayWordBundleMethod and closes the views Inner Pile.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="analysisOccurrence"></param>
		/// <param name="showMultipleAnalyses">Tells DisplayWordBundleMethod whether or not to show
		/// the colored highlighting if a word has multiple analyses</param>
		protected void DisplayAnalysisAndCloseInnerPile(IVwEnv vwenv, AnalysisOccurrence analysisOccurrence,
			bool showMultipleAnalyses)
		{
			// if it is just a punctuation annotation, we just insert the form.
			var analysis = analysisOccurrence.Analysis;
			if (analysis is IPunctuationForm)
			{
				vwenv.AddStringProp(PunctuationFormTags.kflidForm, this);
			}
			else
			{
				// It's a full wordform-possessing annotation, display the full bundle.
				new DisplayWordBundleMethod(vwenv, analysisOccurrence, this).Run(showMultipleAnalyses);
			}
			AddExtraBundleRows(vwenv, analysisOccurrence);
			vwenv.CloseInnerPile();
		}
Пример #57
0
        /// <summary>
        /// This is the basic method needed for the view constructor.
        /// </summary>
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case VectorReferenceView.kfragTargetVector:
                // Check for an empty vector.
                if (hvo == 0 || m_cache.DomainDataByFlid.get_VecSize(hvo, m_flid) == 0)
                {
                    vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
                                          (int)FwTextPropVar.ktpvDefault,
                                          (int)ColorUtil.ConvertColorToBGR(Color.Gray));
                    vwenv.set_IntProperty((int)FwTextPropType.ktptLeadingIndent,
                                          (int)FwTextPropVar.ktpvMilliPoint, 18000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                          (int)FwTextPropVar.ktpvDefault,
                                          (int)TptEditable.ktptNotEditable);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                                          (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                    //vwenv.AddString(m_cache.MakeUserTss("Click to select -->"));
                    if (hvo != 0)
                    {
                        vwenv.NoteDependency(new[] { hvo }, new[] { m_flid }, 1);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(TextStyle))
                    {
                        vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
                    }
                    vwenv.OpenParagraph();
                    vwenv.AddObjVec(m_flid, this, frag);
                    vwenv.CloseParagraph();
                }
                break;

            case VectorReferenceView.kfragTargetObj:
                // Display one object from the vector.
            {
                ILgWritingSystemFactory wsf =
                    m_cache.WritingSystemFactory;

                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvDefault,
                                      (int)TptEditable.ktptNotEditable);
                ITsString tss;
                Debug.Assert(hvo != 0);
#if USEBESTWS
                if (m_displayWs != null && m_displayWs.StartsWith("best"))
                {
                    // The flid can be a variety of types, so deal with those.
                    Debug.WriteLine("Using 'best ws': " + m_displayWs);
                    int magicWsId = LgWritingSystem.GetMagicWsIdFromName(m_displayWs);
                    int actualWS  = m_cache.LanguageProject.ActualWs(magicWsId, hvo, m_flid);
                    Debug.WriteLine("Actual ws: " + actualWS.ToString());
                }
                else
                {
#endif
                // Use reflection to get a prebuilt name if we can.  Otherwise
                // settle for piecing together a string.
                Debug.Assert(m_cache != null);
                var obj = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(hvo);
                Debug.Assert(obj != null);
                Type type = obj.GetType();
                System.Reflection.PropertyInfo pi = type.GetProperty("TsName",
                                                                     System.Reflection.BindingFlags.Instance |
                                                                     System.Reflection.BindingFlags.Public |
                                                                     System.Reflection.BindingFlags.FlattenHierarchy);
                if (pi != null)
                {
                    tss = (ITsString)pi.GetValue(obj, null);
                }
                else
                {
                    if (!string.IsNullOrEmpty(m_displayNameProperty))
                    {
                        pi = type.GetProperty(m_displayNameProperty,
                                              System.Reflection.BindingFlags.Instance |
                                              System.Reflection.BindingFlags.Public |
                                              System.Reflection.BindingFlags.FlattenHierarchy);
                    }
                    int ws = wsf.GetWsFromStr(obj.SortKeyWs);
                    if (ws == 0)
                    {
                        ws = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle;
                    }
                    if (pi != null)
                    {
                        object s = pi.GetValue(obj, null);
                        if (s is ITsString)
                        {
                            tss = (ITsString)s;
                        }
                        else
                        {
                            tss = TsStringUtils.MakeString((string)s, ws);
                        }
                    }
                    else
                    {
                        // ShortNameTss sometimes gets PropChanged, so worth letting the view know that's
                        // what we're inserting.
                        var flid = Cache.MetaDataCacheAccessor.GetFieldId2(obj.ClassID, "ShortNameTSS", true);
                        vwenv.AddStringProp(flid, this);
                        break;
                    }
#if USEBESTWS
                }
#endif
                }
                if (!string.IsNullOrEmpty(TextStyle))
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
                }
                vwenv.AddString(tss);
            }
            break;

            default:
                throw new ArgumentException(
                          "Don't know what to do with the given frag.", "frag");
            }
        }
            private void DisplayMorphForm(IVwEnv vwenv, int hvo, int frag, int ws, int choiceIndex)
            {
                int hvoMorphForm = vwenv.DataAccess.get_ObjectProp(hvo, ktagSbMorphForm);

                // Allow editing of the morpheme breakdown line.
                SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));
                // On this line we want an icon only for the first column (and only if it is the first
                // occurrence of the flid).
                bool fWantIcon = m_fIsMorphemeFormEditable && (frag == kfragFirstMorph) && m_choices.IsFirstOccurrenceOfFlid(choiceIndex);

                if (!fWantIcon)
                {
                    SetIndentForMissingIcon(vwenv);
                }
                vwenv.OpenParagraph();
                bool fFirstMorphLine = (m_choices.IndexOf(InterlinLineChoices.kflidMorphemes) == choiceIndex);

                if (fWantIcon)                 // Review JohnT: should we do the 'edit box' for all first columns?
                {
                    AddPullDownIcon(vwenv, ktagMorphFormIcon);
                    // Create an edit box that stays visible when the user deletes
                    // the first morpheme (like the WordGloss box).
                    // This is especially useful if the user wants to
                    // delete the entire MorphForm line (cf. LT-1621).
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          kmpIconMargin);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          2000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          2000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
                                          (int)FwTextPropVar.ktpvDefault, krgbEditable);
                }
                if (m_fIsMorphemeFormEditable)
                {
                    MakeNextFlowObjectEditable(vwenv);
                }
                else
                {
                    MakeNextFlowObjectReadOnly(vwenv);
                }
                vwenv.OpenInnerPile();
                vwenv.OpenParagraph();
                if (fFirstMorphLine)
                {
                    vwenv.AddStringProp(ktagSbMorphPrefix, this);
                }
                // This is never missing, but may, or may not, be editable.
                vwenv.AddObjProp(ktagSbMorphForm, this, kfragNamedObjectNameChoices + choiceIndex);
                if (fFirstMorphLine)
                {
                    vwenv.AddStringProp(ktagSbMorphPostfix, this);
                }
                // close the special edit box we opened for the first morpheme.
                vwenv.CloseParagraph();
                vwenv.CloseInnerPile();
                vwenv.CloseParagraph();
            }
Пример #59
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// </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 kfragRoot:
					ITsString tssWord = vwenv.DataAccess.get_StringProp(hvo, ktagCf);
					ITsStrBldr tsbSdRelation = m_tssSdRelation.GetBldr();
					ITsStrBldr tsbLexRel = m_tssLexRelation.GetBldr();
					if (tssWord != null && tssWord.Length > 0)
					{
						int ich = tsbSdRelation.Text.IndexOf("{0}");
						if (ich >= 0)
							tsbSdRelation.ReplaceTsString(ich, ich + 3, tssWord);
						ich = tsbLexRel.Text.IndexOf("{0}");
						if (ich >= 0)
							tsbLexRel.ReplaceTsString(ich, ich + 3, tssWord);
					}
					int cDomains = vwenv.DataAccess.get_VecSize(hvo, ktagDomains);
					int cLexRels = vwenv.DataAccess.get_VecSize(hvo, ktagLexRels);
					Debug.Assert(cDomains > 0 || cLexRels > 0);
					if (cDomains > 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint,
							6000);
						vwenv.OpenParagraph();
						vwenv.AddString(tsbSdRelation.GetString());
						vwenv.CloseParagraph();
						vwenv.AddLazyVecItems(ktagDomains, this, kfragEntryList);
					}
					if (cLexRels > 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
							(int)FwTextPropVar.ktpvMilliPoint, 6000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint, 6000);
						vwenv.OpenParagraph();
						vwenv.AddString(tsbLexRel.GetString());
						vwenv.CloseParagraph();
						vwenv.AddLazyVecItems(ktagLexRels, this, kfragEntryList);
					}
					break;
				case kfragEntryList:
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.OpenParagraph();
					vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
						(int)FwTextPropVar.ktpvEnum,
						(int)FwTextToggleVal.kttvForceOn);
					vwenv.AddStringProp(ktagName, this);
					vwenv.AddString (m_tssColon);
					vwenv.AddObjVec(ktagWords, this, kfragWords);
					vwenv.CloseParagraph();
					break;
				case kfragName:
					vwenv.AddStringProp(ktagName, this);
					break;
				default:
					throw new Exception("bad case in RelatedWordsVc.Display");
			}
		}
Пример #60
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)
		{
			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;
			}
		}