I do have one minor glitch, however. It tends to leave a few random
"ghost" insertion marks (I haven't found a pattern, yet).
This is the code I use to select the misspelled word:
m_pView->cmdUnselectSelection();
m_pView->moveInsPtTo((PT_DocPosition) (m_pBlock->getPosition() +
m_iWordOffset));
m_pView->extSelHorizontal(UT_TRUE, (UT_uint32) m_iWordLength);
and this replaces the misspelled word with the user's correction:
m_iWordLength = UT_UCS_strlen(newword);
result = m_pView->cmdCharInsert(newword, m_iWordLength);
I also toss this in after every encounter with a misspelled word:
m_pView->updateScreen();
but it didn't seem to help. Selecting the text with the mark does get
rid of it.
The suggestions on performing these actions that were given to me before
required access to protected functions in the FV_View object, so I
couldn't use them from the dialog (without specially extending View,
anyway).
Could I cause problems with the cmdUnselectSelection, when nothing is
selected? Or maybe I need to clear the selection, delete the existing
word, and the write the one?
> Could you also include a web-friendly screenshot of your dialog, so that all
> the platforms can look the same?
I'll post a URL tomorrow as well. I basically have a look which is very
close to the one used by Office, with a couple functionality improvements
(I think at least).
As for internationalization, I use the string ID's for everything.
Also, I wrote two functions (convertFromMB and convertToMB) which convert
from Abiword's internal UCS (2 byte Unicode) to UTF-8 (multibyte
encodings). GTK+ uses multibyte internally (according to some
documentation I read on the GNOME site). They make use of the wctomb and
mbtowc libc functions, so I kept them in the unix side of the dialog code
(I'm not sure if BeOS and Windows support those functions).
Anyway, something similar might be useful xap-wide.
> 2. By contrast, I'm pretty sure "ignore all" only makes sense as
> per-document functionality. If you never want a particular word flagged in
> any document, add it to your dictionary. If you don't want it flagged in
> *this* document, ignore all.
This just needs to be a hash table anyway. I'll add this next so that
Ignore All's are real. Also, I'll add the check down in fl_BlockLayout's
spell check code, so that the squiggles disappear when you do that.
Justin