private void AddPullDownIcon(IVwEnv vwenv, int tag) { if (m_fIconsForAnalysisChoices) { vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin); vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -2500); vwenv.AddPicture(m_PulldownArrowPic.Picture, tag, 0, 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); } break; } }
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; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// This is the main interesting method of displaying objects and fragments of them. /// A Scripture is displayed by displaying its Books; /// and a Book is displayed by displaying its Title and Sections; /// and a Section is diplayed by displaying its Heading and Content; /// which are displayed by 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: case (int)ScrFrags.kfrScripture: { vwenv.NoteDependency(new[] { hvo }, new[] { ScrBookTags.kflidFootnotes }, 1); // This fragment should only be used on full refresh - clear the user prompt // flags so they will be shown again. ClearUserPromptUpdates(); // We add this lazy - we will expand some of it immediately, but the non- // visible parts will remain lazy! vwenv.NoteDependency(new[]{m_cache.LanguageProject.TranslatedScriptureOA.Hvo}, new[]{ScriptureTags.kflidScriptureBooks}, 1); vwenv.AddLazyVecItems(BooksTag, this, frag == (int)ScrFrags.kfrScripture ? (int)ScrFrags.kfrBook : (int)FootnoteFrags.kfrBook); // Add a 48 point gap at the bottom of the view if (!PrintLayout && (frag != (int)FootnoteFrags.kfrScripture)) vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0); break; } case (int)ScrFrags.kfrBook: { vwenv.OpenDiv(); vwenv.AddObjProp(ScrBookTags.kflidTitle, this, (int)StTextFrags.kfrText); vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this, (int)ScrFrags.kfrSection); // Add a 48 point gap at the bottom of the view if (!PrintLayout && m_fShowTailingSpace) vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0); if (!PrintLayout) InsertBookSeparator(hvo, vwenv); vwenv.CloseDiv(); break; } case (int)ScrFrags.kfrSection: { vwenv.OpenDiv(); vwenv.AddObjProp(ScrSectionTags.kflidHeading, this, (int)StTextFrags.kfrText); vwenv.AddObjProp(ScrSectionTags.kflidContent, this, (int)StTextFrags.kfrText); vwenv.CloseDiv(); break; } case (int)StTextFrags.kfrPara: if (PrintLayout || !m_fDisplayInTable) { // We are displaying Scripture or a print layout view base.Display(vwenv, hvo, frag); } else { // We are displaying a back translation or Scripture in draftview in a table // Open a table to display the BT para in column 1, and the icon in column 2. VwLength vlTable; // we use this to specify that the table takes 100% of the width. vlTable.nVal = 10000; vlTable.unit = VwUnit.kunPercent100; VwLength vlColumn; // and this one to specify 90% for the text vlColumn.nVal = DisplayTranslation ? 9000 : 10000; vlColumn.unit = VwUnit.kunPercent100; int nColumns = DisplayTranslation ? 2 : 1; vwenv.OpenTable(nColumns, // One or two columns. vlTable, // Table uses 100% of available width. 0, // Border thickness. VwAlignment.kvaLeft, // Default alignment. VwFramePosition.kvfpVoid, // No border. //VwFramePosition.kvfpBox, //VwRule.kvrlAll, // rule lines between cells VwRule.kvrlNone, 0, //No space between cells. 0, //No padding inside cells. false); // Specify column widths. The first argument is the number of columns, // not a column index. vwenv.MakeColumns(nColumns, vlColumn); vwenv.OpenTableBody(); vwenv.OpenTableRow(); // Display paragraph in the first cell vwenv.OpenTableCell(1, 1); InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this); vwenv.CloseTableCell(); if (DisplayTranslation) { // Stylesheet should never be null for a VC that displays BTs, but to be safe... Debug.Assert (m_stylesheet != null); if (m_stylesheet != null) { IStPara para = m_cache.ServiceLocator.GetInstance<IStParaRepository>().GetObject(hvo); ITsTextProps styleRules = para.StyleRules; if (styleRules == null) { Debug.Fail("Style Rules should not be null"); styleRules = NormalStyle; } string paraStyleName = styleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); ITsTextProps ttp = m_stylesheet.GetStyleRgch(0, paraStyleName); Debug.Assert(ttp != null); if (ttp != null) { int var; int spaceBefore = ttp.GetIntPropValues((int)FwTextPropType.ktptSpaceBefore, out var); if (spaceBefore > 0) vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, var, spaceBefore); } } // BT status icon in the next cell, not editable vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); vwenv.OpenTableCell(1, 1); vwenv.AddObjVec(StTxtParaTags.kflidTranslations, this, (int)ScrFrags.kfrBtTranslationStatus); vwenv.CloseTableCell(); } // Close table vwenv.CloseTableRow(); vwenv.CloseTableBody(); vwenv.CloseTable(); } break; case (int)ScrFrags.kfrBtTranslationStatus: { ICmTranslation trans = m_cache.ServiceLocator.GetInstance<ICmTranslationRepository>().GetObject(hvo); if (trans != null) { string status = trans.Status.get_String(m_wsDefault).Text; IPicture picture; if (status == BackTranslationStatus.Checked.ToString()) picture = m_CheckedPic; else if (status == BackTranslationStatus.Finished.ToString()) picture = m_FinishedPic; else picture = m_UnfinishedPic; vwenv.OpenDiv(); vwenv.AddPicture(picture, -1, 0, 0); vwenv.NoteDependency(new [] {hvo}, new [] {CmTranslationTags.kflidStatus}, 1); vwenv.CloseDiv(); } } break; default: base.Display(vwenv, hvo, frag); break; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Displays an annotation expanded or contracted /// </summary> /// <param name="vwenv"></param> /// <param name="ann"></param> /// <param name="expanded"></param> /// ------------------------------------------------------------------------------------ private void DisplayAnnotation(IVwEnv vwenv, IScrScriptureNote ann, bool expanded) { #region First row has status, ref, category, & quote SetBackgroundColorForNote(ann, vwenv); OpenTableRow(vwenv, ann); // Display expand box (+/-) in the first cell //InsertNoteSeparator(vwenv); vwenv.OpenTableCell(1, 1); vwenv.AddObj(ann.Hvo, this, (int)NotesFrags.kfrExpansion); vwenv.CloseTableCell(); // Display status in the second cell vwenv.OpenTableCell(1, 1); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 1000); if (ann.AnnotationType == NoteType.CheckingError) { // When the annotation is a checking error, we don't want clicking on the status // to change the status. Therefore, make the min and max the same. vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus, this, (int)NotesFrags.kfrStatus, 0, 0); } else { vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus, this, (int)NotesFrags.kfrStatus, (int)NoteStatus.Open, (int)NoteStatus.Closed); } vwenv.CloseTableCell(); // Display reference in the third cell and make it readonly. vwenv.OpenTableCell(1, 1); vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvDefault, 0); vwenv.OpenParagraph(); vwenv.AddProp((int)CmBaseAnnotationTags.kflidBeginRef, this, (int)NotesFrags.kfrScrRef); vwenv.CloseParagraph(); vwenv.CloseTableCell(); // Display CONNOT category in the fourth (and possibly fifth and sixth) cell(s) vwenv.OpenTableCell(1, expanded ? 3 : 1); IStTxtPara quotePara = ann.QuoteOA[0]; bool fQuoteParaRtoL = IsParaRightToLeft(quotePara); // Conc paragraphs don't work well for R-to-L: If the text doesn't fit, it will // show the trailing text rather than the leading text. if (fQuoteParaRtoL || expanded) vwenv.OpenParagraph(); else vwenv.OpenConcPara(0, 0, 0, 0); vwenv.AddObjVec((int)ScrScriptureNoteTags.kflidCategories, this, (int)NotesFrags.kfrConnotCategory); vwenv.CloseParagraph(); vwenv.CloseTableCell(); // Display CONNOT category chooser button in the penultimate or last cell vwenv.OpenTableCell(1, 1); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 1000); vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000); vwenv.AddPicture(m_picChooser, -(int)NotesFrags.kfrConnotCategory, 0, 0); vwenv.CloseTableCell(); // If not expanded, display the quote in the last cell if (!expanded) { vwenv.OpenTableCell(1, 1); SetupWsAndDirectionForPara(vwenv, quotePara.Hvo); if (fQuoteParaRtoL) vwenv.OpenParagraph(); // Conc paragraphs don't work well for R-to-L else vwenv.OpenConcPara(0, 0, 0, 0); vwenv.AddString(quotePara.Contents); vwenv.CloseParagraph(); vwenv.CloseTableCell(); } CloseTableRow(vwenv, ann); #endregion if (!expanded) return; #region Second through fifth rows bool fRegularAnnotation = ann.AnnotationType != NoteType.CheckingError; //Second row has quote DisplayExpandableAnnotation(vwenv, ann, (int)ScrScriptureNoteTags.kflidQuote, ann.QuoteOA.Hvo, ann.QuoteOA, fRegularAnnotation ? m_quoteLabel : m_detailsLabel, !fRegularAnnotation); // Third row has discussion DisplayExpandableAnnotation(vwenv, ann, ScrScriptureNoteTags.kflidDiscussion, ann.DiscussionOA.Hvo, ann.DiscussionOA, fRegularAnnotation ? m_discussionLabel : m_messageLabel, !fRegularAnnotation); // Fourth row has recommendation (i.e. suggestion) DisplayExpandableAnnotation(vwenv, ann, ScrScriptureNoteTags.kflidRecommendation, ann.RecommendationOA.Hvo, ann.RecommendationOA, m_suggestionLabel); // Fifth row has resolution DisplayExpandableAnnotation(vwenv, ann, ScrScriptureNoteTags.kflidResolution, ann.ResolutionOA.Hvo, ann.ResolutionOA, m_resolutionLabel); #endregion #region Sixth row has author SetBackgroundColorForNote(ann, vwenv); OpenTableRow(vwenv, ann); // Display empty first and second cell vwenv.OpenTableCell(1, 2); vwenv.CloseTableCell(); // Display author in third cell vwenv.OpenTableCell(1, 3); vwenv.OpenParagraph(); SetDisabledColorForNote(vwenv); vwenv.AddString(m_authorLabel); vwenv.CloseParagraph(); vwenv.CloseTableCell(); CloseTableRow(vwenv, ann); #endregion #region Seventh row has dates SetBackgroundColorForNote(ann, vwenv); OpenTableRow(vwenv, ann); // Display empty first and second cell vwenv.OpenTableCell(1, 2); vwenv.CloseTableCell(); // Display date created in third cell vwenv.OpenTableCell(1, 1); vwenv.OpenParagraph(); vwenv.AddString(m_createdLabel); vwenv.AddTimeProp(CmAnnotationTags.kflidDateCreated, 0); vwenv.CloseParagraph(); vwenv.CloseTableCell(); // Display date modified in fourth/fifth cells vwenv.OpenTableCell(1, 2); vwenv.OpenParagraph(); vwenv.AddString(m_modifiedLabel); vwenv.AddTimeProp(CmAnnotationTags.kflidDateModified, 0); vwenv.CloseParagraph(); vwenv.CloseTableCell(); // Display date resolved in last two cells vwenv.OpenTableCell(1, 2); vwenv.OpenParagraph(); if (ann.ResolutionStatus == NoteStatus.Closed) { SetDisabledColorForNote(vwenv); vwenv.AddString(m_resolvedLabel); // TODO (TE-4039) This date is incorrect //vwenv.AddTimeProp(ScrScriptureNote.ScrScriptureNoteTags.kflidDateResolved, 0); } vwenv.CloseParagraph(); vwenv.CloseTableCell(); CloseTableRow(vwenv, ann); #endregion }
/// ------------------------------------------------------------------------------------ /// <summary> /// This is the main interesting method of displaying objects and fragments of them. /// A Scripture is displayed by displaying its Books; /// and a Book is displayed by displaying its Title and Sections; /// and a Section is diplayed by displaying its Heading and Content; /// which are displayed by 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: case (int)ScrFrags.kfrScripture: { vwenv.NoteDependency(new[] { hvo }, new[] { ScrBookTags.kflidFootnotes }, 1); // This fragment should only be used on full refresh - clear the user prompt // flags so they will be shown again. ClearUserPromptUpdates(); // We add this lazy - we will expand some of it immediately, but the non- // visible parts will remain lazy! vwenv.NoteDependency(new[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo }, new[] { ScriptureTags.kflidScriptureBooks }, 1); vwenv.AddLazyVecItems(BooksTag, this, frag == (int)ScrFrags.kfrScripture ? (int)ScrFrags.kfrBook : (int)FootnoteFrags.kfrBook); // Add a 48 point gap at the bottom of the view if (!PrintLayout && (frag != (int)FootnoteFrags.kfrScripture)) { vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0); } break; } case (int)ScrFrags.kfrBook: { vwenv.OpenDiv(); vwenv.AddObjProp(ScrBookTags.kflidTitle, this, (int)StTextFrags.kfrText); vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this, (int)ScrFrags.kfrSection); // Add a 48 point gap at the bottom of the view if (!PrintLayout && m_fShowTailingSpace) { vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0); } if (!PrintLayout) { InsertBookSeparator(hvo, vwenv); } vwenv.CloseDiv(); break; } case (int)ScrFrags.kfrSection: { vwenv.OpenDiv(); vwenv.AddObjProp(ScrSectionTags.kflidHeading, this, (int)StTextFrags.kfrText); vwenv.AddObjProp(ScrSectionTags.kflidContent, this, (int)StTextFrags.kfrText); vwenv.CloseDiv(); break; } case (int)StTextFrags.kfrPara: if (PrintLayout || !m_fDisplayInTable) { // We are displaying Scripture or a print layout view base.Display(vwenv, hvo, frag); } else { // We are displaying a back translation or Scripture in draftview in a table // Open a table to display the BT para in column 1, and the icon in column 2. VwLength vlTable; // we use this to specify that the table takes 100% of the width. vlTable.nVal = 10000; vlTable.unit = VwUnit.kunPercent100; VwLength vlColumn; // and this one to specify 90% for the text vlColumn.nVal = DisplayTranslation ? 9000 : 10000; vlColumn.unit = VwUnit.kunPercent100; int nColumns = DisplayTranslation ? 2 : 1; vwenv.OpenTable(nColumns, // One or two columns. vlTable, // Table uses 100% of available width. 0, // Border thickness. VwAlignment.kvaLeft, // Default alignment. VwFramePosition.kvfpVoid, // No border. //VwFramePosition.kvfpBox, //VwRule.kvrlAll, // rule lines between cells VwRule.kvrlNone, 0, //No space between cells. 0, //No padding inside cells. false); // Specify column widths. The first argument is the number of columns, // not a column index. vwenv.MakeColumns(nColumns, vlColumn); vwenv.OpenTableBody(); vwenv.OpenTableRow(); // Display paragraph in the first cell vwenv.OpenTableCell(1, 1); InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this); vwenv.CloseTableCell(); if (DisplayTranslation) { // Stylesheet should never be null for a VC that displays BTs, but to be safe... Debug.Assert(m_stylesheet != null); if (m_stylesheet != null) { IStPara para = m_cache.ServiceLocator.GetInstance <IStParaRepository>().GetObject(hvo); ITsTextProps styleRules = para.StyleRules; if (styleRules == null) { Debug.Fail("Style Rules should not be null"); styleRules = NormalStyle; } string paraStyleName = styleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); ITsTextProps ttp = m_stylesheet.GetStyleRgch(0, paraStyleName); Debug.Assert(ttp != null); if (ttp != null) { int var; int spaceBefore = ttp.GetIntPropValues((int)FwTextPropType.ktptSpaceBefore, out var); if (spaceBefore > 0) { vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, var, spaceBefore); } } } // BT status icon in the next cell, not editable vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); vwenv.OpenTableCell(1, 1); vwenv.AddObjVec(StTxtParaTags.kflidTranslations, this, (int)ScrFrags.kfrBtTranslationStatus); vwenv.CloseTableCell(); } // Close table vwenv.CloseTableRow(); vwenv.CloseTableBody(); vwenv.CloseTable(); } break; case (int)ScrFrags.kfrBtTranslationStatus: { ICmTranslation trans = m_cache.ServiceLocator.GetInstance <ICmTranslationRepository>().GetObject(hvo); if (trans != null) { string status = trans.Status.get_String(m_wsDefault).Text; IPicture picture; if (status == BackTranslationStatus.Checked.ToString()) { picture = m_CheckedPic; } else if (status == BackTranslationStatus.Finished.ToString()) { picture = m_FinishedPic; } else { picture = m_UnfinishedPic; } vwenv.OpenDiv(); vwenv.AddPicture(picture, -1, 0, 0); vwenv.NoteDependency(new [] { hvo }, new [] { CmTranslationTags.kflidStatus }, 1); vwenv.CloseDiv(); } } break; default: base.Display(vwenv, hvo, frag); break; } }
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; } }
/// ------------------------------------------------------------------------------------ /// <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)ScrFrags.kfrScripture: { vwenv.AddLazyVecItems(ScriptureTags.kflidBookAnnotations, this, (int)ScrFrags.kfrBook); break; } case (int)ScrFrags.kfrBook: { vwenv.AddLazyVecItems(ScrBookAnnotationsTags.kflidNotes, this, (int)NotesFrags.kfrAnnotation); break; } case (int)NotesFrags.kfrAnnotation: { DisplayAnnotationFragment(vwenv, hvo); break; } case (int)NotesFrags.kfrResponse: { DisplayResponseFragment(vwenv, hvo); break; } case (int)NotesFrags.kfrExpansion: { vwenv.OpenParagraph(); //if (m_expanderPadding == -1) // m_expanderPadding = GetImagePadding(vwenv, m_picMinus); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2500); ICmObject obj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo); vwenv.AddPicture((m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]) ? m_picMinus : m_picPlus, (int)obj.OwningFlid, 0, 0); vwenv.CloseParagraph(); break; } default: base.Display(vwenv, hvo, frag); break; } }
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); } break; } }
private void AddPullDownIcon(IVwEnv vwenv, int tag) { if (m_fIconsForAnalysisChoices) { vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin); vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -2500); vwenv.AddPicture(m_PulldownArrowPic.Picture, tag, 0, 0); } }
///// ------------------------------------------------------------------------------------ ///// <summary> ///// Gets the image padding. ///// </summary> ///// ------------------------------------------------------------------------------------ //private int GetImagePadding(IVwEnv vwenv, stdole.IPicture pic) //{ // ITsTextProps ttp = StyleUtils.CharStyleTextProps(ScrStyleNames.NotationTag, // m_cache.DefaultUserWs); // ITsStrBldr bldr = TsStrBldrClass.Create(); // bldr.Replace(0, 0, "X", ttp); // int dmpX, lineHeight; // vwenv.get_StringWidth(bldr.GetString(), ttp, out dmpX, out lineHeight); // float pixelsY = ((float)m_pixelHeights[pic] - 1f); // *m_zoomPercent; // float inchesY = pixelsY / (float)m_dpiY; // float milliptY = 72000f * inchesY; // return (int)(Math.Abs((float)lineHeight - milliptY) / 2f); //} #endregion #region Overridden methods /// ------------------------------------------------------------------------------------ /// <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)ScrFrags.kfrScripture: { vwenv.AddObjVecItems((int)Scripture.ScriptureTags.kflidBookAnnotations, this, (int)ScrFrags.kfrBook); break; } case (int)ScrFrags.kfrBook: { // REVIEW: This dependency causes the relevent portions of the view to be // re-laid out when the underlying sequence property (kflidNotes) changes // because PropChanged never gets called for the virtual property, though // maybe it should. vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes }, 1); vwenv.AddLazyVecItems(VirtualNotesTag, this, (int)NotesFrags.kfrAnnotation); break; } case (int)NotesFrags.kfrAnnotation: { DisplayAnnotationFragment(vwenv, hvo); break; } case (int)NotesFrags.kfrResponse: { DisplayResponseFragment(vwenv, hvo); break; } case (int)NotesFrags.kfrExpansion: { vwenv.OpenParagraph(); //if (m_expanderPadding == -1) // m_expanderPadding = GetImagePadding(vwenv, m_picMinus); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2500); vwenv.AddPicture((m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]) ? m_picMinus : m_picPlus, m_cache.GetOwningFlidOfObject(hvo), 0, 0); vwenv.CloseParagraph(); break; } default: base.Display(vwenv, hvo, frag); break; } }
private void AddSelectionCell(IVwEnv vwenv, int hvo) { vwenv.OpenTableCell(1, 1); // Put a pixel of light grey pad around the check box itself. vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault, (int)RGB(System.Drawing.Color.LightGray)); vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, (m_dxmpCheckBorderWidth)); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint, (m_dxmpCheckBorderWidth)); vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, (m_dxmpCheckBorderWidth)); vwenv.set_IntProperty((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint, (m_dxmpCheckBorderWidth)); if (ShowEnabled) { int enabled = vwenv.DataAccess.get_IntProp(hvo, ktagItemEnabled); vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagItemEnabled }, 1); if (enabled != 0) { // Even if the view as a whole does not allow editing, presumably a check box // does! vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptIsEditable); vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1); } else { vwenv.AddPicture(m_DisabledCheckPic, 0, 0, 0); } } else { // Unconditionally show the selected property. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptIsEditable); vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1); } vwenv.CloseTableCell(); }
private void AddPreviewArrow(IVwEnv vwenv, XmlNode node) { vwenv.OpenParagraph(); if (IsWritingSystemRTL(node)) vwenv.AddPicture(m_PreviewRTLArrowPic, 0, 0, 0); else vwenv.AddPicture(m_PreviewArrowPic, 0, 0, 0); vwenv.CloseParagraph(); }