From 7ed63816f68049dcaf73ff740e1c1650f17e39eb Mon Sep 17 00:00:00 2001 From: Gal Hammer Date: Wed, 21 Mar 2007 19:33:10 +0000 Subject: [PATCH] RFE: [ 1646407 ] Use "equal" or "not equal" as file compare icon --- Src/Changes.txt | 4 ++++ Src/ChildFrm.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ Src/ChildFrm.h | 3 +++ Src/MergeDoc.cpp | 2 +- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Src/Changes.txt b/Src/Changes.txt index 29b9916d0..3a3173e33 100644 --- a/Src/Changes.txt +++ b/Src/Changes.txt @@ -3,6 +3,10 @@ Add new items to top. (This summarizes all changes to all files under Src, including Src\Languages.) 2007-03-21 Gal + RFE: [ 1646407 ] Use "equal" or "not equal" as file compare icon + Src: ChildFrm.cpp ChildFrm.h MergeDoc.cpp + +2007-03-21 Gal BUG: [ 1491334 ] thinly highlighted position is wrong Src: stringdiffs.cpp stringdiffsi.h diff --git a/Src/ChildFrm.cpp b/Src/ChildFrm.cpp index 5045c7945..dedb9bff0 100644 --- a/Src/ChildFrm.cpp +++ b/Src/ChildFrm.cpp @@ -100,6 +100,8 @@ CChildFrame::CChildFrame() #pragma warning(disable:4355) // 'this' : used in base member initializer list : m_leftStatus(this, PANE_LEFT_INFO) , m_rightStatus(this, PANE_RIGHT_INFO) +, m_hIdentical(NULL) +, m_hDifferent(NULL) #pragma warning(default:4355) { m_bActivated = FALSE; @@ -294,6 +296,9 @@ int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_wndStatusBar.SetPaneText(PANE_LEFT_RO, sText, TRUE); m_wndStatusBar.SetPaneText(PANE_RIGHT_RO, sText, TRUE); + m_hIdentical = AfxGetApp()->LoadIcon(IDI_EQUALFILE); + m_hDifferent = AfxGetApp()->LoadIcon(IDI_NOTEQUALFILE); + SetTimer(0, 250, NULL); // used to update the title headers return 0; } @@ -459,6 +464,19 @@ BOOL CChildFrame::DestroyWindow() GetWindowPlacement(&wp); theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE)); } + + if (m_hIdentical != NULL) + { + DestroyIcon(m_hIdentical); + m_hIdentical = NULL; + } + + if (m_hDifferent != NULL) + { + DestroyIcon(m_hDifferent); + m_hDifferent = NULL; + } + return CMDIChildWnd::DestroyWindow(); } @@ -557,6 +575,33 @@ IHeaderBar * CChildFrame::GetHeaderInterface() return &m_wndFilePathBar; } +/** +* @brief Reflect comparison result in window's icon. +* @param nResult [in] Last comparison result which the application returns. +*/ +void CChildFrame::SetLastCompareResult(int nResult) +{ + HICON hCurrent = GetIcon(FALSE); + HICON hReplace = (nResult == 0) ? m_hIdentical : m_hDifferent; + + if (hCurrent != hReplace) + { + SetIcon(hReplace, FALSE); + + BOOL bMaximized; + GetMDIFrame()->MDIGetActive(&bMaximized); + + // When MDI maximized the window icon is drawn on the menu bar, so we + // need to notify it that our icon has changed. + if (bMaximized) + { + GetMDIFrame()->DrawMenuBar(); + } + } + + theApp.SetLastCompareResult(nResult); +} + void CChildFrame::OnTimer(UINT_PTR nIDEvent) { if (IsWindowVisible()) diff --git a/Src/ChildFrm.h b/Src/ChildFrm.h index ffb55b777..088748959 100644 --- a/Src/ChildFrm.h +++ b/Src/ChildFrm.h @@ -53,6 +53,7 @@ public: IHeaderBar * GetHeaderInterface(); void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; }; CMergeDoc * GetMergeDoc() { return m_pMergeDoc; } + void SetLastCompareResult(int nResult); // Attributes protected: @@ -114,6 +115,8 @@ private: void UpdateHeaderSizes(); BOOL m_bActivated; CMergeDoc * m_pMergeDoc; + HICON m_hIdentical; + HICON m_hDifferent; //{{AFX_MSG(CChildFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); diff --git a/Src/MergeDoc.cpp b/Src/MergeDoc.cpp index d7baa0718..8ee8c6900 100644 --- a/Src/MergeDoc.cpp +++ b/Src/MergeDoc.cpp @@ -525,7 +525,7 @@ int CMergeDoc::Rescan(BOOL &bBinary, BOOL &bIdentical, m_bEditAfterRescan[1] = FALSE; } - theApp.SetLastCompareResult(m_diffList.GetSignificantDiffs()); + GetParentFrame()->SetLastCompareResult(m_diffList.GetSignificantDiffs()); m_pRescanFileInfo[0]->Update(m_filePaths.GetLeft()); m_pRescanFileInfo[1]->Update(m_filePaths.GetRight()); -- 2.11.0