[scribus-dev] Some notes/questions about Scribus internals and my project

Cezary Grabski czarek at oferuje.pl
Mon May 23 05:39:01 UTC 2011


> 2) How does the current undo/redo system work? How do I implement
> undoable actions? Will I need to implement one (or several?) new
> UndoState classes?
> 
As I made undo for text last time I can answer you what I know about undo 
system in Scribus.
It is quite simple in idea - in UndoState are saved changed parameteres of 
item before and after changing. For example for undow moving PageItem in undo 
state is saved its start position and end position. On undo start position of 
PageItem will be restored. On redo end position will be restored again.

In implementation undo can be more complicated because in undostate only 
simple variables types can be saved - numbers and strings.
So for text undo, where in undostate must be saved text with all styles 
information, I prepare function which return all that information in string by 
"saxing" (like in SLA file, when all information is in human readable strings 
in tagged fashion, lets say semi-XML manner).

BTW I think you can dont care about undo at this state of developpment.
We were live with Scribus without undo for text by years, so we can live 
without undo for tables at the beginning. Undo for tables can be added later 
when all new tables code will be "stable", even by someone else.

cezaryece



More information about the scribus-dev mailing list