[openbeos] Re: StyledEdit news of various interest

  • From: "Andrew Bachmann" <shatty@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 16 Jul 2003 14:41:40 -0700 PDT

> On Tue, 15 Jul 2003 23:01:54 -0700 PDT "Andrew Bachmann" <
> shatty@xxxxxxxxxxxxx> wrote:
> > OBOS StyledEdit now stands as an example of how to use this 
> > functionality.  I'm hoping that 
> > something like this could be made a standard through beunited.  
> > However I don't really hope 
> > that this particular interface/implementation makes it. :-)
> 
> Well, if the naming and some details would be adjusted to be more BeOS-
> like, I think, it can go into our libbe as a private API for the time 
> being. :-)

Yeah I have been picking up some un-beos habits from my co-workers
since I have been spending a lot of time doing my real job lately. :-)
Putting it into libbe.so seems okay, or perhaps libtextencoding.so ?

> > Although it works, it may be 
> > preferable to support a different enumeration interface than the 
> > method I chose at the time.  
> 
> The typical roster interface for enumeration would be more like:
> 
>   status_t GetNextCharacterSet(BCharacterSet *charSet);
>   void RewindCharacterSets();

Yeah this is more like what I was thinking of.  Possibly with a cookie
arg?

> If the roster really keeps all of them in memory all the time, the 
> interface would be similar to yours:
> 
>   int32 CountCharacterSets() const;
>   const BCharacterSet *CharacterSetAt(int32 index) const;

I'd prefer not to use this type of interface since the roster already supports
three types of integer ids and indices only adds one more to the mix. :-(

> > Also, the set of character sets is hard-coded into CharacterSet.cpp.  
> > I think it would be superior to 
> > have it read from a file.
> 
> Sure. BTW, this sounds like another service, that could be provided by 
> the registrar. Then the application doesn't need to parse the file, but 
> would get the data from the registrar.

Yup.

> [...]
> > Warning: potential R2 issue + opinion ahead. :-)
> > 
> > In my opinion this functionality probably should be relocated, and 
> > moved into existing 
> > BTranslationUtils functions or new functions, possibly accepting 
> > BFile instead of BPositionIO.  
> 
> Or we could extend BPositionIO (or even BDataIO?) the way Dano did, by 
> {Read,Write}MetaData() methods, which, given the underlying object is 
> indeed a BFile, would be mapped to {Read,Write}Attr().

Okay, that sounds relatively happy to me.

> 
> > BTextView should be expanded to support SetEncoding/Encoding.
> 
> Mmh, is that really necessary? I always found it compelling, that the 
> BeOS always uses UTF8 throughout the whole API, providing conversion 
> functions for other encodings only.

Ah, I agree.  Somehow or another I was thinking GetStyledText was a
BTextView method.  However, it is not.  As such a better solution would
probably be to add an optional argument to GetStyledText which is the
encoding.  This puts the burden on the app developer if they want to
save out in the encoding that it was loaded in, but I don't feel too bad
about doing that.

> The problem is not BTextView. It displays the CRs properly (er... as 
> ugly box) -- also in OBOS StyledEdit (just copy one from R5 
> StyledEdit). I suspect BTranslationUtils::GetStyledText() screws it up, 
> replacing CRs by LFs, thus duplicating the newlines. The OBOS 
> counterpart doesn't do this. E.g. running StyledEdited with our 
> libtranslation.so, e.g. by

Arggg.. you're right.  It's yet another R5 GetStyledText bug.

>   LIBRARY_PATH=distro/x86.R1/beos/system/lib:$LIBRARY_PATH distro/
> x86.R1/beos/apps/StyledEdit
> 
> makes it work properly.
> 
> BTW, read-only files aren't handled correctly. The R5 StyledEdit 
> doesn't allow editing them, while OBOS StyledEdit does.

Interesting.  But is the best solution to not allow editing at all, or just not
to allow saving over a read-only file? (or both)

> > In the meantime, please try the OBOS StyledEdit encoding features and 
> > let me know if you have 
> > any problems.
> 
> BTW, wouldn't it be a good idea to call the thing beta, put a binary 
> somewhere, and set up a news item. I guess Sikosis would be the one to 
> bother. :-)
> 
> CU, Ingo
> 

I put the binary in my beshare shares. :-)  But a more accessible one + news
item is a good idea. (+ pointer to bug list)

Andrew


Other related posts: