From 4a2711476ca954edfd218355eb9a272480dd014d Mon Sep 17 00:00:00 2001 From: Daniel Richard G Date: Fri, 20 Sep 2013 14:01:31 -0400 Subject: [PATCH] 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.) --- graphicswin.cpp | 2 +- win32/w32main.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/graphicswin.cpp b/graphicswin.cpp index 0df9d965..f49843f3 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -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 }, diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 9ceaea9f..ccd9d1e2 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -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);