Mercurial > octave
annotate scripts/plot/util/ginput.m @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 ## Copyright (C) 2008-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27225
diff
changeset
|
2 ## |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27225
diff
changeset
|
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27225
diff
changeset
|
4 ## or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27225
diff
changeset
|
5 ## |
7673 | 6 ## |
7 ## This file is part of Octave. | |
8 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24457
diff
changeset
|
9 ## Octave is free software: you can redistribute it and/or modify it |
7673 | 10 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24457
diff
changeset
|
11 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## (at your option) any later version. |
7673 | 13 ## |
14 ## Octave is distributed in the hope that it will be useful, but | |
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## GNU General Public License for more details. |
7673 | 18 ## |
19 ## You should have received a copy of the GNU General Public License | |
20 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24457
diff
changeset
|
21 ## <https://www.gnu.org/licenses/>. |
7673 | 22 |
23 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20249
diff
changeset
|
24 ## @deftypefn {} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20249
diff
changeset
|
25 ## @deftypefnx {} {[@var{x}, @var{y}, @var{buttons}] =} ginput () |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
26 ## Return the position and type of mouse button clicks and/or key strokes |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
27 ## in the current figure window. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
28 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
29 ## If @var{n} is defined, then capture @var{n} events before returning. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
30 ## When @var{n} is not defined @code{ginput} will loop until the return key |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
31 ## @key{RET} is pressed. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
32 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
33 ## The return values @var{x}, @var{y} are the coordinates where the mouse |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
34 ## was clicked in the units of the current axes. The return value @var{button} |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
35 ## is 1, 2, or 3 for the left, middle, or right button. If a key is pressed |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
36 ## the ASCII value is returned in @var{button}. |
20073
3b90259f17f3
Document that ginput() is intended for 2-D plots (bug #44427).
Rik <rik@octave.org>
parents:
19947
diff
changeset
|
37 ## |
3b90259f17f3
Document that ginput() is intended for 2-D plots (bug #44427).
Rik <rik@octave.org>
parents:
19947
diff
changeset
|
38 ## Implementation Note: @code{ginput} is intenteded for 2-D plots. For 3-D |
3b90259f17f3
Document that ginput() is intended for 2-D plots (bug #44427).
Rik <rik@octave.org>
parents:
19947
diff
changeset
|
39 ## plots see the @var{currentpoint} property of the current axes which can be |
3b90259f17f3
Document that ginput() is intended for 2-D plots (bug #44427).
Rik <rik@octave.org>
parents:
19947
diff
changeset
|
40 ## transformed with knowledge of the current @code{view} into data units. |
17483
710309214e0d
doc: Add seealso links between waitfor, waitforbuttonpress, and ginput.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
41 ## @seealso{gtext, waitforbuttonpress} |
7673 | 42 ## @end deftypefn |
43 | |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
44 function varargout = ginput (n = -1) |
7673 | 45 |
46 if (nargin > 1) | |
47 print_usage (); | |
48 endif | |
49 | |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
50 ## Create an axis, if necessary. |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
51 fig = gcf (); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
52 ax = gca (); |
7673 | 53 drawnow (); |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
54 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
55 if (isempty (ax)) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
56 error ("ginput: must have at least one axes"); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
57 endif |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
58 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
59 toolkit = get (fig, "__graphics_toolkit__"); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
60 toolkit_fcn = sprintf ("__%s_ginput__", toolkit); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
61 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
62 if (exist (toolkit_fcn)) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
63 varargout = cell (1, nargout); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
64 if (nargin == 0) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
65 [varargout{:}] = feval (toolkit_fcn, fig); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
66 else |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
67 [varargout{:}] = feval (toolkit_fcn, fig, n); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
68 endif |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
69 return |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
70 endif |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
71 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
72 x = y = button = []; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
73 ginput_accumulator (0, 0, 0, 0); # initialize accumulator |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
74 |
19947
6e5365ee200a
ginput: Fix for clicks outside axes and within multiple axes (bug #44426)
Mike Miller <mtmiller@octave.org>
parents:
19764
diff
changeset
|
75 orig_windowbuttondownfcn = get (fig, "windowbuttondownfcn"); |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
76 orig_keypressfcn = get (fig, "keypressfcn"); |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
77 orig_closerequestfcn = get (fig, "closerequestfcn"); |
25852
f6537847b043
ginput.m: temporarily disable mouse tools in Qt toolkit (bug #51452)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
78 orig_mousemode = get (fig, "__mouse_mode__"); |
27103
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
79 orig_pointer = get (fig, "pointer"); |
7673 | 80 |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
81 unwind_protect |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
82 |
27103
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
83 set (fig, "windowbuttondownfcn", @ginput_windowbuttondownfcn, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
84 "keypressfcn", @ginput_keypressfcn, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
85 "closerequestfcn", {@ginput_closerequestfcn, orig_closerequestfcn}, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
86 "pointer", "crosshair", "__mouse_mode__", "none"); |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
87 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
88 do |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
89 if (strcmp (toolkit, "fltk")) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
90 __fltk_check__ (); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
91 endif |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
92 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
93 ## Release CPU. |
20923
58263bea2fdf
Unified "sleep" functions to "octave_sleep" in C++ and "pause" in Octave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20852
diff
changeset
|
94 pause (0.01); |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
95 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
96 [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
97 until ((n > -1 && n0 >= n) || n0 < 0) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
98 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
99 if (n0 > n) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
100 ## More clicks than requested due to double-click or too fast clicking |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
101 x = x(1:n); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
102 y = y(1:n); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
103 button = button(1:n); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
104 endif |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
105 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
106 unwind_protect_cleanup |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
107 if (isfigure (fig)) |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
108 ## Only execute if window still exists |
27103
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
109 set (fig, "windowbuttondownfcn", orig_windowbuttondownfcn, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
110 "keypressfcn", orig_keypressfcn, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
111 "closerequestfcn", orig_closerequestfcn, ... |
3aa37c2e22a3
Use crosshair pointer during ginput and gtext execution.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
112 "pointer", orig_pointer, "__mouse_mode__", orig_mousemode); |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
113 endif |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
114 end_unwind_protect |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
115 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
116 varargout = {x, y, button}; |
7673 | 117 |
118 endfunction | |
13123
6efa1a691713
Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
119 |
24457
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
120 function [rx, ry, rn, rbutton] = ginput_accumulator (mode, xn, yn, btn) |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
121 persistent x y n button; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
122 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
123 if (mode == 0) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
124 ## Initialize. |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
125 x = y = button = []; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
126 n = 0; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
127 elseif (mode == 1) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
128 ## Append mouse button or key press. |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
129 x = [x; xn]; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
130 y = [y; yn]; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
131 button = [button; btn]; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
132 n += 1; |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
133 elseif (mode == 2) |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
134 ## The end due to Enter. |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
135 n = -1; |
24457
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
136 endif |
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
137 |
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
138 rx = x; |
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
139 ry = y; |
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
140 rn = n; |
e3751f50e8ef
make ginput work again (bug #52699)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
141 rbutton = button; |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
142 |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
143 endfunction |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
144 |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
145 function ginput_windowbuttondownfcn (~, button) |
19947
6e5365ee200a
ginput: Fix for clicks outside axes and within multiple axes (bug #44426)
Mike Miller <mtmiller@octave.org>
parents:
19764
diff
changeset
|
146 point = get (gca (), "currentpoint"); |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
147 ginput_accumulator (1, point(1,1), point(1,2), button); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
148 endfunction |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
149 |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
150 function ginput_keypressfcn (~, evt) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20923
diff
changeset
|
151 |
19764
c040bed12b2e
* ginput.m: Fix botched search and replace in previous change.
John W. Eaton <jwe@octave.org>
parents:
19748
diff
changeset
|
152 point = get (gca (), "currentpoint"); |
27225
57bb8f531707
ginput.m: Make "Enter" key on numeric keypad stop input (bug #56599).
Rik <rik@octave.org>
parents:
27103
diff
changeset
|
153 if (strcmp (evt.Key, "return") || strcmp (evt.Key, "enter")) |
57bb8f531707
ginput.m: Make "Enter" key on numeric keypad stop input (bug #56599).
Rik <rik@octave.org>
parents:
27103
diff
changeset
|
154 ## <Return> or <Enter> on numeric keypad stops ginput. |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
155 ginput_accumulator (2, NaN, NaN, NaN); |
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
156 else |
20094
0b83a442ff78
Process SHIFT/CTRL/ALT keys properly for ginput (Bug #44833).
Rik <rik@octave.org>
parents:
20073
diff
changeset
|
157 character = evt.Character; |
0b83a442ff78
Process SHIFT/CTRL/ALT keys properly for ginput (Bug #44833).
Rik <rik@octave.org>
parents:
20073
diff
changeset
|
158 if (! isempty (character)) |
0b83a442ff78
Process SHIFT/CTRL/ALT keys properly for ginput (Bug #44833).
Rik <rik@octave.org>
parents:
20073
diff
changeset
|
159 ginput_accumulator (1, point(1,1), point(1,2), uint8 (character(1))); |
0b83a442ff78
Process SHIFT/CTRL/ALT keys properly for ginput (Bug #44833).
Rik <rik@octave.org>
parents:
20073
diff
changeset
|
160 endif |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
161 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20923
diff
changeset
|
162 |
19748
3fc946d5e91f
make ginput work for all toolkits again (bug #41977)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
163 endfunction |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
164 |
20197
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
165 function ginput_closerequestfcn (hfig, ~, orig_closerequestfcn) |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
166 ginput_accumulator (2, NaN, NaN, NaN); # Stop ginput |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
167 feval (orig_closerequestfcn); # Close window with original fcn |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
168 endfunction |
2283dd03bf50
ginput.m: Don't hang if window is close while fcn active (bug #44897).
Rik <rik@octave.org>
parents:
20094
diff
changeset
|
169 |
20094
0b83a442ff78
Process SHIFT/CTRL/ALT keys properly for ginput (Bug #44833).
Rik <rik@octave.org>
parents:
20073
diff
changeset
|
170 |
13123
6efa1a691713
Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
171 ## Remove from test statistics. No real tests possible. |
6efa1a691713
Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
172 %!test |
6efa1a691713
Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents:
11576
diff
changeset
|
173 %! assert (1); |