forked from MarineBioAcousticsRC/Triton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initpulldowns.m
187 lines (170 loc) · 7.33 KB
/
initpulldowns.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
function initpulldowns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% initpulldowns.m
%
% generate figure pulldown menus
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global HANDLES PARAMS
% 'File' pulldown
HANDLES.filemenu = uimenu(HANDLES.fig.ctrl,'Label','&File');
%
uimenu(HANDLES.filemenu,'Label','&Open LTSA File','Callback','filepd(''openltsa'')');
uimenu(HANDLES.filemenu,'Label','Open &XWAV File','Callback','filepd(''openxwav'')');
uimenu(HANDLES.filemenu,'Label','Open &WAV or FLAC File','Callback','filepd(''openwav'')');
%
HANDLES.exportdata = uimenu(HANDLES.filemenu, 'Separator','on','Label',...
'&Export Plotted Data To','Enable','off');
%
uimenu(HANDLES.exportdata,'Label','&normalized WAV File',...
'Callback','filepd(''export_normwav'')');
uimenu(HANDLES.exportdata,'Label','&WAV File',...
'Callback','filepd(''export_wav'')');
uimenu(HANDLES.exportdata,'Label','&XWAV File',...
'Callback','filepd(''export_xwav'')');
uimenu(HANDLES.exportdata, 'Label', '&MATLAB File *.mat',...
'Callback', 'miscpd(''export_mat'')');
%
HANDLES.savefig = uimenu(HANDLES.filemenu,'Label',...
'Save Plot Window As','Enable','off');
uimenu(HANDLES.savefig,'Label','&JPEG File',...
'Callback','filepd(''savejpg'')');
%
uimenu(HANDLES.savefig,'Label','&PDF File',...
'Callback','filepd(''savepdf'')');
%
uimenu(HANDLES.savefig,...
'Label','MATLAB File *.fig',...
'Callback','filepd(''savefigureas'')');
%
HANDLES.exportparams = uimenu(HANDLES.filemenu, 'Label', '&Export PARAMS as MATLAB File *.mat',...
'Callback', 'miscpd(''export_params'')');
HANDLES.saveimageas = uimenu(HANDLES.filemenu,'Label','Save Spectrogram As &Image',...
'Visible','off',...
'Enable','off','Callback','filepd(''saveimageas'')');
uimenu(HANDLES.filemenu,'Separator','on','Label','E&xit',...
'Callback','filepd(''exit'')');
%Settings pulldown
HANDLES.setmenu = uimenu(HANDLES.fig.ctrl, 'Label', '&Settings');
uimenu(HANDLES.setmenu, 'Label', '&Save Current Window Positions',...
'Callback', 'miscpd(''save_settings'')');
uimenu(HANDLES.setmenu, 'Label', '&Load Window Positions',...
'Callback', 'miscpd(''load_settings'')');
uimenu(HANDLES.setmenu, 'Label', '&Set Current Window Positions for Startup',...
'Callback', 'miscpd(''set_startup'')');
uimenu(HANDLES.setmenu, 'Label', '&Load Triton Default Window Positions',...
'Callback', 'miscpd(''default_windows'')');
uimenu(HANDLES.setmenu,'Separator','on','Label', '&Save, Load, or Change Plot Parameters',...
'Callback', 'miscpd(''plot_params'')');
uimenu(HANDLES.setmenu,'Label', '&Set Default Parameters',...
'Callback', 'miscpd(''default_params'')');
% 'Tools' Pulldown
HANDLES.toolmenu = uimenu(HANDLES.fig.ctrl,'Label','&Tools',...
'Enable','on');
uimenu(HANDLES.toolmenu,'Separator','on','Label','&Convert Single HARP Raw File to XWAV',...
'Callback','toolpd(''convertfile'')');
uimenu(HANDLES.toolmenu,'Label','Load Transfer Function File',...
'Enable','on','Callback','toolpd(''loadTF'')');
% Decimate ops
HANDLES.decimenu = uimenu(HANDLES.toolmenu,'Label','Decimate XWAV/WAV Files');
uimenu(HANDLES.decimenu,'Label','&Decimate Single XWAV File',...
'Enable','on','Callback','toolpd(''decimatefile'')');
uimenu(HANDLES.decimenu,'Label','&Decimate All XWAV Files in Directory',...
'Enable','on','Callback','toolpd(''decimatefiledir'')');
uimenu(HANDLES.decimenu,'Separator','on','Label','&Decimate Single WAV or FLAC File',...
'Enable','on','Callback','toolpd(''decimatewavfile'')');
uimenu(HANDLES.decimenu,'Label','&Decimate All WAV/FLAC Files in Directory',...
'Enable','on','Callback','toolpd(''decimatewavfiledir'')');
uimenu(HANDLES.toolmenu,'Label','&Make LTSA from Directory of Files',...
'Enable','on','Callback','toolpd(''mkltsa'')');
if ~isdeployed % don't initilalize remora pull down if compiled
% 'Remora' Pulldown
HANDLES.remmenu = uimenu(HANDLES.fig.ctrl,'Label','&Remoras','Enable','on');
uimenu(HANDLES.remmenu,'Separator','on','Label','&Add Remora',...
'Enable','on','Callback','remorapd(''add_remora'')');
HANDLES.removerems = uimenu(HANDLES.remmenu,'Label','&Remove Remora',...
'Enable','off','Callback','remorapd(''rem_remora'')');
% HANDLES.listrems = uimenu(HANDLES.remmenu, 'Label', '&List Installed Remoras',...
% 'Enable', 'off','Callback', 'toolpd(''list_remoras'')');
% TritonPath = fileparts(which('triton'));
% RemoraConfFile = fullfile(TritonPath, 'Settings',...
% 'InstalledRemoras.cnf');
RemoraConfFile = fullfile(PARAMS.path.Settings,'InstalledRemoras.cnf');
fid = fopen(RemoraConfFile);
fseek(fid, 0, 'bof');
beginningpos = ftell(fid);
fseek(fid, 0, 'eof');
endpos = ftell(fid);
fclose(fid);
if beginningpos ~= endpos
set(HANDLES.removerems,'Enable','On')
% set(HANDLES.listrems, 'Enable', 'On')
end
end
% 'Help' pulldown
HANDLES.helpmenu = uimenu(HANDLES.fig.ctrl,'Label','&Help',...
'Enable','on');
uimenu(HANDLES.helpmenu,'Label','&About Triton',...
'Callback','miscpd(''dispAbout'')');
uimenu(HANDLES.helpmenu, 'Label','&Triton User Manual',...
'Callback','open_TritonManual');
% Message window pulldown
HANDLES.msgmenu = uimenu(HANDLES.fig.msg,'Label','&File');
HANDLES.openpicks = uimenu(HANDLES.msgmenu,'Separator','off','Label','&Open Picks',...
'Enable','on','Visible','on','Callback','filepd(''openpicks'')');
HANDLES.savepicks = uimenu(HANDLES.msgmenu,'Separator','off','Label','Save &Picks',...
'Enable','off','Callback','filepd(''savepicks'')');
HANDLES.savemsgs = uimenu(HANDLES.msgmenu,'Separator','on','Label','Save &Messages',...
'Enable','on','Callback','filepd(''savemsgs'')');
HANDLES.clrmsgs = uimenu(HANDLES.msgmenu,'Separator','off','Label','Clear Messages',...
'Enable','on','Callback','filepd(''clrmsgs'')');
% some window stuff?
set(gcf,'Units','pixels');
axis off
% axHndl1=gca;
if ~isdeployed % standard in MATLAB mode
% Read contents of InstalledRemoras.cnf and initialize those that are
% installed
oldDir = pwd;
% tritonDir = fileparts(which('triton'));
% settingDir = fullfile(tritonDir,'Settings');
% cnf_file = fullfile(settingDir,'InstalledRemoras.cnf');
cnf_file = fullfile(PARAMS.path.Settings,'InstalledRemoras.cnf');
% cd(tritonDir)
% cd(PARAMS.path.Triton)
%goes to Remora directory
% if exist('Remora', 'dir')
if exist(PARAMS.path.Remoras, 'dir')
% dirs = dir('Remora');
% cd Remora;
cd(PARAMS.path.Remoras)
fid = fopen(cnf_file, 'r+');
remorapath = fgetl(fid);
pwd0 = pwd;
if ~isempty(remorapath)
while ischar(remorapath)
remora_init = fullfile(remorapath,'initialize');
if exist(remora_init) ~= 2
disp_msg(sprintf('File %s does not exist, or missing from matlab''s path', ...
remora_init));
else
cd(remorapath);
eval('initialize');
end
remorapath = fgetl(fid);
end
end
fclose(fid);
cd(pwd0)
else
disp_msg('Remoras folder not found, restart Triton!')
return
end
if exist(oldDir,'dir')
cd(oldDir)
else
% cd(tritonDir)
cd(PARAMS.path.Triton)
end
end