[CM] Re: Play Head (SND-8.3)

Bill Schottstaedt bil@ccrma.Stanford.EDU
Thu, 3 Aug 2006 04:54:12 -0700


> * Ctrl + mouse click works with buttons 1, 2, 3 but not with 4 and 5 (wheel). In 
> SoundForge the wheel zooms horizontally, and ctrl+wheel zooms vertically. Is it 
> a X, gtk, gtk-guile or a snd bug? 
> * I don't know how to handle double-click... is it possible? 

In Snd, a mouse click can be handled with the mouse-click-hook:

  (add-hook! mouse-click-hook (lambda (snd chn button state x y axis) ...))

where "button" is an integer, and "state" includes a bit (4) for the control
key.  So, (if (and (= button 5) (not (= (logand state 4) 0))) control-button-5-code)
There's nothing built into Snd regarding buttons 4 and 5.

Double clicks might be harder -- I don't think the mouse-click-hook has
an easy way to tell that the current event represents a double click.
You could get (and save) the event time, and look for a fast second
event, or go down a level and set up event handlers directly in Gtk or Motif.
Both toolkits have a double click time (milliseconds, if I remember
right) to distinguish between a double click and a fast sequence of single
clicks, and the event handler is passed the time of the mouse press.
This sounds like a good example for the manual...