SetParser(&m_xParser);
m_bAutomaticRescan = FALSE;
fTimerWaitingForIdle = 0;
+
+ m_bSyntaxHighlight = mf->m_options.GetInt(OPT_SYNTAX_HIGHLIGHT);
+ m_cachedColors.clrDiff = mf->m_options.GetInt(OPT_CLR_DIFF);
+ m_cachedColors.clrSelDiff = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF);
+ m_cachedColors.clrDiffDeleted = mf->m_options.GetInt(OPT_CLR_DIFF_DELETED);
+ m_cachedColors.clrSelDiffDeleted = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_DELETED);
+ m_cachedColors.clrDiffText = mf->m_options.GetInt(OPT_CLR_DIFF_TEXT);
+ m_cachedColors.clrSelDiffText = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_TEXT);
+ m_cachedColors.clrTrivial = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF);
+ m_cachedColors.clrTrivialDeleted = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF_DELETED);
+
}
CMergeEditView::~CMergeEditView()
// Line inside diff
if (dwLineFlags & LF_WINMERGE_FLAGS)
{
- crText = mf->m_options.GetInt(OPT_CLR_DIFF_TEXT);
+ crText = m_cachedColors.clrDiffText;
bDrawWhitespace = TRUE;
BOOL lineInCurrentDiff = IsLineInCurrentDiff(nLineIndex);
{
if (lineInCurrentDiff)
{
- crBkgnd = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF);
- crText = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_TEXT);
+ crBkgnd = m_cachedColors.clrSelDiff;
+ crText = m_cachedColors.clrSelDiffText;
}
else
{
- crBkgnd = mf->m_options.GetInt(OPT_CLR_DIFF);
- crText = mf->m_options.GetInt(OPT_CLR_DIFF_TEXT);
+ crBkgnd = m_cachedColors.clrDiff;
+ crText = m_cachedColors.clrDiffText;
}
return;
}
// trivial diff can not be selected
if (dwLineFlags & LF_GHOST)
// ghost lines in trivial diff has their own color
- crBkgnd = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF_DELETED);
+ crBkgnd = m_cachedColors.clrTrivialDeleted;
else
- crBkgnd = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF);
+ crBkgnd = m_cachedColors.clrTrivial;
return;
}
else if (dwLineFlags & LF_GHOST)
{
if (lineInCurrentDiff)
- crBkgnd = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_DELETED);
+ crBkgnd = m_cachedColors.clrSelDiffDeleted;
else
- crBkgnd = mf->m_options.GetInt(OPT_CLR_DIFF_DELETED);
+ crBkgnd = m_cachedColors.clrDiffDeleted;
return;
}
-
}
else
{
// Line not inside diff,
- if (!mf->m_options.GetInt(OPT_SYNTAX_HIGHLIGHT))
+ if (!m_bSyntaxHighlight)
{
// If no syntax hilighting, get windows default colors
crBkgnd = GetSysColor (COLOR_WINDOW);
{
pCmdUI->Enable(TRUE);
}
+
+/**
+ * @brief Reload cached options.
+ */
+void CMergeEditView::RefreshOptions()
+{
+ m_bSyntaxHighlight = mf->m_options.GetInt(OPT_SYNTAX_HIGHLIGHT);
+ m_cachedColors.clrDiff = mf->m_options.GetInt(OPT_CLR_DIFF);
+ m_cachedColors.clrSelDiff = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF);
+ m_cachedColors.clrDiffDeleted = mf->m_options.GetInt(OPT_CLR_DIFF_DELETED);
+ m_cachedColors.clrSelDiffDeleted = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_DELETED);
+ m_cachedColors.clrDiffText = mf->m_options.GetInt(OPT_CLR_DIFF_TEXT);
+ m_cachedColors.clrSelDiffText = mf->m_options.GetInt(OPT_CLR_SELECTED_DIFF_TEXT);
+ m_cachedColors.clrTrivial = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF);
+ m_cachedColors.clrTrivialDeleted = mf->m_options.GetInt(OPT_CLR_TRIVIAL_DIFF_DELETED);
+}
+
#if !defined(AFX_MERGEEDITVIEW_H__0CE31CFD_4BEE_4378_ADB4_B7C9F50A9F53__INCLUDED_)
#define AFX_MERGEEDITVIEW_H__0CE31CFD_4BEE_4378_ADB4_B7C9F50A9F53__INCLUDED_
+/**
+ * @brief Color settings.
+ */
+struct COLORSETTINGS
+{
+ COLORREF clrDiff; // The difference color
+ COLORREF clrSelDiff; // The selected difference color
+ COLORREF clrDiffDeleted; // The difference deleted color
+ COLORREF clrSelDiffDeleted; // The selected difference deleted color
+ COLORREF clrDiffText; // The difference text color
+ COLORREF clrSelDiffText; // The selected difference text color
+ COLORREF clrTrivial; // The blank line change
+ COLORREF clrTrivialDeleted; // The missing blank line
+ COLORREF clrFileLeftNewer; // The left file newer color (dir view)
+ COLORREF clrFileRightNewer; // The right file newer color (dir view)
+};
/**
* @brief Non-diff lines shown above diff when scrolling to it
IMergeEditStatus * m_piMergeEditStatus; // interface to status bar
protected:
- // Controls if rescan is done after edit events
+ /** Controls if rescan is done after edit events */
BOOL m_bAutomaticRescan;
private:
to wait for theApp::OnIdle before processing it
*/
BOOL fTimerWaitingForIdle;
+ COLORSETTINGS m_cachedColors; /**< Cached color settings */
+ BOOL m_bSyntaxHighlight; /**< Cached setting for syntax highlight */
// Operations
public:
+ void RefreshOptions();
BOOL EnableRescan(BOOL bEnable);
BOOL IsReadOnly(BOOL bLeft);
void ShowDiff(BOOL bScroll, BOOL bSelectText);