Update of /cvsroot/anyedit/AnyEditv2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18199
Modified Files:
OutputEdit.cpp OutputEdit.h
Log Message:
- bug fixed: output was stopped after some lines
- added flicker free drawing of output
Index: OutputEdit.cpp
===================================================================
RCS file: /cvsroot/anyedit/AnyEditv2/OutputEdit.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** OutputEdit.cpp 17 Oct 2005 17:18:59 -0000 1.10
--- OutputEdit.cpp 7 Nov 2005 19:37:47 -0000 1.11
***************
*** 29,32 ****
--- 29,33 ----
#include "anyedit.h"
#include "OutputEdit.h"
+ #include "MemDC.h"
#ifdef _DEBUG
***************
*** 68,90 ****
CString szCurrentText;
- // Construct the new line with EOL
- szCurrentText = lpszNewStr;
- szCurrentText += "\r\n";
-
- // This trick prevents the jump to the first
- // line in when Setting the Window Text. We
- // paste the text from the Clipboard at the
- // end of the Edit box.
- CopyStrToClipboard(szCurrentText);
- Paste();
- // TODO: Is there a way to save the clipboard content?
- EmptyClipboard();
-
- // Set the new text of the Edit box.
GetWindowText(szCurrentText);
! // Scroll the Editbox, so the last line is visible.
! int length = szCurrentText.GetLength();
! SetSel(length,length);
}
--- 69,83 ----
CString szCurrentText;
GetWindowText(szCurrentText);
! if( !szCurrentText.IsEmpty() )
! szCurrentText += _T("\r\n");
! szCurrentText += lpszNewStr;
! SetRedraw(FALSE);
! SetWindowText(szCurrentText);
! // Scroll the edit control
! LineScroll (GetLineCount(), 0);
! SetRedraw(TRUE);
! UpdateWindow();
}
***************
*** 189,194 ****
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
- ON_WM_TIMER()
ON_WM_CHAR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
--- 182,188 ----
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
ON_WM_CHAR()
+ ON_WM_TIMER()
+ ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
***************
*** 200,205 ****
{
//CPaintDC dc(this); // device context for painting
! Default();
SetAutoScrollBars();
--- 194,209 ----
{
//CPaintDC dc(this); // device context for painting
! CPaintDC dc(this);
+ CRect rect;
+ GetClientRect(&rect);
+
+ // Paint to a memory device context to reduce screen flicker.
+ CMemDC memDC(&dc, &rect);
+ /*
+ CRect clip;
+ memDC.GetClipBox(&clip);
+ memDC.FillSolidRect(clip, GetSysColor(COLOR_WINDOW));
+ */
SetAutoScrollBars();
***************
*** 207,210 ****
--- 211,217 ----
DrawLine(TRUE);
// Do not call CEdit::OnPaint() for painting messages
+
+ CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
+ // Default();
}
***************
*** 480,481 ****
--- 487,493 ----
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
+
+ BOOL COutputEdit::OnEraseBkgnd(CDC* pDC)
+ {
+ return FALSE;
+ }
Index: OutputEdit.h
===================================================================
RCS file: /cvsroot/anyedit/AnyEditv2/OutputEdit.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OutputEdit.h 12 Oct 2005 18:55:57 -0000 1.7
--- OutputEdit.h 7 Nov 2005 19:37:47 -0000 1.8
***************
*** 75,78 ****
--- 75,79 ----
afx_msg void OnEditCopy();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
protected:
|