commit 9e62fd2d63f578de33e2604d1fb239b0c423a140
parent 586e9d82a81fe2e5384e706ef788f878165e12c6
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 5 Jun 2016 16:08:42 -0400
manager: implement Ctrl+A and Ctrl+Shift+A shortcuts
Diffstat:
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/dialog.cpp b/src/dialog.cpp
@@ -97,6 +97,8 @@ int Dialog::HandleKey(MSG *msg, accelerator_register_t *accel)
if(GetAsyncKeyState(VK_CONTROL) & 0x8000)
modifiers |= MOD_CONTROL;
+ if(GetAsyncKeyState(VK_SHIFT) & 0x8000)
+ modifiers |= MOD_SHIFT;
if(msg->message == WM_KEYDOWN && dialog->onKeyDown(msg->wParam, modifiers))
return 1;
diff --git a/src/dialog.hpp b/src/dialog.hpp
@@ -98,6 +98,7 @@ public:
protected:
enum Modifiers {
MOD_CONTROL = 1<<1,
+ MOD_SHIFT = 1<<2,
};
Dialog(int templateId);
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -175,18 +175,25 @@ void Manager::onContextMenu(HWND target, const int x, const int y)
bool Manager::onKeyDown(const int key, const int mods)
{
- if(GetFocus() == m_list->handle() && mods & MOD_CONTROL && key == 'C') {
+ if(GetFocus() != m_list->handle())
+ return false;
+
+ if(mods == MOD_CONTROL && key == 'A')
+ m_list->selectAll();
+ else if(mods == (MOD_CONTROL | MOD_SHIFT) && key == 'A')
+ m_list->unselectAll();
+ else if(mods == MOD_CONTROL && key == 'C') {
vector<string> values;
for(const int index : m_list->selection(false))
values.push_back(getRemote(index).url());
setClipboard(values);
-
- return true;
}
+ else
+ return false;
- return false;
+ return true;
}
void Manager::refresh()