MCPcopy Create free account
hub / github.com/WinMerge/winmerge / GetLineColors2

Method GetLineColors2

Src/MergeEditView.cpp:776–927  ·  view source on GitHub ↗

* @brief Determine text and background color for line * @param [in] nLineIndex Index of line in view (NOT line in file) * @param [in] ignoreFlags Flags that caller wishes ignored * @param [out] crBkgnd Backround color for line * @param [out] crText Text color for line * * This version allows caller to suppress particular flags */

Source from the content-addressed store, hash-verified

774 * This version allows caller to suppress particular flags
775 */
776void CMergeEditView::GetLineColors2(int nLineIndex, DWORD ignoreFlags, CEColor & crBkgnd,
777 CEColor & crText, bool & bDrawWhitespace)
778{
779 if (GetLineCount() <= nLineIndex)
780 return;
781
782 lineflags_t dwLineFlags = GetLineFlags(nLineIndex);
783
784 if (dwLineFlags & ignoreFlags)
785 dwLineFlags &= (~ignoreFlags);
786
787 if (m_bDetailView)
788 {
789 // Line with WinMerge flag,
790 // Lines with only the LF_DIFF/LF_TRIVIAL flags are not colored with Winmerge colors
791 if (dwLineFlags & (LF_WINMERGE_FLAGS & ~LF_DIFF & ~LF_TRIVIAL & ~LF_MOVED & ~LF_SNP))
792 {
793 crText = m_cachedColors.clrDiffText;
794 bDrawWhitespace = true;
795
796 if (dwLineFlags & LF_GHOST)
797 {
798 crBkgnd = m_cachedColors.clrDiffDeleted;
799 }
800 }
801 else
802 {
803 // If no syntax hilighting
804 if (!GetOptionsMgr()->GetBool(OPT_SYNTAX_HIGHLIGHT))
805 {
806 crBkgnd = GetColor (COLORINDEX_BKGND);
807 crText = GetColor (COLORINDEX_NORMALTEXT);
808 bDrawWhitespace = false;
809 }
810 else
811 // Line not inside diff, get colors from CrystalEditor
812 CCrystalEditViewEx::GetLineColors(nLineIndex, crBkgnd,
813 crText, bDrawWhitespace);
814 }
815 if (nLineIndex < m_lineBegin || nLineIndex > m_lineEnd)
816 {
817 crBkgnd = GetColor (COLORINDEX_WHITESPACE);
818 crText = GetColor (COLORINDEX_WHITESPACE);
819 bDrawWhitespace = false;
820 }
821 return;
822 }
823
824 // Line inside diff
825 if (dwLineFlags & LF_WINMERGE_FLAGS)
826 {
827 crText = m_cachedColors.clrDiffText;
828 bDrawWhitespace = true;
829 bool lineInCurrentDiff = IsLineInCurrentDiff(nLineIndex);
830
831 if (dwLineFlags & LF_SNP)
832 {
833 if (lineInCurrentDiff)

Callers 1

OnDrawMethod · 0.80

Calls 2

GetOptionsMgrFunction · 0.70
GetBoolMethod · 0.45

Tested by

no test coverage detected