File: edit_menus.C

package info (click to toggle)
mixviews 1.20-10.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,928 kB
  • ctags: 5,960
  • sloc: cpp: 32,879; ansic: 2,110; makefile: 445; sh: 17
file content (426 lines) | stat: -rw-r--r-- 11,987 bytes parent folder | download | duplicates (2)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
// edit_menus.C

/******************************************************************************
 *
 *  MiXViews - an X window system based sound & data editor/processor
 *
 *  Copyright (c) 1993, 1994 Regents of the University of California
 *
 *  Author:     Douglas Scott
 *  Date:       December 13, 1994
 *
 *  Permission to use, copy and modify this software and its documentation
 *  for research and/or educational purposes and without fee is hereby granted,
 *  provided that the above copyright notice appear in all copies and that
 *  both that copyright notice and this permission notice appear in
 *  supporting documentation. The author reserves the right to distribute this
 *  software and its documentation.  The University of California and the author
 *  make no representations about the suitability of this software for any 
 *  purpose, and in no event shall University of California be liable for any
 *  damage, loss of data, or profits resulting from its use.
 *  It is provided "as is" without express or implied warranty.
 *
 ******************************************************************************/


#include "localdefs.h"
#include <X11/keysym.h>
#include "data.h"
#include "editor.h"
#include "menus.h"
#include "pvoceditor.h"
#include "soundeditor.h"
#include "sndconfig.h"

static const int Inactive = true;

// The structs containing the various menuitem templates for the menus

static MenuInfo viewModeSubmenu[] = {
	{ "view as channels",			" ",	XK_copyright },
	{ "view as frames",				" ",	XK_ordfeminine },
	{ nil }
};

static MenuInfo channelSubmenu[] = {
	{ "set channel view...",		"=",	XK_equal },
	{ "add channel",				"+",	XK_plus },
	{ "remove channel",				"-",	XK_minus },
	{ "shift up",					">",	XK_greater },
	{ "shift down",					"<",	XK_less },
	{ nil }
};

static MenuInfo viewMenu[] = {
	{ "new view of selection",		"N",	XK_N },
	{ "zoom to selection", 			"z",	XK_z },
	{ "zoom to full", 				"Z",	XK_Z },
	{ "set frame view...",			"f",	XK_f },
	{ "reset vertical scale",		"V",	XK_V },
	{ "View Mode",				"",		0L,		false, viewModeSubmenu },
	{ "Channel Display",			"",		0L,		false, channelSubmenu },
	{ "display copy buffer",	"I",	XK_I },
	{ "close current view",			"W",	XK_W },
	{ nil }
};

static MenuInfo fileTypeSubmenu[] = {
	{ "LPC datafile...", 			" ",	XK_nobreakspace },
	{ "Sound file...", 				" ",	XK_exclamdown },
	{ "Envelope...", 				" ",	XK_cent },
	{ "Pvoc datafile...",			" ",	XK_currency },
	{ nil }
};

static MenuInfo fileMenu[] = {
	{ "set default dir...",			".",	XK_period },
	{ "new",						"n",	XK_n },
	{ "New Type",					"",		0L,		false, fileTypeSubmenu },
	{ "open...",					"o",	XK_o },
	{ "save",						"s",	XK_s },
	{ "save as...",					"S",	XK_S },
	{ "revert",						"U",	XK_U },
	{ "change name...",				"'",	XK_quoteright },
	{ "change file comment...",		"\"",	XK_quotedbl },
	{ "file information...",		"?",	XK_question },
	{ "data dump of selection...",	"}",	XK_braceright },
	{ "show program version",		" ",	XK_yen },
	{ "quit program",				"Q",	XK_Q },
	{ nil }
};

// the unusual keycodes are just for internal communication--no one is 
// expect to type those characters!

static MenuInfo editMenu[] = {
	{ "set insert point...",	"j",	XK_j },
	{ "set edit region...",		"J",	XK_J },
	{ "copy",				"c",	XK_c },
	{ "copy to new",		"C",	XK_C },
	{ "remove",				"r",	XK_r },
	{ "remove to new",		"y",	XK_y },
	{ "erase",				"e",	XK_e },
	{ "splice out",			"x",	XK_x },
	{ "splice out to new",	"X",	XK_X },
	{ "delete",				"d",	XK_d },
	{ "mix",				"m",	XK_m },
	{ "replace",			"R",	XK_R },
	{ "crossfade...",		"g",	XK_g },
	{ "splice in",			"v",	XK_v },
	{ nil }
};

static MenuInfo modifyMenu[] = {
	{ "normalize values",		"[",	XK_bracketleft },
	{ "smooth curve",			"L",	XK_L },
	{ "scale values...",		"P",	XK_P },
	{ "rescale to fit...", 		"]",	XK_bracketright },
	{ "add offset...",			"O",	XK_O },
	{ "apply envelope...",		"E",	XK_E },
	{ "reverse",				"b",	XK_b },
	{ "insert space...",		"i",	XK_i },
	{ "add delay...",			"D",	XK_D },
	{ "stretch/shrink",			"t",	XK_t },
	{ nil }
};

