Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / mouselab_2.dem
1 #
2 # $Id: mouselab_2.dem,v 1.1 2006/07/10 19:49:54 sfeam Exp $
3 #
4 # Wait for keystroke in plot window
5 #
6 pause mouse key
7 #
8 # Add new printable character to label
9 #
10 if (31 < MOUSE_KEY && MOUSE_KEY < 127) \
11     LABEL = LABEL.MOUSE_CHAR
12 #
13 # Add newline to label if input character was <cr>
14 #
15 if (MOUSE_KEY == 13) \
16     LABEL = LABEL."\n"
17 #
18 # Delete previous character from label on <backspace> or <delete>
19 #
20 if (MOUSE_KEY == 8 || MOUSE_KEY == 127) \
21     LABEL = LABEL[1:strlen(LABEL)-1]
22 #
23 # Allow arrow keys to tweak label position
24 # The GP_Up GP_Right GP_Down GP_Left (1008-1011) are defined in mousecmn.h
25 #
26 if (MOUSE_KEY == 1009) LABEL_Y = LABEL_Y + (GPVAL_Y_MAX-GPVAL_Y_MIN)/100.
27 if (MOUSE_KEY == 1010) LABEL_X = LABEL_X + (GPVAL_X_MAX-GPVAL_X_MIN)/100.
28 if (MOUSE_KEY == 1011) LABEL_Y = LABEL_Y - (GPVAL_Y_MAX-GPVAL_Y_MIN)/100.
29 if (MOUSE_KEY == 1008) LABEL_X = LABEL_X - (GPVAL_X_MAX-GPVAL_X_MIN)/100.
30 #
31 # Update label
32 #
33 set label LID LABEL at LABEL_X, LABEL_Y
34 replot
35 #
36 # DEBUG feedback 
37 #       print "<",MOUSE_KEY,">"
38 #
39 # Return to caller on <esc> or <tab>, otherwise loop
40 #
41 if (MOUSE_KEY != 27 && MOUSE_CHAR ne "  ") reread