[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Undo framework
From:       Werner Trobin <trobin () kde ! org>
Date:       2001-02-09 10:02:12
[Download RAW message or body]

Andrea Rizzi wrote:
> 
> Hi all,
> as you know we (me and Ulrich) are planing a major rewrite of kformula.
> We want to know if exists a undo framework in koffice so that for example
> embedded formula in kword/kspread could use the kword/kspread undo stack.
> This is useful when you do not use the kformula part(and so its native
> undo) but only the library that must give the possibility of undo to
> kword/kspread.
> I think what we need is a common "Command" class (like the one of
> kpresenter) that each part/library can inherits and modify.

There is a command class in kdelibs/kdeui (and I suggest using that class
for native KFormula(part) undo/redo), but it won't be trivial to port all
apps to these classes. The problem is that we probably can't put it into
KoDocument so you'd need to have a small wrapper library for every
application... ugly.

What you could do easily (and this is also the way how undo/redo will
be done in KWord and KPresenter using the new text edit from Qt is:
add a signal (formulaChanged) and two slots (undo/redo) to the formula
"widget". Then the application author has to connect to that signal and
add a pseudo-command to his global command history on any change. As
soon as the user presses Undo/Redo and such a pseudo command is supposed
to be undone the program activates the undo slot from your "widget". Then
your library will undo the command using its local command history. This
is not very elegant, but it's one of the few ways to keep the "component"
structure.

-- 
Werner Trobin - trobin@kde.org
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic