bool px_ChangeHistory::didRedo(void) { xxx_UT_DEBUGMSG((" Doing didRedo void in PT undopos %d savePos pos %d iAdjustOffset %d \n",m_undoPosition,m_savePosition,m_iAdjustOffset)); if (m_bOverlap) { clearHistory(); return false; } if ((m_undoPosition - m_iAdjustOffset) >= m_vecChangeRecords.getItemCount()) return false; PX_ChangeRecord * pcr = m_vecChangeRecords.getNthItem(m_undoPosition - m_iAdjustOffset); // leave records from external documents in place so we can correct if (pcr && !pcr->isFromThisDoc() && (m_iAdjustOffset == 0)) return false; if (m_iAdjustOffset > 0) { m_iAdjustOffset--; xxx_UT_DEBUGMSG(("AdjustOffset decremented -3 redo %d ", m_iAdjustOffset)); } else { xxx_UT_DEBUGMSG(("Undo Position incremented in redo \n")); m_undoPosition++; } if (pcr && !pcr->getPersistance()) m_savePosition++; return true; }
bool px_ChangeHistory::didUndo(void) { xxx_UT_DEBUGMSG((" Doing Undo void in PT undopos %d savePos pos %d \n",m_undoPosition,m_savePosition)); if (m_bOverlap) { clearHistory(); return false; } UT_return_val_if_fail(m_undoPosition > 0, false); UT_return_val_if_fail(m_undoPosition - m_iAdjustOffset > m_iMinUndo, false); PX_ChangeRecord * pcr = m_vecChangeRecords.getNthItem(m_undoPosition-m_iAdjustOffset-1); UT_return_val_if_fail(pcr && pcr->isFromThisDoc(), false); if (m_iAdjustOffset == 0) m_undoPosition--; pcr = m_vecChangeRecords.getNthItem(m_undoPosition-m_iAdjustOffset); if (pcr && !pcr->getPersistance()) { UT_return_val_if_fail(m_savePosition > 0,false); m_savePosition--; } return true; }