1 |
function lastouch |
---|
2 |
% lastouch |
---|
3 |
% |
---|
4 |
% Abstract: This function keeps track of last object and type touched in |
---|
5 |
% a figure window. Figure handles touched are kept in globals. |
---|
6 |
% |
---|
7 |
% Usage: windowbuttondown callback function, not to be called directly. |
---|
8 |
% |
---|
9 |
% Calls: none |
---|
10 |
% |
---|
11 |
% Sara Haines, April 1995 |
---|
12 |
% |
---|
13 |
% |
---|
14 |
|
---|
15 |
figNUM=gcf; |
---|
16 |
figNUM = watchon; |
---|
17 |
|
---|
18 |
% determine globals |
---|
19 |
global LASTOBJECT LASTTYPE LASTAXIS LASTFIGURE LASTCONTROL LASTMENU |
---|
20 |
global LASTTEXT LASTLINE LASTPATCH LASTIMAGE LASTSURFACE |
---|
21 |
|
---|
22 |
% set last object and type touched |
---|
23 |
LASTOBJECT = get(gcf, 'CurrentObject'); |
---|
24 |
if isempty(LASTOBJECT) |
---|
25 |
LASTOBJECT = gcf; |
---|
26 |
end |
---|
27 |
LASTTYPE = get(LASTOBJECT, 'Type'); |
---|
28 |
LASTFIGURE = figNUM; |
---|
29 |
|
---|
30 |
% find open windows that need updating |
---|
31 |
figCHAXIS = findfig('Edit Axis Limits'); |
---|
32 |
figLABEL = findfig('Edit Labels'); |
---|
33 |
|
---|
34 |
% find uimenu indicators |
---|
35 |
uiTYPE = findobj(LASTFIGURE, 'type', 'uimenu', 'Tag', 'PrType'); |
---|
36 |
uiOBJ = findobj(LASTFIGURE, 'type', 'uimenu', 'Tag', 'PrObject'); |
---|
37 |
|
---|
38 |
% find all the figure objects that are axes and children of axes. |
---|
39 |
figOBJ = findobj(LASTFIGURE, 'type', 'axes'); |
---|
40 |
figOBJ = findobj(figOBJ); |
---|
41 |
|
---|
42 |
if strcmp( get(LASTOBJECT, 'selected'), 'off') |
---|
43 |
% set selected off for each one |
---|
44 |
set(figOBJ, 'selected', 'off'); |
---|
45 |
end |
---|
46 |
|
---|
47 |
% set handle depending on type |
---|
48 |
if ( strcmp(LASTTYPE, 'figure') ) |
---|
49 |
LASTFIGURE = LASTOBJECT; |
---|
50 |
elseif ( strcmp(LASTTYPE, 'uimenu') ) |
---|
51 |
LASTMENU = LASTOBJECT; |
---|
52 |
elseif ( strcmp(LASTTYPE, 'uicontrol') ) |
---|
53 |
LASTCONTROL = LASTOBJECT; |
---|
54 |
elseif ( strcmp(LASTTYPE, 'axes') ) |
---|
55 |
LASTAXIS = LASTOBJECT; |
---|
56 |
set(LASTOBJECT, 'selected', 'on'); |
---|
57 |
if (figCHAXIS) |
---|
58 |
EditAxis('reset','newaxestouched'); |
---|
59 |
end |
---|
60 |
if (figLABEL) |
---|
61 |
EditLabel('reset','newaxestouched'); |
---|
62 |
end |
---|
63 |
elseif ( strcmp(LASTTYPE, 'text') ) |
---|
64 |
LASTTEXT = LASTOBJECT; |
---|
65 |
set(LASTOBJECT, 'selected', 'on'); |
---|
66 |
elseif ( strcmp(LASTTYPE, 'line') ) |
---|
67 |
LASTLINE = LASTOBJECT; |
---|
68 |
set(LASTOBJECT, 'selected', 'on'); |
---|
69 |
elseif ( strcmp(LASTTYPE, 'patch') ) |
---|
70 |
LASTPATCH = LASTOBJECT; |
---|
71 |
set(LASTOBJECT, 'selected', 'on'); |
---|
72 |
elseif ( strcmp(LASTTYPE, 'image') ) |
---|
73 |
LASTIMAGE = LASTOBJECT; |
---|
74 |
set(LASTOBJECT, 'selected', 'on'); |
---|
75 |
end |
---|
76 |
|
---|
77 |
if (uiTYPE) |
---|
78 |
set(uiTYPE, 'Label', LASTTYPE); |
---|
79 |
end |
---|
80 |
if (uiOBJ) |
---|
81 |
set(uiOBJ, 'Label', num2str(LASTOBJECT,6)); |
---|
82 |
end |
---|
83 |
|
---|
84 |
watchoff(figNUM); |
---|