mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Fix navigation keys for OS X and Windows
On OS X we can use Cmd+[ or Cmd+] to navigate the history. And Cmd+Up/Down to go to the enclosing folder, or enter in a folder respectively. On Windows we can use Alt+Left/Right to navigate the history. And Alt+Up to go to the enclosing folder. (Alt+Down is an extra shortcut to enter in the folder).
This commit is contained in:
parent
4e911b7eea
commit
05fb32bb84
@ -191,18 +191,41 @@ protected:
|
||||
case kCloseMessage:
|
||||
getManager()->removeMessageFilter(kKeyDownMessage, this);
|
||||
break;
|
||||
case kKeyDownMessage:
|
||||
if (msg->ctrlPressed() || msg->cmdPressed()) {
|
||||
KeyMessage* keyMsg = static_cast<KeyMessage*>(msg);
|
||||
KeyScancode scancode = keyMsg->scancode();
|
||||
switch (scancode) {
|
||||
case kKeyUp: m_filesel->goUp(); return true;
|
||||
case kKeyLeft: m_filesel->goBack(); return true;
|
||||
case kKeyRight: m_filesel->goForward(); return true;
|
||||
case kKeyDown: m_filesel->goInsideFolder(); return true;
|
||||
}
|
||||
case kKeyDownMessage: {
|
||||
KeyMessage* keyMsg = static_cast<KeyMessage*>(msg);
|
||||
KeyScancode scancode = keyMsg->scancode();
|
||||
int unicode = keyMsg->unicodeChar();
|
||||
|
||||
#ifdef __APPLE__
|
||||
bool up = (msg->cmdPressed() && scancode == kKeyUp);
|
||||
bool enter = (msg->cmdPressed() && scancode == kKeyDown);
|
||||
bool back = (msg->cmdPressed() && msg->shiftPressed() && unicode == '[');
|
||||
bool forward = (msg->cmdPressed() && msg->shiftPressed() && unicode == ']');
|
||||
#else
|
||||
bool up = (msg->altPressed() && scancode == kKeyUp);
|
||||
bool enter = (msg->altPressed() && scancode == kKeyDown);
|
||||
bool back = (msg->altPressed() && scancode == kKeyLeft);
|
||||
bool forward = (msg->altPressed() && scancode == kKeyRight);
|
||||
#endif
|
||||
|
||||
if (up) {
|
||||
m_filesel->goUp();
|
||||
return true;
|
||||
}
|
||||
if (enter) {
|
||||
m_filesel->goInsideFolder();
|
||||
return true;
|
||||
}
|
||||
if (back) {
|
||||
m_filesel->goBack();
|
||||
return true;
|
||||
}
|
||||
if (forward) {
|
||||
m_filesel->goForward();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return Widget::onProcessMessage(msg);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user