[openbeos] more CharacterSet and StyledEdit news
- From: "Andrew Bachmann" <andrewbachmann@xxxxxxxxx>
- To: "openbeos" <openbeos@xxxxxxxxxxxxx>
- Date: Sun, 27 Jul 2003 15:40:34 -0700 PDT
- CharacterSet news
Thanks to Axel and Ingo for their advice on restructuring the CharacterSet and
CharacterSetRoster. I did as we discussed and created a new library
libtextencoding.so. It's built
from the sources in src/kits/support. It does have convert_to_utf8 and
convert_from_utf8
functions but they are currently simply stubs. In addition to those, it has
BCharacterSet and
BCharacterSetRoster which are defined in the BPrivate namespace.
BCharacterSet is very similar to my earlier proposal, except that it now has a
CountAliases()
function and a AliasAt(uint32 index) function. It also has two new
constructors, a default
constructor, and a constructor providing all the fields. The class is doxygen
documented in the
header, which is at private/support/CharacterSet.h.
BCharacterSetRoster is a bit different from before. I followed Ingo's advice
and made it a
lightweight stateful object. (one int) It performs iterator through the
functions
GetNextCharacterSet(BCharacterSet * charset) and RewindCharacterSets(). I
rewrote
StyledEdit to use these iterators.
BCharacterSetRoster also has 3 static functions for retrieving character sets
in constant time.
(from FontID, ConversionID, or MIBenum) It has two functions for retrieving
character sets in
linear time by PrintName or by standard name. (IANA, MIME, or a known alias)
The retrieval
functions have not been well exercised.
Lastly BCharacterSetRoster has two possibly superfluous functions:
StartWatching and
StopWatching. I put these in because of my concern that we are going to have
an unweildy
number of character sets. Presenting all of these character sets in menus in
Terminal, StyledEdit,
BeMail, etc., could get ugly. It's not too much of a problem yet but I was
thinking perhaps it could
be possible for us to have a character set pref that would allow the user to
select the character
sets that they commonly use. Of course, such a pref would be live and if the
user changed that set,
then applications which have encodings menus would like to be notified so they
can change
their menus appropriately. Since this would obviously be an R2 feature I have
left it with stub
implementations (return B_ERROR). Also the whole idea needs to be discussed,
etc.
- StyledEdit news
And for those watching, I did promise some more StyledEdit news and here it is.
Printing works
now. I mean, works, like, works real good. You can even print selected pages.
Print in color,
print wacky fonts, etc. The behavior is dpi perfect to R5 StyledEdit as far as
I can tell, even
down to the buggy printing of right-aligned text. (Perhaps OBOS BTextView
isn't buggy this
way?)
In addition to printing I added in cancelling via escape on the find/replace
windows. (thanks
Technix for pointing that out) I've also revamped the find window so that it
is font sensitive.
The window doesn't change its size in response to the font size (maybe it
should?) But the items
on it are all layed out so that they will be legible at sizes up to about 18.
(For those wanting to set
their system font to 13+ pixels I point you to FontSelector on bebits:
http://www.bebits.com/app/
267 ) Compare the behavior with R5 StyledEdit and you can appreciate it
better. :-)
The replace window hasn't been made font-sensitive yet though. Also, the
border effect on the
OBOS Find window is slightly different than the R5 Find window. I can't figure
out how to
replicate the R5 effect yet. All my pixel tweaks have failed so far.
As I said before StyledEdit has been changed to use the new
CharacterSet-related headers and
implementation. Since there isn't a working convert_to_utf8, etc., yet for
libtextencoding.so, I
linked the relevant files directly into StyledEdit. So, OBOS StyledEdit is
very usable now on R5.
It's also a little bit bigger than it needs to be, but still smaller than the
R5 StyledEdit. :-) As usual,
I'm sharing a built copy on beshare:StyledEdit.zip@Andrew and it's all in cvs
of course.
Andrew Bachmann
- Follow-Ups:
- [openbeos] Re: more CharacterSet and StyledEdit news
- From: Ingo Weinhold
Other related posts:
- » [openbeos] more CharacterSet and StyledEdit news
- » [openbeos] Re: more CharacterSet and StyledEdit news
- [openbeos] Re: more CharacterSet and StyledEdit news
- From: Ingo Weinhold