From 4a9460797182054c981d7d2f3fdfb113dc74be9e Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 1 Jun 2005 21:54:51 +0000 Subject: Automatically resize status bar panes to fit their text. git-svn-id: http://svn.leocad.org/trunk@394 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/System.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'win/System.cpp') 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) -- cgit v1.2.3