diff --git a/MANUAL.md b/MANUAL.md index f617cf5..b32d6b7 100644 --- 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 index 2a86a6e..e60ce93 100644 --- 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) { - this->lrange = spek_min(this->lrange + 1, this->urange - 1); - } else if (C && D) { - this->lrange = spek_max(this->lrange - 1, MIN_RANGE); - } else if (CS && U) { - this->urange = spek_min(this->urange + 1, MAX_RANGE); - } else if (CS && D) { - this->urange = spek_max(this->urange - 1, this->lrange + 1); - } else if (S && evt.GetKeyCode() == 'F') { + switch (evt.GetKeyCode()) { + case 'F': this->window_function = (enum window_function) ((this->window_function + 1) % WINDOW_COUNT); - } else if (N && evt.GetKeyCode() == 'f') { + break; + case 'f': this->window_function = (enum window_function) ((this->window_function - 1 + WINDOW_COUNT) % WINDOW_COUNT); - } else if (S && evt.GetKeyCode() == 'S') { - this->fft_bits = spek_min(this->fft_bits + 1, MAX_FFT_BITS); - this->create_palette(); - } else if (N && evt.GetKeyCode() == 's') { - this->fft_bits = spek_max(this->fft_bits - 1, MIN_FFT_BITS); - this->create_palette(); - } else if (S && evt.GetKeyCode() == 'P') { + break; + case 'L': + this->lrange = spek_min(this->lrange + 1, this->urange - 1); + break; + case 'l': + this->lrange = spek_max(this->lrange - 1, MIN_RANGE); + break; + case 'P': this->palette = (enum palette) ((this->palette + 1) % PALETTE_COUNT); this->create_palette(); - } else if (N && evt.GetKeyCode() == 'p') { + break; + case 'p': this->palette = (enum palette) ((this->palette - 1 + PALETTE_COUNT) % PALETTE_COUNT); this->create_palette(); - } else { + break; + case 'U': + this->urange = spek_min(this->urange + 1, MAX_RANGE); + break; + case 'u': + this->urange = spek_max(this->urange - 1, this->lrange + 1); + break; + case 'W': + this->fft_bits = spek_min(this->fft_bits + 1, MAX_FFT_BITS); + this->create_palette(); + break; + case 'w': + this->fft_bits = spek_max(this->fft_bits - 1, MIN_FFT_BITS); + this->create_palette(); + break; + default: evt.Skip(); return; }