Undo/Redo (Project)

=early draft=

It is hard to edit this while there is not working copy/paste between QtCreator and this Wiki page....

=Undo for Text Frames=

OK, try to explain how it works...

Whole text undo solution works depend of what we are change... 1. whole text attributes (by select frame and change text properties in PP) 2. only selection of text in edit mode a) selection of text b) selection of paragraphs c) insert/delete chars

Before every change, state of changed text must saved for undo/redo purposes in field itemTextSaxed. After change, new state of text is saved. Function getItemTextSaxed returns portion of text needed by undo stored in QString (with styles). Undo State created for each text change has few values needed be undo/redo operation like range of change (whole story, paragraph, selection or char) old text, new text and cursor position. To avoid storing many undo steps while change is same type (eg inserting chars or changing typographic values by multiply changing spinboxes in Properties Palette) lastUndoAction variable is used. If current action is same as last one only new state of text is updated in last created Undo State. If user move cursor in new place or change Doc->appMode to/from modeEdit lastUndoAction is cleared (by PageItem_TextFrame::clearLastUndoAction) and then new Undo State will be created.