OSDN Git Service

Add /new command line option
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 22 Jul 2021 06:20:54 +0000 (15:20 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 22 Jul 2021 06:20:54 +0000 (15:20 +0900)
13 files changed:
Docs/Manual/EN/Command_line.xml
Docs/Manual/JP/Command_line.xml
Docs/Users/ChangeLog.html
Docs/Users/ChangeLog.md
Docs/Users/ReleaseNotes.html
Docs/Users/ReleaseNotes.md
Src/DirView.cpp
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.cpp
Src/MergeCmdLineInfo.cpp
Src/MergeCmdLineInfo.h
Src/OpenView.cpp

index cd0a63e..36ce1ac 100644 (file)
@@ -61,6 +61,8 @@
 
       <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>
index ba8398c..3101c20 100644 (file)
@@ -61,6 +61,8 @@
 
       <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>
index 4ff6f93..008f1a0 100644 (file)
@@ -91,7 +91,7 @@
 <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>
index b4e0643..3f54021 100644 (file)
@@ -72,7 +72,7 @@
 ### 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
 
index cc9d513..add7fb2 100644 (file)
 <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>
index 64d9ff3..a1a8155 100644 (file)
@@ -86,7 +86,7 @@ Please submit bug reports to our <a href="http://github.com/winmerge/winmerge/is
 ### 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
 
index 20990b5..62362e2 100644 (file)
@@ -1259,7 +1259,7 @@ void CDirView::OpenParentDirectory(CDirDoc *pDocOpen)
                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;
@@ -1352,12 +1352,12 @@ void CDirView::Open(CDirDoc *pDoc, const PathContext& paths, DWORD dwFlags[3], F
        {
                // 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
        {
index e885d60..e917b2f 100644 (file)
@@ -200,14 +200,14 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
        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)
@@ -680,7 +680,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
 
 void CMainFrame::OnFileOpen() 
 {
-       DoFileOpen();
+       DoFileOrFolderOpen();
 }
 
 /**
@@ -1071,7 +1071,7 @@ static bool AddToRecentDocs(const PathContext& paths, const unsigned flags[], bo
  * @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*/,
@@ -1217,12 +1217,16 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= 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);
 }
@@ -1579,7 +1583,7 @@ void CMainFrame::OnDropFiles(const std::vector<String>& dropped_files)
                }
        }
 
-       DoFileOpen(&tFiles, dwFlags, nullptr, _T(""), recurse);
+       DoFileOrFolderOpen(&tFiles, dwFlags, nullptr, _T(""), recurse);
 }
 
 void CMainFrame::OnPluginUnpackMode(UINT nID )
@@ -1735,39 +1739,37 @@ void CMainFrame::OnSaveConfigData()
  * @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);
 }
 
 /**
@@ -1780,10 +1782,10 @@ void CMainFrame::FileNew(int nPanes, FRAMETYPE frameType, bool table)
  * @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);
 }
 
 /**
@@ -2477,7 +2479,7 @@ bool CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc
                                (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
                {
@@ -2487,7 +2489,7 @@ bool CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc
                                (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
@@ -2498,7 +2500,8 @@ bool CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc
 }
 
 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());
@@ -2512,7 +2515,7 @@ bool CMainFrame::DoSelfCompare(UINT nID, const String& file, const String strDes
                (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);
 }
 
 /**
index f827b49..228a1d4 100644 (file)
@@ -97,16 +97,23 @@ public:
        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);
@@ -125,9 +132,11 @@ public:
                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();
@@ -278,7 +287,7 @@ protected:
        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();
index e3025ab..05cad9f 100644 (file)
@@ -727,14 +727,14 @@ bool CMergeApp::ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainF
                        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);
                }
@@ -745,7 +745,8 @@ bool CMergeApp::ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainF
                        {
                                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))
                        {
@@ -762,16 +763,23 @@ bool CMergeApp::ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainF
                        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;
@@ -1254,7 +1262,7 @@ bool CMergeApp::LoadAndOpenProjectFile(const String& sProject, const String& sRe
 
                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());
        }
 
index da76fe1..55bb1f6 100644 (file)
@@ -125,6 +125,7 @@ MergeCmdLineInfo::MergeCmdLineInfo(const TCHAR* q)
        , m_bNoPrefs(false)
        , m_nCodepage(0)
        , m_bSelfCompare(false)
+       , m_bNewCompare(false)
        , m_dwLeftFlags(FFILEOPEN_NONE)
        , m_dwMiddleFlags(FFILEOPEN_NONE)
        , m_dwRightFlags(FFILEOPEN_NONE)
@@ -312,6 +313,11 @@ void MergeCmdLineInfo::ParseWinMergeCmdLine(const TCHAR *q)
                        // -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.
index 56afc44..3be64b5 100644 (file)
@@ -74,6 +74,7 @@ public:
        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 *< */
index 8946fcf..1ce393f 100644 (file)
@@ -657,14 +657,14 @@ void COpenView::OnCompare(UINT nID)
        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);
        }
@@ -675,7 +675,7 @@ void COpenView::OnCompare(UINT nID)
                if (dlg.DoModal() == IDOK)
                {
                        tmpPackingInfo.SetPluginPipeline(dlg.GetPluginPipeline());
-                       GetMainFrame()->DoFileOpen(
+                       GetMainFrame()->DoFileOrFolderOpen(
                                &tmpPathContext, dwFlags.data(),
                                nullptr, _T(""), recurse, nullptr, &tmpPackingInfo, nullptr);
                }