static MenuInfo analysisMenu[] = {
	{ "locate next zero crossing",	"0",	XK_0 },
	{ "find slope change",		"1",	XK_1 },
	{ "show maxamp sample location","2",	XK_2 },
	{ "extract amplitude envelope",	"3",	XK_3 },
	{ nil }
};

static MenuInfo styleSubmenu[] = {
	{ "line",	"%",	XK_percent },
	{ "bar",	"^",	XK_asciicircum },
	{ nil }
};

static MenuInfo channelUnitSubmenu[] = {
	{ "frames",	"#",	XK_numbersign },
	{ "time",	"@",	XK_at },
	{ "SMPTE",	"!",	XK_exclam },
	{ "CDDA",	"|",	XK_bar },
	{ nil }
};

static MenuInfo channelDisplayMenu[] = {
	{ "Graph Style",		"",	0L, false, styleSubmenu },
	{ "Horiz Scale Units",	"",	0L, false, channelUnitSubmenu },
	{ nil }
};

static MenuInfo soundFilterSubmenu[] = {
	{ "low pass",					"L",	XK_L },
	{ "resonant",					"q",	XK_q },
	{ "comb",					"K",	XK_K },
	{ "elliptical",					"H",	XK_H },
	{ "FIR",					"F",	XK_F },
	{ "LPC formant",				" ",	XK_brokenbar },
	{ nil }
};

static MenuInfo soundModifyMenu[] = {
	{ "phrase...",				"P",	XK_P },
	{ "apply envelope...",		"E",	XK_E },
	{ "reverse",				"b",	XK_b },
	{ "transpose...",			"t",	XK_t },
	{ "time shift...",			"T",	XK_T, Inactive },
	{ "Filter",			"", 	0L, false, soundFilterSubmenu },
	{ "insert space...",		"i",	XK_i },
	{ "normalize values",		"[",	XK_bracketleft },
	{ "add delay...",			"D",	XK_D },
	{ "add DC offset...",		"O", 	XK_O },
	{ "remove DC offset",		"~", 	XK_asciitilde },
	{ nil }
};

static MenuInfo synthesisSubmenu[] = {
	{ "LPC resynthesis...", 			"K1",	XK_KP_1 },
	{ "Phase Vocoder resynthesis...", 	"K2",	XK_KP_2 },
	{ nil }
};

static MenuInfo converterSubmenu[] = {
#ifdef SPARC_DACS
	{ "SPARC",		"",	XK_section },
#elif defined SGI_DACS
	{ "SGI",		"",	XK_section },
#elif defined SOUNDBLASTER
	{ "SoundBlaster",	"",	XK_section },
#elif defined VOXWARE_DACS
	{ "VoxWare",	"",	XK_section },
#elif defined NeXT
	{ "NeXT",		"",	XK_section },
#endif
#ifdef ADC_DACS
	{ "ADR",		"",	XK_diaeresis },
#elif defined PROPORT_DACS
	{ "S56x",		"",	XK_diaeresis },
#endif
	{ "converter settings...",		")",	XK_parenright },
	{ "reset converter",			"",	XK_threesuperior },
	{ nil }
};

static MenuInfo soundSpecialMenu[] = {
	{ "play",						"p",	XK_p },
	{ "stop",						"h",	XK_BackSpace },
	{ "rescan for peak", 			"$",	XK_dollar },
	{ "rescale", 					"]",	XK_bracketright },
	{ "record",						":",	XK_colon },
	{ "change sample format...",	"&",	XK_ampersand },
	{ "change sample rate...",		"k",	XK_k },
	{ "change file length...",		"l",	XK_l },
	{ "Synthesis",					" ",	0L, false, synthesisSubmenu },
	{ "D/A Converter",				" ",	0L, false, converterSubmenu },
	{ "sound options...", 			" ", 	XK_degree },
	{ nil }
};

static MenuInfo soundAnalysisMenu[] = {
	{ "locate next zero crossing",	"0",	XK_0 },
	{ "find slope change",		"1",	XK_1 },
	{ "show maxamp sample location","2",	XK_2 },
	{ "extract amplitude envelope",	"3",	XK_3 },
	{ "FFT analysis",				"4",	XK_4 },
	{ "LPC analysis",				"5",	XK_5 },
	{ "extract pitch envelope",		"6",	XK_6 },
	{ "LPC and pitch envelope",		"7",	XK_7 },
	{ "Phase Vocoder analysis",		"8",	XK_8 },
	{ nil }
};

static MenuInfo peakRescanSubmenu[] = {
	{ "on",		"/",	XK_slash },
	{ "off",	"\\",	XK_backslash },
	{ nil }
};

