Changeset ee639a46690e…
Parent 52406a84c3ae…
by
Changes to 17 files · Browse files at ee639a46690e Showing diff from parent 52406a84c3ae Diff from another changeset...
|
|
@@ -19,86 +19,87 @@
static const CMenuDescription MenuDescList[] =
{
- {"commit", L"Commit...",
+ { "commit", L"Commit...",
L"Commit changes in repository",
"menucommit.ico", 0},
- {"init", L"Create Repository Here",
+ { "init", L"Create Repository Here",
L"Create a new repository",
"menucreaterepos.ico", 0},
- {"clone", L"Clone...",
+ { "clone", L"Clone...",
L"Create clone here from source",
"menuclone.ico", 0},
- {"shelve", L"Shelve Changes",
+ { "shelve", L"Shelve Changes",
L"Shelve or unshelve file changes",
"shelve.ico", 0},
- {"status", L"View File Status",
+ { "status", L"View File Status",
L"Repository status & changes",
"menushowchanged.ico", 0},
- {"add", L"Add Files...",
+ { "add", L"Add Files...",
L"Add files to version control",
"menuadd.ico", 0},
- {"revert", L"Revert Files...",
+ { "revert", L"Revert Files...",
L"Revert file changes",
"menurevert.ico", 0},
- {"remove", L"Remove Files...",
+ { "remove", L"Remove Files...",
L"Remove files from version control",
"menudelete.ico", 0},
- {"rename", L"Rename File...",
+ { "rename", L"Rename File...",
L"Rename file or directory",
"general.ico", 0},
- {"workbench", L"Workbench",
+ { "workbench", L"Workbench",
L"View change history of repository",
"menulog.ico", 0},
- {"log", L"Revision History",
+ { "log", L"Revision History",
L"View change history of selected files",
"menulog.ico", 0},
- {"synch", L"Synchronize",
+ { "synch", L"Synchronize",
L"Synchronize with remote repository",
"menusynch.ico", 0},
- {"serve", L"Web Server",
+ { "serve", L"Web Server",
L"Start web server for this repository",
"proxy.ico", 0},
- {"update", L"Update...",
+ { "update", L"Update...",
L"Update working directory",
"menucheckout.ico", 0},
- {"thgstatus", L"Update Icons",
+ { "thgstatus", L"Update Icons",
L"Update icons for this repository",
"refresh_overlays.ico", 0},
- {"userconf", L"Global Settings",
+ { "userconf", L"Global Settings",
L"Configure user wide settings",
"settings_user.ico", 0},
- {"repoconf", L"Repository Settings",
+ { "repoconf", L"Repository Settings",
L"Configure repository settings",
"settings_repo.ico", 0},
- {"about", L"About TortoiseHg",
+ { "about", L"About TortoiseHg",
L"Show About Dialog",
"menuabout.ico", 0},
- {"annotate", L"Annotate Files",
+ { "annotate", L"Annotate Files",
L"Changeset information per file line",
"menublame.ico", 0},
- {"vdiff", L"Visual Diff",
+ { "vdiff", L"Visual Diff",
L"View changes using GUI diff tool",
"TortoiseMerge.ico", 0},
- {"hgignore", L"Edit Ignore Filter",
+ { "hgignore", L"Edit Ignore Filter",
L"Edit repository ignore filter",
"ignore.ico", 0},
- {"guess", L"Guess Renames",
+ { "guess", L"Guess Renames",
L"Detect renames and copies",
"detect_rename.ico", 0},
- {"grep", L"Search History",
+ { "grep", L"Search History",
L"Search file revisions for patterns",
"menurepobrowse.ico", 0},
- {"forget", L"Forget Files...",
+ { "forget", L"Forget Files...",
L"Remove files from version control",
"menudelete.ico", 0},
- {"shellconf", L"Explorer Extension Settings",
+ { "shellconf", L"Explorer Extension Settings",
L"Configure Explorer extension",
"settings_repo.ico", 0},
- /* Add new items here */
-
- // template
- //{"", L"", L"", ".ico", 0},
+ // Add new items here.
+ // Template:
+ // { "cmdname", L"Display Name",
+ // L"Status bar prompt.",
+ // "iconfile.ico", 0 },
};
static const char* const RepoNoFilesMenu =
@@ -108,22 +109,18 @@ " synch serve clone init thgstatus sep"
" hgignore guess sep"
" shellconf repoconf userconf sep"
- " about"
-;
+ " about";
static const char* const RepoFilesMenu =
"commit status vdiff sep"
" add revert rename forget remove sep"
" log annotate sep"
- " about"
-;
+ " about";
static const char* const NoRepoMenu =
"clone init shellconf userconf thgstatus sep"
" workbench sep"
- " about"
-;
-
+ " about";
void CTortoiseHgCmenuBase::AddMenuList(UINT idCmd, const CString& strName)
{
@@ -131,7 +128,6 @@ m_mapMenuId[idCmd] = m_mapMenuDesc[strName];
}
-
void GetCMenuTranslation(const CString& strLang, LPCTSTR lpszName,
CStringW& strMenuText, CStringW& strHelpText)
{
@@ -152,7 +148,8 @@ }
else
{
- ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", (LPCWSTR)strSubKey);
+ ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n",
+ (LPCWSTR)strSubKey);
}
if (hKey)
@@ -214,7 +211,8 @@ }
else
{
- ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", strIconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n",
+ (LPCTSTR)strIconName);
}
}
else
@@ -223,22 +221,22 @@ if (hIcon)
{
mii.fMask |= MIIM_BITMAP | MIIM_DATA;
- mii.dwItemData = (ULONG_PTR) hIcon;
+ mii.dwItemData = (ULONG_PTR)hIcon;
mii.hbmpItem = HBMMENU_CALLBACK;
}
else
{
- ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", strIconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n",
+ (LPCTSTR)strIconName);
}
}
::InsertMenuItemW(hMenu, indexMenu, TRUE, &mii);
- ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", strMenuText);
+ ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", (LPCWSTR)strMenuText);
}
-void InsertSubMenuItemWithIcon2(
- HMENU hMenu, HMENU hSubMenu, UINT indexMenu, UINT idCmd,
+void InsertSubMenuItemWithIcon2(HMENU hMenu, HMENU hSubMenu, UINT indexMenu, UINT idCmd,
const CStringW& strMenuText, const CString& strIconName)
{
// MFT_STRING is obsolete and should not be used (replaced by MIIM_STRING
@@ -262,7 +260,8 @@ }
else
{
- ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)strIconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n",
+ (LPCTSTR)strIconName);
}
}
else
@@ -276,7 +275,8 @@ }
else
{
- ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)strIconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n",
+ (LPCTSTR)strIconName);
}
}
@@ -286,28 +286,29 @@}
-void CTortoiseHgCmenuBase::InsertMenuItemByName(HMENU hMenu, const CString& strName, UINT indexMenu,
- UINT idCmd, UINT idCmdFirst, const CStringW& strPrefix)
+void CTortoiseHgCmenuBase::InsertMenuItemByName(HMENU hMenu, const CString& strName,
+ UINT indexMenu, UINT idCmd, UINT idCmdFirst, const CStringW& strPrefix)
{
const CMenuDescriptionMap::CPair* pPair = m_mapMenuDesc.Lookup(strName);
if (pPair == NULL)
{
- ATLTRACE("***** InsertMenuItemByName: can't find menu info for '%s'\n", (LPCTSTR)strName);
+ ATLTRACE("***** InsertMenuItemByName: can't find menu info for '%s'\n",
+ (LPCTSTR)strName);
return;
}
const CMenuDescription& md = pPair->m_value;
AddMenuList(idCmd - idCmdFirst, strName);
- InsertMenuItemWithIcon1(
- hMenu, indexMenu, idCmd, strPrefix + md.strMenuText, md.strIconName);
+ InsertMenuItemWithIcon1(hMenu, indexMenu, idCmd, strPrefix + md.strMenuText,
+ md.strIconName);
}
const LPCWSTR TortoiseHgMenuEntryString = L"TortoiseHg";
+// returns -1 on error, 0 otherwise
int HasTortoiseMenu(HMENU hMenu, bool& bHasMenu)
-// returns -1 on error, 0 otherwise
{
bHasMenu = false;
@@ -327,7 +328,8 @@ // first GetMenuItemInfoW call: get size of menu item string
mii.fMask = MIIM_STRING;
BOOL bRes = ::GetMenuItemInfoW(hMenu, i, true, &mii);
- if (bRes == 0) {
+ if (bRes == 0)
+ {
ATLTRACE("HasTortoiseMenu: first GetMenuItemInfo returned 0\n");
continue;
}
@@ -347,7 +349,8 @@ ++mii.cch; // size of buffer is one more than length of string
bRes = ::GetMenuItemInfoW(hMenu, i, true, &mii);
strMenuItemText.ReleaseBuffer();
- if (bRes == 0) {
+ if (bRes == 0)
+ {
ATLTRACE("HasTortoiseMenu: second GetMenuItemInfo returned 0\n");
continue;
}
@@ -381,9 +384,8 @@#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
// IContextMenu
-STDMETHODIMP
-CTortoiseHgCmenuBase::QueryContextMenu(
- HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
+STDMETHODIMP CTortoiseHgCmenuBase::QueryContextMenu(HMENU hMenu, UINT indexMenu,
+ UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
ATLTRACE("CTortoiseHgCmenuBase::QueryContextMenu\n");
@@ -464,10 +466,12 @@ /* We have three menu types: files-selected, no-files-selected, no-repo */
LPCTSTR lpszEntries = 0;
if (bIsHgRepo)
+ {
if (bFileMenu)
lpszEntries = RepoFilesMenu;
else
lpszEntries = RepoNoFilesMenu;
+ }
else
lpszEntries = NoRepoMenu;
@@ -536,8 +540,7 @@}
-STDMETHODIMP
-CTortoiseHgCmenuBase::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
+STDMETHODIMP CTortoiseHgCmenuBase::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
{
ATLTRACE("CTortoiseHgCmenuBase::InvokeCommand");
@@ -562,10 +565,8 @@}
-STDMETHODIMP
-CTortoiseHgCmenuBase::GetCommandString(
- UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved,
- LPSTR pszName, UINT cchMax)
+STDMETHODIMP CTortoiseHgCmenuBase::GetCommandString(UINT_PTR idCmd, UINT uFlags,
+ UINT FAR *reserved, LPSTR pszName, UINT cchMax)
{
// see http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx
@@ -578,21 +579,27 @@ switch (uFlags)
{
case GCS_HELPTEXTW:
- strFlags = "GCS_HELPTEXTW"; break;
+ strFlags = "GCS_HELPTEXTW";
+ break;
case GCS_HELPTEXTA:
- strFlags = "GCS_HELPTEXTA"; break;
+ strFlags = "GCS_HELPTEXTA";
+ break;
case GCS_VALIDATEW:
- strFlags = "GCS_VALIDATEW"; break;
+ strFlags = "GCS_VALIDATEW";
+ break;
case GCS_VALIDATEA:
- strFlags = "GCS_VALIDATEA"; break;
+ strFlags = "GCS_VALIDATEA";
+ break;
case GCS_VERBW:
- strFlags = "GCS_VERBW"; break;
+ strFlags = "GCS_VERBW";
+ break;
case GCS_VERBA:
- strFlags = "GCS_VERBA"; break;
+ strFlags = "GCS_VERBA";
+ break;
}
ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: idCmd = %d, uFlags = %d (%s), "
- "cchMax = %d\n", idCmd, uFlags, strFlags, cchMax);
+ "cchMax = %d\n", idCmd, uFlags, (LPCTSTR)strFlags, cchMax);
const CMenuIdCmdMap::CPair* p = m_mapMenuId.Lookup((UINT)idCmd);
if (p == NULL)
@@ -601,19 +608,20 @@ }
else
{
- ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: name = '%s'\n", p->m_value.strName);
+ ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: name = '%s'\n",
+ (LPCTSTR)p->m_value.strName);
if (uFlags == GCS_HELPTEXTW)
{
pszw = p->m_value.strHelpText;
hr = S_OK;
- size_t size = p->m_value.strHelpText.GetLength();
- if (size >= 40)
+ int nSize = p->m_value.strHelpText.GetLength();
+ if (nSize >= 40)
{
ATLTRACE("***** CTortoiseHgCmenuBase::GetCommandString: warning: "
"length of help text is %d, which is not reasonably "
- "short (<40)\n", size);
+ "short (<40)\n", nSize);
}
}
else if (uFlags == GCS_HELPTEXTA)
@@ -681,17 +689,15 @@}
-STDMETHODIMP
-CTortoiseHgCmenuBase::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
+STDMETHODIMP CTortoiseHgCmenuBase::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult;
return HandleMenuMsg2(uMsg, wParam, lParam, &lResult);
}
-STDMETHODIMP
-CTortoiseHgCmenuBase::HandleMenuMsg2(
- UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
+STDMETHODIMP CTortoiseHgCmenuBase::HandleMenuMsg2(UINT uMsg, WPARAM wParam,
+ LPARAM lParam, LRESULT* pResult)
{
// A great tutorial on owner drawn menus in shell extension can be found
// here: http://www.codeproject.com/shell/shellextguide7.asp
@@ -706,7 +712,7 @@ case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT* lpmis = (MEASUREITEMSTRUCT*)lParam;
- if (lpmis==NULL)
+ if (lpmis == NULL)
break;
lpmis->itemWidth += 2;
if(lpmis->itemHeight < 16)
@@ -722,7 +728,7 @@ break; //not for a menu
::DrawIconEx(lpdis->hDC, lpdis->rcItem.left - 16,
lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - 16) / 2,
- (HICON) lpdis->itemData, 16, 16, 0, 0, DI_NORMAL);
+ (HICON)lpdis->itemData, 16, 16, 0, 0, DI_NORMAL);
*pResult = TRUE;
}
break;
@@ -745,7 +751,7 @@ }
CString strHgCmd = strDir + "\\thgw.exe";
- WIN32_FIND_DATAA data;
+ WIN32_FIND_DATA data;
HANDLE hFind = ::FindFirstFile(strHgCmd, &data);
if (hFind == INVALID_HANDLE_VALUE)
{
@@ -838,10 +844,10 @@ ATLTRACE("MSI msires: %d", msires);
ATLTRACE("MSI installed product id: %s\n", szProductId);
- DWORD busize = 300;
- CAutoVectorPtr<char> buf(new char[busize]);
+ DWORD dwBufSize = 300;
+ CAutoVectorPtr<char> buf(new char[dwBufSize]);
msires = ::MsiGetProductInfo(szProductId, INSTALLPROPERTY_INSTALLLOCATION,
- buf, &busize);
+ buf, &dwBufSize);
if (msires == ERROR_SUCCESS)
{
ATLTRACE("MSI install location: %s\n", &buf[0]);
@@ -858,10 +864,10 @@ ATLTRACE(" pDataObj: %p\n", pDataObj);
}
-STDMETHODIMP CTortoiseHgCmenuBase::Initialize(
- LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)
+STDMETHODIMP CTortoiseHgCmenuBase::Initialize(LPCITEMIDLIST pIDFolder,
+ LPDATAOBJECT pDataObj, HKEY hRegKey)
{
- TCHAR szName[MAX_PATH+1];
+ TCHAR szName[MAX_PATH + 1];
PrintDebugHeader(pIDFolder, pDataObj);
@@ -916,10 +922,13 @@
// disable context menu if neither the folder nor the files
// have been found
- if (m_strFolder.IsEmpty() && m_arrFiles.IsEmpty()) {
+ if (m_strFolder.IsEmpty() && m_arrFiles.IsEmpty())
+ {
ATLTRACE(" shell extension not available on this object\n");
return E_FAIL;
- } else {
+ }
+ else
+ {
return S_OK;
}
}
|
@@ -44,20 +44,16 @@ END_COM_MAP()
// IContextMenu3
- STDMETHOD(QueryContextMenu)(
- HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast,
- UINT uFlags);
+ STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst,
+ UINT idCmdLast, UINT uFlags);
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpcmi);
- STDMETHOD(GetCommandString)(
- UINT_PTR idCmd, UINT uFlags, UINT FAR* reserved,LPSTR pszName,
- UINT cchMax);
+ STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uFlags, UINT FAR* reserved,
+ LPSTR pszName, UINT cchMax);
STDMETHOD(HandleMenuMsg)(UINT uMsg, WPARAM wParam, LPARAM lParam);
- STDMETHOD(HandleMenuMsg2)(
- UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
+ STDMETHOD(HandleMenuMsg2)(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
// IShellExtInit
- STDMETHOD(Initialize)(
- LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
+ STDMETHOD(Initialize)(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
};
class CTortoiseHgCmenu :
|
@@ -10,37 +10,39 @@
static const CMenuDescription CDndMenuDescList[] =
{
- {"drag_move", L"Hg Move versioned item(s) here",
- L"", "hg.ico", 0},
- {"drag_copy", L"Hg Copy versioned item(s) here",
- L"", "hg.ico", 0},
- /* Add new items here */
+ { "drag_move", L"Hg Move versioned item(s) here",
+ L"", "hg.ico", 0 },
+ { "drag_copy", L"Hg Copy versioned item(s) here",
+ L"", "hg.ico", 0 },
- // template
- //{"", L"", L"", ".ico", 0},
+ // Add new items here.
+ // Template:
+ // { "cmdname", L"Display Name",
+ // L"Status bar prompt.",
+ // "iconfile.ico", 0 },
};
static const char* const DropMenu =
- "drag_move drag_copy"
-;
+ "drag_move drag_copy";
#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
// IContextMenu
-STDMETHODIMP
-CTortoiseHgDropHandler::QueryContextMenu(
- HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
+STDMETHODIMP CTortoiseHgDropHandler::QueryContextMenu(HMENU hMenu, UINT indexMenu,
+ UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
ATLTRACE("CShellExtDnd::QueryContextMenu\n");
- if ((uFlags & CMF_DEFAULTONLY)!=0)
+ if ((uFlags & CMF_DEFAULTONLY) != 0)
return S_OK; //we don't change the default action
- if (((uFlags & 0x000f)!=CMF_NORMAL)&&(!(uFlags & CMF_EXPLORE))&&(!(uFlags & CMF_VERBSONLY)))
+ if ((uFlags & 0x000f) != CMF_NORMAL && !(uFlags & CMF_EXPLORE) &&
+ !(uFlags & CMF_VERBSONLY))
+ {
return S_OK;
-
+ }
UINT idCmd = idCmdFirst;
@@ -72,17 +74,17 @@void CTortoiseHgDropHandler::RunDialog(const CString& strCmd)
{
if (strCmd == "drag_move" || strCmd == "drag_copy") {
- //Append the current directory as the dest
+ // Append the current directory as the dest.
m_arrFiles.Add(m_strFolder);
}
CTortoiseHgCmenuBase::RunDialog(strCmd);
}
-STDMETHODIMP CTortoiseHgDropHandler::Initialize(
- LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)
+STDMETHODIMP CTortoiseHgDropHandler::Initialize(LPCITEMIDLIST pIDFolder,
+ LPDATAOBJECT pDataObj, HKEY hRegKey)
{
- TCHAR szName[MAX_PATH+1];
+ TCHAR szName[MAX_PATH + 1];
PrintDebugHeader(pIDFolder, pDataObj);
@@ -99,7 +101,7 @@
CString strRoot;
- //short circuit if we're dragging into a non-Hg repository
+ // short circuit if we're dragging into a non-Hg repository
if (m_strFolder.IsEmpty() || (strRoot = GetHgRepoRoot(m_strFolder)).IsEmpty())
{
ATLTRACE(" drag into a non-Hg repos directory\n");
@@ -118,7 +120,8 @@ {
UINT uNumFiles = ::DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);
- for (UINT i = 0; i < uNumFiles; ++i) {
+ for (UINT i = 0; i < uNumFiles; ++i)
+ {
if (::DragQueryFile(hDrop, i, szName, MAX_PATH) > 0)
{
ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, szName);
@@ -152,10 +155,13 @@
// disable context menu if neither the folder nor the files
// have been found
- if (m_arrFiles.IsEmpty()) {
+ if (m_arrFiles.IsEmpty())
+ {
ATLTRACE(" shell extension not available on this object\n");
return E_FAIL;
- } else {
+ }
+ else
+ {
return S_OK;
}
}
|
@@ -5,10 +5,10 @@
// CTortoiseHgCmenuBase implements IContextMenu3, IShellExtInit
-class CTortoiseHgDropHandler : public CTortoiseHgCmenuBase,
+class CTortoiseHgDropHandler :
+ public CTortoiseHgCmenuBase,
public CComCoClass<CTortoiseHgDropHandler, &CLSID_TortoiseHgDropHandler>
{
-
protected:
virtual void RunDialog(const CString& strCmd);
@@ -18,13 +18,11 @@ DECLARE_REGISTRY_RESOURCEID(IDR_DRAGDROP)
// IContextMenu3
- STDMETHOD(QueryContextMenu)(
- HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast,
- UINT uFlags);
+ STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst,
+ UINT idCmdLast, UINT uFlags);
// IShellExtInit
- STDMETHOD(Initialize)(
- LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
+ STDMETHOD(Initialize)(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
};
|
@@ -8,8 +8,8 @@
CComAutoCriticalSection CTortoiseHgOverlay::m_cs;
-STDMETHODIMP CTortoiseHgOverlay::GetOverlayInfo(
- LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
+STDMETHODIMP CTortoiseHgOverlay::GetOverlayInfo(LPWSTR pwszIconFile, int cchMax,
+ int *pIndex, DWORD *pdwFlags)
{
ATLTRACE("CShellExtOverlay::GetOverlayInfo: myTortoiseClass = '%c'\n", m_chTortoiseClass);
// icons are determined by TortoiseOverlays shim
|
@@ -17,8 +17,8 @@ END_COM_MAP()
// IShellIconOverlayIdentifier
- STDMETHOD(GetOverlayInfo)(
- LPWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags);
+ STDMETHOD(GetOverlayInfo)(LPWSTR pwszIconFile, int cchMax, int* pIndex,
+ DWORD* pdwFlags);
STDMETHOD(GetPriority)(int* pPriority);
STDMETHOD(IsMemberOf)(LPCWSTR pwszPath, DWORD dwAttrib);
};
|
@@ -59,11 +59,11 @@ return 1;
}
- if (nPos == 0 || nPos == strPath.GetLength()-1)
+ if (nPos == 0 || nPos == strPath.GetLength() - 1)
return 0;
strBase = strPath.Left(nPos);
- strRest = strPath.Mid(nPos+1);
+ strRest = strPath.Mid(nPos + 1);
return 1;
}
@@ -79,7 +79,8 @@ for (;;)
{
- if (!SplitBase(strName, strBase, strRest)) {
+ if (!SplitBase(strName, strBase, strRest))
+ {
ATLTRACE("CDirectory('%s')::Add(%d): splitbase returned 0\n",
(LPCTSTR)Path(), (LPCTSTR)strName);
return 0;
@@ -97,7 +98,8 @@ while (position != NULL)
{
CDirectory* pItem = cur->m_listSubdirs.GetNext(position);
- if (pItem->m_strName == strBase) {
+ if (pItem->m_strName == strBase)
+ {
pDir = pItem;
break;
}
@@ -207,36 +209,37 @@ POSITION position = m_listSubdirs.GetHeadPosition();
while (position != NULL)
{
- const CDirectory* d = m_listSubdirs.GetNext(position);
- if (!d)
+ const CDirectory* pDir = m_listSubdirs.GetNext(position);
+ if (!pDir)
{
ATLTRACE("Directory('%s')::print: error: d is 0\n", (LPCTSTR)Path());
return;
}
- d->Print();
+ pDir->Print();
}
- CString base = Path();
+ CString strBase = Path();
time_t t;
- CString s;
+ CString str;
char ctime_res[26];
position = m_listFiles.GetHeadPosition();
while (position != NULL)
{
const CDirentry& rItem = m_listFiles.GetNext(position);
- CString p = (!base.IsEmpty() ? base + "/" + rItem.m_strName : rItem.m_strName);
+ CString strPath = (!strBase.IsEmpty() ? strBase + "/" + rItem.m_strName :
+ rItem.m_strName);
t = rItem.m_uMTime;
errno_t err = ctime_s(ctime_res, 26, &t);
if (err == 0) {
- s = ctime_res;
- s.Truncate(s.GetLength() - 1); // strip ending '\n'
+ str = ctime_res;
+ str.Truncate(str.GetLength() - 1); // strip ending '\n'
}
else {
- s = "unset";
+ str = "unset";
}
printf("%c %6o %10u %-24s %s\n", rItem.m_chState, rItem.m_uMode, rItem.m_uSize,
- (LPCTSTR)s, (LPCTSTR)p);
+ (LPCTSTR)str, (LPCTSTR)strPath);
}
}
|
@@ -20,7 +20,6 @@ #include "Direntry.h"
#include "Winstat.h"
-
int CDirentry::Read(FILE* pFile, CString& strRelPath)
{
if (fread(&m_chState, sizeof(char), 1, pFile) != 1)
@@ -47,7 +46,6 @@ return 1;
}
-
char CDirentry::Status(const CWinstat& stat) const
{
switch (m_chState)
|
@@ -35,8 +35,10 @@ int Read(FILE* pFile, CString& strRelPath);
char Status(const CWinstat& stat) const;
- bool Unset() const {
- return (m_chState == 'n') && (m_uMode == 0) && (m_uSize == -1) && (m_uMTime == -1);
+ bool Unset() const
+ {
+ return (m_chState == 'n') && (m_uMode == 0) && (m_uSize == -1) &&
+ (m_uMTime == -1);
}
private:
|
@@ -28,7 +28,6 @@ return c;
}
-
CDirstate* CDirstateCache::Get(const CString& strHgRoot, const CString& strCwd,
bool& bUnset, bool bUseKbfiles)
{
@@ -156,7 +155,6 @@ return rItem.pDirstate;
}
-
void CDirstateCache::Invalidate(const CString& strHgRoot, bool bUseKbfiles)
{
if (strHgRoot.IsEmpty())
|
@@ -31,9 +31,12 @@
if (m_hUxTheme)
{
- m_pfnGetBufferedPaintBits = (FN_GetBufferedPaintBits)::GetProcAddress(m_hUxTheme, "GetBufferedPaintBits");
- m_pfnBeginBufferedPaint = (FN_BeginBufferedPaint)::GetProcAddress(m_hUxTheme, "BeginBufferedPaint");
- m_pfnEndBufferedPaint = (FN_EndBufferedPaint)::GetProcAddress(m_hUxTheme, "EndBufferedPaint");
+ m_pfnGetBufferedPaintBits = (FN_GetBufferedPaintBits)::GetProcAddress(
+ m_hUxTheme, "GetBufferedPaintBits");
+ m_pfnBeginBufferedPaint = (FN_BeginBufferedPaint)::GetProcAddress(m_hUxTheme,
+ "BeginBufferedPaint");
+ m_pfnEndBufferedPaint = (FN_EndBufferedPaint)::GetProcAddress(m_hUxTheme,
+ "EndBufferedPaint");
}
}
}
@@ -107,9 +110,11 @@ if (!hIcon)
return NULL;
- if (m_pfnBeginBufferedPaint == NULL || m_pfnEndBufferedPaint == NULL || m_pfnGetBufferedPaintBits == NULL)
+ if (m_pfnBeginBufferedPaint == NULL || m_pfnEndBufferedPaint == NULL ||
+ m_pfnGetBufferedPaintBits == NULL)
{
- ATLTRACE(" CIconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL\n");
+ ATLTRACE(" CIconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, "
+ "returns NULL\n");
return NULL;
}
@@ -136,11 +141,12 @@ paintParams.pBlendFunction = &bfAlpha;
HDC hBufferDC;
- HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hDestDC, &rcIcon, BPBF_DIB, &paintParams, &hBufferDC);
+ HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hDestDC, &rcIcon,
+ BPBF_DIB, &paintParams, &hBufferDC);
if (hPaintBuffer)
{
- if (::DrawIconEx(hBufferDC, 0, 0, hIcon, sizeIcon.cx, sizeIcon.cy, 0, NULL, DI_NORMAL))
- //if (::FillRect(hBufferDC, &rcIcon, (HBRUSH) (0x000000FF)) != 0)
+ if (::DrawIconEx(hBufferDC, 0, 0, hIcon, sizeIcon.cx, sizeIcon.cy, 0,
+ NULL, DI_NORMAL))
{
// If icon did not have an alpha channel we need to convert buffer to PARGB
ConvertBufferToPARGB32(hPaintBuffer, hDestDC, hIcon, sizeIcon);
@@ -159,7 +165,8 @@ return hBitmap;
}
-HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, HBITMAP* phBitmap)
+HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits,
+ HBITMAP* phBitmap)
{
*phBitmap = NULL;
@@ -185,7 +192,8 @@ return (NULL == *phBitmap) ? E_OUTOFMEMORY : S_OK;
}
-HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon, SIZE& sizeIcon)
+HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC,
+ HICON hIcon, SIZE& sizeIcon)
{
RGBQUAD *prgbQuad;
int cxRow;
@@ -231,7 +239,8 @@ return false;
}
-HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap, SIZE& sizeImage, int cxRow)
+HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap,
+ SIZE& sizeImage, int cxRow)
{
BITMAPINFO bmi;
::SecureZeroMemory(&bmi, sizeof(BITMAPINFO));
@@ -245,7 +254,8 @@
HRESULT hr = E_OUTOFMEMORY;
HANDLE hHeap = ::GetProcessHeap();
- void *pvBits = ::HeapAlloc(hHeap, 0, bmi.bmiHeader.biWidth * 4 * bmi.bmiHeader.biHeight);
+ void *pvBits = ::HeapAlloc(hHeap, 0,
+ bmi.bmiHeader.biWidth * 4 * bmi.bmiHeader.biHeight);
if (pvBits)
{
hr = E_UNEXPECTED;
@@ -270,10 +280,8 @@ *pargb++ |= 0xFF000000;
}
}
-
pargb += cxDelta;
}
-
hr = S_OK;
}
|
@@ -23,9 +23,13 @@ #include <Uxtheme.h>
#include <GdiPlus.h>
-typedef HRESULT (WINAPI *FN_GetBufferedPaintBits) (HPAINTBUFFER hBufferedPaint, RGBQUAD **ppbBuffer, int *pcxRow);
-typedef HPAINTBUFFER (WINAPI *FN_BeginBufferedPaint) (HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc);
-typedef HRESULT (WINAPI *FN_EndBufferedPaint) (HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget);
+typedef HRESULT (WINAPI *FN_GetBufferedPaintBits) (HPAINTBUFFER hBufferedPaint,
+ RGBQUAD **ppbBuffer, int *pcxRow);
+typedef HPAINTBUFFER (WINAPI *FN_BeginBufferedPaint) (HDC hdcTarget,
+ const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams,
+ HDC *phdc);
+typedef HRESULT (WINAPI *FN_EndBufferedPaint) (HPAINTBUFFER hBufferedPaint,
+ BOOL fUpdateTarget);
/**
@@ -40,11 +44,13 @@
HBITMAP IconToBitmap(HICON hIcon);
HBITMAP IconToBitmapPARGB32(HICON hIcon);
- HRESULT Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, __out HBITMAP* phBitmap);
- HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon, SIZE& sizeIcon);
+ HRESULT Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits,
+ HBITMAP* phBitmap);
+ HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon,
+ SIZE& sizeIcon);
bool HasAlpha(Gdiplus::ARGB *pargb, SIZE& sizeImage, int cxRow);
- HRESULT ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap, SIZE& sizeImage, int cxRow);
-
+ HRESULT ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap,
+ SIZE& sizeImage, int cxRow);
private:
HMODULE m_hUxTheme;
|
@@ -27,7 +27,6 @@
#include <shlwapi.h>
-
class CQueryState
{
public:
@@ -117,7 +116,6 @@ if (!::PathIsNetworkPath(qsCur.strPath))
{
// checking if we have a repo root, visible from its parent dir
-
bool bHasHg = HasHgDir(chClass, qsCur.strPath, uTicks);
if (uTicks > 5000 /* ms */)
@@ -180,12 +178,7 @@ return 0;
}
-
-int GetRelPath(
- const CString& strHgRoot,
- const CString& strPath,
- CString& strRes
-)
+int GetRelPath(const CString& strHgRoot, const CString& strPath, CString& strRes)
{
int nOffset = strHgRoot.GetLength();
if (nOffset == 0)
@@ -237,7 +230,6 @@ return 0;
int nOffset = qsCur.strHgRoot.GetLength();
-
if (nOffset == 0)
{
qsLast = qsCur;
|
@@ -29,7 +29,6 @@ return strRes;
}
-
int CTHgStatus::SendRequest(const CString& strRequest)
{
static const CString strPipeName = GetPipeName();
@@ -40,7 +39,7 @@ BOOL fSuccess;
DWORD cbRead;
- ATLTRACE("CTHgStatus:SendRequest: sending '%s' to %s\n",
+ ATLTRACE("CTHgStatus::SendRequest: sending '%s' to %s\n",
(LPCTSTR)strRequest, (LPCTSTR)strPipeName);
fSuccess = ::CallNamedPipe(strPipeName, (void*)(LPCTSTR)strRequest,
@@ -53,12 +52,12 @@ }
else if (dwErr == ERROR_PIPE_BUSY)
{
- ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n");
+ ATLTRACE("CTHgStatus::SendRequest: CallNamedPipe failed (ERROR_PIPE_BUSY)\n");
return -1;
}
else
{
- ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (%d)\n", dwErr);
+ ATLTRACE("CTHgStatus::SendRequest: CallNamedPipe failed (%d)\n", dwErr);
return -1;
}
}
|
@@ -7,7 +7,6 @@
#include "shlwapi.h"
-
CString GetTHgProgRoot()
{
LPCTSTR lpszKeyName = "Software\\TortoiseHg";
@@ -103,7 +102,6 @@ return strFileName.Mid(nPos+1);
}
-
// not reentrant
HICON GetTortoiseIcon(const CString& strIconName)
{
@@ -215,7 +213,6 @@ return pFile;
}
-
// read string value from registry, wide version
int GetRegSZValueW(HKEY hKey, LPCWSTR lpszName, CStringW& strRes)
{
@@ -237,7 +234,6 @@ return 0;
}
-
// true if a starts with b
bool StartsWith(const CString& strWhole, const CString& strPrefix)
{
@@ -256,7 +252,6 @@ return true;
}
-
void Tokenize(CString str, CAtlList<CString>& rTokens, LPCTSTR lpszDelimiters)
{
int nPos = 0;
@@ -267,4 +262,3 @@ strToken = str.Tokenize(lpszDelimiters, nPos);
}
}
-
|
@@ -20,7 +20,6 @@ #include "dirstate.h"
#include "TortoiseUtils.h"
-
CAutoPtr<CDirstate> CDirstate::Read(const CString& strPath, bool& bUnset)
{
bUnset = false;
@@ -55,7 +54,6 @@ return pd;
}
-
static char *RevHashString(const char achRevHash[HASH_LENGTH])
{
static char szRevString[HASH_LENGTH * 2 + 1];
@@ -69,7 +67,6 @@ return szRevString;
}
-
void TestRead()
{
bool bUnset;
@@ -85,7 +82,6 @@ pDirstate->Root().Print();
}
-
#ifdef APPMAIN
int main(int argc, char *argv[])
{
|
@@ -37,7 +37,8 @@
CDirectory& Root() { return m_dirRoot; }
- void Add(const CString& strRelPath, CDirentry& rEntry) {
+ void Add(const CString& strRelPath, CDirentry& rEntry)
+ {
m_dirRoot.Add(strRelPath, rEntry);
++m_nNumEntries;
}
|
Loading...