A program I'm working on uses a GTK main window to view an underlying gnome 
canvas object.  The canvas is wider than the part of it that's visible at any 
given time, so a horizontal scrollbar can be used to scroll the canvas, 
leftwards or rightwards.  The effect is similar to a multitrack audio tape.  
Like the tape analogy, the user needs to be able to "fast-forward" and "rewind" 
(by dragging the scrollbar) but also, the canvas needs to scroll continuously 
in time (i.e. programatically) to simulate time-based movement (like a tape 
that's "playing").  There are two ways to achieve the "playing" effect:-

1) Every 1/30th second or thereabouts, erase all the objects on the canvas and 
redraw them, slightly to the left of their former positions.  This works quite 
well if the canvas only contains a small number of objects but if too many 
objects need to be redrawn, it soon becomes unwieldy and the movement ends up 
looking very jerky.

2) Draw all the objects onto a very wide canvas.  Every 1/30th second, 
reposition the viewport so that it's slightly to the right of its previous 
position (analogous to programatically setting the current position of the 
scrollbar).  This also works and gives a much smoother scrolling effect.

Now for the problem....  when in "playback" mode, I'd like the viewport to have 
a vertical "now line" (similar to the play head on a tape recorder).  At the 
moment, this is drawn onto the canvas.  Therefore every 1/30th second, it needs 
to be erased, then the viewport needs to be adjusted, then the "now line" needs 
to be redrawn.  This produces a very flickery now line.

In an ideal world, I'd like the now line to be a viewport object, rather than a 
canvas object.  The viewport would ideally contain some kind of transparent 
pane (with the now line drawn on it) and the canvas would be viewable through 
the pane's transparent part.  The pane would be treated like a foreground 
object (so as to be permanently visible) with a fixed position, relative to the 
viewport, whereas the canvas would have a variable position, relative to the 
viewport.

Off the top of my head, I can't think of any gtk widget that's designed for 
this purpose.  Has anyone ever seen a project with this kind of feature?  Or 
can anyone suggest a feasible strategy I could try?

Thanks,

John
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to