On Tue, Nov 22, 2011 at 4:12 PM, Fons Adriaensen <fons(a)linuxaudio.org> wrote:
Yes, I see your point, and it makes a lot of sense. So
what would be
required is
* compute the new parameter value from
- a stored state in 'paramater space' rather than 'widget space'
- and pointer (mouse) gestures,
* update the widget according to that value.
its typically called Model-View-Controller programming. its not quite
the same MVC that people mean when they use it in connection with web
programming.
we use this model in ardour as much as possible, which is not say
everywhere, but many/most places.
But this is not how most (all) toolkits work.
You could probably use them in the way you suggest with some
extra effort.
for both Qt and GTK, you can simply override the default event
handlers to get this behaviour. its very easy.
But in many cases (e.g. linear sliders) the
pointer and widget would have to remain in sync visually,
which then means that your resolution in paramater space
can't be better than the visual one. Unless you allow the
pointer to move faster than the visual object it is controlling
(which is what I do in the 2-D panner, but it's possible only
because the widget is so small).
its can get quite a lot more complex than this. its not uncommon to
find cases where you want the on-screen view/control to be updated
*without* modifying the model. the canonical case of this in ardour
involves dragging regions around on screen. forget the canvas - there
can be clocks that show the current region position. these need to
update to show the motion of the region, but its vastly,
overwhelmingly too expensive to update the model (the backend, in
libardour) with every recorded mouse motion. so a rather complex
scheme is sometimes necessary wherein UI events change the state of
the view(s)/controller(s) without changing the model, and only at the
end of a gesture of some kind does the model finally update and things
go back to the regular dependencies.
this does make for some hellish code, though.