Re: ScrolledWindow, DrawingArea, and setting step-increment

2013-11-12 Thread Gabriele Greco

 I'm developing a MUD client in Pike, using GTK2 for the UI, and
 there's an aspect of scrolling that's bugging me. The display uses
 discrete lines of text of a fixed height (or, to be more technically
 accurate, a fixed distance from the start of one line to the start of
 the next), and I'd really like the scrolling to be done in lines


I suggest you to use GtkTextView for your text output, thank to GtkTextTag
it's flexible enough to do everything a mud client needs, also blinking
text, it scrolls at line boundaries and let you keep thousands of lines of
textbuffer without slowdowns.

For an example of ANSI16 parser/output with GtkTextView using GTK2 you can
look at my own mud client ( source
http://sourceforge.net/p/ggmud/code/HEAD/tree/trunk/ggmud/ ).

I think most of the code you may be interested in is in ansi.c  window. c.

--
Bye,
 Gabry
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: ScrolledWindow, DrawingArea, and setting step-increment

2013-11-12 Thread Chris Angelico
On Wed, Nov 13, 2013 at 4:44 AM, Gabriele Greco gabriele.gr...@darts.it wrote:
 I suggest you to use GtkTextView for your text output, thank to GtkTextTag
 it's flexible enough to do everything a mud client needs, also blinking
 text, it scrolls at line boundaries and let you keep thousands of lines of
 textbuffer without slowdowns.

Hmm. I used to have something using that, in one of the early tests,
but there was either a critical performance problem, or something I
couldn't do with it. Can that handle mark-and-copy, clickable URLs,
and so on? Or possibly it's that you say thousands there; to me,
thousands of lines is just barely getting started. My current session
in Gypsum has barely started and I already have 50K lines; my RosMud
session currently has 300K lines of scrollback; and I've noted as an
unsolvable RosMud bug that it's unacceptably slow adding the
16,777,216th line to the buffer (because it does a naive
double-and-move-pointers operation). Unfortunately I don't have (or
can't find) my notes on exactly what was wrong there, but there were
some issues on Windows that I had to warp my code around. (Gypsum is
slated as a replacement for RosMud, a Windows client, so it has to be
at least plausibly equivalent in performance and functionality. Being
awesome on Linux and abysmal on Windows isn't good enough.)

I'm currently looking at whether it's worth bypassing the
ScrolledWindow and simply putting an Hbox with the DrawingArea and a
Scrollbar, and managing the scroll position myself. That might be
easier, I don't know; is there a way to blit a DrawingArea's contents?
I can't find anything. (It'd make scrolling a lot quicker and smoother
if I could say move this bit here.)

ChrisA
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list