OSDN Git Service

Add Shell Notification at add, cleanup and remove and rename, CommitDlg.cpp
authorFrank Li <lznuaa@gmail.com>
Fri, 20 Feb 2009 10:26:45 +0000 (18:26 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 20 Feb 2009 10:26:45 +0000 (18:26 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/Commands/AddCommand.cpp
src/TortoiseProc/Commands/CleanupCommand.cpp
src/TortoiseProc/Commands/RemoveCommand.cpp
src/TortoiseProc/Commands/RenameCommand.cpp
src/TortoiseProc/CommitDlg.cpp
src/Utils/ShellUpdater.cpp
src/Utils/Utils.vcproj

index ea0bc74..984a377 100644 (file)
@@ -86,10 +86,14 @@ bool AddCommand::Execute()
                                //progDlg.SetProjectProperties(props);\r
                                progDlg.SetItemCount(dlg.m_pathList.GetCount());\r
                                progDlg.DoModal();\r
                                //progDlg.SetProjectProperties(props);\r
                                progDlg.SetItemCount(dlg.m_pathList.GetCount());\r
                                progDlg.DoModal();\r
+\r
+                               CShellUpdater::Instance().AddPathsForUpdate(dlg.m_pathList);\r
+\r
                                bRet = !progDlg.DidErrorsOccur();\r
 \r
                        }\r
        //      }\r
        }\r
                                bRet = !progDlg.DidErrorsOccur();\r
 \r
                        }\r
        //      }\r
        }\r
+       CShellUpdater::Instance().Flush();\r
        return bRet;\r
 }\r
        return bRet;\r
 }\r
index af60770..89324fa 100644 (file)
@@ -107,5 +107,6 @@ bool CleanupCommand::Execute()
        }\r
        CMessageBox::Show(hwndExplorer, strMessage, _T("TortoiseSVN"), MB_OK | (strFailedPaths.IsEmpty()?MB_ICONINFORMATION:MB_ICONERROR));\r
 #endif\r
        }\r
        CMessageBox::Show(hwndExplorer, strMessage, _T("TortoiseSVN"), MB_OK | (strFailedPaths.IsEmpty()?MB_ICONINFORMATION:MB_ICONERROR));\r
 #endif\r
+       CShellUpdater::Instance().Flush();\r
        return bRet;\r
 }\r
        return bRet;\r
 }\r
index e618c9c..3e07246 100644 (file)
@@ -145,7 +145,10 @@ bool RemoveCommand::Execute()
 \r
        output.Format(_T("%d files removed"),nPath);\r
        \r
 \r
        output.Format(_T("%d files removed"),nPath);\r
        \r
+       CShellUpdater::Instance().AddPathsForUpdate(pathList);\r
+\r
        CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONINFORMATION|MB_OK);\r
 \r
        CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONINFORMATION|MB_OK);\r
 \r
+       CShellUpdater::Instance().Flush();\r
        return bRet;\r
 }\r
        return bRet;\r
 }\r
index e203adc..b4a4e6d 100644 (file)
@@ -61,6 +61,10 @@ bool RenameCommand::Execute()
                CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_OK);\r
        }\r
 \r
                CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_OK);\r
        }\r
 \r
+       CTGitPath newpath;\r
+       newpath.SetFromGit(sNewName);\r
+\r
+       CShellUpdater::Instance().AddPathForUpdate(newpath);\r
 #if 0\r
        TRACE(_T("rename file %s to %s\n"), (LPCTSTR)cmdLinePath.GetWinPathString(), (LPCTSTR)sNewName);\r
        CTSVNPath destinationPath(basePath);\r
 #if 0\r
        TRACE(_T("rename file %s to %s\n"), (LPCTSTR)cmdLinePath.GetWinPathString(), (LPCTSTR)sNewName);\r
        CTSVNPath destinationPath(basePath);\r
@@ -248,5 +252,6 @@ bool RenameCommand::Execute()
                }\r
        }\r
 #endif\r
                }\r
        }\r
 #endif\r
+       CShellUpdater::Instance().Flush();\r
        return bRet;\r
 }\r
        return bRet;\r
 }\r
index 7bf2c24..b2e0879 100644 (file)
@@ -33,6 +33,7 @@
 #include "CommonResource.h"\r
 #include "UnicodeUtils.h"\r
 #include "ProgressDlg.h"\r
 #include "CommonResource.h"\r
 #include "UnicodeUtils.h"\r
 #include "ProgressDlg.h"\r
+#include "ShellUpdater.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
@@ -406,6 +407,7 @@ void CCommitDlg::OnOK()
 \r
                        g_Git.Run(cmd,&out,CP_OEMCP);\r
                        nchecked++;\r
 \r
                        g_Git.Run(cmd,&out,CP_OEMCP);\r
                        nchecked++;\r
