Undo/Redo (Project)

From Scribus Wiki
Jump to navigation Jump to search

Reference wiki pages

All Undo/Redo bugs ---->

<mantis> bugid = 11809,13779,12422,11134,13728,12194,12500,11550,13664,11634,11365,11114,12495,12451,12423,12392,12374,12276,12270,12251,12155,12043,11871,13286,13281,12657,12596,12568,12559,12539,12538,12425,3455,12223,12084,12082,12012,11989,11767,11619,11566,11247,11224,9890,8981,4353,13509,13195,13056,13017,12946,12600,12579,12531,12512,12491,12481,12427,12409,12397,12351,12320,12308,12307,12299,12248,12241,12236,12224,9591,13313,13543,13520,12458,13331,12225,9946,13083,12951,13015,12682,12779,12745,11881,11276, </mantis>


Undo/Redo 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 called "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.