Hi,
still working on my specialized browser I'm starting to implement the gui part of the application. Three questions:
- Can I update (redraw) a pane without activating it with the mouse? "(window-refresh pane)" doesn't actually draw unless the window gets activated in the window-manager).
- How can I implement scrolling in the pane? The scroll bars are there but they don't get updated if I draw off the visible region of the pane.
- Is there a straightforward way to get a reference to an output record upon creation of the output record (to store it in the object which gets presented)?
I can get it by searching the list of all output records in a pane and compare it's object slot to the object, but that seems rather inefficient, especially since newly allocated output records are appended to the end of the list. Currently I'm creating the output records in a loop of "draw-line*" embedded in "(with-output-as-presentation)".
Maybe I'm doing it wrong by trying to access the output records themselves. This is the idea: I want to present graphical objects and change the shape of some of them using incremental redisplay. As far as I see, this should be done by deleting the respective output record and redrawing it with the new properties.
Can anybody help? Sorry if I'm missing the obvious...
Thanks, Orm
On Mon, May 4, 2009 at 8:08 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
Hi,
still working on my specialized browser I'm starting to implement the gui part of the application. Three questions:
- Can I update (redraw) a pane without activating it with the mouse?
"(window-refresh pane)" doesn't actually draw unless the window gets activated in the window-manager).
That sounds very odd. I could speculate at causes, but McCLIM's definition of window-refresh looks suspect anyway. I recommend using (repaint-sheet stream (window-viewport stream)) instead of window-refresh. Possibly there's a buffering issue, but in most circumstances McCLIM takes care of that for you. Try calling finish-output on the stream after drawing.
- How can I implement scrolling in the pane? The scroll bars are there
but they don't get updated if I draw off the visible region of the pane.
After drawing on the pane, at some point the pane has to be resized to fit the output. McCLIM tries to do this itself at appropriate times (such as at the end of lines of text, after calling the display function, or table/graph formatting), but this is somewhat expensive so the various drawing functions don't do it automatically. In particular, if you're working outside the normal paradigm of display functions, you might have to do this manually. One way is to call change-space-requirements on the pane with a width determined from the bounding rectangle of the stream-output-history. A shorter way is to call climi::fit-pane-to-output, which is what mcclim calls internally.
- Is there a straightforward way to get a reference to an output
record upon creation of the output record (to store it in the object which gets presented)?
with-output-as-presentation returns the output record of the presentation. If you mean it's the output record of the drawn lines you want, I don't know of a good way of obtaining those as such. What I do is to draw things inside with-new-output-record, which will return a standard-sequence-output-record containing your drawing, then come back and add/remove things from this record or delete it altogether.
Maybe I'm doing it wrong by trying to access the output records themselves. This is the idea: I want to present graphical objects and change the shape of some of them using incremental redisplay. As far as I see, this should be done by deleting the respective output record and redrawing it with the new properties.
I do this sort of thing all the time (directly manipulating output records) and it's a powerful approach. Incremental redisplay is a higher level facility intended to spare you from the lower level details of dealing directly with output records, using updating-output to handle caching and update of sections of the output. There might be some confusion of terminology here. Perhaps using the higher level facilities will make things simpler. I personally always go the lower level route that you seem to be taking (mostly because I understand the output recording code quite well and like to maintain complete control), but other software like Climacs and the inspector have used incremental redisplay to good effect.
On Tue, 2009-05-05 at 04:30 +0000, Andy Hefner wrote:
On Mon, May 4, 2009 at 8:08 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
Hi,
Hi Orm,
still working on my specialized browser I'm starting to implement the gui part of the application. Three questions:
- Can I update (redraw) a pane without activating it with the mouse?
"(window-refresh pane)" doesn't actually draw unless the window gets activated in the window-manager).
Just a shot into the dark: are you using a "fancy" window system with a composition manager (like compiz or the like)? This could be caused by a broken heuristic off when the composition manager needs to redraw the screen from the buffer.
Cheers, RalfD
That sounds very odd. I could speculate at causes, but McCLIM's definition of window-refresh looks suspect anyway. I recommend using (repaint-sheet stream (window-viewport stream)) instead of window-refresh. Possibly there's a buffering issue, but in most circumstances McCLIM takes care of that for you. Try calling finish-output on the stream after drawing.
- How can I implement scrolling in the pane? The scroll bars are there
but they don't get updated if I draw off the visible region of the pane.
After drawing on the pane, at some point the pane has to be resized to fit the output. McCLIM tries to do this itself at appropriate times (such as at the end of lines of text, after calling the display function, or table/graph formatting), but this is somewhat expensive so the various drawing functions don't do it automatically. In particular, if you're working outside the normal paradigm of display functions, you might have to do this manually. One way is to call change-space-requirements on the pane with a width determined from the bounding rectangle of the stream-output-history. A shorter way is to call climi::fit-pane-to-output, which is what mcclim calls internally.
- Is there a straightforward way to get a reference to an output
record upon creation of the output record (to store it in the object which gets presented)?
with-output-as-presentation returns the output record of the presentation. If you mean it's the output record of the drawn lines you want, I don't know of a good way of obtaining those as such. What I do is to draw things inside with-new-output-record, which will return a standard-sequence-output-record containing your drawing, then come back and add/remove things from this record or delete it altogether.
Maybe I'm doing it wrong by trying to access the output records themselves. This is the idea: I want to present graphical objects and change the shape of some of them using incremental redisplay. As far as I see, this should be done by deleting the respective output record and redrawing it with the new properties.
I do this sort of thing all the time (directly manipulating output records) and it's a powerful approach. Incremental redisplay is a higher level facility intended to spare you from the lower level details of dealing directly with output records, using updating-output to handle caching and update of sections of the output. There might be some confusion of terminology here. Perhaps using the higher level facilities will make things simpler. I personally always go the lower level route that you seem to be taking (mostly because I understand the output recording code quite well and like to maintain complete control), but other software like Climacs and the inspector have used incremental redisplay to good effect.
mcclim-devel mailing list mcclim-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
Hi Andy,
thanks for your post, your insight and the explanations saved me hours! You're right about the confusion on my part about incremental redisplay. I thought it is a generic term and didn't exactly understand the way it is implemented in clim. I found out about the mechanism of updating-output yesterday and got a working example (and a vague idea, how it works internally). The mechanism is amazing and can probably save lots of coding time, but it might be a little too expensive. IIUC a redisplay function has to traverse all output records in order to find out which ones have changed. That might be too inefficient when doing redraws of changing records during pointer-motion, but I'll see about that.
I will also check your suggestions about window redrawing. I found out that a call to force-output on the pane will do the redraw on my system (Linux/X11).
-- Orm
Am Dienstag, den 05. Mai 2009 um 04:30:52 Uhr (+0000) schrieb Andy Hefner:
On Mon, May 4, 2009 at 8:08 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
Hi,
still working on my specialized browser I'm starting to implement the gui part of the application. Three questions:
- Can I update (redraw) a pane without activating it with the mouse?
"(window-refresh pane)" doesn't actually draw unless the window gets activated in the window-manager).
That sounds very odd. I could speculate at causes, but McCLIM's definition of window-refresh looks suspect anyway. I recommend using (repaint-sheet stream (window-viewport stream)) instead of window-refresh. Possibly there's a buffering issue, but in most circumstances McCLIM takes care of that for you. Try calling finish-output on the stream after drawing.
- How can I implement scrolling in the pane? The scroll bars are there
but they don't get updated if I draw off the visible region of the pane.
After drawing on the pane, at some point the pane has to be resized to fit the output. McCLIM tries to do this itself at appropriate times (such as at the end of lines of text, after calling the display function, or table/graph formatting), but this is somewhat expensive so the various drawing functions don't do it automatically. In particular, if you're working outside the normal paradigm of display functions, you might have to do this manually. One way is to call change-space-requirements on the pane with a width determined from the bounding rectangle of the stream-output-history. A shorter way is to call climi::fit-pane-to-output, which is what mcclim calls internally.
- Is there a straightforward way to get a reference to an output
record upon creation of the output record (to store it in the object which gets presented)?
with-output-as-presentation returns the output record of the presentation. If you mean it's the output record of the drawn lines you want, I don't know of a good way of obtaining those as such. What I do is to draw things inside with-new-output-record, which will return a standard-sequence-output-record containing your drawing, then come back and add/remove things from this record or delete it altogether.
Maybe I'm doing it wrong by trying to access the output records themselves. This is the idea: I want to present graphical objects and change the shape of some of them using incremental redisplay. As far as I see, this should be done by deleting the respective output record and redrawing it with the new properties.
I do this sort of thing all the time (directly manipulating output records) and it's a powerful approach. Incremental redisplay is a higher level facility intended to spare you from the lower level details of dealing directly with output records, using updating-output to handle caching and update of sections of the output. There might be some confusion of terminology here. Perhaps using the higher level facilities will make things simpler. I personally always go the lower level route that you seem to be taking (mostly because I understand the output recording code quite well and like to maintain complete control), but other software like Climacs and the inspector have used incremental redisplay to good effect.
On Tue, May 5, 2009 at 9:09 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
I will also check your suggestions about window redrawing. I found out that a call to force-output on the pane will do the redraw on my system (Linux/X11).
Out of curiousity, which implementation of lisp are you using? McCLIM is supposed to flush the CLX buffers before going to sleep to wait for events, but this is one of the areas where threaded/unthreaded builds of McCLIM differ, and my impression is that all the active developers use lisps with threading enabled, so the single process path doesn't get tested so often. Maybe it got overlooked.
Hi Andy,
Am Tuesday, den 05. May 2009 um 21:51:45 Uhr (+0000) schrieb Andy Hefner:
Out of curiousity, which implementation of lisp are you using? McCLIM
I use sbcl, version 1.0.18 (Ubuntu build) and have no idea, whether threading is enabled in sbcl or the mcclim build. How do I find out?
-- Orm
In *features*, :sb-thread is present in builds with threads (and also :clim-mp, once mcclim is loaded).
On Wed, May 6, 2009 at 6:13 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
Hi Andy,
Am Tuesday, den 05. May 2009 um 21:51:45 Uhr (+0000) schrieb Andy Hefner:
Out of curiousity, which implementation of lisp are you using? McCLIM
I use sbcl, version 1.0.18 (Ubuntu build) and have no idea, whether threading is enabled in sbcl or the mcclim build. How do I find out?
-- Orm