static MenuInfo optionsMenu[] = {
	{ "Peak Rescan",			"",		0L, false, peakRescanSubmenu },
	{ "Global Options...",		" ",	XK_macron },
	{ "Scale Options...",		" ",	XK_twosuperior },
	{ "File Options...",		" ",	XK_acute },
	{ "Memory Options...",		" ",	XK_mu },
	{ nil }
};

// And now the structs containing the various menu templates

static MenuBarInfo defaultChannelMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Analysis ", analysisMenu },
	{ " Display ", channelDisplayMenu },
	{ nil }
};

static MenuBarInfo soundMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Modify ", soundModifyMenu },
	{ " Sound ", soundSpecialMenu },
	{ " Analysis ", soundAnalysisMenu },
	{ " Display ", channelDisplayMenu },
	{ " Options ", optionsMenu },
	{ nil }
};

static MenuInfo lpcSpecialMenu[] = {
	{ "stabilize frames", 				"*",	XK_asterisk },
	{ "display filter amplitudes", 		"A",	XK_A },
	{ "display filter formants", 		"F",	XK_F },
	{ "merge pitch data",				"M",	XK_M },
	{ "adjust pitch deviation...", 		"p",	XK_p },
	{ "change sample rate...",			"k",	XK_k },
	{ "change file length...",			"l",	XK_l },
	{ "lpc options...", 				" ", 	XK_degree },
	{ nil }
};

static MenuBarInfo lpcMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Modify ", modifyMenu },
	{ "  LPC  ", lpcSpecialMenu },
	{ " Analysis ", analysisMenu },
	{ " Display ", channelDisplayMenu },
	{ " Options ", optionsMenu },
	{ nil }
};

static MenuInfo envelopeSpecialMenu[] = {
	{ "create linear curve...", 		"_",	XK_underscore },
	{ "create exponential curve...", 	"*",	XK_asterisk },
	{ "invert existing curve",	 		" ",	0L, Inactive },
	{ "change file length...",			"l",	XK_l },
	{ "envelope options...", 			" ", 	XK_degree, Inactive },
	{ nil }
};

static MenuBarInfo envelopeMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Modify ", modifyMenu },
	{ " Envelope ", envelopeSpecialMenu },
	{ " Analysis ", analysisMenu },
	{ " Display ", channelDisplayMenu },
	{ " Options ", optionsMenu },
	{ nil }
};

static MenuInfo pitchSpecialMenu[] = {
	{ "change file length...",		"l",	XK_l },
	{ "shift by pitch interval...",	" ", 	0L, Inactive },
	{ nil }
};

static MenuBarInfo pitchMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Modify ", modifyMenu },
	{ " Pitch ", pitchSpecialMenu },
	{ " Analysis ", analysisMenu },
	{ " Display ", channelDisplayMenu },
	{ " Options ", optionsMenu },
	{ nil }
};

static MenuInfo frameHorizUnitSubmenu[] = {
	{ "band numbers",	"#",	XK_numbersign },
	{ "frequency",		"@",	XK_at },
	{ nil }
};

static MenuInfo frameVertUnitSubmenu[] = {
	{ "amplitude",		"a",	XK_a },
	{ "decibels",		"d",	XK_d },
	{ nil }
};

static MenuInfo frameDisplayMenu[] = {
	{ "Horiz. Scale Units",	"",	0L, false, frameHorizUnitSubmenu },
	{ "Vert. Scale Units",	"",	0L, false, frameVertUnitSubmenu },
	{ nil }
};

static MenuBarInfo defaultFrameMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ " Display ", frameDisplayMenu },
	{ nil }
};

static MenuInfo pvocSpecialMenu[] = {
	{ "harmonically shift spectrum", 		"t",	XK_t },
	{ "stretch/shrink shift spectrum", 		"T",	XK_T },
	{ "expand/compress spectrum", 			"X",	XK_X, Inactive },
	{ "change file length...",				"l",	XK_l },
	{ "pvoc options...", 					" ", 	XK_degree, Inactive },
	{ nil }
};

static MenuBarInfo pvocMenuBar[] = {
	{ "  File  ", fileMenu },
	{ "  View  ", viewMenu },
	{ "  Edit  ", editMenu },
	{ " Modify ", modifyMenu },
	{ "  PVoc  ", pvocSpecialMenu },
	{ " Analysis ", analysisMenu },
	{ " Display ", channelDisplayMenu },
	{ " Options ", optionsMenu },
	{ nil }
};

////////

const MenuBarInfo *
DataEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : defaultChannelMenuBar;
}

const MenuBarInfo *
SoundEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : soundMenuBar;
}

const MenuBarInfo *
LPCEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : lpcMenuBar;
}

const MenuBarInfo *
PvocEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : pvocMenuBar;
}

const MenuBarInfo *
PCHEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : pitchMenuBar;
}

const MenuBarInfo *
EnvelopeEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : envelopeMenuBar;
}

const MenuBarInfo *
FFTEditor::menuBarInfo() const {
	return model()->displayAsFrames() ?
		defaultFrameMenuBar : defaultChannelMenuBar;
}