+\r
                        //checkedLists.insert(entry->GetGitPathString());\r
 //                     checkedfiles += _T("\"")+entry->GetGitPathString()+_T("\" ");\r
                }\r
                        //checkedLists.insert(entry->GetGitPathString());\r
 //                     checkedfiles += _T("\"")+entry->GetGitPathString()+_T("\" ");\r
                }\r
@@ -449,6 +451,8 @@ void CCommitDlg::OnOK()
                        }\r
 #endif\r
                }\r
                        }\r
 #endif\r
                }\r
+\r
+               CShellUpdater::Instance().AddPathForUpdate(*entry);\r
        }\r
 \r
        //if(uncheckedfiles.GetLength()>0)\r
        }\r
 \r
        //if(uncheckedfiles.GetLength()>0)\r
@@ -626,6 +630,8 @@ void CCommitDlg::OnOK()
        SaveSplitterPos();\r
 \r
        CResizableStandAloneDialog::OnOK();\r
        SaveSplitterPos();\r
 \r
        CResizableStandAloneDialog::OnOK();\r
+\r
+       CShellUpdater::Instance().Flush();\r
 }\r
 \r
 void CCommitDlg::SaveSplitterPos()\r
 }\r
 \r
 void CCommitDlg::SaveSplitterPos()\r
index e7785a9..7356c1d 100644 (file)
 //\r
 #include "StdAfx.h"\r
 #include "Shellupdater.h"\r
 //\r
 #include "StdAfx.h"\r
 #include "Shellupdater.h"\r
-#include "../TSVNCache/CacheInterface.h"\r
+#include "../TGitCache/CacheInterface.h"\r
 #include "Registry.h"\r
 #include "Registry.h"\r
+#include "git.h"\r
 \r
 CShellUpdater::CShellUpdater(void)\r
 {\r
 \r
 CShellUpdater::CShellUpdater(void)\r
 {\r
-       m_hInvalidationEvent = CreateEvent(NULL, FALSE, FALSE, _T("TortoiseSVNCacheInvalidationEvent"));\r
+       m_hInvalidationEvent = CreateEvent(NULL, FALSE, FALSE, _T("TortoiseGitCacheInvalidationEvent"));\r
 }\r
 \r
 CShellUpdater::~CShellUpdater(void)\r
 }\r
 \r
 CShellUpdater::~CShellUpdater(void)\r
@@ -43,7 +44,7 @@ CShellUpdater& CShellUpdater::Instance()
 * Add a single path for updating.\r
 * The update will happen at some suitable time in the future\r
 */\r
 * Add a single path for updating.\r
 * The update will happen at some suitable time in the future\r
 */\r
