RICHEDIT once again
Krzysztof Foltman
kfoltman at portal.onet.pl
Sun Jan 30 16:20:38 CST 2005
Rob Shearman wrote:
> No, the LocalAlloc/LocalFree/GlobalAlloc/GlobalFree functions are relics
> from the old days of Win16. You should use HeapAlloc/HeapFree.
True.
> Undo should be pretty easy as long as you can represent easily represent
> user actions in a transactions stack.
Yes, I know the undo basics. The most recent source has the basic stack
structure. :) It's still a bit complex, as, first, we have formatting to
store on the stack (linked actions are the way to go), and it's easy to
miss something, making undo fail in unusual circumstances.
> stack (although you would probably want some coalescing so that you
> don't have to undo each character you typed,
There's more: it's required by RICHEDIT API.
> sentence). The undo command will pop a transaction of the stack and
> apply the inverse.
Well, it can't apply the inverse ;) You need to push the inverse.
> However, there are a few superfluous typecasts.
Any examples ?
> In particular, please remove the ALLOC_OBJ macro because the name seems to suggest it does
> more than it actually does.
I'd prefer to rename the macro, and not remove it completely, it could
be used for tracking memory allocations one day. And I don't really like
the HeapAlloc API.
> This is just a
> suggestion and you may feel that it is easier to use your own.
The big advantage is that it's independent from Wine-specific API. Which
makes it more useful in non-Wine applications (the code is LGPLed, so
why not use it somewhere else ?).
> A few more comments wouldn't go amiss either.
Definitely. And to make things worse, not all FIXME's and XXXKF's are
still relevant. It asks for a cleanup. But, undo first (because it
involves even more major changes).
> What is the ParaStyle structure used for?
Currently, it's not used. It's a placeholder for keeping real paragraph
attributes, RICHEDIT's PARAFORMAT/PARAFORMAT2, part of which is
currently stored directly in ME_Paragraph (nAlign, nLeftMargin,
nRightMargin, nFirstMargin). The whole paragraph handling (para.c) needs
lots of work.
> Each character can have a different style, so why is
> there a paragraph style?
See above. The current content of the structure is irrelevant, and is a
kind of legacy from my misunderstanding of the relationship between
CHARFORMAT and PARAFORMAT.
Krzysztof
More information about the wine-devel
mailing list