OSDN Git Service

PATCH: [ 715553 ] Add commandline options to not add paths to MRU
authorKimmo Varis <kimmov@gmail.com>
Mon, 7 Apr 2003 14:09:21 +0000 (14:09 +0000)
committerKimmo Varis <kimmov@gmail.com>
Mon, 7 Apr 2003 14:09:21 +0000 (14:09 +0000)
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.cpp
Src/readme.txt

index ad5c481..af788a3 100644 (file)
@@ -850,13 +850,12 @@ void CMainFrame::rptStatus(BYTE code)
        m_wndStatusBar.SetPaneText(2, s);
 }
 
-
-BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*/, BOOL bRecurse /*= FALSE*/)
+BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*/,
+       DWORD dwLeftFlags /*=0*/, DWORD dwRightFlags /*=0*/, BOOL bRecurse /*=FALSE*/)
 {
        CString strLeft(pszLeft);
        CString strRight(pszRight);
        CString strExt;
-       CFileStatus status;
 
        BOOL docNull;
        CDirDoc * pDirDoc = GetDirDocToShow(&docNull);
@@ -889,8 +888,10 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
        else
        {
                //save the MRU left and right files.
-               addToMru(pszLeft, _T("Files\\Left"));
-               addToMru(pszRight, _T("Files\\Right"));
+               if (!(dwLeftFlags & FFILEOPEN_NOMRU))
+                       addToMru(pszLeft, _T("Files\\Left"));
+               if (!(dwRightFlags & FFILEOPEN_NOMRU))
+                       addToMru(pszRight, _T("Files\\Right"));
        }
 
        if (1)
index 3af3086..7304065 100644 (file)
 
 #define BACKUP_FILE_EXT   _T(".bak")
 
+enum
+{
+       FFILEOPEN_NONE          = 0x0000,
+       FFILEOPEN_NOMRU         = 0x0001
+};
 
 class CDiffView;
 class CDirView;
@@ -72,7 +77,8 @@ public:
        BOOL SyncFiles(LPCTSTR pszSrc, LPCTSTR pszDest, CString * psError);
        BOOL DoSyncFiles(LPCTSTR pszSrc, LPCTSTR pszDest, CString * psError);
        void UpdateCurrentFileStatus(CDirDoc * pDirDoc, UINT nStatus, int idx);
-       BOOL DoFileOpen(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL, BOOL bRecurse = FALSE);
+       BOOL DoFileOpen(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL,
+               DWORD dwLeftFlags = 0, DWORD dwRightFlags = 0, BOOL bRecurse = FALSE);
        void ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight);
        void UpdateResources();
        HMENU NewDefaultMenu();
index d207ae8..850c4da 100644 (file)
@@ -194,6 +194,8 @@ BOOL CMergeApp::InitInstance()
        UINT nFiles=0;
        BOOL recurse=FALSE;
        files.SetSize(2);
+       DWORD dwLeftFlags = 0;
+       DWORD dwRightFlags = 0;
        for (int i = 1; i < __argc; i++)
        {
                LPCTSTR pszParam = __targv[i];
@@ -202,11 +204,29 @@ BOOL CMergeApp::InitInstance()
                        // remove flag specifier
                        ++pszParam;
 
+                       // -r to compare recursively
                        if (!_tcsicmp(pszParam, _T("r")))
                                recurse=TRUE;
 
+                       // -e to allow closing with single esc press
                        if (!_tcsicmp(pszParam, _T("e")))
                                m_bEscCloses = TRUE;
+
+                       // -ur to not add left path to MEU
+                       if (!_tcsicmp(pszParam, _T("ul")))
+                               dwLeftFlags |= FFILEOPEN_NOMRU;
+
+                       // -ur to not add right path to MRU
+                       if (!_tcsicmp(pszParam, _T("ur")))
+                               dwRightFlags |= FFILEOPEN_NOMRU;
+
+                       // -ur to not add paths to MRU
+                       if (!_tcsicmp(pszParam, _T("ub")))
+                       {
+                               dwLeftFlags |= FFILEOPEN_NOMRU;
+                               dwRightFlags |= FFILEOPEN_NOMRU;
+                       }
+
                }
                else
                {
@@ -220,19 +240,21 @@ BOOL CMergeApp::InitInstance()
        if (nFiles>2)
        {
                pMainFrame->m_strSaveAsPath = files[2];
-               pMainFrame->DoFileOpen(files[0], files[1], recurse);
+               pMainFrame->DoFileOpen(files[0], files[1],
+                       dwLeftFlags, dwRightFlags, recurse);
        }
        else if (nFiles>1)
        {
                pMainFrame->m_strSaveAsPath = _T("");
-               pMainFrame->DoFileOpen(files[0], files[1], recurse);
+               pMainFrame->DoFileOpen(files[0], files[1],
+                       dwLeftFlags, dwRightFlags, recurse);
        }
        else if (nFiles>0)
        {
                pMainFrame->m_strSaveAsPath = _T("");
-               pMainFrame->DoFileOpen(files[0], "", recurse);
+               pMainFrame->DoFileOpen(files[0], "",
+                       dwLeftFlags, dwRightFlags, recurse);
        }
-
        return TRUE;
 }
 
index f54593d..1525d43 100644 (file)
@@ -1,6 +1,9 @@
 2003-04-07 Kimmo
  PATCH: [ 716308 ] Disable italic text
   editlib: ccrystaltextview.cpp
+ PATCH: [ 715553 ] Add commandline options to not add paths to MRU
+  Usage: -ur to ignore rigth, -ul to ignore left and -ub to ignore both
+  WinMerge: MainFrm.h MainFrm.cpp Merge.cpp 
 
 2003-04-06 Kimmo
  PATCH: [ 715457 ] LoadFromFile() rewrote