From e9b1326c34bada9712e4d577c98e6a1c3f6eeee1 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 13 Jun 2016 22:29:42 +0200 Subject: [PATCH] Fixed issue #2783: "Delete and add to ignore list" does not work when more than 16 files are selected If more than 15 items are selected, we won't know about that in QueryContextMenu(). So don't show the number of items in the context menu text in that situation but only "multiple". Based on TortoiseSVN rev. 27335. Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 16 +++++++++++ src/Changelog.txt | 1 + src/TortoiseShell/ContextMenu.cpp | 54 +++++++++++++++++++++++++++++++------- src/TortoiseShell/resource.h | 4 +++ src/TortoiseShell/resourceshell.rc | 5 ++++ 5 files changed, 71 insertions(+), 9 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index 729708375..b9b6fb6fb 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -747,6 +747,10 @@ msgstr "" msgid "&Ignore %d items by name" msgstr "" +#. Resource IDs: (IDS_MENUIGNOREMULTIPLE2) +msgid "&Ignore multiple items by name" +msgstr "" + #. Resource IDs: (ID_VIEW_IGNORE_WHITESPACE - Menu) msgid "&Ignore whitespace" msgstr "" @@ -3496,6 +3500,10 @@ msgstr "" msgid "Delete and &ignore %d items by name" msgstr "" +#. Resource IDs: (IDS_MENUDELETEIGNOREMULTIPLE2) +msgid "Delete and &ignore multiple items by name" +msgstr "" + #. Resource IDs: (IDS_MENUDELETEIGNORE) msgid "Delete and add to &ignore list" msgstr "" @@ -3505,6 +3513,10 @@ msgstr "" msgid "Delete and ignore %d items by &extension" msgstr "" +#. Resource IDs: (IDS_MENUDELETEIGNOREMULTIPLEMASK2) +msgid "Delete and ignore multiple items by &extension" +msgstr "" + #. Resource IDs: (IDS_PROC_BROWSEREFS_DELETEBRANCH) msgid "Delete branch" msgstr "" @@ -5571,6 +5583,10 @@ msgstr "" msgid "Ignore line &endings (recommended)" msgstr "" +#. Resource IDs: (IDS_MENUIGNOREMULTIPLEMASK2) +msgid "Ignore multiple items by &extension" +msgstr "" + #. Resource IDs: (IDS_DIFFOPTION_IGNORESPACEATEOL) msgid "Ignore space at EOL" msgstr "" diff --git a/src/Changelog.txt b/src/Changelog.txt index 799c9c74b..5bcfbc2f9 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -10,6 +10,7 @@ Released: unreleased * Fixed issue #2767: The online help of Settings->Git->Remote should explain the "Push Default" checkbox * Fixed issue #2772: Comparing with added file might result in comparison with empty file * Fixed issue #2774: Pull dialog with Russian LangPack has three defficiencies + * Fixed issue #2783: "Delete and add to ignore list" does not work when more than 16 files are selected = Release 2.1.0 = Released: 2016-03-26 diff --git a/src/TortoiseShell/ContextMenu.cpp b/src/TortoiseShell/ContextMenu.cpp index e3cc75ac7..0562cf68f 100644 --- a/src/TortoiseShell/ContextMenu.cpp +++ b/src/TortoiseShell/ContextMenu.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2003-2012, 2014-2015 - TortoiseSVN +// Copyright (C) 2003-2012, 2014-2016 - TortoiseSVN // Copyright (C) 2008-2016 - TortoiseGit // This program is free software; you can redistribute it and/or @@ -2089,10 +2089,22 @@ bool CShellExt::InsertIgnoreSubmenus(UINT &idCmd, UINT idCmdFirst, HMENU hMenu, } else { + // note: as of Windows 7, the shell does not pass more than 16 items from a multiselection + // in the Initialize() call before the QueryContextMenu() call. Which means even if the user + // has selected more than 16 files, we won't know about that here. + // Note: after QueryContextMenu() exits, Initialize() is called again with all selected files. if (itemStates & ITEMIS_INGIT) { - MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLE); - _stprintf_s(ignorepath, MAX_PATH, stringtablebuffer, files_.size()); + if (files_.size() >= 16) + { + MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLE2); + wcscpy_s(ignorepath, stringtablebuffer); + } + else + { + MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLE); + swprintf_s(ignorepath, stringtablebuffer, files_.size()); + } InsertMenu(ignoresubmenu, indexignoresub++, MF_BYPOSITION | MF_STRING , idCmd, ignorepath); tstring verb = tstring(ignorepath); myVerbsMap[verb] = idCmd - idCmdFirst; @@ -2102,8 +2114,16 @@ bool CShellExt::InsertIgnoreSubmenus(UINT &idCmd, UINT idCmdFirst, HMENU hMenu, myIDMap[idCmd - idCmdFirst] = ShellMenuDeleteIgnore; myIDMap[idCmd++] = ShellMenuDeleteIgnore; - MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLEMASK); - _stprintf_s(ignorepath, MAX_PATH, stringtablebuffer, files_.size()); + if (files_.size() >= 16) + { + MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLEMASK2); + wcscpy_s(ignorepath, stringtablebuffer); + } + else + { + MAKESTRING(IDS_MENUDELETEIGNOREMULTIPLEMASK); + swprintf_s(ignorepath, stringtablebuffer, files_.size()); + } InsertMenu(ignoresubmenu, indexignoresub++, MF_BYPOSITION | MF_STRING , idCmd, ignorepath); verb = tstring(ignorepath); myVerbsMap[verb] = idCmd - idCmdFirst; @@ -2115,8 +2135,16 @@ bool CShellExt::InsertIgnoreSubmenus(UINT &idCmd, UINT idCmdFirst, HMENU hMenu, } else { - MAKESTRING(IDS_MENUIGNOREMULTIPLE); - _stprintf_s(ignorepath, MAX_PATH, stringtablebuffer, files_.size()); + if (files_.size() >= 16) + { + MAKESTRING(IDS_MENUIGNOREMULTIPLE2); + wcscpy_s(ignorepath, stringtablebuffer); + } + else + { + MAKESTRING(IDS_MENUIGNOREMULTIPLE); + swprintf_s(ignorepath, stringtablebuffer, files_.size()); + } InsertMenu(ignoresubmenu, indexignoresub++, MF_BYPOSITION | MF_STRING , idCmd, ignorepath); tstring verb = tstring(ignorepath); myVerbsMap[verb] = idCmd - idCmdFirst; @@ -2126,8 +2154,16 @@ bool CShellExt::InsertIgnoreSubmenus(UINT &idCmd, UINT idCmdFirst, HMENU hMenu, myIDMap[idCmd - idCmdFirst] = ShellMenuIgnore; myIDMap[idCmd++] = ShellMenuIgnore; - MAKESTRING(IDS_MENUIGNOREMULTIPLEMASK); - _stprintf_s(ignorepath, MAX_PATH, stringtablebuffer, files_.size()); + if (files_.size() >= 16) + { + MAKESTRING(IDS_MENUIGNOREMULTIPLEMASK2); + wcscpy_s(ignorepath, stringtablebuffer); + } + else + { + MAKESTRING(IDS_MENUIGNOREMULTIPLEMASK); + swprintf_s(ignorepath, stringtablebuffer, files_.size()); + } InsertMenu(ignoresubmenu, indexignoresub++, MF_BYPOSITION | MF_STRING , idCmd, ignorepath); verb = tstring(ignorepath); myVerbsMap[verb] = idCmd - idCmdFirst; diff --git a/src/TortoiseShell/resource.h b/src/TortoiseShell/resource.h index 05264d159..251fd3b49 100644 --- a/src/TortoiseShell/resource.h +++ b/src/TortoiseShell/resource.h @@ -147,6 +147,10 @@ #define IDS_MENUDESCREMOVEKEEP 272 #define IDS_YES 273 #define IDS_NO 274 +#define IDS_MENUIGNOREMULTIPLEMASK2 282 +#define IDS_MENUIGNOREMULTIPLE2 283 +#define IDS_MENUDELETEIGNOREMULTIPLE2 284 +#define IDS_MENUDELETEIGNOREMULTIPLEMASK2 285 #define IDS_git_DEPTH_INFINITE 300 #define IDS_git_DEPTH_IMMEDIATE 301 #define IDS_git_DEPTH_FILES 302 diff --git a/src/TortoiseShell/resourceshell.rc b/src/TortoiseShell/resourceshell.rc index af5e15aa7..49c1e414f 100644 --- a/src/TortoiseShell/resourceshell.rc +++ b/src/TortoiseShell/resourceshell.rc @@ -422,6 +422,11 @@ BEGIN IDS_MENUDESCREMOVEKEEP "Deletes files/folders from version control but keeps the file" IDS_YES "yes" IDS_NO "no" + IDS_MENUIGNOREMULTIPLEMASK2 "Ignore multiple items by &extension" + IDS_MENUIGNOREMULTIPLE2 "&Ignore multiple items by name" + IDS_MENUDELETEIGNOREMULTIPLE2 "Delete and &ignore multiple items by name" + IDS_MENUDELETEIGNOREMULTIPLEMASK2 + "Delete and ignore multiple items by &extension" END STRINGTABLE -- 2.11.4.GIT