void InitCompare(const PathContext & paths, bool bRecursive, CTempPathContext *);
void DiffThreadCallback(int& state);
void Rescan();
+ String GetDescription(int nIndex) const { return m_strDesc[nIndex]; };
bool GetReadOnly(int nIndex) const;
const bool *GetReadOnly(void) const;
void SetReadOnly(int nIndex, bool bReadOnly);
bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[]);
void MoveOnLoad(int nPane = -1, int nLineIndex = -1);
void CheckFileChanged(void) override;
- String GetDescription(int pane) const { return m_strDesc[pane]; };
+ String GetDescription(int pane) const override { return m_strDesc[pane]; };
void SetDescription(int pane, const String& strDesc) { m_strDesc[pane] = strDesc; };
void SaveAs(int nBuffer, bool packing = true) { DoFileSaveAs(nBuffer, packing); }
private:
virtual const PrediffingInfo *GetPrediffer() const = 0;\r
virtual int GetFileCount() const = 0;\r
virtual String GetPath(int pane) const = 0;\r
+ virtual String GetDescription(int pane) const = 0;\r
virtual bool GetReadOnly(int pane) const = 0;\r
};\r
\r
bool IsModified() const;
IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
void CheckFileChanged(void) override;
- String GetDescription(int pane) const { return m_strDesc[pane]; }
+ String GetDescription(int pane) const override { return m_strDesc[pane]; }
static bool IsLoadable();
// Attributes
// Update all dirdoc settings
for (auto pDirDoc : GetAllDirDocs())
pDirDoc->RefreshOptions();
- for (auto pOpenDoc : GetAllOpenDocs())
- pOpenDoc->RefreshOptions();
for (auto pHexMergeDoc : GetAllHexMergeDocs())
pHexMergeDoc->RefreshOptions();
for (auto pImgMergeFrame : GetAllImgMergeFrames())
CFrameWnd * pFrame = GetActiveFrame();
FRAMETYPE frame = pFrame ? GetFrameType(pFrame) : FRAME_OTHER;
- if (frame == FRAME_FILE || frame == FRAME_HEXFILE || frame == FRAME_IMGFILE)
+ if (frame == FRAME_FILE || frame == FRAME_HEXFILE || frame == FRAME_IMGFILE || frame == FRAME_WEBPAGE)
{
if (IMergeDoc* pMergeDoc = GetActiveIMergeDoc())
{
for (int pane = 0; pane < pMergeDoc->GetFileCount(); ++pane)
{
pOpenDoc->m_dwFlags[pane] = FFILEOPEN_PROJECT | (pMergeDoc->GetReadOnly(pane) ? FFILEOPEN_READONLY : 0);
- paths.SetPath(pane, pMergeDoc->GetPath(pane));
+ paths.SetPath(pane, pMergeDoc->GetPath(pane), false);
+ pOpenDoc->m_strDesc[pane] = pMergeDoc->GetDescription(pane);
}
pOpenDoc->m_files = paths;
pOpenDoc->m_bRecurse = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
pOpenDoc->m_strExt = theApp.GetGlobalFileFilter()->GetFilterNameOrMask();
pOpenDoc->m_strUnpackerPipeline = pMergeDoc->GetUnpacker()->GetPluginPipeline();
+ switch (frame)
+ {
+ case FRAME_FILE:
+ pOpenDoc->m_nWindowType = (static_cast<CMergeDoc*>(pMergeDoc)->GetEnableTableEditing().value_or(false) ?
+ ID_MERGE_COMPARE_TABLE : ID_MERGE_COMPARE_TEXT) - ID_MERGE_COMPARE_TEXT + 1;
+ break;
+ case FRAME_HEXFILE:
+ pOpenDoc->m_nWindowType = ID_MERGE_COMPARE_HEX - ID_MERGE_COMPARE_TEXT + 1;
+ break;
+ case FRAME_IMGFILE:
+ pOpenDoc->m_nWindowType = ID_MERGE_COMPARE_IMAGE - ID_MERGE_COMPARE_TEXT + 1;
+ break;
+ case FRAME_WEBPAGE:
+ pOpenDoc->m_nWindowType = ID_MERGE_COMPARE_WEBPAGE - ID_MERGE_COMPARE_TEXT + 1;
+ break;
+ }
}
}
else if (frame == FRAME_FOLDER)
{
pOpenDoc->m_dwFlags[pane] = FFILEOPEN_PROJECT | (pDoc->GetReadOnly(pane) ? FFILEOPEN_READONLY : 0);
pOpenDoc->m_files.SetPath(pane, paths::AddTrailingSlash(ctxt.GetNormalizedPath(pane)));
+ pOpenDoc->m_strDesc[pane] = pDoc->GetDescription(pane);
}
pOpenDoc->m_bRecurse = ctxt.m_bRecursive;
pOpenDoc->m_strExt = static_cast<FileFilterHelper*>(ctxt.m_piFilterGlobal)->GetFilterNameOrMask();
}
*pResult = 0;
}
+
void CMainFrame::OnDiffWhitespace(UINT nID)
{
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_WHITESPACE, nID - ID_DIFF_OPTIONS_WHITESPACE_COMPARE);
pInfoUnpacker.reset(new PackingInfo(projItem.GetUnpacker()));
if (projItem.HasPrediffer())
pInfoPrediffer.reset(new PrediffingInfo(projItem.GetPrediffer()));
+ int nID = 0;
+ if (projItem.HasWindowType())
+ nID = ID_MERGE_COMPARE_TEXT + projItem.GetWindowType() - 1;
+ String strDesc[3];
DWORD dwFlags[3] = {
static_cast<DWORD>(tFiles.GetPath(0).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT),
static_cast<DWORD>(tFiles.GetPath(1).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT),
};
if (bLeftReadOnly)
dwFlags[0] |= FFILEOPEN_READONLY;
+ if (projItem.HasLeftDesc())
+ strDesc[0] = projItem.GetLeftDesc();
if (tFiles.GetSize() == 2)
{
if (bRightReadOnly)
dwFlags[1] |= FFILEOPEN_READONLY;
+ if (projItem.HasRightDesc())
+ strDesc[1] = projItem.GetRightDesc();
}
else
{
dwFlags[1] |= FFILEOPEN_READONLY;
if (bRightReadOnly)
dwFlags[2] |= FFILEOPEN_READONLY;
+ if (projItem.HasMiddleDesc())
+ strDesc[1] = projItem.GetMiddleDesc();
+ if (projItem.HasRightDesc())
+ strDesc[2] = projItem.GetRightDesc();
}
GetOptionsMgr()->Set(OPT_CMP_INCLUDE_SUBDIRS, bRecursive);
pOpenFolderParams->m_hiddenItems = projItem.GetHiddenItems();
}
- rtn &= GetMainFrame()->DoFileOrFolderOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive,
- nullptr, pInfoUnpacker.get(), pInfoPrediffer.get(), 0, pOpenFolderParams.get());
+ rtn &= GetMainFrame()->DoFileOrFolderOpen(&tFiles, dwFlags, strDesc, sReportFile, bRecursive,
+ nullptr, pInfoUnpacker.get(), pInfoPrediffer.get(), nID, pOpenFolderParams.get());
}
AddToRecentProjectsMRU(sProject.c_str());
void ClearSyncPoints();
bool HasSyncPoints();
std::vector<std::vector<int> > GetSyncPointList();
- String GetDescription(int pane) const { return m_strDesc[pane]; }
+ String GetDescription(int pane) const override { return m_strDesc[pane]; }
void SetDescription(int pane, const String& sText) { m_strDesc[pane] = sText; }
// Overrides
COpenDoc::COpenDoc() :
m_bRecurse(false)
, m_dwFlags()
+, m_nWindowType(-1)
{
PackingInfo infoHandler;
m_strUnpackerPipeline = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? infoHandler.GetPluginPipeline() : _T("");
bool m_bRecurse;
String m_strExt;
String m_strUnpackerPipeline;
+ String m_strDesc[3];
+ int m_nWindowType;
std::vector<String> m_hiddenItems;
protected:
if (!m_strPath[0].empty())
projItem.SetLeft(m_strPath[0], &m_bReadOnly[0]);
+ if (!GetDocument()->m_strDesc[0].empty())
+ projItem.SetLeftDesc(GetDocument()->m_strDesc[0]);
if (m_strPath[2].empty())
{
if (!m_strPath[1].empty())
projItem.SetRight(m_strPath[1], &m_bReadOnly[1]);
+ if (!GetDocument()->m_strDesc[1].empty())
+ projItem.SetRightDesc(GetDocument()->m_strDesc[1]);
}
else
{
projItem.SetMiddle(m_strPath[1], &m_bReadOnly[1]);
if (!m_strPath[2].empty())
projItem.SetRight(m_strPath[2], &m_bReadOnly[2]);
+ if (!GetDocument()->m_strDesc[1].empty())
+ projItem.SetMiddleDesc(GetDocument()->m_strDesc[1]);
+ if (!GetDocument()->m_strDesc[2].empty())
+ projItem.SetRightDesc(GetDocument()->m_strDesc[2]);
}
if (bSaveFileFilter && !m_strExt.empty())
{
projItem.SetSubfolders(m_bRecurse);
if (bSaveUnpackerPlugin && !m_strUnpackerPipeline.empty())
projItem.SetUnpacker(m_strUnpackerPipeline);
+ if (GetDocument()->m_nWindowType != -1)
+ projItem.SetWindowType(GetDocument()->m_nWindowType);
if (bSaveCompareOptions)
{
const char Left_element_name[] = "left";
const char Middle_element_name[] = "middle";
const char Right_element_name[] = "right";
+const char Left_desc_element_name[] = "left-desc";
+const char Middle_desc_element_name[] = "middle-desc";
+const char Right_desc_element_name[] = "right-desc";
const char Filter_element_name[] = "filter";
const char Subfolders_element_name[] = "subfolders";
const char Left_ro_element_name[] = "left-readonly";
const char Right_ro_element_name[] = "right-readonly";
const char Unpacker_element_name[] = "unpacker";
const char Prediffer_element_name[] = "prediffer";
+const char Window_type_element_name[] = "window-type";
const char White_spaces_element_name[] = "white-spaces";
const char Ignore_blank_lines_element_name[] = "ignore-blank-lines";
const char Ignore_case_element_name[] = "ignore-case";
currentItem.m_paths.SetRight(currentItem.m_paths.GetRight() + xmlch2tstr(ch + start, length), false);
currentItem.m_bHasRight = true;
}
+ else if (nodename == Left_desc_element_name)
+ {
+ currentItem.m_leftDesc += xmlch2tstr(ch + start, length);
+ currentItem.m_bHasLeftDesc = true;
+ }
+ else if (nodename == Middle_desc_element_name)
+ {
+ currentItem.m_middleDesc += xmlch2tstr(ch + start, length);
+ currentItem.m_bHasMiddleDesc = true;
+ }
+ else if (nodename == Right_desc_element_name)
+ {
+ currentItem.m_rightDesc += xmlch2tstr(ch + start, length);
+ currentItem.m_bHasRightDesc = true;
+ }
else if (nodename == Filter_element_name)
{
currentItem.m_filter += xmlch2tstr(ch + start, length);
currentItem.m_prediffer += xmlch2tstr(ch + start, length);
currentItem.m_bHasPrediffer = true;
}
+ else if (nodename == Window_type_element_name)
+ {
+ currentItem.m_nWindowType = atoi(token.c_str());
+ currentItem.m_bHasWindowType = true;
+ }
else if (nodename == White_spaces_element_name)
{
currentItem.m_nIgnoreWhite = atoi(token.c_str());
: m_bHasLeft(false)
, m_bHasMiddle(false)
, m_bHasRight(false)
+, m_bHasLeftDesc(false)
+, m_bHasMiddleDesc(false)
+, m_bHasRightDesc(false)
, m_bHasFilter(false)
, m_bHasSubfolders(false)
, m_bHasUnpacker(false)
, m_bHasPrediffer(false)
+, m_bHasWindowType(false)
, m_subfolders(-1)
, m_bLeftReadOnly(false)
, m_bMiddleReadOnly(false)
, m_bRightReadOnly(false)
+, m_nWindowType(-1)
, m_bHasIgnoreWhite(false)
, m_nIgnoreWhite(0)
, m_bHasIgnoreBlankLines(false)
writeElement(writer, Middle_element_name, toUTF8(item.m_paths.GetMiddle()));
if (!item.m_paths.GetRight().empty())
writeElement(writer, Right_element_name, toUTF8(item.m_paths.GetRight()));
+ if (!item.m_leftDesc.empty())
+ writeElement(writer, Left_desc_element_name, toUTF8(item.m_leftDesc));
+ if (!item.m_middleDesc.empty())
+ writeElement(writer, Middle_desc_element_name, toUTF8(item.m_middleDesc));
+ if (!item.m_rightDesc.empty())
+ writeElement(writer, Right_desc_element_name, toUTF8(item.m_rightDesc));
if (item.m_bSaveFilter && !item.m_filter.empty())
writeElement(writer, Filter_element_name, toUTF8(item.m_filter));
if (item.m_bSaveSubfolders)
writeElement(writer, Unpacker_element_name, toUTF8(item.m_unpacker));
if (!item.m_prediffer.empty())
writeElement(writer, Prediffer_element_name, toUTF8(item.m_prediffer));
+ if (item.m_nWindowType != -1)
+ writeElement(writer, Window_type_element_name, std::to_string(item.m_nWindowType));
if (item.m_bSaveIgnoreWhite)
writeElement(writer, White_spaces_element_name, std::to_string(item.m_nIgnoreWhite));
if (item.m_bSaveIgnoreBlankLines)
bool HasLeft() const;
bool HasMiddle() const;
bool HasRight() const;
+ bool HasLeftDesc() const;
+ bool HasMiddleDesc() const;
+ bool HasRightDesc() const;
bool HasFilter() const;
bool HasSubfolders() const;
bool HasUnpacker() const;
bool HasPrediffer() const;
+ bool HasWindowType() const;
bool HasIgnoreWhite() const;
bool HasIgnoreBlankLines() const;
bool HasIgnoreCase() const;
bool HasHiddenItems() const;
String GetLeft(bool * pReadOnly = nullptr) const;
+ String GetLeftDesc() const;
bool GetLeftReadOnly() const;
String GetMiddle(bool * pReadOnly = nullptr) const;
+ String GetMiddleDesc() const;
bool GetMiddleReadOnly() const;
String GetRight(bool * pReadOnly = nullptr) const;
+ String GetRightDesc() const;
bool GetRightReadOnly() const;
String GetFilter() const;
int GetSubfolders() const;
String GetUnpacker() const;
String GetPrediffer() const;
+ int GetWindowType() const;
int GetIgnoreWhite() const;
bool GetIgnoreBlankLines() const;
bool GetIgnoreCase() const;
void SetLeft(const String& sLeft, const bool * pReadOnly = nullptr);
void SetMiddle(const String& sMiddle, const bool * pReadOnly = nullptr);
void SetRight(const String& sRight, const bool * pReadOnly = nullptr);
+ void SetLeftDesc(const String& sLeftDesc);
+ void SetMiddleDesc(const String& sMiddleDesc);
+ void SetRightDesc(const String& sRightDesc);
void SetFilter(const String& sFilter);
void SetSubfolders(bool bSubfolder);
void SetUnpacker(const String& sUnpacker);
void SetPrediffer(const String& sPrediffer);
+ void SetWindowType(int nWindowType);
void SetIgnoreWhite(int nIgnoreWhite);
void SetIgnoreBlankLines(bool bIgnoreBlankLines);
void SetIgnoreCase(bool bIgnoreCase);
bool m_bHasLeft; /**< Has left path? */
bool m_bHasMiddle; /**< Has middle path? */
bool m_bHasRight; /**< Has right path? */
+ String m_leftDesc;
+ String m_middleDesc;
+ String m_rightDesc;
+ bool m_bHasLeftDesc; /**< Has left description? */
+ bool m_bHasMiddleDesc; /**< Has middle description? */
+ bool m_bHasRightDesc; /**< Has right description? */
bool m_bHasFilter; /**< Has filter? */
String m_filter; /**< Filter name or mask */
bool m_bHasSubfolders; /**< Has subfolders? */
String m_unpacker; /**< Unpacker name or pipeline */
bool m_bHasPrediffer; /**< Has prediffer? */
String m_prediffer; /**< Prediffer name or pipeline */
+ bool m_bHasWindowType; /**< Has window type? */
+ int m_nWindowType; /**< The value of the window type */
bool m_bHasIgnoreWhite; /**< Has "Whitespaces" setting? */
int m_nIgnoreWhite; /**< The value of the "Whitespaces" setting */
bool m_bHasIgnoreBlankLines; /**< Has "Ignore blank lines" setting? */
}
/**
+ * @brief Returns if left description is defined in project file.
+ * @return true if project file has left description.
+ */
+inline bool ProjectFileItem::HasLeftDesc() const
+{
+ return m_bHasLeftDesc;
+}
+
+/**
+ * @brief Returns if middle description is defined.
+ */
+inline bool ProjectFileItem::HasMiddleDesc() const
+{
+ return m_bHasMiddleDesc;
+}
+
+/**
+ * @brief Returns if right description is defined in project file.
+ * @return true if project file has right description.
+ */
+inline bool ProjectFileItem::HasRightDesc() const
+{
+ return m_bHasRightDesc;
+}
+
+/**
+ * @brief Returns left description.
+ * @return left description.
+ */
+inline String ProjectFileItem::GetLeftDesc() const
+{
+ return m_leftDesc;
+}
+
+/**
+ * @brief Returns middle description.
+ * @return middle description.
+ */
+inline String ProjectFileItem::GetMiddleDesc() const
+{
+ return m_middleDesc;
+}
+
+/**
+ * @brief Returns right description.
+ * @return right description.
+ */
+inline String ProjectFileItem::GetRightDesc() const
+{
+ return m_rightDesc;
+}
+
+/**
+ * @brief Set left description.
+ * @param [in] sDesc New left description.
+ */
+inline void ProjectFileItem::SetLeftDesc(const String& sDesc)
+{
+ m_leftDesc = sDesc;
+}
+
+/**
+ * @brief Set middle description.
+ * @param [in] sDesc New middle description.
+ */
+inline void ProjectFileItem::SetMiddleDesc(const String& sDesc)
+{
+ m_middleDesc = sDesc;
+}
+
+/**
+ * @brief Set right description.
+ * @param [in] sDesc New right description.
+ */
+inline void ProjectFileItem::SetRightDesc(const String& sDesc)
+{
+ m_rightDesc = sDesc;
+}
+
+/**
* @brief Returns if filter is defined in project file.
* @return true if project file has filter.
*/
}
/**
+ * @brief Returns if window type is defined in projectfile.
+ * @return true if project file has window type definition.
+ */
+inline bool ProjectFileItem::HasWindowType() const
+{
+ return m_bHasWindowType;
+}
+
+/**
* @brief Returns if "Whitespaces" setting is defined in projectfile.
* @return true if project file has "Whitespaces" setting definition.
*/
}
/**
+ * @brief Returns window type
+ * @return Window type
+ */
+inline int ProjectFileItem::GetWindowType() const
+{
+ return m_nWindowType;
+}
+
+/**
+ * @brief Set window type
+ * @param [in] nWindowType New window type to set.
+ */
+inline void ProjectFileItem::SetWindowType(int nWindowType)
+{
+ m_nWindowType = nWindowType;
+}
+
+/**
* @brief Returns the value of the "Whitespaces" setting.
* @return The value of the "Whitespaces" setting
*/
CString GetTooltipString() const override;
IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
void CheckFileChanged(void) override;
- String GetDescription(int pane) const { return m_strDesc[pane]; }
+ String GetDescription(int pane) const override { return m_strDesc[pane]; }
static bool IsLoadable();
static bool MatchURLPattern(const String& url);