ON_COMMAND(ID_WINDOW_CLOSEALL, OnWindowCloseAll)
ON_UPDATE_COMMAND_UI(ID_WINDOW_CLOSEALL, OnUpdateWindowCloseAll)
ON_COMMAND(ID_FILE_SAVEPROJECT, OnSaveProject)
+ ON_WM_TIMER()
+ ON_WM_ACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
ID_INDICATOR_SCRL,
};
-/**
- * @brief Relative (to WinMerge executable ) path to local help file.
- */
+/** @brief Relative (to WinMerge executable ) path to local help file. */
static const TCHAR DocsPath[] = _T("\\Docs\\WinMerge.chm");
/**
*/
static const TCHAR DefaultRelativeFilterPath[] = _T("WinMergeFilters");
+/** @brief Timer ID for window flashing timer. */
+static const UINT ID_TIMER_FLASH = 1;
+
+/** @brief Timeout for window flashing timer, in milliseconds. */
+static const UINT WINDOW_FLASH_TIMEOUT = 500;
+
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
* @todo Preference for logging?
*/
CMainFrame::CMainFrame()
+: m_bFlashing(FALSE)
+, m_bFirstTime(TRUE)
+, m_bEscShutdown(FALSE)
+, m_bClearCaseTool(FALSE)
+, m_bShowErrors(TRUE)
+, m_CheckOutMulti(FALSE)
+, m_bVCProjSync(FALSE)
+, m_bVssSuppressPathCheck(FALSE)
{
- m_bFirstTime = TRUE;
- m_bEscShutdown = FALSE;
- m_bClearCaseTool = FALSE;
ZeroMemory(&m_pMenus[0], sizeof(m_pMenus));
OptionsInit(); // Implementation in OptionsInit.cpp
UpdateCodepageModule();
- m_bShowErrors = TRUE;
- m_CheckOutMulti = FALSE;
- m_bVCProjSync = FALSE;
- m_bVssSuppressPathCheck = FALSE;
-
InitializeSourceControlMembers();
g_bUnpackerMode = theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL);
// uncomment this when the GUI allows to toggle the mode
/**
* @brief Send current option settings into codepage module
*/
-void
-CMainFrame::UpdateCodepageModule()
+void CMainFrame::UpdateCodepageModule()
{
// Get current codepage settings from the options module
// and push them into the codepage module
updateDefaultCodepage(m_options.GetInt(OPT_CP_DEFAULT_MODE), m_options.GetInt(OPT_CP_DEFAULT_CUSTOM));
}
-void
-CMainFrame::OnTimer(UINT nIDEvent)
+/**
+ * @brief Handle timer events.
+ * @param [in] nIDEvent Timer that timed out.
+ */
+void CMainFrame::OnTimer(UINT nIDEvent)
{
- if (nIDEvent == WM_NONINTERACTIVE)
+ switch (nIDEvent)
{
- KillTimer(nIDEvent);
+ case WM_NONINTERACTIVE:
+ KillTimer(WM_NONINTERACTIVE);
PostMessage(WM_CLOSE);
+ break;
+
+ case ID_TIMER_FLASH:
+ // This timer keeps running until window is activated
+ // See OnActivate()
+ FlashWindow(TRUE);
+ break;
}
+ CMDIFrameWnd::OnTimer(nIDEvent);
}
/**
pathsDlg.m_sFilter = filterNameOrMask;
sht.DoModal();
}
+
+/**
+ * @brief Start flashing window if window is inactive.
+ */
+void CMainFrame::StartFlashing()
+{
+ CWnd * activeWindow = GetActiveWindow();
+ if (activeWindow != this)
+ {
+ FlashWindow(TRUE);
+ m_bFlashing = TRUE;
+ SetTimer(ID_TIMER_FLASH, WINDOW_FLASH_TIMEOUT, NULL);
+ }
+}
+
+/**
+ * @brief Stop flashing window when window is activated.
+ *
+ * If WinMerge is inactive when compare finishes, we start flashing window
+ * to alert user. When user activates WinMerge window we stop flashing.
+ * @param [in] nState Tells if window is being activated or deactivated.
+ * @param [in] pWndOther Pointer to window whose status is changing.
+ * @param [in] Is window minimized?
+ */
+void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
+{
+ CMDIFrameWnd::OnActivate(nState, pWndOther, bMinimized);
+
+ if (nState == WA_ACTIVE || nState == WA_CLICKACTIVE)
+ {
+ if (m_bFlashing)
+ {
+ m_bFlashing = FALSE;
+ FlashWindow(FALSE);
+ KillTimer(ID_TIMER_FLASH);
+ }
+ }
+}
void ResetOptions() { OptionsInit(); }
static void CenterToMainFrame(CDialog * dlg);
static void SetMainIcon(CDialog * dlg);
+ void StartFlashing();
// Overrides
// ClassWizard generated virtual function overrides
VSSHelper m_vssHelper; /**< Helper class for VSS integration */
SyntaxColors * GetMainSyntaxColors() { return m_pSyntaxColors; }
BOOL m_bClearCaseTool; /**< WinMerge is executed as an external Rational ClearCase compare/merge tool. */
+ BOOL m_bFlashing; /**< Window is flashing. */
/**
* @name Version Control System (VCS) integration.
afx_msg void OnWindowCloseAll();
afx_msg void OnUpdateWindowCloseAll(CCmdUI* pCmdUI);
afx_msg void OnSaveProject();
+ afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()