From 4ea740dc8870e9bbeae8d76faf3f99d44da57e3a Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 13 Dec 2004 20:37:52 +0000 Subject: Added keys for Angle Snap, and display it on the Status Bar. git-svn-id: http://svn.leocad.org/trunk@366 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/System.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'win/System.cpp') diff --git a/win/System.cpp b/win/System.cpp index c8a36ae..cf19926 100644 --- a/win/System.cpp +++ b/win/System.cpp @@ -665,19 +665,35 @@ void SystemUpdateTime(bool bAnimation, int nTime, int nTotal) StepModeless->UpdateRange(nTime, nTotal); } -void SystemUpdateMoveSnap(unsigned short nMoveSnap) +void SystemUpdateSnap(unsigned short MoveSnap, unsigned short RotateSnap) { // Status bar - char snap[11]; + char snap[256]; CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd(); CStatusBar* pStatusBar = (CStatusBar*)pFrame->GetControlBar(AFX_IDW_STATUS_BAR); - if (nMoveSnap) - wsprintf(snap, " Move x%i ", nMoveSnap); + if (MoveSnap) + wsprintf(snap, " M: %d R: %d ", MoveSnap, RotateSnap); else - strcpy (snap, " Move /2 "); + wsprintf(snap, " M: /2 R: %d ", RotateSnap); - pStatusBar->SetPaneText(pStatusBar->CommandToIndex(ID_INDICATOR_SNAP), LPCSTR(snap)); + int Index = pStatusBar->CommandToIndex(ID_INDICATOR_SNAP); + pStatusBar->SetPaneText(Index, LPCSTR(snap)); + + // Resize the pane to fit the text. + UINT nID, nStyle; int cxWidth; + HFONT hFont = (HFONT)pStatusBar->SendMessage(WM_GETFONT); + CClientDC dcScreen(NULL); + HGDIOBJ hOldFont = NULL; + if (hFont != NULL) + hOldFont = dcScreen.SelectObject(hFont); + + pStatusBar->GetPaneInfo(Index, nID, nStyle, cxWidth); + cxWidth = dcScreen.GetTextExtent(snap).cx; + pStatusBar->SetPaneInfo(Index, nID, nStyle, cxWidth); + + if (hOldFont != NULL) + dcScreen.SelectObject(hOldFont); } void SystemUpdatePaste(bool enable) -- cgit v1.2.3