<arg choice="opt" rep="norepeat"><option>/wr</option></arg>
+ <arg choice="opt" rep="norepeat"><option>/new</option></arg>
+
<arg choice="opt" rep="norepeat"><option>/self-compare</option></arg>
<arg><option>/minimize</option></arg>
</varlistentry>
<varlistentry>
+ <term><option>/new</option></term>
+ <listitem>
+ <para>Opens a new blank window.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>/self-compare</option></term>
<listitem>
<para>Compares the specified file with a copy of the file.</para>
<arg choice="opt" rep="norepeat"><option>/wr</option></arg>
+ <arg choice="opt" rep="norepeat"><option>/new</option></arg>
+
<arg choice="opt" rep="norepeat"><option>/self-compare</option></arg>
<arg><option>/minimize</option></arg>
</varlistentry>
<varlistentry>
+ <term><option>/new</option></term>
+ <listitem>
+ <para>新規ブランクウインドウを開きます。</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>/self-compare</option></term>
<listitem>
<para>指定された1つのファイルとそのファイルのコピーを比較します。</para>
<h3 id="command-line">Command line</h3>
<ul>
<li>Added /l command line option (osdn.net #41528)</li>
-<li>Added /t, /table-delimiter and /inifile command line option</li>
+<li>Added /t, /table-delimiter, /new and /inifile command line option</li>
</ul>
<h3 id="installer">Installer</h3>
<ul>
### Command line
- Added /l command line option (osdn.net #41528)
-- Added /t, /table-delimiter and /inifile command line option
+- Added /t, /table-delimiter, /new and /inifile command line option
### Installer
<h3 id="command-line">Command line</h3>
<ul>
<li>Added /l command line option (osdn.net #41528)</li>
-<li>Added /t, /table-delimiter and /inifile command line option</li>
+<li>Added /t, /table-delimiter, /new and /inifile command line option</li>
</ul>
<h3 id="installer">Installer</h3>
<ul>
### Command line
- Added /l command line option (osdn.net #41528)
-- Added /t, /table-delimiter and /inifile command line option
+- Added /t, /table-delimiter, /new and /inifile command line option
### Installer
DWORD dwFlags[3];
for (int nIndex = 0; nIndex < pathsParent.GetSize(); ++nIndex)
dwFlags[nIndex] = FFILEOPEN_NOMRU | (pDoc->GetReadOnly(nIndex) ? FFILEOPEN_READONLY : 0);
- GetMainFrame()->DoFileOpen(&pathsParent, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDocOpen);
+ GetMainFrame()->DoFileOrFolderOpen(&pathsParent, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDocOpen);
[[fallthrough]];
case AllowUpwardDirectory::No:
break;
{
// Open subfolders
// Don't add folders to MRU
- GetMainFrame()->DoFileOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDoc);
+ GetMainFrame()->DoFileOrFolderOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDoc);
}
else if (HasZipSupport() && std::count_if(paths.begin(), paths.end(), ArchiveGuessFormat) == paths.GetSize())
{
// Open archives, not adding paths to MRU
- GetMainFrame()->DoFileOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, nullptr, infoUnpacker, nullptr);
+ GetMainFrame()->DoFileOrFolderOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, nullptr, infoUnpacker, nullptr);
}
else
{
ON_UPDATE_COMMAND_UI(ID_RELOAD_PLUGINS, OnUpdatePluginRelatedMenu)
ON_COMMAND(ID_RELOAD_PLUGINS, OnReloadPlugins)
ON_COMMAND(ID_HELP_GETCONFIG, OnSaveConfigData)
- ON_COMMAND(ID_FILE_NEW, (OnFileNew<2, FRAME_FILE>))
- ON_COMMAND(ID_FILE_NEW_TABLE, (OnFileNew<2, FRAME_FILE, true>))
- ON_COMMAND(ID_FILE_NEW_HEX, (OnFileNew<2, FRAME_HEXFILE>))
- ON_COMMAND(ID_FILE_NEW_IMAGE, (OnFileNew<2, FRAME_IMGFILE>))
- ON_COMMAND(ID_FILE_NEW3, (OnFileNew<3, FRAME_FILE>))
- ON_COMMAND(ID_FILE_NEW3_TABLE, (OnFileNew<2, FRAME_FILE, true>))
- ON_COMMAND(ID_FILE_NEW3_HEX, (OnFileNew<3, FRAME_HEXFILE>))
- ON_COMMAND(ID_FILE_NEW3_IMAGE, (OnFileNew<3, FRAME_IMGFILE>))
+ ON_COMMAND(ID_FILE_NEW, (OnFileNew<2, ID_MERGE_COMPARE_TEXT>))
+ ON_COMMAND(ID_FILE_NEW_TABLE, (OnFileNew<2, ID_MERGE_COMPARE_TABLE>))
+ ON_COMMAND(ID_FILE_NEW_HEX, (OnFileNew<2, ID_MERGE_COMPARE_HEX>))
+ ON_COMMAND(ID_FILE_NEW_IMAGE, (OnFileNew<2, ID_MERGE_COMPARE_IMAGE>))
+ ON_COMMAND(ID_FILE_NEW3, (OnFileNew<3, ID_MERGE_COMPARE_TEXT>))
+ ON_COMMAND(ID_FILE_NEW3_TABLE, (OnFileNew<2, ID_MERGE_COMPARE_TABLE>))
+ ON_COMMAND(ID_FILE_NEW3_HEX, (OnFileNew<3, ID_MERGE_COMPARE_HEX>))
+ ON_COMMAND(ID_FILE_NEW3_IMAGE, (OnFileNew<3, ID_MERGE_COMPARE_IMAGE>))
ON_COMMAND(ID_TOOLS_FILTERS, OnToolsFilters)
ON_COMMAND(ID_VIEW_STATUS_BAR, OnViewStatusBar)
ON_UPDATE_COMMAND_UI(ID_VIEW_TAB_BAR, OnUpdateViewTabBar)
void CMainFrame::OnFileOpen()
{
- DoFileOpen();
+ DoFileOrFolderOpen();
}
/**
* @param [in] infoPrediffer Prediffer plugin name.
* @return `true` if opening files and compare succeeded, `false` otherwise.
*/
-bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
+bool CMainFrame::DoFileOrFolderOpen(const PathContext * pFiles /*= nullptr*/,
const DWORD dwFlags[] /*= nullptr*/, const String strDesc[] /*= nullptr*/, const String& sReportFile /*= T("")*/,
bool bRecurse /*= false*/, CDirDoc* pDirDoc/*= nullptr*/,
const PackingInfo *infoUnpacker /*= nullptr*/, const PrediffingInfo *infoPrediffer /*= nullptr*/,
bool CMainFrame::DoFileOpen(UINT nID, const PathContext* pFiles /*= nullptr*/,
const DWORD dwFlags[] /*= nullptr*/, const String strDesc[] /*= nullptr*/,
- const String& sReportFile /*= _T("")*/, const PackingInfo *infoUnpacker /*= nullptr*/, OpenTextFileParams *pOpenParams /*= nullptr*/)
+ const String& sReportFile /*= _T("")*/,
+ const PackingInfo *infoUnpacker /*= nullptr*/, const PrediffingInfo *infoPrediffer /*= nullptr*/,
+ OpenTextFileParams *pOpenParams /*= nullptr*/)
{
CDirDoc* pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->CreateNewDocument());
FileLocation fileloc[3];
for (int pane = 0; pane < pFiles->GetSize(); pane++)
fileloc[pane].setPath((*pFiles)[pane]);
+ if (infoPrediffer && !infoPrediffer->GetPluginPipeline().empty())
+ pDirDoc->GetPluginManager().SetPrediffer(_T("|"), infoPrediffer->GetPluginPipeline());
return ShowMergeDoc(nID, pDirDoc, pFiles->GetSize(), fileloc,
dwFlags, strDesc, sReportFile, infoUnpacker, pOpenParams);
}
}
}
- DoFileOpen(&tFiles, dwFlags, nullptr, _T(""), recurse);
+ DoFileOrFolderOpen(&tFiles, dwFlags, nullptr, _T(""), recurse);
}
void CMainFrame::OnPluginUnpackMode(UINT nID )
* @sa CMergeDoc::OpenDocs()
* @sa CMergeDoc::TrySaveAs()
*/
-void CMainFrame::FileNew(int nPanes, FRAMETYPE frameType, bool table)
+bool CMainFrame::DoFileNew(UINT nID, int nPanes, const String strDesc[],
+ const PrediffingInfo *infoPrediffer /*= nullptr*/,
+ OpenTextFileParams *pOpenParams)
{
CDirDoc *pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->CreateNewDocument());
// Load emptyfile descriptors and open empty docs
// Use default codepage
DWORD dwFlags[3] = {0, 0, 0};
- String strDesc[3];
FileLocation fileloc[3];
+ String strDesc2[3];
if (nPanes == 2)
{
- strDesc[0] = _("Untitled left");
- strDesc[1] = _("Untitled right");
- fileloc[0].encoding.SetCodepage(ucr::getDefaultCodepage());
- fileloc[1].encoding.SetCodepage(ucr::getDefaultCodepage());
+ strDesc2[0] = _("Untitled left");
+ strDesc2[1] = _("Untitled right");
}
else
{
- strDesc[0] = _("Untitled left");
- strDesc[1] = _("Untitled middle");
- strDesc[2] = _("Untitled right");
- fileloc[0].encoding.SetCodepage(ucr::getDefaultCodepage());
- fileloc[1].encoding.SetCodepage(ucr::getDefaultCodepage());
- fileloc[2].encoding.SetCodepage(ucr::getDefaultCodepage());
+ strDesc2[0] = _("Untitled left");
+ strDesc2[1] = _("Untitled middle");
+ strDesc2[2] = _("Untitled right");
}
- UINT nID = ID_MERGE_COMPARE_TEXT;
- switch (frameType)
+ for (int i = 0; i < nPanes; ++i)
{
- case FRAME_FILE: nID = !table ? ID_MERGE_COMPARE_TEXT : ID_MERGE_COMPARE_TABLE; break;
- case FRAME_HEXFILE: nID = ID_MERGE_COMPARE_HEX; break;
- case FRAME_IMGFILE: nID = ID_MERGE_COMPARE_IMAGE; break;
+ if (strDesc && !strDesc[i].empty())
+ strDesc2[i] = strDesc[i];
+ fileloc[i].encoding.SetCodepage(ucr::getDefaultCodepage());
}
- ShowMergeDoc(nID, pDirDoc, nPanes, fileloc, dwFlags, strDesc);
+ if (infoPrediffer && !infoPrediffer->GetPluginPipeline().empty())
+ pDirDoc->GetPluginManager().SetPrediffer(_T("|"), infoPrediffer->GetPluginPipeline());
+ return ShowMergeDoc(nID, pDirDoc, nPanes, fileloc, dwFlags, strDesc2, _T(""), nullptr, pOpenParams);
}
/**
* @sa CMergeDoc::OpenDocs()
* @sa CMergeDoc::TrySaveAs()
*/
-template <int nFiles, CMainFrame::FRAMETYPE frameType, bool table>
+template <int nFiles, unsigned nID>
void CMainFrame::OnFileNew()
{
- FileNew(nFiles, frameType, table);
+ DoFileNew(nID, nFiles);
}
/**
(strDesc && !strDesc[2].empty()) ? strDesc[2] : _("Mine File") };
DWORD dwFlags[2] = {FFILEOPEN_READONLY | FFILEOPEN_NOMRU, FFILEOPEN_NOMRU | FFILEOPEN_MODIFIED};
PathContext tmpPathContext(revFile, workFile);
- conflictCompared = DoFileOpen(&tmpPathContext, dwFlags, strDesc2);
+ conflictCompared = DoFileOrFolderOpen(&tmpPathContext, dwFlags, strDesc2);
}
else
{
(strDesc && !strDesc[2].empty()) ? strDesc[2] : _("Mine File") };
PathContext tmpPathContext(baseFile, revFile, workFile);
DWORD dwFlags[3] = {FFILEOPEN_READONLY | FFILEOPEN_NOMRU, FFILEOPEN_READONLY | FFILEOPEN_NOMRU, FFILEOPEN_NOMRU | FFILEOPEN_MODIFIED};
- conflictCompared = DoFileOpen(&tmpPathContext, dwFlags, strDesc3);
+ conflictCompared = DoFileOrFolderOpen(&tmpPathContext, dwFlags, strDesc3);
}
}
else
}
bool CMainFrame::DoSelfCompare(UINT nID, const String& file, const String strDesc[] /*= nullptr*/,
- const PackingInfo *infoUnpacker /*= nullptr*/, OpenTextFileParams *pOpenParams /*= nullptr*/)
+ const PackingInfo *infoUnpacker /*= nullptr*/, const PrediffingInfo *infoPrediffer /*= nullptr*/,
+ OpenTextFileParams *pOpenParams /*= nullptr*/)
{
String ext = paths::FindExtension(file);
TempFilePtr wTemp(new TempFile());
(strDesc && !strDesc[1].empty()) ? strDesc[1] : _("") };
DWORD dwFlags[2] = {FFILEOPEN_READONLY | FFILEOPEN_NOMRU, FFILEOPEN_NOMRU};
PathContext tmpPathContext(copiedFile, file);
- return DoFileOpen(nID, &tmpPathContext, dwFlags, strDesc2, _T(""), infoUnpacker, pOpenParams);
+ return DoFileOpen(nID, &tmpPathContext, dwFlags, strDesc2, _T(""), infoUnpacker, infoPrediffer, pOpenParams);
}
/**
HMENU GetPrediffersSubmenu(HMENU mainMenu);
void UpdatePrediffersMenu();
- void FileNew(int nPanes, FRAMETYPE frameType, bool table);
- bool DoFileOpen(const PathContext *pFiles = nullptr,
+ bool DoFileOrFolderOpen(const PathContext *pFiles = nullptr,
const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr,
const String& sReportFile = _T(""), bool bRecurse = false, CDirDoc *pDirDoc = nullptr,
- const PackingInfo * infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr, UINT nID = 0, OpenTextFileParams *pOpenParams = nullptr);
+ const PackingInfo * infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ UINT nID = 0, OpenTextFileParams *pOpenParams = nullptr);
bool DoFileOpen(UINT nID, const PathContext* pFiles = nullptr,
const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr,
- const String& sReportFile = _T(""), const PackingInfo* infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
+ const String& sReportFile = _T(""),
+ const PackingInfo* infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams *pOpenParams = nullptr);
+ bool DoFileNew(UINT nID, int nPanes, const String strDesc[] = nullptr,
+ const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams *pOpenParams = nullptr);
bool DoOpenConflict(const String& conflictFile, const String strDesc[] = nullptr, bool checked = false);
- bool DoSelfCompare(UINT nID, const String& file, const String strDesc[] = nullptr, const PackingInfo* infoUnpacker = nullptr, OpenTextFileParams* pOpenParams = nullptr);
+ bool DoSelfCompare(UINT nID, const String& file, const String strDesc[] = nullptr,
+ const PackingInfo* infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams* pOpenParams = nullptr);
bool ShowAutoMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
bool ShowHexMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr);
bool ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr);
void UpdateResources();
void ClearStatusbarItemCount();
afx_msg void OnUpdatePluginRelatedMenu(CCmdUI* pCmdUI);
afx_msg void OnReloadPlugins();
afx_msg void OnSaveConfigData();
- template <int nFiles, FRAMETYPE frameType, bool table = false>
+ template <int nFiles, unsigned nID>
afx_msg void OnFileNew();
afx_msg void OnToolsFilters();
afx_msg void OnViewStatusBar();
cmdInfo.m_dwMiddleFlags |= FFILEOPEN_CMDLINE;
cmdInfo.m_dwRightFlags |= FFILEOPEN_CMDLINE;
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwMiddleFlags, cmdInfo.m_dwRightFlags};
- bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
+ bCompared = pMainFrame->DoFileOrFolderOpen(&cmdInfo.m_Files,
dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
infoUnpacker.get(), infoPrediffer.get(), nID, &openParams);
}
else if (cmdInfo.m_Files.GetSize() > 1)
{
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwRightFlags, FFILEOPEN_NONE};
- bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
+ bCompared = pMainFrame->DoFileOrFolderOpen(&cmdInfo.m_Files,
dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
infoUnpacker.get(), infoPrediffer.get(), nID, &openParams);
}
{
strDesc[0] = cmdInfo.m_sLeftDesc;
strDesc[1] = cmdInfo.m_sRightDesc;
- bCompared = pMainFrame->DoSelfCompare(nID, sFilepath, strDesc, nullptr, &openParams);
+ bCompared = pMainFrame->DoSelfCompare(nID, sFilepath, strDesc,
+ infoUnpacker.get(), infoPrediffer.get(), &openParams);
}
else if (IsProjectFile(sFilepath))
{
else
{
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwRightFlags, FFILEOPEN_NONE};
- bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
+ bCompared = pMainFrame->DoFileOrFolderOpen(&cmdInfo.m_Files,
dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
infoUnpacker.get(), infoPrediffer.get(), nID, &openParams);
}
}
else if (cmdInfo.m_Files.GetSize() == 0) // if there are no input args, we can check the display file dialog flag
{
- bool showFiles = m_pOptions->GetBool(OPT_SHOW_SELECT_FILES_AT_STARTUP);
- if (showFiles)
- pMainFrame->DoFileOpen();
+ if (!cmdInfo.m_bNewCompare)
+ {
+ bool showFiles = m_pOptions->GetBool(OPT_SHOW_SELECT_FILES_AT_STARTUP);
+ if (showFiles)
+ pMainFrame->DoFileOrFolderOpen();
+ }
+ else
+ {
+ bCompared = pMainFrame->DoFileNew(nID, 2, strDesc, infoPrediffer.get(), &openParams);
+ }
}
}
return bCompared;
GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, bRecursive);
- rtn &= GetMainFrame()->DoFileOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive,
+ rtn &= GetMainFrame()->DoFileOrFolderOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive,
nullptr, pInfoUnpacker.get(), pInfoPrediffer.get());
}
, m_bNoPrefs(false)
, m_nCodepage(0)
, m_bSelfCompare(false)
+ , m_bNewCompare(false)
, m_dwLeftFlags(FFILEOPEN_NONE)
, m_dwMiddleFlags(FFILEOPEN_NONE)
, m_dwRightFlags(FFILEOPEN_NONE)
// -self-compare means compare a specified file with a copy of the file
m_bSelfCompare = true;
}
+ else if (param == _T("new"))
+ {
+ // -new means to display a new blank window
+ m_bNewCompare = true;
+ }
else if (param == _T("minimize"))
{
// -minimize means minimize the main window.
int m_nCodepage; /**< Codepage. */
bool m_bNoPrefs; /**< Do not load or remember options (preferences) */
bool m_bSelfCompare; /**< Compares the specified file with a copy of the file */
+ bool m_bNewCompare; /**< Show a new blank window */
int m_nLineIndex; /**< Line number to jump after loading files */
std::optional<TCHAR> m_cTableDelimiter; /**< Delimiter character for table editing*/
std::optional<TCHAR> m_cTableQuote; /* Quote character for table editing *< */
bool recurse = pDoc->m_bRecurse;
if (nID == IDOK)
{
- GetMainFrame()->DoFileOpen(
+ GetMainFrame()->DoFileOrFolderOpen(
&tmpPathContext, dwFlags.data(),
nullptr, _T(""), recurse, nullptr, &tmpPackingInfo, nullptr);
}
else if (ID_UNPACKERS_FIRST <= nID && nID <= ID_UNPACKERS_LAST)
{
tmpPackingInfo.SetPluginPipeline(CMainFrame::GetPluginPipelineByMenuId(nID, FileTransform::UnpackerEventNames, ID_UNPACKERS_FIRST));
- GetMainFrame()->DoFileOpen(
+ GetMainFrame()->DoFileOrFolderOpen(
&tmpPathContext, dwFlags.data(),
nullptr, _T(""), recurse, nullptr, &tmpPackingInfo, nullptr);
}
if (dlg.DoModal() == IDOK)
{
tmpPackingInfo.SetPluginPipeline(dlg.GetPluginPipeline());
- GetMainFrame()->DoFileOpen(
+ GetMainFrame()->DoFileOrFolderOpen(
&tmpPathContext, dwFlags.data(),
nullptr, _T(""), recurse, nullptr, &tmpPackingInfo, nullptr);
}