[java-gnome-hackers] TextView frustrations
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2008-06-12 01:07:18
|
Well, maybe a quarter of the way into figuring out TextView, I have to note that I am vastly dissatisfied. It's an ugly API. I mean, sure TreeView/TreeModel were complex, but powerful and you could, once you'd wrapped your mind around it, deal with that complexity. TextView/TextBuffer on the other hand, are underwhelming. Whether the cursor is visible or not is a method on TextView, but placeCursor() is a method on TextBuffer. Oh, except for placeCursorOnscreen(), which is back on TextView. If you want to move a pointer forward you use TextIter's forwardLine(). Unless you want to move it forward a line in the Widget, in which case it's TextView's forwardDisplayLine(). And so on. Oh yeah - don't even try to make scrolling work sensibly. It's all pretty discouraging. With TreeViewColumn/CellRenderer we made a fairly significant API style change but one which introduced some real sanity to the family as a whole. I'm pretty pleased with how that worked out. With TextView/TextBuffer, however, I am at a bit of a loss. It doesn't feel right. Every time I try to use it to do something it is either not where I expect it to be or not there at all. So obviously I am feeling the temptation to "do something about it" but unlike before it is really not obvious what unifying vision would drive such a divergence. Even more obviously I must be missing something, but without someone who *knows* GtkTextView *really* well working on this it's been a bit tough. [I already have more than enough to drive what I wrote 4-5 years ago, but then I was just displaying text, not manipulating it] To this point Stefan Prelle has been contributing boat loads, and has done much of the grunt work. So we're getting there. What's missing is the big picture Anyone who has an interest in seeing TextView coverage in java-gnome would probably be of great help. There has been a bit of tinkering; changing scroll_to_mark and scroll_to_iter into a family of scrollTo() overrides seemed to make sense. It didn't help that it turns out that the real gtk_text_view_scroll_to_iter() is *busted* and doesn't work for shit. My work is available on the branch at 'hackers/andrew/textview' branch; and most of Stefan's contributions are included in there. That branch is *NOT* anywhere near merge ready, but you can at least tinker with it. This isn't 'mainline'; API subject to change, etc etc. AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management. We actively carry out research and development in these areas on behalf of our clients, and enable successful use of open source in their mission critical enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |