From f4e2b1c72b90a0e5b85dd2e190351acdadcc5baa Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 26 Feb 2006 22:06:29 +0000 Subject: Show selection on the status bar. git-svn-id: http://svn.leocad.org/trunk@497 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/Mainfrm.cpp | 13 +++++++------ win/System.cpp | 27 +++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) (limited to 'win') diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp index 6754379..cb980ab 100644 --- a/win/Mainfrm.cpp +++ b/win/Mainfrm.cpp @@ -1082,16 +1082,12 @@ LRESULT CMainFrame::OnSetMessageString(WPARAM wParam, LPARAM lParam) CString strMessage; // set the message bar text - if (!m_strStatusBar.IsEmpty()) - { - lpsz = m_strStatusBar; - } - else if (lParam != 0) + if (lParam != 0) { ASSERT(wParam == 0); // can't have both an ID and a string lpsz = (LPCTSTR)lParam; // set an explicit string } - else if (wParam != 0) + else if ((wParam != 0) && !(wParam == AFX_IDS_IDLEMESSAGE && !m_strStatusBar.IsEmpty())) { // map SC_CLOSE to PREVIEW_CLOSE when in print preview mode if (wParam == AFX_IDS_SCCLOSE && m_lpfnCloseProc != NULL) @@ -1101,6 +1097,11 @@ LRESULT CMainFrame::OnSetMessageString(WPARAM wParam, LPARAM lParam) GetMessageString(wParam, strMessage); lpsz = strMessage; } + else if (!m_strStatusBar.IsEmpty()) + { + lpsz = m_strStatusBar; + } + pMessageBar->SetWindowText(lpsz); // update owner of the bar in terms of last message selected diff --git a/win/System.cpp b/win/System.cpp index 89b57ca..47db92b 100644 --- a/win/System.cpp +++ b/win/System.cpp @@ -586,10 +586,10 @@ void SystemUpdateSnap(const unsigned long nSnap) // TODO: change Snap None & All (or maybe not ?) } -void SystemUpdateSelected(unsigned long flags) +void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus) { CMenu* pMenu; - CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd(); + CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd(); if (!pFrame) return; CToolBar* pBar = (CToolBar*)pFrame->GetControlBar(AFX_IDW_TOOLBAR); @@ -655,6 +655,29 @@ void SystemUpdateSelected(unsigned long flags) pCtrl->EnableButton(ID_PIECE_PREVIOUS, flags & LC_SEL_PIECE ? TRUE : FALSE); pCtrl->EnableButton(ID_PIECE_NEXT, flags & LC_SEL_PIECE ? TRUE : FALSE); + + // Status bar text. + if (SelectedCount == 0) + { + pFrame->SetStatusBarMessage(""); + pFrame->SetMessageText(AFX_IDS_IDLEMESSAGE); + } + else if ((SelectedCount == 1) && (Focus != NULL)) + { + pFrame->SetStatusBarMessage(Focus->GetName()); + pFrame->SetMessageText(Focus->GetName()); + } + else + { + char Message[256]; + if (SelectedCount == 1) + strcpy(Message, "1 Object selected."); + else + sprintf(Message, "%d Objects selected.", SelectedCount); + + pFrame->SetStatusBarMessage(Message); + pFrame->SetMessageText(Message); + } } // Changed current step/frame -- cgit v1.2.3