commit b35bcbc090251d610abbcf49ca1777177b70a8a0
parent 70ecaae62eb908f0784cce406138fcc6787f718e
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Sun, 3 Apr 2016 16:58:32 -0700
Update shortcuts
Diffstat:
2 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/MANUAL.md b/MANUAL.md
@@ -47,21 +47,21 @@ On OS X use the Command key instead of Ctrl.
## Spectrogram
-`Ctrl-up`, `Ctrl-down`
-: Change the lower limit of the dynamic range in dBFS.
-
-`Ctrl-Shift-up`, `Ctrl-Shift-down`
-: Change the upper limit of the dynamic range in dBFS.
-
`f`, `F`
: Change the DFT window function.
-`s`, `S`
-: Change the DFT window size.
+`l`, `L`
+: Change the lower limit of the dynamic range in dBFS.
`p`, `P`
: Change the palette.
+`u`, `U`
+: Change the upper limit of the dynamic range in dBFS.
+
+`w`, `W`
+: Change the DFT window size.
+
# FILES
*~/.config/spek/preferences*
diff --git a/src/spek-spectrogram.cc b/src/spek-spectrogram.cc
@@ -87,39 +87,43 @@ void SpekSpectrogram::save(const wxString& path)
void SpekSpectrogram::on_char(wxKeyEvent& evt)
{
- bool N = evt.GetModifiers() == wxMOD_NONE;
- bool C = evt.GetModifiers() == wxMOD_CONTROL;
- bool S = evt.GetModifiers() == wxMOD_SHIFT;
- bool CS = evt.GetModifiers() == (wxMOD_CONTROL | wxMOD_SHIFT);
- bool U = evt.GetKeyCode() == WXK_UP;
- bool D = evt.GetKeyCode() == WXK_DOWN;
-
- if (C && U) {
+ switch (evt.GetKeyCode()) {
+ case 'F':
+ this->window_function = (enum window_function) ((this->window_function + 1) % WINDOW_COUNT);
+ break;
+ case 'f':
+ this->window_function =
+ (enum window_function) ((this->window_function - 1 + WINDOW_COUNT) % WINDOW_COUNT);
+ break;
+ case 'L':
this->lrange = spek_min(this->lrange + 1, this->urange - 1);
- } else if (C && D) {
+ break;
+ case 'l':
this->lrange = spek_max(this->lrange - 1, MIN_RANGE);
- } else if (CS && U) {
+ break;
+ case 'P':
+ this->palette = (enum palette) ((this->palette + 1) % PALETTE_COUNT);
+ this->create_palette();
+ break;
+ case 'p':
+ this->palette = (enum palette) ((this->palette - 1 + PALETTE_COUNT) % PALETTE_COUNT);
+ this->create_palette();
+ break;
+ case 'U':
this->urange = spek_min(this->urange + 1, MAX_RANGE);
- } else if (CS && D) {
+ break;
+ case 'u':
this->urange = spek_max(this->urange - 1, this->lrange + 1);
- } else if (S && evt.GetKeyCode() == 'F') {
- this->window_function = (enum window_function) ((this->window_function + 1) % WINDOW_COUNT);
- } else if (N && evt.GetKeyCode() == 'f') {
- this->window_function =
- (enum window_function) ((this->window_function - 1 + WINDOW_COUNT) % WINDOW_COUNT);
- } else if (S && evt.GetKeyCode() == 'S') {
+ break;
+ case 'W':
this->fft_bits = spek_min(this->fft_bits + 1, MAX_FFT_BITS);
this->create_palette();
- } else if (N && evt.GetKeyCode() == 's') {
+ break;
+ case 'w':
this->fft_bits = spek_max(this->fft_bits - 1, MIN_FFT_BITS);
this->create_palette();
- } else if (S && evt.GetKeyCode() == 'P') {
- this->palette = (enum palette) ((this->palette + 1) % PALETTE_COUNT);
- this->create_palette();
- } else if (N && evt.GetKeyCode() == 'p') {
- this->palette = (enum palette) ((this->palette - 1 + PALETTE_COUNT) % PALETTE_COUNT);
- this->create_palette();
- } else {
+ break;
+ default:
evt.Skip();
return;
}