-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfm_bar.m
113 lines (100 loc) · 2.82 KB
/
fm_bar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
function fm_bar(command)
% FM_BAR draws PSAT status bar
%
% FM_BAR(COMMAND)
%
%see also FM_MAIN
%
%Author: Federico Milano
%Date: 25-Feb-2004
%Version: 1.0.0
%
%E-mail: [email protected]
%Web-site: faraday1.ucd.ie/psat.html
%
% Copyright (C) 2002-2019 Federico Milano
global Hdl Fig Theme Settings
persistent p1 p2
if ~ishandle(Fig.main), return, end
if isnumeric(command)
x1 = command(1);
x2 = command(2);
if x1 > 0.95
command = 'drawend';
else
command = 'draw';
end
x1 = 0.01+x1*0.98;
x2 = 0.01+x2*0.98;
end
switch command
case 'open'
set(Fig.main,'Pointer','watch')
set(0,'CurrentFigure',Fig.main);
set(Hdl.text,'Visible','off');
set(Hdl.frame,'Visible','off');
if ishandle(Hdl.bar), delete(Hdl.bar); end
Hdl.bar = axes('position',[0.04064 0.0358 0.9212 0.04361], ...
'box','on');
if Settings.hostver < 8.04
set(Hdl.bar, ...
'Drawmode','fast', ...
'NextPlot','add', ...
'Color',[0.9 0.9 0.9], ...
'Xlim',[0 1], ...
'Ylim',[0 1], ...
'Box','on', ...
'XTick',[], ...
'YTick',[], ...
'XTickLabel','', ...
'YTickLabel','');
else
set(Hdl.bar, ...
'SortMethod','depth', ...
'NextPlot','add', ...
'Color',[0.9 0.9 0.9], ...
'Xlim',[0 1], ...
'Ylim',[0 1], ...
'Box','on', ...
'XTick',[], ...
'YTick',[], ...
'XTickLabel','', ...
'YTickLabel','');
end
p1 = fill([0.01 0.01 0.01+1e-5 0.01+1e-5],[0.25 0.75 0.75 0.25], ...
Theme.color08,'EdgeColor',Theme.color08);
p2 = text(1e-5,0.35,[' ',num2str(round(1e-5*100)),'%']);
if Settings.hostver < 8.04 && Settings.hostver > 8
set(p1,'HorizontalAlignment','left');
set(p2,'HorizontalAlignment','left');
elseif Settings.hostver >= 7.07 && Settings.hostver < 8
set(p1,'EraseMode','background','HorizontalAlignment','left');
set(p2,'EraseMode','background','HorizontalAlignment','left');
elseif Settings.hostver < 7.07
set(p1,'EraseMode','xor','HorizontalAlignment','left');
set(p2,'EraseMode','xor','HorizontalAlignment','left');
end
drawnow
case 'draw'
set(p2,'Position',[x1, 0.35, 0], ...
'String',[' ',num2str(round(x1*100)),'%']);
set(p2,'Position',[x2, 0.35, 0], ...
'String',[' ',num2str(round(x2*100)),'%']);
set(p1,'XData',[0.01, 0.01, x2, x2]);
drawnow
case 'drawend'
set(p2,'Position',[x1, 0.35, 0], ...
'String',[' ',num2str(round(x1*100)),'%']);
set(p2,'HorizontalAlignment','right');
set(p1,'XData',[x1, x1, x2, x2]);
set(p2,'Position',[x2, 0.35, 0], ...
'String',[' ',num2str(round(x2*100)),'%']);
drawnow
case 'close'
set(Fig.main,'Pointer','arrow');
delete(Hdl.bar);
Hdl.bar = -1;
set(Hdl.frame,'Visible','on');
set(Hdl.text,'Visible','on');
clear p1 p2
end