/// ------------------------------------------------------------------------------------ /// <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 }