On Wed, 29 Nov 2006, Forest Bond wrote:
> On Wed, Nov 29, 2006 at 04:35:45AM +0100, Kjetil S. Matheussen wrote:
>> Forest Bond:
>>> I am using snd-ls 0.9.7.12. I have searched through documentation, and
>>> fail to
>>> see how I can define the end point of a selection started with C-space.
>>> Am I
>>> missing something? I would like to move the cursor into position, press
>>> C-space, move the cursor to a new position, and press some key to have the
>>> selection end there. I am expecting to see a high-lighted selection at
>>> the end
>>> of that process.
>>
>> I don't know if theres anything built in, but its relatively easy to add a
>> keybinding to do it yourself.
>>
>> To let C-space select both start and end of selection plus cancel it, put
>> the following lines into your .snd-ls file:
>>
>> (bind-key (char->integer #\ ) 4
>> (let ((selstart #f))
>> (lambda ()
>> (let ((set-selstart! (lambda ()
>> (report-in-minibuffer (format #f
>> "Selection start at ~A" (cursor)))
>> (set! selstart (cursor)))))
>> (if (c-selection?)
>> (begin
>> (set! (selection-member? #t) #f)
>> (set-selstart!))
>> (if selstart
>> (begin
>> (c-set-selection! (c-selected-sound) 0 (min
>> selstart (cursor)) (max selstart (cursor)))
>> (report-in-minibuffer "")
>> (set! selstart #f))
>> (set-selstart!)))))))
>> (load-from-path "snd_conffile.scm")
>
> Hmm. I definately wouldn't have come up with that.
Well. :-)
It was ment to be a complete well-working example. You could get away with
something like this:
(bind-key (char->integer #\n) 4
(lambda ()
(set! (selection-frames) (- (cursor) (selection-position))))))
but the first one is much better. And this one is even better:
(bind-key (char->integer #\ ) 4
(lambda ()
(let* ((snd (c-selected-sound))
(old-selstart (c-get snd 'c-space-selstart #f))
(new-selstart (cursor)))
(cond ((c-selection?)
(set! (selection-member? #t) #f))
(old-selstart
(c-set-selection! (c-selected-sound) 0 (min old-selstart new-selstart) (max old-selstart new-selstart))
(set! new-selstart! #f)))
(report-in-minibuffer (if new-selstart
(format #f "Selection starts at ~A" new-selstart)
""))
(c-put snd 'c-space-selstart new-selstart)))))
> How do people normally
> terminate a selection? Or is it just always done with the mouse?
Yeah, I just use the mouse. Its not very efficient, but I don't
terminate a selection very often. I'm going to add the above code
to snd-ls though.
> If so, why
> have the default C-space binding at all?
>
Don't know...
Received on Wed Nov 29 20:15:02 2006
This archive was generated by hypermail 2.1.8 : Wed Nov 29 2006 - 20:15:03 EET