Changeset a3f4dec502da…
Parent a3769970ee05…
by
Changes to 2 files · Browse files at a3f4dec502da Showing diff from parent a3769970ee05 Diff from another changeset...
|
@@ -123,25 +123,73 @@ // "iconfile.ico", 0 },
};
-static const char* const RepoNoFilesMenu =
- "commit status shelve vdiff sep"
- " add revert rename forget remove sep"
- " workbench update grep sep kiln sep"
- " synch serve clone init thgstatus sep"
- " hgignore guess sep"
- " shellconf repoconf userconf sep"
- " about";
+static const LPCTSTR RepoNoFilesMenu[] =
+{
+ "commit",
+ "status",
+ "shelve",
+ "vdiff",
+ NULL,
+ "add",
+ "revert",
+ "rename",
+ "forget",
+ "remove",
+ NULL,
+ "workbench",
+ "update",
+ "grep",
+ NULL,
+ "kiln",
+ NULL,
+ "synch",
+ "serve",
+ "clone",
+ "init"
+ "thgstatus",
+ NULL,
+ "hgignore",
+ "guess",
+ NULL,
+ "shellconf",
+ "repoconf",
+ "userconf",
+ NULL,
+ "about",
+};
-static const char* const RepoFilesMenu =
- "commit status vdiff sep"
- " add revert rename forget remove sep"
- " log annotate sep kilnfiles sep"
- " about";
+static const LPCTSTR RepoFilesMenu[] =
+{
+ "commit",
+ "status",
+ "vdiff",
+ NULL,
+ "add",
+ "revert",
+ "rename",
+ "forget",
+ "remove",
+ NULL,
+ "log",
+ "annotate",
+ NULL,
+ "kilnfiles",
+ NULL,
+ "about",
+};
-static const char* const NoRepoMenu =
- "clone init shellconf userconf thgstatus sep"
- " workbench sep"
- " about";
+static const LPCTSTR NoRepoMenu[] =
+{
+ "clone",
+ "init",
+ "shellconf",
+ "userconf",
+ "thgstatus",
+ NULL,
+ "workbench",
+ NULL,
+ "about",
+};
static const LPCTSTR DefaultPromotedString = "commit,workbench,kiln,kilnfiles";
@@ -487,27 +535,33 @@ bIsHgRepo, bFileMenu);
/* We have three menu types: files-selected, no-files-selected, no-repo */
- LPCTSTR lpszEntries = 0;
+ const LPCTSTR* ppszEntries = NULL;
+ int nCount;
if (bIsHgRepo)
{
if (bFileMenu)
- lpszEntries = RepoFilesMenu;
+ {
+ ppszEntries = RepoFilesMenu;
+ nCount = sizeof(RepoFilesMenu) / sizeof(LPCTSTR);
+ }
else
- lpszEntries = RepoNoFilesMenu;
+ {
+ ppszEntries = RepoNoFilesMenu;
+ nCount = sizeof(RepoNoFilesMenu) / sizeof(LPCTSTR);
+ }
}
else
- lpszEntries = NoRepoMenu;
+ {
+ ppszEntries = NoRepoMenu;
+ nCount = sizeof(NoRepoMenu) / sizeof(LPCTSTR);
+ }
// start building TortoiseHg menus and submenus
::InsertMenu(hMenu, indexMenu++, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
- CAtlList<CString> listEntries;
- Tokenize(lpszEntries, listEntries, " ");
-
- POSITION position = listEntries.GetHeadPosition();
- while (position != NULL)
+ for (int i = 0; i < nCount; i++)
{
- CString strName = listEntries.GetNext(position);
+ CString strName = ppszEntries[i];
if (listPromoted.Find(strName) != NULL)
{
if ((strName == "kiln" || strName == "kilnfiles") && !KilnGetUrl(strCwd))
@@ -521,11 +575,9 @@ {
UINT indexSubMenu = 0;
bool bIsSeparator = true;
- POSITION position = listEntries.GetHeadPosition();
- while (position != NULL)
+ for (int i = 0; i < nCount; i++)
{
- CString strName = listEntries.GetNext(position);
- if (strName == "sep")
+ if (ppszEntries[i] == NULL)
{
if (!bIsSeparator)
{
@@ -536,6 +588,7 @@ }
else
{
+ CString strName = ppszEntries[i];
if (listPromoted.Find(strName) == NULL)
{
if ((strName == "kiln" || strName == "kilnfiles") && !KilnGetUrl(strCwd))
|
@@ -38,8 +38,11 @@ // "iconfile.ico", 0 },
};
-static const char* const DropMenu =
- "drag_move drag_copy";
+static const LPCTSTR DropMenu[] =
+{
+ "drag_move",
+ "drag_copy",
+};
#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
@@ -62,17 +65,9 @@
InitMenuMaps(CDndMenuDescList, sizeof(CDndMenuDescList) / sizeof(CMenuDescription));
- LPCTSTR lpszEntries = DropMenu;
- CAtlList<CString> listEntries;
- Tokenize(lpszEntries, listEntries, " ");
-
- POSITION position = listEntries.GetHeadPosition();
- while (position != NULL)
+ for (int i = 0; i < sizeof(DropMenu) / sizeof(LPCTSTR); i++)
{
- CString strName = listEntries.GetNext(position);
- if (strName.IsEmpty())
- break;
- InsertMenuItemByName(hMenu, strName, indexMenu++, idCmd++, idCmdFirst, L"");
+ InsertMenuItemByName(hMenu, DropMenu[i], indexMenu++, idCmd++, idCmdFirst, L"");
}
// separator
|
Loading...