IMPLEMENT_DYNCREATE(CDirFrame, CMDIChildWnd)
CDirFrame::CDirFrame()
+: m_hIdentical(NULL)
+, m_hDifferent(NULL)
{
}
m_wndStatusBar.SetPaneText(PANE_LEFT_RO, sText.c_str(), TRUE);
m_wndStatusBar.SetPaneText(PANE_MIDDLE_RO, sText.c_str(), TRUE);
m_wndStatusBar.SetPaneText(PANE_RIGHT_RO, sText.c_str(), TRUE);
+
+ m_hIdentical = AfxGetApp()->LoadIcon(IDI_EQUALFOLDER);
+ m_hDifferent = AfxGetApp()->LoadIcon(IDI_NOTEQUALFOLDER);
+
return 0;
}
{
}
+/**
+* @brief Reflect comparison result in window's icon.
+* @param nResult [in] Last comparison result which the application returns.
+*/
+void CDirFrame::SetLastCompareResult(int nResult)
+{
+ HICON hCurrent = GetIcon(FALSE);
+ HICON hReplace = (nResult == 0) ? m_hIdentical : m_hDifferent;
+
+ if (hCurrent != hReplace)
+ {
+ SetIcon(hReplace, TRUE);
+
+ 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 CDirFrame::OnClose()
{
CMDIChildWnd::OnClose();
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();
}
// Attributes
public:
+private:
+ HICON m_hIdentical;
+ HICON m_hDifferent;
+
// Operations
public:
void SetStatus(LPCTSTR szStatus);
IHeaderBar * GetHeaderInterface();
void UpdateResources();
void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; };
+ void SetLastCompareResult(int nResult);
// Overrides
virtual void GetMessageString(UINT nID, CString& rMessage) const;
int alldiffs = 0;
UIntPtr diffpos = ctxt.GetFirstDiffPosition();
RedisplayChildren(diffpos, 0, cnt, alldiffs);
- theApp.SetLastCompareResult(alldiffs);
+ if (pDoc->m_diffThread.GetThreadState() == CDiffThread::THREAD_COMPLETED)
+ GetParentFrame()->SetLastCompareResult(alldiffs);
SortColumnsAppropriately();
SetRedraw(TRUE);
}