summaryrefslogtreecommitdiff
path: root/win/System.cpp
diff options
context:
space:
mode:
authorleo2005-06-01 21:54:51 +0000
committerleo2005-06-01 21:54:51 +0000
commit4a9460797182054c981d7d2f3fdfb113dc74be9e (patch)
treebdc2bf9fd70edbb21af29cc49c23a20e74c9fcc4 /win/System.cpp
parent26885315bc07017948d54962b5d585b8bc666b24 (diff)
Automatically resize status bar panes to fit their text.
git-svn-id: http://svn.leocad.org/trunk@394 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/System.cpp')
-rw-r--r--win/System.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/win/System.cpp b/win/System.cpp
index 6d951ce..ec016fd 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -669,31 +669,13 @@ void SystemUpdateSnap(unsigned short MoveSnap, unsigned short RotateSnap)
{
// Status bar
char snap[256];
- CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd();
- CStatusBar* pStatusBar = (CStatusBar*)pFrame->GetControlBar(AFX_IDW_STATUS_BAR);
if (MoveSnap)
wsprintf(snap, " M: %d R: %d ", MoveSnap, RotateSnap);
else
wsprintf(snap, " M: /2 R: %d ", RotateSnap);
- 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);
+ ((CMainFrame*)AfxGetMainWnd())->SetStatusBarPane(ID_INDICATOR_SNAP, snap);
}
void SystemUpdatePaste(bool enable)