strokes support for GNOME



[resend, this list seems to not accept messages if you are not
subscribed, but it doesn't return an error either...]

Hi!

A well known EDA CAD toolset that has a realy nice feature: it
implements mouse strokes in all the programs in the toolset.

This a feature that would be excellent to have in GNOME as it improves
usability a lot!

The good news is that there already is a GPL implementation for
strokes, LibStroke:

http://www.etla.net/libstroke/

gEDA includes support for libstroke, its homepage it's at:
http://www.geda.seul.org/

The author Mark Willey <willey@etla.net> has said that he would like
very much for LibStroke to be included in GNOME.  He's also working on a
GNOME control and config program for LibStroke to make integration with
GNOME apps easy.

How do strokes work? You click the middle button of the mouse and then
drag it as you were drawing something, a thin line is drawn on the
screen, when you release the button the line is erased and the shape
you have drawn is matched against some predifined shapes, if it
matches then an acction associated with that shape is executed.


As an example a horizontal line drawn from right to left could mean
"Cancel",  one drawn from left to right could mean "Ok", one at 45
degree could mean "Zoom in", and one at 45 degree in the oposite sense
could mean "Zoom out". 

This is useful in very complex CAD packages, you won't need to go to a
toolbar, and pick a tool all the time (which means that you have to
move the mouse from the place on the screen were you are working if
you have a stroke that picks the last tool you used, or zooms in and
out, or undo, redo etc.). Even doing a right-click and then picking
something from a menu is not as easy, as it distracts your
attention. Or in a web browser if you have some strokes that do:
forward, backward, etc. you won't have to reach for the toolbar, you
can have the mouse anywhere.

This is implemented in Emacs-20.[23] (are you suprised? :-) 

To try this feature in emacs just do:
M-x strokes-mode RET
M-x load-file RET test.el RET

--test.el cut here--
;;   -*- Syntax: Emacs-Lisp; Mode: emacs-lisp -*-
(setq strokes-global-map '((((8 . 4)
			     (7 . 4)
			     (6 . 4)
			     (5 . 4)
			     (4 . 4)
			     (3 . 4)
			     (2 . 4)
			     (1 . 4)
			     (0 . 4))
			    . kill-buffer)
			   (((0 . 4)
			     (1 . 4)
			     (2 . 4)
			     (3 . 4)
			     (4 . 4)
			     (5 . 4)
			     (6 . 4)
			     (7 . 4)
			     (8 . 4))
			    . switch-to-buffer))
      )
--test.el up to here--


With this, if you draw a horizontal line with the middle button from
right to left it will kill the current buffer, if you do it from left
to right it will switch to another buffer. 

You can define your own strokes with: 
M-x global-set-stroke

How does the stroke recognition works?  You match the figure drawn
against a matrix. 

For a 3x3 matrix, using a notation like phone pad:

 1 2 3 
 4 5 6
 7 8 9

a "456" stroke is a horizontal line from left to right.
a "258" stroke is a vertical line

There are some some screenshots from an EDA tool that uses strokes at:
http://www.ics.uci.edu/~dann/strokes1.jpg
http://www.ics.uci.edu/~dann/strokes2.jpg

Having strokes implemented in GTK would be a very good thing, and have
a few strokes defined by default (like for Ok, Cancel, Copy, Paste, etc.)
then the applications could define more specialized strokes.

It should not be too hard to integrate it (the implementation in Emacs
is less than 1000 lines of elisp code, well if this is a valid
comparison...)  The LibStroke library interface is really simple as well.
Just send it a sequence of coordinates and it returns a string of numbers
to you.  Just look up the sequence of numbers in a table, and match it to
the command to execute.

We talked to Miguel about strokes, he seems to like the idea and
suggested to discuss this on the gnome-devel list.

What do you think about this? 

PS:  If you want to see how strokes work in real life, in the aforementioned
CAD program, we could do a live a demo for the interested people using VNC,
so you can see how useful and easy to use strokes are.  You can also
install the patch for FVWM2 available at the LibStroke page and try some
yourself.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]