Numbers in parentheses refer to SourceForge.net tracker item numbers (#XXXXX) or
to Subversion revision numbers (rXXXXX).
+WinMerge 2.9.1.3
+ BugFix: Location Pane flickers when resizing (#1740106)
+
WinMerge 2.9.1.2 - 2008-05-23 (r5362)
Optimize location pane (r5341, r5342, r5346, r5351, r5355, r5356)
BugFix: Version Control filter did not match all VSS files (#1881186)
--- /dev/null
+#ifndef _MEMDC_H_
+#define _MEMDC_H_
+
+//////////////////////////////////////////////////
+// CMemDC - memory DC
+//
+// Author: Keith Rule
+// Email: keithr@europa.com
+// Copyright 1996-2002, Keith Rule
+//
+// You may freely use or modify this code provided this
+// Copyright is included in all derived versions.
+//
+// History - 10/3/97 Fixed scrolling bug.
+// Added print support. - KR
+//
+// 11/3/99 Fixed most common complaint. Added
+// background color fill. - KR
+//
+// 11/3/99 Added support for mapping modes other than
+// MM_TEXT as suggested by Lee Sang Hun. - KR
+//
+// 02/11/02 Added support for CScrollView as supplied
+// by Gary Kirkham. - KR
+//
+// This class implements a memory Device Context which allows
+// flicker free drawing.
+
+class CMemDC : public CDC {
+private:
+ CBitmap m_bitmap; // Offscreen bitmap
+ CBitmap* m_oldBitmap; // bitmap originally found in CMemDC
+ CDC* m_pDC; // Saves CDC passed in constructor
+ CRect m_rect; // Rectangle of drawing area.
+ BOOL m_bMemDC; // TRUE if CDC really is a Memory DC.
+public:
+
+ CMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
+ {
+ ASSERT(pDC != NULL);
+
+ // Some initialization
+ m_pDC = pDC;
+ m_oldBitmap = NULL;
+ m_bMemDC = !pDC->IsPrinting();
+
+ // Get the rectangle to draw
+ if (pRect == NULL) {
+ pDC->GetClipBox(&m_rect);
+ } else {
+ m_rect = *pRect;
+ }
+
+ if (m_bMemDC) {
+ // Create a Memory DC
+ CreateCompatibleDC(pDC);
+ pDC->LPtoDP(&m_rect);
+
+ m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+ m_oldBitmap = SelectObject(&m_bitmap);
+
+ SetMapMode(pDC->GetMapMode());
+
+ SetWindowExt(pDC->GetWindowExt());
+ SetViewportExt(pDC->GetViewportExt());
+
+ pDC->DPtoLP(&m_rect);
+ SetWindowOrg(m_rect.left, m_rect.top);
+ } else {
+ // Make a copy of the relevent parts of the current DC for printing
+ m_bPrinting = pDC->m_bPrinting;
+ m_hDC = pDC->m_hDC;
+ m_hAttribDC = pDC->m_hAttribDC;
+ }
+
+ // Fill background
+ FillSolidRect(m_rect, pDC->GetBkColor());
+ }
+
+ ~CMemDC()
+ {
+ if (m_bMemDC) {
+ // Copy the offscreen bitmap onto the screen.
+ m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+ this, m_rect.left, m_rect.top, SRCCOPY);
+
+ //Swap back the original bitmap.
+ SelectObject(m_oldBitmap);
+ } else {
+ // All we need to do is replace the DC with an illegal value,
+ // this keeps us from accidently deleting the handles associated with
+ // the CDC that was passed to the constructor.
+ m_hDC = m_hAttribDC = NULL;
+ }
+ }
+
+ // Allow usage as a pointer
+ CMemDC* operator->()
+ {
+ return this;
+ }
+
+ // Allow usage as a pointer
+ operator CMemDC*()
+ {
+ return this;
+ }
+};
+
+#endif
\ No newline at end of file
#include "OptionsDef.h"
#include "MergeLineFlags.h"
#include "Bitmap.h"
+#include "memdc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
}
/**
- * @brief Change the background color for a CView
- * See http://support.microsoft.com/kb/103786
+ * @brief Override for CMemDC to work.
*/
BOOL CLocationView::OnEraseBkgnd(CDC* pDC)
{
+ return FALSE;
+}
+
+/**
+ * @brief Draw custom (non-white) background.
+ * @param [in] pDC Pointer to draw context.
+ */
+void CLocationView::DrawBackground(CDC* pDC)
+{
// Set brush to desired background color
CBrush backBrush(RGB(0xe8, 0xe8, 0xf4));
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
- return TRUE;
}
/**
if (!m_view[MERGE_VIEW_LEFT]->IsInitialized()) return;
+ CMemDC dc(pDC);
+
COLORREF cr0 = CLR_NONE; // Left side color
COLORREF cr1 = CLR_NONE; // Right side color
COLORREF crt = CLR_NONE; // Text color
m_movedLines.RemoveAll();
CalculateBars();
+ DrawBackground(&dc);
// Draw bar outlines
- CPen* oldObj = (CPen*)pDC->SelectStockObject(BLACK_PEN);
- pDC->Rectangle(m_leftBar);
- pDC->Rectangle(m_rightBar);
- pDC->SelectObject(oldObj);
+ CPen* oldObj = (CPen*)dc.SelectStockObject(BLACK_PEN);
+ dc.Rectangle(m_leftBar);
+ dc.Rectangle(m_rightBar);
+ dc.SelectObject(oldObj);
// Iterate the differences list and draw differences as colored blocks.
// Draw left side block
m_view[MERGE_VIEW_LEFT]->GetLineColors2(block.top_line, 0, cr0, crt, bwh);
CRect r0(m_leftBar.left, block.top_coord, m_leftBar.right, block.bottom_coord);
- DrawRect(pDC, r0, cr0, bInsideDiff);
+ DrawRect(&dc, r0, cr0, bInsideDiff);
// Draw right side block
m_view[MERGE_VIEW_RIGHT]->GetLineColors2(block.top_line, 0, cr1, crt, bwh);
CRect r1(m_rightBar.left, block.top_coord, m_rightBar.right, block.bottom_coord);
- DrawRect(pDC, r1, cr1, bInsideDiff);
+ DrawRect(&dc, r1, cr1, bInsideDiff);
}
nPrevEndY = block.bottom_coord;
}
if (m_displayMovedBlocks != DISPLAY_MOVED_NONE)
- DrawConnectLines(pDC);
+ DrawConnectLines(&dc);
// Since we have invalidated locationbar there is no previous
// arearect to remove
m_visibleTop = -1;
m_visibleBottom = -1;
- DrawVisibleAreaRect(pDC);
+ DrawVisibleAreaRect(&dc);
m_bDrawn = true;
}
void DrawDiffMarker(CDC* pDC, int yCoord);
void CalculateBars();
void CalculateBlocks();
+ void DrawBackground(CDC* pDC);
private:
CMergeEditView* m_view[MERGE_VIEW_COUNT]; //*< Table for view pointers */
RelativePath="Common\coretools.h">
</File>
<File
- RelativePath="Common\coretypes.h"
- >
+ RelativePath="Common\coretypes.h">
</File>
<File
RelativePath="common\CShellFileOp.h">
RelativePath="Common\MDITabBar.h">
</File>
<File
+ RelativePath=".\Common\memdc.h">
+ </File>
+ <File
RelativePath="Merge.h">
</File>
<File