-#endif
-}
-
-#if ! defined( USE_NEW_CURSORCODE )
-
-bool
-wxLayoutList::MoveCursor(int dx, int dy)
-{
- CoordType offs, lineLength;
- wxLayoutObjectList::iterator i;
-
- m_CursorMoved = true;
-
- bool rc = true; // have we moved?
-
- //FIXME calculate cursor object & offset for y movements
- if(dy > 0 && m_CursorPos.y < m_MaxLine)
- m_CursorPos.y += dy;
- else if(dy < 0 && m_CursorPos.y > 0)
- m_CursorPos.y += dy; // dy is negative
- if(m_CursorPos.y < 0)
- {
- m_CursorPos.y = 0;
- rc = false;
- }
- else if (m_CursorPos.y > m_MaxLine)
- {
- m_CursorPos.y = m_MaxLine;
- rc = false;
- }
-
- while(dx > 0)
- {
- i = FindCurrentObject(&offs);
- lineLength = GetLineLength(i,offs);
- if(m_CursorPos.x < lineLength)
- {
- m_CursorPos.x ++;
- dx--;
- continue;
- }
- else
- {
- if(m_CursorPos.y < m_MaxLine)
- {
- m_CursorPos.y++;
- m_CursorPos.x = 0;
- dx--;
- }
- else
- {
- rc = false;
- break; // cannot move there
- }
- }
- }
- while(dx < 0)
- {
- if(m_CursorPos.x > 0)
- {
- m_CursorPos.x --;
- dx++;
- }
- else
- {
- if(m_CursorPos.y > 0)
- {
- m_CursorPos.y --;
- m_CursorPos.x = 0;
- i = FindCurrentObject(&offs);
- lineLength = GetLineLength(i,offs);
- m_CursorPos.x = lineLength;
- dx++;
- continue;
- }
- else
- {
- rc = false;
- break; // cannot move left any more
- }
- }
- }
-// final adjustment:
- i = FindCurrentObject(&offs);
- lineLength = GetLineLength(i,offs);
- if(m_CursorPos.x > lineLength)
- {
- m_CursorPos.x = lineLength;
- rc = false;
- }
-#ifdef WXLAYOUT_DEBUG
- ShowCurrentObject();
-#endif
- return rc;