diff options
author | Alexander Kojevnikov <alexander@kojevnikov.com> | 2016-04-03 16:58:32 -0700 |
---|---|---|
committer | Alexander Kojevnikov <alexander@kojevnikov.com> | 2016-04-03 16:58:32 -0700 |
commit | b35bcbc090251d610abbcf49ca1777177b70a8a0 (patch) | |
tree | e633ab8b701325d830b9c8a1c43fa3732e190b45 /src | |
parent | 70ecaae62eb908f0784cce406138fcc6787f718e (diff) | |
download | spek-b35bcbc090251d610abbcf49ca1777177b70a8a0.zip spek-b35bcbc090251d610abbcf49ca1777177b70a8a0.tar.gz spek-b35bcbc090251d610abbcf49ca1777177b70a8a0.tar.bz2 |
Update shortcuts
Diffstat (limited to 'src')
-rw-r--r-- | src/spek-spectrogram.cc | 54 |
1 files changed, 29 insertions, 25 deletions
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) { + 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; } |