OSDN Git Service

initial icon overlay support using the wingit lib
[tortoisegit/TortoiseGitJp.git] / src / TortoiseShell / IconOverlay.cpp
index 5627945..55b56b7 100644 (file)
@@ -132,7 +132,7 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
                        }\r
                        return S_FALSE;\r
                }\r
-#if 0\r
+\r
                switch (g_ShellCache.GetCacheType())\r
                {\r
                case ShellCache::exe:\r
@@ -140,22 +140,21 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
 #if 0\r
                                TSVNCacheResponse itemStatus;\r
                                SecureZeroMemory(&itemStatus, sizeof(itemStatus));\r
-                               if (m_remoteCacheLink.GetStatusFromRemoteCache(CTSVNPath(pPath), &itemStatus, true))\r
+                               if (m_remoteCacheLink.GetStatusFromRemoteCache(CTGitPath(pPath), &itemStatus, true))\r
                                {\r
-                                       status = SVNStatus::GetMoreImportant(itemStatus.m_status.text_status, itemStatus.m_status.prop_status);\r
+                                       status = GitStatus::GetMoreImportant(itemStatus.m_status.text_status, itemStatus.m_status.prop_status);\r
                                        if ((itemStatus.m_kind == git_node_file)&&(status == git_wc_status_normal)&&((itemStatus.m_needslock && itemStatus.m_owner[0]==0)||(itemStatus.m_readonly)))\r
                                                readonlyoverlay = true;\r
                                        if (itemStatus.m_owner[0]!=0)\r
                                                lockedoverlay = true;\r
                                }\r
-#endif \r
+#endif\r
                        }\r
-//                     break;\r
+                       break;\r
                case ShellCache::dll:\r
                        {\r
                                // Look in our caches for this item \r
-#if 0\r
-                               const FileStatusCacheEntry * s = m_CachedStatus.GetCachedItem(CTSVNPath(pPath));\r
+                               const FileStatusCacheEntry * s = m_CachedStatus.GetCachedItem(CTGitPath(pPath));\r
                                if (s)\r
                                {\r
                                        status = s->status;\r
@@ -177,9 +176,11 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
                                                        }\r
                                                        else\r
                                                        {\r
-                                                               const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTSVNPath(pPath), TRUE);\r
+                                                               const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTGitPath(pPath), TRUE);\r
                                                                status = s->status;\r
-                                                               status = SVNStatus::GetMoreImportant(git_wc_status_normal, status);\r
+                                                               // if get status fails then display status as 'normal' on folder (since it contains .git)\r
+                                                               // TODO: works for svn since each folder has .svn, not sure if git needs additinoal processing\r
+                                                               status = GitStatus::GetMoreImportant(git_wc_status_normal, status);\r
                                                        }\r
                                                }\r
                                                else\r
@@ -189,7 +190,7 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
                                        }\r
                                        else\r
                                        {\r
-                                               const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTSVNPath(pPath), FALSE);\r
+                                               const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTGitPath(pPath), FALSE);\r
                                                status = s->status;\r
                                        }\r
                                }\r
@@ -197,7 +198,6 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
                                        readonlyoverlay = true;\r
                                if ((s)&&(s->owner[0]!=0))\r
                                        lockedoverlay = true;\r
-#endif\r
                        }\r
 \r
                        break;\r
@@ -225,25 +225,13 @@ STDMETHODIMP CShellExt::IsMemberOf(LPCWSTR pwszPath, DWORD /*dwAttrib*/)
                        break;\r
                }\r
                ATLTRACE(_T("Status %d for file %s\n"), status, pwszPath);\r
-#endif \r
-       }\r
-\r
-       if (PathIsDirectory(pPath))\r
-       {\r
-               if (g_ShellCache.HasSVNAdminDir(pPath, TRUE))\r
-               {\r
-                       status = git_wc_status_normal;          \r
-               }else\r
-               {\r
-                       status = git_wc_status_none;\r
-               }\r
        }\r
        g_filepath.clear();\r
        g_filepath = pPath;\r
        g_filestatus = status;\r
        g_readonlyoverlay = readonlyoverlay;\r
        g_lockedoverlay = lockedoverlay;\r
-       \r
+\r
        //the priority system of the shell doesn't seem to work as expected (or as I expected):\r
        //as it seems that if one handler returns S_OK then that handler is used, no matter\r
        //if other handlers would return S_OK too (they're never called on my machine!)\r