BEGIN_MESSAGE_MAP(CDirDoc, CDocument)
//{{AFX_MSG_MAP(CDirDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
+ // Progress dialog
+ ON_BN_CLICKED(IDC_COMPARISON_STOP, OnBnClickedComparisonStop)
+ ON_BN_CLICKED(IDC_COMPARISON_PAUSE, OnBnClickedComparisonPause)
+ ON_BN_CLICKED(IDC_COMPARISON_CONTINUE, OnBnClickedComparisonContinue)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
m_pCompareStats->Reset();
m_pDirView->StartCompare(m_pCompareStats.get());
+ if (m_pCmpProgressBar == nullptr)
+ m_pCmpProgressBar.reset(new DirCompProgressBar());
+
+ if (!::IsWindow(m_pCmpProgressBar->GetSafeHwnd()))
+ m_pCmpProgressBar->Create(m_pDirView->GetParentFrame());
+
+ m_pCmpProgressBar->SetCompareStat(m_pCompareStats.get());
+ m_pCmpProgressBar->StartUpdating();
+
+ m_pDirView->GetParentFrame()->ShowControlBar(m_pCmpProgressBar.get(), TRUE, FALSE);
+
if (!m_bGeneratingReport)
m_pDirView->DeleteAllDisplayItems();
// Don't clear if only scanning selected items
InitDiffContext(m_pCtxt.get());
- pf->GetHeaderInterface()->SetPaneCount(m_nDirs);
- pf->GetHeaderInterface()->SetOnSetFocusCallback([&](int pane) {
+ auto* pHeaderBar = pf->GetHeaderInterface();
+ pHeaderBar->SetPaneCount(m_nDirs);
+ pHeaderBar->SetOnSetFocusCallback([&](int pane) {
m_pDirView->SetActivePane(pane);
GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, pane);
});
+ pHeaderBar->SetOnCaptionChangedCallback([&](int pane, const String& sText) {
+ m_strDesc[pane] = sText;
+ UpdateHeaderPath(pane);
+ });
+ pHeaderBar->SetOnFolderSelectedCallback([&](int pane, const String& sFolderpath) {
+ PathContext paths = m_pCtxt->GetNormalizedPaths();
+ paths.SetPath(pane, sFolderpath);
+ m_strDesc[pane].clear();
+ InitCompare(paths, m_pCtxt->m_bRecursive, nullptr);
+ Rescan();
+ });
for (int nIndex = 0; nIndex < m_nDirs; nIndex++)
{
UpdateHeaderPath(nIndex);
SetGeneratingReport(false);
SetReport(nullptr);
});
+ m_diffThread.SetMarkedRescan(false);
}
else if (m_bMarkedRescan)
{
- m_diffThread.SetCollectFunction(nullptr);
- m_diffThread.SetCompareFunction([](DiffFuncStruct* myStruct) {
+ m_diffThread.SetCollectFunction([](DiffFuncStruct* myStruct) {
int nItems = DirScan_UpdateMarkedItems(myStruct, nullptr);
myStruct->context->m_pCompareStats->IncreaseTotalItems(nItems);
+ });
+ m_diffThread.SetCompareFunction([](DiffFuncStruct* myStruct) {
DirScan_CompareRequestedItems(myStruct, nullptr);
- });
+ });
+ m_diffThread.SetMarkedRescan(true);
}
else
{
m_diffThread.SetCompareFunction([](DiffFuncStruct* myStruct) {
DirScan_CompareItems(myStruct, nullptr);
});
+ m_diffThread.SetMarkedRescan(false);
}
m_diffThread.CompareDirectories();
m_bMarkedRescan = false;
m_pDirView = newView;
// MFC has a view list for us, so lets check against it
POSITION pos = GetFirstViewPosition();
- CDirView * temp = static_cast<CDirView *>(GetNextView(pos));
- ASSERT(temp == m_pDirView); // verify that our stashed pointer is the same as MFC's
+ ASSERT(m_pDirView == static_cast<CDirView *>(GetNextView(pos))); // verify that our stashed pointer is the same as MFC's
}
/**
*/
void CDirDoc::CompareReady()
{
+ // Close and destroy the dialog after compare
+ if (m_pCmpProgressBar != nullptr)
+ m_pDirView->GetParentFrame()->ShowControlBar(m_pCmpProgressBar.get(), FALSE, FALSE);
+ m_pCmpProgressBar.reset();
}
/**
m_diffThread.Abort();
while (m_diffThread.GetThreadState() == CDiffThread::THREAD_COMPARING)
Sleep(50);
+ CompareReady();
}
return CDocument::SaveModified();
}
}
+/**
+ * @brief A string to display as a tooltip for MDITabbar
+ */
+CString CDirDoc::GetTooltipString() const
+{
+ return CMergeFrameCommon::GetTooltipString(m_pCtxt->GetNormalizedPaths(), m_strDesc, nullptr, nullptr).c_str();
+}
/**
* @brief Checks if current folders are opened from archive file.
FolderCmp cmp(&ctxt);
CWaitCursor waitstatus;
di.diffcode.diffcode |= cmp.prepAndCompareFiles(di);
- AfxMessageBox(ci.ColGetTextToDisplay(&ctxt, 2, di).c_str(), MB_OK | MB_ICONINFORMATION);
+ if (di.diffcode.isResultSame())
+ {
+ ctxt.GetComparePaths(di, paths);
+ CMergeFrameCommon::ShowIdenticalMessage(paths, true,
+ [](LPCTSTR msg, UINT flags, UINT id) -> int { return AfxMessageBox(msg, flags, id); });
+ }
+ else
+ {
+ AfxMessageBox(ci.ColGetTextToDisplay(&ctxt, 2, di).c_str(), MB_OK | MB_ICONINFORMATION);
+ }
theApp.SetLastCompareResult(di.diffcode.isResultDiff() ? 1 : 0);
return true;
}
+void CDirDoc::OnBnClickedComparisonStop()
+{
+ if (m_pCmpProgressBar != nullptr)
+ m_pCmpProgressBar->EndUpdating();
+ AbortCurrentScan();
+}
+
+void CDirDoc::OnBnClickedComparisonPause()
+{
+ if (m_pCmpProgressBar != nullptr)
+ m_pCmpProgressBar->SetPaused(true);
+ PauseCurrentScan();
+}
+
+void CDirDoc::OnBnClickedComparisonContinue()
+{
+ if (m_pCmpProgressBar != nullptr)
+ m_pCmpProgressBar->SetPaused(false);
+ ContinueCurrentScan();
+}
+