static void MoveUp( LPCLASSDATA lpcd ) { /* * Caret at the first line? */ if ( lpcd->ptCaretPos.y > 0 ) { /* * Fast scrolling? */ if ( Parser->bFastScroll && lpcd->bRepeatMode ) { /* * Are we at the top of the view? */ if ( lpcd->ptCaretPos.y == lpcd->ptViewPos.y ) /* * Setup new position. */ lpcd->ptCaretPos.y = max( lpcd->ptCaretPos.y - 2, 0 ); else /* * One line up. */ lpcd->ptCaretPos.y--; } else /* * Go one up. */ lpcd->ptCaretPos.y--; /* * Try to locate the caret as close to the * last column position as possible since * the user changed the column. */ lpcd->ptCaretPos.x = GetTextOffset( lpcd, lpcd->nLastColumnPos ); /* * Are we passed the end? */ if ( lpcd->ptCaretPos.x > GETLINE( lpcd )->nLength ) /* * Set us at the end. */ lpcd->ptCaretPos.x = GETLINE( lpcd )->nLength; } /* * Make sure the care is in the view. */ MakeCaretVisible( lpcd ); /* * Update caret position. */ UpdateCaret( lpcd ); }
//******************************************************************************* CSize CBCGPRibbonStatusBarPane::GetIntermediateSize (CDC* pDC) { ASSERT_VALID (this); if (m_AnimImages.GetCount () > 0) { CSize imageSize = m_AnimImages.GetImageSize (); return CSize ( imageSize.cx + 2 * m_szMargin.cx + m_sizePadding.cx, imageSize.cy + 2 * m_szMargin.cy + m_sizePadding.cy); } CSize size = CBCGPRibbonButton::GetIntermediateSize (pDC); size.cx -= GetTextOffset () + 1; return size; }
static void MoveTabBack( LPCLASSDATA lpcd ) { int nScreenPos = GetCaretOffset( lpcd, lpcd->ptCaretPos.x ), nPos; /* * Are we at the start of the line? */ if ( lpcd->ptCaretPos.x == 0 ) return; /* * Compute the number of characters we are * right of a tab-stop. */ nPos = nScreenPos % Parser->nTabSize; /* * Go left the amount of position computed above * or a whole tab-stop. */ nPos = nScreenPos - ( nPos ? nPos : Parser->nTabSize ); /* * Position the caret. */ lpcd->ptCaretPos.x = GetTextOffset( lpcd, nPos ); /* * Save this position. */ lpcd->nLastColumnPos = GetCaretOffset( lpcd, lpcd->ptCaretPos.x ); /* * Make sure the care is in the view. */ MakeCaretVisible( lpcd ); /* * Update caret position. */ UpdateCaret( lpcd ); }
static void MoveDown( LPCLASSDATA lpcd ) { /* * Caret at the last line? */ if ( lpcd->ptCaretPos.y < ArrayGetSize( lpcd->lpLines ) - 1 ) { /* * Fast scrolling? */ if ( Parser->bFastScroll && lpcd->bRepeatMode ) { /* * Are we at the top of the view? */ if ( lpcd->ptCaretPos.y == ( lpcd->ptViewPos.y + lpcd->szViewSize.cy - 1 )) /* * Setup new position. */ lpcd->ptCaretPos.y = min( lpcd->ptCaretPos.y + 2, ArrayGetSize( lpcd->lpLines ) - 1 ); else /* * One line up. */ lpcd->ptCaretPos.y++; } else /* * Go one down. */ lpcd->ptCaretPos.y++; /* * Try to locate the cursor as close to the * last column position as possible since * the user changed the column. */ lpcd->ptCaretPos.x = GetTextOffset( lpcd, lpcd->nLastColumnPos ); /* * Are we passed the end? */ if ( lpcd->ptCaretPos.x > GETLINE( lpcd )->nLength ) /* * Set us at the end. */ lpcd->ptCaretPos.x = GETLINE( lpcd )->nLength; } else { /* * Caret at the end of the line? */ // Modified by Stephan (2005-06-08): Don't jump to end of line //if ( lpcd->ptCaretPos.x < GETLINE( lpcd )->nLength ) //lpcd->ptCaretPos.x = GETLINE( lpcd )->nLength; } /* * Make sure the care is in the view. */ MakeCaretVisible( lpcd ); /* * Update caret position. */ UpdateCaret( lpcd ); }