diff --git a/common/view.cpp b/common/view.cpp index dcff7daa..85c77e4f 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -69,13 +69,15 @@ LC_CURSOR_TYPE View::GetCursor(int Ptx, int Pty) const case LC_ACTION_ROTATE_VIEW: switch (m_Project->GetOverlayMode()) { - case LC_OVERLAY_X: return LC_CURSOR_ROTATEX; - case LC_OVERLAY_Y: return LC_CURSOR_ROTATEY; - case LC_OVERLAY_Z: return LC_CURSOR_ROLL; - case LC_OVERLAY_XYZ: return LC_CURSOR_ROTATE_VIEW; + case LC_OVERLAY_X: + return LC_CURSOR_ROTATEX; + case LC_OVERLAY_Y: + return LC_CURSOR_ROTATEY; + case LC_OVERLAY_Z: + return LC_CURSOR_ROLL; + case LC_OVERLAY_XYZ: default: - LC_ASSERT_FALSE("Unknown cursor type."); - return LC_CURSOR_NONE; + return LC_CURSOR_ROTATE_VIEW; } case LC_ACTION_ROLL: diff --git a/win/Cadview.cpp b/win/Cadview.cpp index 14cab0e0..22024857 100644 --- a/win/Cadview.cpp +++ b/win/Cadview.cpp @@ -661,90 +661,54 @@ void CCADView::OnCaptureChanged(CWnd *pWnd) CView::OnCaptureChanged(pWnd); } - - - - - - - - void CCADView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { char nKey = nChar; - switch (nChar) - { - case VK_NUMPAD0 : case VK_NUMPAD1 : case VK_NUMPAD2 : case VK_NUMPAD3 : case VK_NUMPAD4 : - case VK_NUMPAD5 : case VK_NUMPAD6 : case VK_NUMPAD7 : case VK_NUMPAD8 : case VK_NUMPAD9 : - { - nKey = nChar - VK_NUMPAD0 + 0x30; - } break; - - // select the next/previous piece on the pieces list - case VK_HOME: - case VK_END: + if (nChar >= VK_NUMPAD0 && nChar <= VK_NUMPAD9) { - /* - CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd (); - CPiecesList& pList = pMain->m_wndPiecesBar.m_wndPiecesList; - LV_FINDINFO lvfi; - int sel; - - lvfi.flags = LVFI_PARAM; - lvfi.lParam = (LPARAM)pMain->m_wndPiecesBar.m_wndPiecePreview.GetPieceInfo (); - sel = pList.FindItem (&lvfi); - - if (sel != -1) - { - if (nChar == VK_HOME) - sel--; - else - sel++; - - pList.SetItemState (sel, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); - pList.EnsureVisible (sel, FALSE); - } -*/ - } break; + nKey = nChar - VK_NUMPAD0 + '0'; } - lcGetActiveProject()->OnKeyDown(nKey, GetKeyState (VK_CONTROL) < 0, GetKeyState (VK_SHIFT) < 0); -/* - switch (nChar) + // Update cursor for multiple selection. + if (nChar == VK_CONTROL) { -// HANDLE CTRL if action == pan/zoom - case VK_CONTROL: - if (m_nCurAction == ACTION_SELECT) + if (lcGetActiveProject()->GetAction() == LC_ACTION_SELECT) { POINT pt; + GetCursorPos(&pt); CRect rc; GetWindowRect(rc); + if (rc.PtInRect(pt)) OnSetCursor(this, HTCLIENT, 0); - } break; -*/ + } + } + + lcGetActiveProject()->OnKeyDown(nKey, GetKeyState (VK_CONTROL) < 0, GetKeyState (VK_SHIFT) < 0); + CView::OnKeyDown(nChar, nRepCnt, nFlags); } void CCADView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { -/* if (nChar == VK_CONTROL) + // Update cursor for multiple selection. + if (nChar == VK_CONTROL) { -// HANDLE CTRL if action == pan/zoom - CCADDoc* pDoc = GetDocument(); - if (pDoc->m_nCurAction == ACTION_SELECT) + if (lcGetActiveProject()->GetAction() == LC_ACTION_SELECT) { POINT pt; + GetCursorPos(&pt); CRect rc; GetWindowRect(rc); + if (rc.PtInRect(pt)) OnSetCursor(this, HTCLIENT, 0); } } -*/ + CView::OnKeyUp(nChar, nRepCnt, nFlags); }