Skip to content

Commit

Permalink
- Added circular item focus in ShortcutsWindow.
Browse files Browse the repository at this point in the history
- Version bump for 0.20.1
  • Loading branch information
clangen committed Jul 16, 2017
1 parent 9a8a305 commit 28d43f2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/musikbox/app/util/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
47 changes: 28 additions & 19 deletions src/musikbox/cursespp/ShortcutsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,38 @@ void ShortcutsWindow::SetChangedCallback(ChangedCallback callback) {

bool ShortcutsWindow::KeyPress(const std::string& key) {
if (this->changedCallback && this->IsFocused()) {
if (key == "KEY_RIGHT") {
int active = getActiveIndex();
if (active >= 0 && active + 1 < (int) this->entries.size()) {
this->activeKey = this->entries[active + 1]->key;
int count = (int) this->entries.size();
if (count > 0) {
if (key == "KEY_RIGHT") {
int active = getActiveIndex();
if (active >= 0 && active + 1 < count) {
this->activeKey = this->entries[active + 1]->key;
}
else {
this->activeKey = this->entries[0]->key;
}
this->Redraw();
return true;
}
return true;
}
else if (key == "KEY_LEFT") {
int active = getActiveIndex();
if (active > 0) {
this->activeKey = this->entries[active - 1]->key;
else if (key == "KEY_LEFT") {
int active = getActiveIndex();
if (active > 0) {
this->activeKey = this->entries[active - 1]->key;
}
else {
this->activeKey = this->entries[count - 1]->key;
}
this->Redraw();
return true;
}
return true;
}
else if (key == "KEY_ENTER") {
/* replace the original key we cached when we were forcused originally
to "commit" the operation, as it'll be swapped back when we lose focus */
this->originalKey = this->activeKey;

if (this->changedCallback) {
this->changedCallback(this->activeKey);
else if (key == "KEY_ENTER") {
/* replace the original key we cached when we were forcused originally
to "commit" the operation, as it'll be swapped back when we lose focus */
this->originalKey = this->activeKey;

if (this->changedCallback) {
this->changedCallback(this->activeKey);
}
}
}
}
Expand Down

0 comments on commit 28d43f2

Please sign in to comment.