}
}
}
+
+void CompareStats::Swap(int idx1, int idx2)
+{
+ idx2 = m_nDirs < 3 ? idx2 + 1 : idx2;
+ std::swap(m_counts[RESULT_LUNIQUE + idx1], m_counts[RESULT_LUNIQUE + idx2]);
+ std::swap(m_counts[RESULT_LMISSING + idx1], m_counts[RESULT_LMISSING + idx2]);
+ std::swap(m_counts[RESULT_LDIRUNIQUE + idx1], m_counts[RESULT_LDIRUNIQUE + idx2]);
+ std::swap(m_counts[RESULT_LDIRMISSING + idx1], m_counts[RESULT_LDIRMISSING + idx2]);
+}
CompareStats::CMP_STATE GetCompareState() const;
void SetCurrentDiffItem(const DIFFITEM *di);
bool IsCompareDone() const { return m_bCompareDone; }
-
CompareStats::RESULT GetResultFromCode(unsigned diffcode) const;
+ void Swap(int idx1, int idx2);
private:
int m_counts[RESULT_COUNT]; /**< Table storing result counts */
int GetCompareDirs() const { return m_paths.GetSize(); }
+ void Swap(int idx1, int idx2)
+ {
+ String tmp;
+ tmp = m_paths.GetPath(idx1);
+ m_paths.SetPath(idx1, m_paths.GetPath(idx2));
+ m_paths.SetPath(idx2, tmp);
+ DiffItemList::Swap(idx1, idx2);
+ }
+
IDiffFilter * m_piFilterGlobal; /**< Interface for file filtering. */
IPluginInfos * m_piPluginInfos;
int m_iGuessEncodingType;
delete p;
}
}
+
+void DIFFITEM::Swap(int idx1, int idx2)
+{
+ std::swap(diffFileInfo[idx1], diffFileInfo[idx2]);
+ diffcode.swap(idx1, idx2);
+ if (HasChildren())
+ {
+ for (ListEntry *p = children.IsSibling(children.Flink); p; p = children.IsSibling(p->Flink))
+ static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
+ }
+}
// rescan
bool isScanNeeded() const { return ((diffcode & DIFFCODE::SCANFLAGS) == DIFFCODE::NEEDSCAN); }
+ void swap(int idx1, int idx2)
+ {
+ bool e[3] = { false, false, false };
+ for (int i = 0; i < 3; ++i)
+ e[i] = exists(i);
+ std::swap(e[idx1], e[idx2]);
+ setSideNone();
+ for (int i = 0; i < 3; ++i)
+ if (e[i]) setSideFlag(i);
+ }
};
/**
bool IsAncestor(const DIFFITEM *pdi) const;
bool HasChildren() const;
void RemoveChildren();
+ void Swap(int idx1, int idx2);
};
DIFFITEM & di = GetDiffRefAt(diffpos);
di.customFlags1 = flag;
}
+
+void DiffItemList::Swap(int idx1, int idx2)
+{
+ for (ListEntry *p = m_root.IsSibling(m_root.Flink); p; p = m_root.IsSibling(p->Flink))
+ static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
+}
unsigned GetCustomFlags1(uintptr_t diffpos) const;
void SetCustomFlags1(uintptr_t diffpos, unsigned flag);
+ void Swap(int idx1, int idx2);
+
protected:
ListEntry m_root; /**< Root of list of diffitems */
};
else
return false;
}
+
+void CDirDoc::Swap(int idx1, int idx2)
+{
+ std::swap(m_bRO[idx1], m_bRO[idx2]);
+ std::swap(m_strDesc[idx1], m_strDesc[idx2]);
+ m_pCtxt->Swap(idx1, idx2);
+ m_pCompareStats->Swap(idx1, idx2);
+ for (int nIndex = 0; nIndex < m_nDirs; nIndex++)
+ UpdateHeaderPath(nIndex);
+}
const CompareStats * GetCompareStats() const { return m_pCompareStats.get(); };
bool IsArchiveFolders() const;
PluginManager& GetPluginManager() { return m_pluginman; };
+ void Swap(int idx1, int idx2);
protected:
void LoadLineFilterList();
ON_UPDATE_COMMAND_UI(ID_VIEW_EXPAND_ALLSUBDIRS, OnUpdateViewExpandAllSubdirs)
ON_COMMAND(ID_VIEW_COLLAPSE_ALLSUBDIRS, OnViewCollapseAllSubdirs)
ON_UPDATE_COMMAND_UI(ID_VIEW_COLLAPSE_ALLSUBDIRS, OnUpdateViewCollapseAllSubdirs)
+ ON_COMMAND(ID_VIEW_SWAPPANES, OnViewSwapPanes)
ON_COMMAND(ID_VIEW_DIR_STATISTICS, OnViewCompareStatistics)
ON_COMMAND(ID_OPTIONS_SHOWDIFFERENT, OnOptionsShowDifferent)
ON_COMMAND(ID_OPTIONS_SHOWIDENTICAL, OnOptionsShowIdentical)
return false;
}
- sLinkPath = di.diffFileInfo[0].GetFile();\r
+ sLinkPath = di.diffFileInfo[0].GetFile();
string_replace(sLinkPath, _T("\\"), _T("_"));
sLinkPath += _T(".html");
pCmdUI->Enable(m_bTreeMode && GetDiffContext().m_bRecursive);
}
+void CDirView::OnViewSwapPanes()
+{
+ GetDocument()->Swap(0, GetDocument()->m_nDirs - 1);
+ Redisplay();
+}
+
/**
* @brief Show/Hide different files/directories
*/
afx_msg void OnUpdateViewExpandAllSubdirs(CCmdUI* pCmdUI);
afx_msg void OnViewCollapseAllSubdirs();
afx_msg void OnUpdateViewCollapseAllSubdirs(CCmdUI* pCmdUI);
+ afx_msg void OnViewSwapPanes();
afx_msg void OnOptionsShowDifferent();
afx_msg void OnOptionsShowIdentical();
afx_msg void OnOptionsShowUniqueLeft();
MENUITEM "Select &Font...", ID_VIEW_SELECTFONT
MENUITEM "Use Default F&ont", ID_VIEW_USEDEFAULTFONT
MENUITEM SEPARATOR
+ MENUITEM "Sw&ap Panes", ID_VIEW_SWAPPANES
+ MENUITEM SEPARATOR
POPUP "&Toolbar"
BEGIN
MENUITEM "&None", ID_TOOLBAR_NONE
<ClCompile Include="..\..\..\Src\CompareEngines\TimeSizeCompare.cpp" />\r
<ClCompile Include="..\..\..\Src\CompareOptions.cpp" />\r
<ClCompile Include="..\..\..\Src\Common\coretools.cpp" />\r
+ <ClCompile Include="..\..\..\Src\DiffFileInfo.cpp" />\r
<ClCompile Include="..\..\..\Src\DiffItem.cpp" />\r
<ClCompile Include="..\..\..\Src\diffutils\src\Diff.cpp" />\r
<ClCompile Include="..\..\..\Src\DirItem.cpp" />\r
<ClCompile Include="..\..\..\Src\OptionsDef.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\Src\DiffFileInfo.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\Src\CompareEngines\ByteComparator.h">\r