Record accelerator for "Show Snap Grid" as '>' instead of Shift-'.'

If we are to synthesize accelerator labels from values of
GraphicsWindow::menu[].accel, it will be more straightforward if
accelerators are represented in the same way that they appear in the menu.
(Windows does return the keystroke as VK_OEM_PERIOD with a Shift modifier,
so we add some special-case logic to recognize that.)
pull/3/head
Daniel Richard G 2013-09-20 14:01:31 -04:00
parent 9da2a3a6c7
commit 4a2711476c
2 changed files with 5 additions and 1 deletions

View File

@ -65,7 +65,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
{ 1, "Nearest &Isometric View\tF3", MNU_NEAREST_ISO, F(3), mView },
{ 1, "&Center View At Point\tF4", MNU_CENTER_VIEW, F(4), mView },
{ 1, NULL, 0, 0, NULL },
{ 1, "Show Snap &Grid\t>", MNU_SHOW_GRID, '.'|S, mView },
{ 1, "Show Snap &Grid\t>", MNU_SHOW_GRID, '>', mView },
{ 1, "Use &Perspective Projection\t`", MNU_PERSPECTIVE_PROJ,'`', mView },
{ 1, NULL, 0, 0, NULL },
{ 1, "Show Text &Window\tTab", MNU_SHOW_TEXT_WND, '\t', mView },

View File

@ -569,6 +569,10 @@ static BOOL ProcessKeyDown(WPARAM wParam)
if(GetAsyncKeyState(VK_SHIFT) & 0x8000) c |= GraphicsWindow::SHIFT_MASK;
if(GetAsyncKeyState(VK_CONTROL) & 0x8000) c |= GraphicsWindow::CTRL_MASK;
switch(c) {
case GraphicsWindow::SHIFT_MASK | '.': c = '>'; break;
}
for(int i = 0; SS.GW.menu[i].level >= 0; i++) {
if(c == SS.GW.menu[i].accel) {
(SS.GW.menu[i].fn)((GraphicsWindow::MenuId)SS.GW.menu[i].id);