Undo/Redo (Project): Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
OK, try to explain how it works...
OK, try to explain how it works...


Whole text undo solution works depend of what we are change...
Whole text undo solution works depend of what we are change...<br />
1. whole text attributes (by select frame and change text properties in PP)
1. whole text attributes (by select frame and change text properties in PP)<br />
2. only selection of text in edit mode
2. only selection of text in edit mode<br />
a) selection of text
a) selection of text<br />
b) selection of paragraphs
b) selection of paragraphs<br />
c) insert/delete chars
c) insert/delete chars<br />
 
<br />
Before every change, state of changed text must saved for undo/redo purposes in field itemTextSaxed.
Before every change, state of changed text must saved for undo/redo purposes in field called "itemTextSaxed".<br />
After change, new state of text is saved.
After change, new state of text is saved.<br />
Function getItemTextSaxed returns portion of text needed by undo stored in QString (with styles).
Function "getItemTextSaxed" returns portion of text needed by undo stored in QString (with styles).<br />
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.
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.<br />
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.
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.<br />

Revision as of 06:45, 9 May 2012

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 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.