comparison scripts/plot/__fltk_ginput__.m @ 11194:b8585f8e11d5

__fltk_ginput__.m: Use semicolons to prevent internal function evaluations being output to screen.
author Rik <octave@nomad.inbox5.com>
date Thu, 04 Nov 2010 13:34:58 -0700
parents 8b9aeb20c03c
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11193:364ef2eb2499 11194:b8585f8e11d5
27 27
28 if (isempty (get (f, "currentaxes"))) 28 if (isempty (get (f, "currentaxes")))
29 error ("ginput: must have at least one axes"); 29 error ("ginput: must have at least one axes");
30 endif 30 endif
31 31
32 x = []; 32 x = y = button = [];
33 y = [];
34 button = [];
35 ginput_aggregator (0, 0, 0); 33 ginput_aggregator (0, 0, 0);
36 34
37 unwind_protect 35 unwind_protect
38 36
39 orig_windowbuttondownfcn = get (f, "windowbuttondownfcn"); 37 orig_windowbuttondownfcn = get (f, "windowbuttondownfcn");
62 end_unwind_protect 60 end_unwind_protect
63 61
64 endfunction 62 endfunction
65 63
66 function [x, y, n] = ginput_aggregator (mode , xn, yn) 64 function [x, y, n] = ginput_aggregator (mode , xn, yn)
67 persistent x y n 65 persistent x y n;
68 66
69 if (mode == 0), 67 if (mode == 0)
70 x = []; 68 x = [];
71 y = []; 69 y = [];
72 n = 0; 70 n = 0;
73 elseif (mode == 1) 71 elseif (mode == 1)
74 x = [x, xn]; 72 x = [x; xn];
75 y = [y, yn]; 73 y = [y; yn];
76 n += 1; 74 n += 1;
77 elseif (mode == 2) 75 elseif (mode == 2)
78 n = -1 76 n = -1;
79 endif 77 endif
80 endfunction 78 endfunction
81 79
82 function ginput_windowbuttondownfcn (src, data) 80 function ginput_windowbuttondownfcn (src, data)
83 point = get (get (src,"currentaxes"), "currentpoint"); 81 point = get (get (src,"currentaxes"), "currentpoint");
84 ginput_aggregator (1, point(1,1), point(2,1)); 82 ginput_aggregator (1, point(1,1), point(2,1));
85 endfunction 83 endfunction
86 84
87 function ginput_keypressfcn (src, evt) 85 function ginput_keypressfcn (src, evt)
88 if (evt.Key == 10) 86 if (evt.Key == 10) # linefeed character
89 ginput_aggregator (2, 0, 0) 87 ginput_aggregator (2, 0, 0);
90 endif 88 endif
91 endfunction 89 endfunction
92 90