Add new items to top.
(This summarizes all changes to all files under Src, including Src\Languages.)
+2006-05-24 Kimmo
+ PATCH: [ 1493742 ] Limit vertical scrolling to last line of files
+ Src/editlib: ccrystaltextview.cpp
+
2006-05-23 Tim
PATCH: [ 1493713 ] Translate 'Bookmarks' feature to German
Src/Languages/German: MergeGerman.rc
// (see OnChar())
///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ccrystaltextview.cpp
+ *
+ * @brief Implementation of the CCrystalTextView class
+ */
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
#include "stdafx.h"
#include <malloc.h>
#include <imm.h> /* IME */
}
}
-//BEGIN SW
+/**
+ * @brief Scroll view to given line.
+ * Scrolls view so that given line is first line in the view. We limit
+ * scrolling so that there is only one empty line visible after the last
+ * line at max. So we don't allow user to scroll last line being at top or
+ * even at middle of the screen. This is how many editors behave and I
+ * (Kimmo) think it is good for us too.
+ * @param [in] nNewTopSubLine New top line for view.
+ * @param [in] bNoSmoothScroll if TRUE don't use smooth scrolling.
+ * @param [in] bTrackScrollBar if TRUE scrollbar is updated after scroll.
+ */
void CCrystalTextView::ScrollToSubLine( int nNewTopSubLine,
BOOL bNoSmoothScroll /*= FALSE*/, BOOL bTrackScrollBar /*= TRUE*/ )
{
{
if (bNoSmoothScroll || ! m_bSmoothScroll)
{
+ // Limit scrolling so that we show one empty line at end of file
+ const int nScreenLines = GetScreenLines();
+ const int nLineCount = GetSubLineCount();
+ if (nNewTopSubLine > (nLineCount - nScreenLines))
+ nNewTopSubLine = nLineCount - nScreenLines;
+
int nScrollLines = m_nTopSubLine - nNewTopSubLine;
m_nTopSubLine = nNewTopSubLine;
// OnDraw() uses m_nTopLine to determine topline
}
}
-/*void CCrystalTextView::GoToLine( int nLine )
-{
- SetCursorPos( CPoint( 0, (nLine > 0)? nLine - 1 : 0 ) );
- EnsureVisible( GetCursorPos() );
-}*/
-//END SW
-
void CCrystalTextView::
ScrollToLine (int nNewTopLine, BOOL bNoSmoothScroll /*= FALSE*/ , BOOL bTrackScrollBar /*= TRUE*/ )
{