From fa8c666962290365f5b29f8e84f86ab129255143 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 22 Feb 2001 02:16:38 +0000 Subject: New shortcuts: Home/End keys will change the Pieces List selection git-svn-id: http://svn.leocad.org/trunk@252 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/Cadview.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'win/Cadview.cpp') diff --git a/win/Cadview.cpp b/win/Cadview.cpp index 744f8ce..44b7e36 100644 --- a/win/Cadview.cpp +++ b/win/Cadview.cpp @@ -14,6 +14,8 @@ #include "system.h" #include "camera.h" #include "view.h" +#include "MainFrm.h" +#include "PiecePrv.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -926,6 +928,32 @@ void CCADView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { nKey = nChar - VK_NUMPAD0 + 0x30; } break; + + // select the next/previous piece on the pieces list + case VK_HOME: + case VK_END: + { + 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; } project->OnKeyDown(nKey, GetKeyState (VK_CONTROL) < 0, GetKeyState (VK_SHIFT) < 0); -- cgit v1.2.3