-void CShellUpdater::AddPathForUpdate(const CTSVNPath& path)\r
+void CShellUpdater::AddPathForUpdate(const CTGitPath& path)\r
 {\r
        // Tell the shell extension to purge its cache - we'll redo this when \r
        // we actually do the shell-updates, but sometimes there's an earlier update, which\r
 {\r
        // Tell the shell extension to purge its cache - we'll redo this when \r
        // we actually do the shell-updates, but sometimes there's an earlier update, which\r
@@ -56,7 +57,7 @@ void CShellUpdater::AddPathForUpdate(const CTSVNPath& path)
 * Add a list of paths for updating.\r
 * The update will happen when the list is destroyed, at the end of execution\r
 */\r
 * Add a list of paths for updating.\r
 * The update will happen when the list is destroyed, at the end of execution\r
 */\r
-void CShellUpdater::AddPathsForUpdate(const CTSVNPathList& pathList)\r
+void CShellUpdater::AddPathsForUpdate(const CTGitPathList& pathList)\r
 {\r
        for(int nPath=0; nPath < pathList.GetCount(); nPath++)\r
        {\r
 {\r
        for(int nPath=0; nPath < pathList.GetCount(); nPath++)\r
        {\r
@@ -113,18 +114,20 @@ void CShellUpdater::UpdateShell()
                        NULL,     // don't set maximum bytes \r
                        NULL))    // don't set maximum time \r
                {\r
                        NULL,     // don't set maximum bytes \r
                        NULL))    // don't set maximum time \r
                {\r
+                       CTGitPath path;\r
                        for(int nPath = 0; nPath < m_pathsForUpdating.GetCount(); nPath++)\r
                        {\r
                        for(int nPath = 0; nPath < m_pathsForUpdating.GetCount(); nPath++)\r
                        {\r
-                               ATLTRACE(_T("Cache Item Update for %s (%d)\n"), m_pathsForUpdating[nPath].GetDirectory().GetWinPathString(), GetTickCount());\r
-                               if (!m_pathsForUpdating[nPath].IsDirectory())\r
+                               path.SetFromWin(g_Git.m_CurrentDir+_T("\\")+m_pathsForUpdating[nPath].GetDirectory().GetWinPathString());\r
+                               ATLTRACE(_T("Cache Item Update for %s (%d)\n"), path.GetDirectory().GetWinPathString(), GetTickCount());\r
+                               if (!path.IsDirectory())\r
                                {\r
                                        // send notifications to the shell for changed files - folders are updated by the cache itself.\r
                                {\r
                                        // send notifications to the shell for changed files - folders are updated by the cache itself.\r
-                                       SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, m_pathsForUpdating[nPath].GetWinPath(), NULL);\r
+                                       SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, path.GetWinPath(), NULL);\r
                                }\r
                                DWORD cbWritten; \r
                                TSVNCacheCommand cmd;\r
                                cmd.command = TSVNCACHECOMMAND_CRAWL;\r
                                }\r
                                DWORD cbWritten; \r
                                TSVNCacheCommand cmd;\r
                                cmd.command = TSVNCACHECOMMAND_CRAWL;\r
-                               wcsncpy_s(cmd.path, MAX_PATH+1, m_pathsForUpdating[nPath].GetDirectory().GetWinPath(), MAX_PATH);\r
+                               wcsncpy_s(cmd.path, MAX_PATH+1, path.GetDirectory().GetWinPath(), MAX_PATH);\r
                                BOOL fSuccess = WriteFile( \r
                                        hPipe,                  // handle to pipe \r
                                        &cmd,                   // buffer to write from \r
                                BOOL fSuccess = WriteFile( \r
                                        hPipe,                  // handle to pipe \r
                                        &cmd,                   // buffer to write from \r
index ae0a085..120ea25 100644 (file)
                        />\r
                </Configuration>\r
                <Configuration\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Debug|x64"\r
-                       OutputDirectory="..\..\bin\$(ConfigurationName)64\bin"\r
-                       IntermediateDirectory="..\..\obj\Utils\$(ConfigurationName)64\"\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="..\..\bin\$(ConfigurationName)\bin"\r
+                       IntermediateDirectory="..\..\obj\Utils\$(ConfigurationName)\"\r
                        ConfigurationType="4"\r
                        UseOfMFC="2"\r
                        ConfigurationType="4"\r
                        UseOfMFC="2"\r
-                       UseOfATL="1"\r
                        CharacterSet="1"\r
                        CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
-                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
+                               Optimization="2"\r
+                               EnableIntrinsicFunctions="true"\r
                                AdditionalIncludeDirectories="../git;../;../ext/scintilla/include;../ext/hunspell;./MiscUi"\r
                                AdditionalIncludeDirectories="../git;../;../ext/scintilla/include;../ext/hunspell;./MiscUi"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"\r
-                               MinimalRebuild="true"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"\r
+                               RuntimeLibrary="2"\r
+                               EnableFunctionLevelLinking="true"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                DebugInformationFormat="3"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                DebugInformationFormat="3"\r
+                               DisableSpecificWarnings="4996,4018"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                        />\r
                </Configuration>\r
                <Configuration\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="..\..\bin\$(ConfigurationName)\bin"\r
-                       IntermediateDirectory="..\..\obj\Utils\$(ConfigurationName)\"\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="..\..\bin\$(ConfigurationName)64\bin"\r
+                       IntermediateDirectory="..\..\obj\Utils\$(ConfigurationName)64\"\r
                        ConfigurationType="4"\r
                        UseOfMFC="2"\r
                        ConfigurationType="4"\r
                        UseOfMFC="2"\r
+                       UseOfATL="1"\r
                        CharacterSet="1"\r
                        CharacterSet="1"\r
-                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               EnableIntrinsicFunctions="true"\r
+                               Optimization="0"\r
                                AdditionalIncludeDirectories="../git;../;../ext/scintilla/include;../ext/hunspell;./MiscUi"\r
                                AdditionalIncludeDirectories="../git;../;../ext/scintilla/include;../ext/hunspell;./MiscUi"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"\r
-                               RuntimeLibrary="2"\r
-                               EnableFunctionLevelLinking="true"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                DebugInformationFormat="3"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                DebugInformationFormat="3"\r
-                               DisableSpecificWarnings="4996,4018"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath=".\ShellUpdater.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\SoundUtils.cpp"\r
                                >\r
                        </File>\r
                                RelativePath=".\SoundUtils.cpp"\r
                                >\r
                        </File>\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|x64"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|x64"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r