- Added circular item focus in ShortcutsWindow.

- Version bump for 0.20.1
This commit is contained in:
casey langen 2017-07-15 19:53:32 -07:00
parent 9a8a305848
commit 28d43f2111
4 changed files with 36 additions and 21 deletions

View File

@ -1,3 +1,9 @@
0.21.1
* arrow keys can now select items in the shortcuts window while focused.
--------------------------------------------------------------------------------
0.20.0
* added play queue "hot-swap". you can now swap a different list of tracks

View File

@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0)
project(musikbox)
set (musikbox_VERSION_MAJOR 0)
set (musikbox_VERSION_MINOR 20)
set (musikbox_VERSION_PATCH 0)
set (musikbox_VERSION_PATCH 1)
set (musikbox_VERSION "${musikbox_VERSION_MAJOR}.${musikbox_VERSION_MINOR}.${musikbox_VERSION_PATCH}")
include(CMakeToolsHelpers OPTIONAL)

View File

@ -2,5 +2,5 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 20
#define VERSION_PATCH 0
#define VERSION "0.20.0"
#define VERSION_PATCH 1
#define VERSION "0.20.1"

View File

@ -107,20 +107,28 @@ void ShortcutsWindow::SetChangedCallback(ChangedCallback callback) {
bool ShortcutsWindow::KeyPress(const std::string& key) {
if (this->changedCallback && this->IsFocused()) {
int count = (int) this->entries.size();
if (count > 0) {
if (key == "KEY_RIGHT") {
int active = getActiveIndex();
if (active >= 0 && active + 1 < (int) this->entries.size()) {
if (active >= 0 && active + 1 < count) {
this->activeKey = this->entries[active + 1]->key;
this->Redraw();
}
else {
this->activeKey = this->entries[0]->key;
}
this->Redraw();
return true;
}
else if (key == "KEY_LEFT") {
int active = getActiveIndex();
if (active > 0) {
this->activeKey = this->entries[active - 1]->key;
this->Redraw();
}
else {
this->activeKey = this->entries[count - 1]->key;
}
this->Redraw();
return true;
}
else if (key == "KEY_ENTER") {
@ -133,6 +141,7 @@ bool ShortcutsWindow::KeyPress(const std::string& key) {
}
}
}
}
return false;
}