summaryrefslogtreecommitdiff
path: root/win/Mainfrm.cpp
diff options
context:
space:
mode:
authorleo2003-09-18 16:50:52 +0000
committerleo2003-09-18 16:50:52 +0000
commit4bd07328df37f1bc8a16cdd77decf49467b6c4be (patch)
tree31c714fab1ece4cd75a3df66e10821a2a9394caf /win/Mainfrm.cpp
parent3df8b99fe7e3961006ab4cd4a3bdc33c7c2b7e51 (diff)
Added a progress bar for long operations.
git-svn-id: http://svn.leocad.org/trunk@349 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/Mainfrm.cpp')
-rw-r--r--win/Mainfrm.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 7c88533..3f30de8 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -3,6 +3,7 @@
#include "stdafx.h"
#include <afxrich.h>
+#include <afxpriv.h>
#include "LeoCAD.h"
#include "MainFrm.h"
#include "Camera.h"
@@ -102,6 +103,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND(ID_FILE_PRINTPIECELIST, OnFilePrintPieceList)
ON_WM_ACTIVATEAPP()
ON_COMMAND(ID_VIEW_NEWVIEW, OnViewNewView)
+ ON_MESSAGE(WM_SETMESSAGESTRING, OnSetMessageString)
//}}AFX_MSG_MAP
ON_COMMAND_RANGE(ID_PIECEBAR_ZOOMPREVIEW, ID_PIECEBAR_SUBPARTS, OnPieceBar)
ON_UPDATE_COMMAND_UI_RANGE(ID_PIECEBAR_ZOOMPREVIEW, ID_PIECEBAR_SUBPARTS, OnUpdatePieceBar)
@@ -987,6 +989,49 @@ void CMainFrame::OnActivateApp(BOOL bActive, HTASK hTask)
project->HandleNotify(LC_ACTIVATE, bActive ? 1 : 0);
}
+LRESULT CMainFrame::OnSetMessageString(WPARAM wParam, LPARAM lParam)
+{
+ UINT nIDLast = m_nIDLastMessage;
+ m_nFlags &= ~WF_NOPOPMSG;
+
+ CWnd* pMessageBar = GetMessageBar();
+ if (pMessageBar != NULL)
+ {
+ LPCTSTR lpsz = NULL;
+ CString strMessage;
+
+ // set the message bar text
+ if (!m_strStatusBar.IsEmpty())
+ {
+ lpsz = m_strStatusBar;
+ }
+ else 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)
+ {
+ // map SC_CLOSE to PREVIEW_CLOSE when in print preview mode
+ if (wParam == AFX_IDS_SCCLOSE && m_lpfnCloseProc != NULL)
+ wParam = AFX_IDS_PREVIEW_CLOSE;
+
+ // get message associated with the ID indicated by wParam
+ GetMessageString(wParam, strMessage);
+ lpsz = strMessage;
+ }
+ pMessageBar->SetWindowText(lpsz);
+
+ // update owner of the bar in terms of last message selected
+ m_nIDLastMessage = (UINT)wParam;
+ m_nIDTracking = (UINT)wParam;
+ }
+
+ m_nIDLastMessage = (UINT)wParam; // new ID (or 0)
+ m_nIDTracking = (UINT)wParam; // so F1 on toolbar buttons work
+ return nIDLast;
+}
+
#include "view.h"
LRESULT CALLBACK GLWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);