1 |
% |
---|
2 |
% EDITTEXT Edit text objects with the mouse |
---|
3 |
% |
---|
4 |
% This is a callback function, used by OPNML-FEDAR MenuBar and |
---|
5 |
% OPNML Prmenu. This function should not be called directly! |
---|
6 |
% |
---|
7 |
% Keith Rogers 11/94 |
---|
8 |
% |
---|
9 |
% Mods: |
---|
10 |
% 12/02/94 Shortened name to appease DOS Users |
---|
11 |
% Mar 95 - Minor Mods by Brian Blanton for OPNML, including name |
---|
12 |
% change from 'txtcback' |
---|
13 |
% |
---|
14 |
% Aug 95 - Sara Haines made changes so that globals are checked |
---|
15 |
% for Prmenu and added call for Edit Text |
---|
16 |
function EditText(command,data) |
---|
17 |
|
---|
18 |
global LASTOBJECT LASTTYPE LASTAXIS |
---|
19 |
|
---|
20 |
if isempty(LASTAXIS) |
---|
21 |
curaxes=gca; |
---|
22 |
else |
---|
23 |
curaxes=LASTAXIS; |
---|
24 |
end |
---|
25 |
|
---|
26 |
selectedObj = LASTOBJECT; |
---|
27 |
if isempty(selectedObj),return,end % exit if no selected object |
---|
28 |
type = LASTTYPE; |
---|
29 |
|
---|
30 |
if( strcmp(lower(get(selectedObj,'Type')),'text') | ... |
---|
31 |
strcmp(lower(get(selectedObj,'Type')),'axes') & selectedObj ~= [] ) |
---|
32 |
if(command == 1) |
---|
33 |
set(selectedObj,'FontName',data); |
---|
34 |
elseif(command == 2) |
---|
35 |
set(selectedObj,'FontAngle',data); |
---|
36 |
elseif(command == 3) |
---|
37 |
set(selectedObj,'FontWeight',data); |
---|
38 |
elseif(command == 4) |
---|
39 |
set(selectedObj,'FontAngle','normal','FontWeight','normal'); |
---|
40 |
elseif(command == 5) |
---|
41 |
if(data == 0) |
---|
42 |
value = get(selectedObj, 'FontSize'); |
---|
43 |
tval=EditValue('EditValue', 'Font Size:', value); |
---|
44 |
set(selectedObj,'FontSize',tval); |
---|
45 |
else |
---|
46 |
set(selectedObj,'FontSize',data); |
---|
47 |
end |
---|
48 |
elseif(command == 6) |
---|
49 |
set(selectedObj,'Vert',data); |
---|
50 |
elseif(command == 7) |
---|
51 |
set(selectedObj,'Horiz',data); |
---|
52 |
elseif(command == 8) |
---|
53 |
if strcmp(lower(get(selectedObj,'Type')),'text') |
---|
54 |
string = get(selectedObj, 'String'); |
---|
55 |
data = EditString('Edit String', 'Edit Text:', string); |
---|
56 |
set(selectedObj,'String',data); |
---|
57 |
end |
---|
58 |
elseif(command == 9) |
---|
59 |
data = EditString('Edit String', 'Add Text:', ''); |
---|
60 |
axes(curaxes); |
---|
61 |
h=gtext(data); |
---|
62 |
end |
---|
63 |
|
---|
64 |
else |
---|
65 |
if(command == 9) |
---|
66 |
data = EditString('Edit String', 'Add Text:', ''); |
---|
67 |
axes(curaxes); |
---|
68 |
h=gtext(data); |
---|
69 |
end |
---|
70 |
end |
---|
71 |
|
---|