Changeset 4037f1bffabc…
Parent dffce7f97154…
by
Changes to 6 files · Browse files at 4037f1bffabc Showing diff from parent dffce7f97154 Diff from another changeset...
|
|
@@ -132,13 +132,13 @@ }
-void GetCMenuTranslation(const CString& lang, LPCSTR name, CStringW& menuText,
- CStringW& helpText)
+void GetCMenuTranslation(const CString& strLang, LPCTSTR lpszName,
+ CStringW& strMenuText, CStringW& strHelpText)
{
CStringW subkey = L"Software\\TortoiseHg\\CMenu\\";
- subkey += lang;
+ subkey += strLang;
subkey += L"\\";
- subkey += name;
+ subkey += lpszName;
ATLTRACE(L"GetCMenuTranslation: '%s'\n", (LPCWSTR)subkey);
@@ -147,8 +147,8 @@
if (rv == ERROR_SUCCESS && hkey)
{
- GetRegSZValueW(hkey, L"menuText", menuText);
- GetRegSZValueW(hkey, L"helpText", helpText);
+ GetRegSZValueW(hkey, L"menuText", strMenuText);
+ GetRegSZValueW(hkey, L"helpText", strHelpText);
}
else
{
@@ -192,7 +192,7 @@
void InsertMenuItemWithIcon1(HMENU hMenu, UINT indexMenu, UINT idCmd,
- const CStringW& menuText, const CString& iconName)
+ const CStringW& strMenuText, const CString& strIconName)
{
// MFT_STRING is obsolete and should not be used (replaced by MIIM_STRING
// from Win2K onward)
@@ -200,13 +200,13 @@ memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.fMask = MIIM_ID | MIIM_STRING;
- mi.dwTypeData = (LPWSTR)(LPCWSTR)menuText;
- mi.cch = menuText.GetLength();
+ mi.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText;
+ mi.cch = strMenuText.GetLength();
mi.wID = idCmd;
if (CSysInfo::Instance().IsVistaOrLater())
{
- HBITMAP hBmp = GetTortoiseIconBitmap(iconName);
+ HBITMAP hBmp = GetTortoiseIconBitmap(strIconName);
if (hBmp)
{
mi.fMask |= MIIM_BITMAP;
@@ -214,12 +214,12 @@ }
else
{
- ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", strIconName);
}
}
else
{
- HICON h = GetTortoiseIcon(iconName);
+ HICON h = GetTortoiseIcon(strIconName);
if (h)
{
mi.fMask |= MIIM_BITMAP | MIIM_DATA;
@@ -228,18 +228,18 @@ }
else
{
- ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", strIconName);
}
}
InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);
- ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", menuText);
+ ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", strMenuText);
}
void InsertSubMenuItemWithIcon2(
HMENU hMenu, HMENU hSubMenu, UINT indexMenu, UINT idCmd,
- const CStringW& menuText, const CString& iconName)
+ const CStringW& strMenuText, const CString& strIconName)
{
// MFT_STRING is obsolete and should not be used (replaced by MIIM_STRING
// from Win2K onward)
@@ -247,14 +247,14 @@ memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.fMask = MIIM_SUBMENU | MIIM_ID | MIIM_STRING;
- mi.dwTypeData = (LPWSTR)(LPCWSTR)menuText;
- mi.cch = menuText.GetLength();
+ mi.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText;
+ mi.cch = strMenuText.GetLength();
mi.wID = idCmd;
mi.hSubMenu = hSubMenu;
if (CSysInfo::Instance().IsVistaOrLater())
{
- HBITMAP hBmp = GetTortoiseIconBitmap(iconName);
+ HBITMAP hBmp = GetTortoiseIconBitmap(strIconName);
if (hBmp)
{
mi.fMask |= MIIM_BITMAP;
@@ -262,12 +262,12 @@ }
else
{
- ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)iconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)strIconName);
}
}
else
{
- HICON h = GetTortoiseIcon(iconName);
+ HICON h = GetTortoiseIcon(strIconName);
if (h)
{
mi.fMask |= MIIM_BITMAP | MIIM_DATA;
@@ -276,13 +276,13 @@ }
else
{
- ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)iconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", (LPCTSTR)strIconName);
}
}
InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);
- ATLTRACE(L"InsertMenuItemWithIcon2('%s') finished\n", (LPCWSTR)menuText);
+ ATLTRACE(L"InsertMenuItemWithIcon2('%s') finished\n", (LPCWSTR)strMenuText);
}
@@ -306,10 +306,10 @@
const LPCWSTR TortoiseHgMenuEntryString = L"TortoiseHg";
-int HasTortoiseMenu(HMENU hMenu, bool& hasmenu)
+int HasTortoiseMenu(HMENU hMenu, bool& bHasMenu)
// returns -1 on error, 0 otherwise
{
- hasmenu = false;
+ bHasMenu = false;
const int count = ::GetMenuItemCount(hMenu);
if (count == -1)
@@ -355,7 +355,7 @@ if (strMenuItemText == TortoiseHgMenuEntryString)
{
ATLTRACE("HasTortoiseMenu: FOUND TortoiseHg menu entry\n");
- hasmenu = true;
+ bHasMenu = true;
return 0;
}
}
|
@@ -46,24 +46,24 @@ }
-int SplitBase(const CString& n, CString& base, CString& rest)
+int SplitBase(const CString& strPath, CString& strBase, CString& strRest)
{
- if (n.IsEmpty())
+ if (strPath.IsEmpty())
return 0;
- int x = n.Find('/');
+ int x = strPath.Find('/');
if (x == -1)
{
- base.Empty();
- rest = n;
+ strBase.Empty();
+ strRest = strPath;
return 1;
}
- if (x == 0 || x == n.GetLength()-1)
+ if (x == 0 || x == strPath.GetLength()-1)
return 0;
- base = n.Left(x);
- rest = n.Mid(x+1);
+ strBase = strPath.Left(x);
+ strRest = strPath.Mid(x+1);
return 1;
}
|
@@ -23,25 +23,25 @@ #include "SysInfo.h"
CIconBitmapUtils::CIconBitmapUtils() :
- hUxTheme(NULL)
+ m_hUxTheme(NULL)
{
if (CSysInfo::Instance().IsVistaOrLater())
{
- hUxTheme = LoadLibrary(_T("UXTHEME.DLL"));
+ m_hUxTheme = LoadLibrary(_T("UXTHEME.DLL"));
- if (hUxTheme)
+ if (m_hUxTheme)
{
- pfnGetBufferedPaintBits = (FN_GetBufferedPaintBits)::GetProcAddress(hUxTheme, "GetBufferedPaintBits");
- pfnBeginBufferedPaint = (FN_BeginBufferedPaint)::GetProcAddress(hUxTheme, "BeginBufferedPaint");
- pfnEndBufferedPaint = (FN_EndBufferedPaint)::GetProcAddress(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");
}
}
}
CIconBitmapUtils::~CIconBitmapUtils()
{
- if (hUxTheme)
- FreeLibrary(hUxTheme);
+ if (m_hUxTheme)
+ FreeLibrary(m_hUxTheme);
}
HBITMAP CIconBitmapUtils::IconToBitmap(HICON hIcon)
@@ -107,9 +107,9 @@ if (!hIcon)
return NULL;
- if (pfnBeginBufferedPaint == NULL || pfnEndBufferedPaint == NULL || pfnGetBufferedPaintBits == NULL)
+ if (m_pfnBeginBufferedPaint == NULL || m_pfnEndBufferedPaint == NULL || m_pfnGetBufferedPaintBits == NULL)
{
- ATLTRACE(" IconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL\n");
+ ATLTRACE(" CIconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL\n");
return NULL;
}
@@ -136,7 +136,7 @@ paintParams.pBlendFunction = &bfAlpha;
HDC hdcBuffer;
- HPAINTBUFFER hPaintBuffer = pfnBeginBufferedPaint(hdcDest, &rcIcon, BPBF_DIB, &paintParams, &hdcBuffer);
+ HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hdcDest, &rcIcon, BPBF_DIB, &paintParams, &hdcBuffer);
if (hPaintBuffer)
{
if (DrawIconEx(hdcBuffer, 0, 0, hIcon, sizIcon.cx, sizIcon.cy, 0, NULL, DI_NORMAL))
@@ -146,7 +146,7 @@ ConvertBufferToPARGB32(hPaintBuffer, hdcDest, hIcon, sizIcon);
}
// This will write the buffer contents to the destination bitmap
- pfnEndBufferedPaint(hPaintBuffer, TRUE);
+ m_pfnEndBufferedPaint(hPaintBuffer, TRUE);
}
SelectObject(hdcDest, hbmpOld);
@@ -189,7 +189,7 @@{
RGBQUAD *prgbQuad;
int cxRow;
- HRESULT hr = pfnGetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);
+ HRESULT hr = m_pfnGetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);
if (SUCCEEDED(hr))
{
Gdiplus::ARGB *pargb = reinterpret_cast<Gdiplus::ARGB *>(prgbQuad);
|
@@ -47,9 +47,9 @@
private:
- HMODULE hUxTheme;
+ HMODULE m_hUxTheme;
- FN_GetBufferedPaintBits pfnGetBufferedPaintBits;
- FN_BeginBufferedPaint pfnBeginBufferedPaint;
- FN_EndBufferedPaint pfnEndBufferedPaint;
+ FN_GetBufferedPaintBits m_pfnGetBufferedPaintBits;
+ FN_BeginBufferedPaint m_pfnBeginBufferedPaint;
+ FN_EndBufferedPaint m_pfnEndBufferedPaint;
};
|
|
|
@@ -28,31 +28,31 @@ #include <shlwapi.h>
-class QueryState
+class CQueryState
{
public:
- CString path;
- bool isdir;
- CString basedir;
- CString hgroot;
+ CString strPath;
+ bool bIsDir;
+ CString strBaseDir;
+ CString strHgRoot;
- char status;
- unsigned tickcount;
+ char chStatus;
+ unsigned uTickCount;
- QueryState(): isdir(false), status('0'), tickcount(0) {}
+ CQueryState() : bIsDir(false), chStatus('0'), uTickCount(0) {}
};
-bool hasHgDir(char cls, const CString& path, unsigned& ticks)
+bool HasHgDir(char chClass, const CString& strPath, unsigned& uTicks)
{
- ticks = 0;
+ uTicks = 0;
bool res = false;
- if (path.IsEmpty() || path == "\\")
+ if (strPath.IsEmpty() || strPath == "\\")
return res;
- const CString p = path + "\\.hg";
+ const CString p = strPath + "\\.hg";
if (::PathIsUNCServerShare(p))
return res;
@@ -61,31 +61,31 @@ res = ::PathIsDirectory(p) != 0;
unsigned tc1 = ::GetTickCount();
- ticks = tc1 - tc0;
+ uTicks = tc1 - tc0;
- if (ticks > 5 /* ms */)
+ if (uTicks > 5 /* ms */)
{
// trace slower PathIsDirectory calls (untypical on local discs)
ATLTRACE("[%c] hasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n",
- cls, (LPCTSTR)p, (int)res, ticks);
+ chClass, (LPCTSTR)p, (int)res, uTicks);
}
return res;
}
-int findHgRoot(char cls, QueryState& cur, QueryState& last, bool outdated)
+int FindHgRoot(char chClass, CQueryState& qsCur, CQueryState& qsLast, bool bOutdated)
{
- CString dp = "["; dp += cls; dp += "] findHgRoot";
+ CString dp = "["; dp += chClass; dp += "] findHgRoot";
{
- CString p = cur.path;
+ CString p = qsCur.strPath;
p.AppendChar('\\');
bool unset = false;
if (p.Find("\\.hg\\") != -1)
{
// ignore files and dirs named '.hg'
- last = cur;
+ qsLast = qsCur;
return 0;
}
int pos;
@@ -97,28 +97,28 @@ if (stat.lstat(p, true) == 0)
{
// ignore files and dirs named '.kbf' when kbfiles is enabled
- last = cur;
+ qsLast = qsCur;
return 0;
}
}
}
- if (!outdated && !last.hgroot.IsEmpty()
- && cur.path.GetLength() >= last.hgroot.GetLength()
- && StartsWith(cur.path, last.hgroot + "\\"))
+ if (!bOutdated && !qsLast.strHgRoot.IsEmpty()
+ && qsCur.strPath.GetLength() >= qsLast.strHgRoot.GetLength()
+ && StartsWith(qsCur.strPath, qsLast.strHgRoot + "\\"))
{
- cur.hgroot = last.hgroot;
+ qsCur.strHgRoot = qsLast.strHgRoot;
return 1;
}
unsigned ticks = 0;
bool file_access_is_unacceptably_slow = false;
- if (!::PathIsNetworkPath(cur.path))
+ if (!::PathIsNetworkPath(qsCur.strPath))
{
// checking if we have a repo root, visible from its parent dir
- const bool has_hg = hasHgDir(cls, cur.path, ticks);
+ const bool has_hg = HasHgDir(chClass, qsCur.strPath, ticks);
if (ticks > 5000 /* ms */)
{
@@ -128,23 +128,23 @@
if (has_hg)
{
- cur.hgroot = cur.path;
- ATLTRACE("%s('%s'): hgroot = cur.path\n", (LPCTSTR)dp, (LPCTSTR)cur.path);
+ qsCur.strHgRoot = qsCur.strPath;
+ ATLTRACE("%s('%s'): hgroot = cur.path\n", (LPCTSTR)dp, (LPCTSTR)qsCur.strPath);
return 1;
}
}
- cur.basedir = DirName(cur.path);
+ qsCur.strBaseDir = DirName(qsCur.strPath);
- if (!outdated && !last.basedir.IsEmpty() && cur.basedir == last.basedir)
+ if (!bOutdated && !qsLast.strBaseDir.IsEmpty() && qsCur.strBaseDir == qsLast.strBaseDir)
{
- cur.hgroot = last.hgroot;
+ qsCur.strHgRoot = qsLast.strHgRoot;
return 1;
}
- for (CString p = cur.basedir;;)
+ for (CString p = qsCur.strBaseDir;;)
{
- bool has_hg = hasHgDir(cls, p, ticks);
+ bool has_hg = HasHgDir(chClass, p, ticks);
if (ticks > 5000 /* ms */)
{
CString reason = "ignoring slow \"" + p + "\"";
@@ -155,9 +155,9 @@
if (has_hg)
{
- cur.hgroot = p;
+ qsCur.strHgRoot = p;
ATLTRACE("%s('%s'): hgroot = '%s' (found repo)", (LPCTSTR)dp,
- (LPCTSTR)cur.path, (LPCTSTR)cur.hgroot);
+ (LPCTSTR)qsCur.strPath, (LPCTSTR)qsCur.strHgRoot);
return 1;
}
CString p2 = DirName(p);
@@ -170,34 +170,34 @@ if (file_access_is_unacceptably_slow)
{
ATLTRACE("****** %s('%s'): ignored, call took too long (%d ticks)\n",
- (LPCTSTR)dp, (LPCTSTR)cur.path, ticks);
+ (LPCTSTR)dp, (LPCTSTR)qsCur.strPath, ticks);
}
else
{
- ATLTRACE("%s('%s'): NO repo found\n", (LPCTSTR)dp, (LPCTSTR)cur.path);
+ ATLTRACE("%s('%s'): NO repo found\n", (LPCTSTR)dp, (LPCTSTR)qsCur.strPath);
}
- last = cur;
+ qsLast = qsCur;
return 0;
}
-int get_relpath(
- const CString& hgroot,
- const CString& path,
+int GetRelPath(
+ const CString& strHgRoot,
+ const CString& strPath,
CString& res
)
{
- int offset = hgroot.GetLength();
+ int offset = strHgRoot.GetLength();
if (offset == 0)
return 0;
- if (offset > path.GetLength())
+ if (offset > strPath.GetLength())
return 0;
- if (path[offset] == '\\')
+ if (strPath[offset] == '\\')
offset++;
- res = path.Mid(offset);
+ res = strPath.Mid(offset);
return 1;
}
@@ -207,21 +207,21 @@{
CString dp = "["; dp += chClass; dp += "] HgQueryDirstate: ";
- static QueryState last;
+ static CQueryState last;
if (strPath.IsEmpty())
return 0;
- QueryState cur;
+ CQueryState cur;
- cur.path = strPath;
- cur.tickcount = ::GetTickCount();
+ cur.strPath = strPath;
+ cur.uTickCount = ::GetTickCount();
- const bool outdated = cur.tickcount - last.tickcount > 2000;
+ const bool outdated = cur.uTickCount - last.uTickCount > 2000;
- if (!outdated && last.path == strPath)
+ if (!outdated && last.strPath == strPath)
{
- chOutStatus = last.status;
+ chOutStatus = last.chStatus;
if (chOutStatus == 'P')
chOutStatus = 'M';
return 1;
@@ -233,10 +233,10 @@ return 0;
}
- if (findHgRoot(chClass, cur, last, outdated) == 0)
+ if (FindHgRoot(chClass, cur, last, outdated) == 0)
return 0;
- int offset = cur.hgroot.GetLength();
+ int offset = cur.strHgRoot.GetLength();
if (offset == 0)
{
@@ -254,7 +254,7 @@ relpath.SetAt(i, '/');
}
- CDirectoryStatus* pdirsta = CDirectoryStatus::Get(cur.hgroot, cur.basedir);
+ CDirectoryStatus* pdirsta = CDirectoryStatus::Get(cur.strHgRoot, cur.strBaseDir);
if (pdirsta && pdirsta->NoIcons())
{
last = cur;
@@ -264,19 +264,19 @@ if (relpath.IsEmpty())
{
chOutStatus = (pdirsta ? pdirsta->Status(relpath) : '?');
- cur.status = chOutStatus;
- cur.tickcount = ::GetTickCount();
+ cur.chStatus = chOutStatus;
+ cur.uTickCount = ::GetTickCount();
last = cur;
return 1;
}
bool unset = false;
- CDirstate* pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset);
+ CDirstate* pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset);
if (!pds)
{
ATLTRACE("%s Dirstatecache::Get('%s') returns no Dirstate\n", (LPCTSTR)dp,
- (LPCTSTR)cur.hgroot);
+ (LPCTSTR)cur.strHgRoot);
last = cur;
return 0;
}
@@ -288,18 +288,18 @@ last = cur;
return 0;
}
- cur.isdir = stat.bIsDir;
+ cur.bIsDir = stat.bIsDir;
#if 0
ATLTRACE("%s stat.lstat('%s') -> stat.isdir is %d\n" << (LPCTSTR)dp,
(LPCTSTR)cur.path, (int)stat.isdir);
#endif
- if (cur.isdir)
+ if (cur.bIsDir)
{
if (!relpath.IsEmpty() && !pds->Root().GetDir(relpath))
{
// attempt to get status from kbfiles
- pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset, true);
+ pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset, true);
if (!pds || !pds->Root().GetDir(relpath))
{
last = cur;
@@ -308,8 +308,8 @@ }
chOutStatus = (pdirsta ? pdirsta->Status(relpath) : '?');
- cur.status = chOutStatus;
- cur.tickcount = ::GetTickCount();
+ cur.chStatus = chOutStatus;
+ cur.uTickCount = ::GetTickCount();
last = cur;
return 1;
}
@@ -318,7 +318,7 @@ if (!e)
{
// attempt to get status from kbfiles
- pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset, true);
+ pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset, true);
if (pds)
{
e = pds->Root().Get(relpath);
@@ -340,7 +340,7 @@ if (chOutStatus == 'M')
{
CString relbase;
- if (pdirsta && get_relpath(cur.hgroot, cur.basedir, relbase))
+ if (pdirsta && GetRelPath(cur.strHgRoot, cur.strBaseDir, relbase))
{
ATLTRACE("%s relbase = '%s'\n", (LPCTSTR)dp, (LPCTSTR)relbase);
@@ -374,10 +374,10 @@ }
exit:
- cur.status = chOutStatus;
+ cur.chStatus = chOutStatus;
if (chOutStatus == 'P')
chOutStatus = 'M';
- cur.tickcount = ::GetTickCount();
+ cur.uTickCount = ::GetTickCount();
last = cur;
return 1;
}
|
@@ -56,15 +56,15 @@ }
-static char *RevHashString(const char revhash[HASH_LENGTH])
+static char *RevHashString(const char achRevHash[HASH_LENGTH])
{
unsigned ix;
static char rev_string[HASH_LENGTH * 2 + 1];
static char *hexval = "0123456789abcdef";
for (ix = 0; ix < HASH_LENGTH; ++ix)
{
- rev_string[ix * 2] = hexval[(revhash[ix] >> 4) & 0xf];
- rev_string[ix * 2 + 1] = hexval[revhash[ix] & 0xf];
+ rev_string[ix * 2] = hexval[(achRevHash[ix] >> 4) & 0xf];
+ rev_string[ix * 2 + 1] = hexval[achRevHash[ix] & 0xf];
}
rev_string[HASH_LENGTH * 2] = 0;
return rev_string;
|
Loading...