summaryrefslogtreecommitdiff
path: root/win/Cadview.cpp
diff options
context:
space:
mode:
authorleo2001-02-22 02:16:38 +0000
committerleo2001-02-22 02:16:38 +0000
commitfa8c666962290365f5b29f8e84f86ab129255143 (patch)
tree7fc42a1f0090f40d6406cbfc29d2095b36e0d37d /win/Cadview.cpp
parent1ed1d967b4973cf6c7b8eb6f0d160b2f6ddd713a (diff)
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
Diffstat (limited to 'win/Cadview.cpp')
-rw-r--r--win/Cadview.cpp28
1 files changed, 28 insertions, 0 deletions
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);