From 963b41ab7fd557d251d6dc58b15687ce3954a41b Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 9 Jul 2017 15:41:07 +0200 Subject: [PATCH] Fix CrLF issues Signed-off-by: Sven Strickroth --- src/TortoiseProc/GitTagCompareList.cpp | 596 ++++++++++++++++----------------- 1 file changed, 298 insertions(+), 298 deletions(-) diff --git a/src/TortoiseProc/GitTagCompareList.cpp b/src/TortoiseProc/GitTagCompareList.cpp index 663d1b62d..98da31d3f 100644 --- a/src/TortoiseProc/GitTagCompareList.cpp +++ b/src/TortoiseProc/GitTagCompareList.cpp @@ -1,98 +1,98 @@ -// TortoiseGit - a Windows shell extension for easy version control - -// Copyright (C) 2015-2017 - TortoiseGit - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// GitRefCompareList.cpp : implementation file -// -#include "stdafx.h" -#include "resource.h" -#include "Git.h" -#include "GitTagCompareList.h" -#include "GitRefCompareList.h" -#include "registry.h" -#include "UnicodeUtils.h" -#include "IconMenu.h" -#include "AppUtils.h" -#include "..\TortoiseShell\resource.h" -#include "LoglistCommonResource.h" -#include "SysProgressDlg.h" -#include "ProgressDlg.h" - -IMPLEMENT_DYNAMIC(CGitTagCompareList, CHintCtrl) - -BEGIN_MESSAGE_MAP(CGitTagCompareList, CHintCtrl) - ON_WM_CONTEXTMENU() -END_MESSAGE_MAP() - -BOOL CGitTagCompareList::m_bSortLogical = FALSE; - -enum IDGITRCL -{ - IDGITRCL_MYLOG = 1, - IDGITRCL_THEIRLOG, - IDGITRCL_COMPARE, - IDGITRCL_DELETELOCAL, - IDGITRCL_DELETEREMOTE, - IDGITRCL_PUSH, - IDGITRCL_FETCH, -}; - -enum IDGITRCLH -{ - IDGITRCLH_HIDEUNCHANGED = 1, -}; - -static bool SortPredicate(bool sortLogical, const CString& e1, const CString& e2) -{ - if (sortLogical) - return StrCmpLogicalW(e1, e2) < 0; - return e1.Compare(e2) < 0; -} - -CGitTagCompareList::CGitTagCompareList() - : CHintCtrl() - , colTag(0) - , colDiff(0) - , colMyHash(0) - , colMyMessage(0) - , colTheirHash(0) - , colTheirMessage(0) -{ - m_bSortLogical = !CRegDWORD(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoStrCmpLogical", 0, false, HKEY_CURRENT_USER); - if (m_bSortLogical) - m_bSortLogical = !CRegDWORD(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoStrCmpLogical", 0, false, HKEY_LOCAL_MACHINE); - m_bHideEqual = CRegDWORD(L"Software\\TortoiseGit\\TagCompareHideEqual", FALSE); -} - -void CGitTagCompareList::Init() -{ - int index = 0; - colTag = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_PROC_TAG))); - colDiff = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_STATUSLIST_COLSTATUS))); - colMyHash = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_LOCALHASH))); - colMyMessage = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_LOCALMESSAGE))); - colTheirHash = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_REMOTEHASH))); - colTheirMessage = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_REMOTEMESSAGE))); - - SetWindowTheme(m_hWnd, L"Explorer", nullptr); -} - -int CGitTagCompareList::Fill(const CString& remote, CString& err) -{ +// TortoiseGit - a Windows shell extension for easy version control + +// Copyright (C) 2015-2017 - TortoiseGit + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// GitRefCompareList.cpp : implementation file +// +#include "stdafx.h" +#include "resource.h" +#include "Git.h" +#include "GitTagCompareList.h" +#include "GitRefCompareList.h" +#include "registry.h" +#include "UnicodeUtils.h" +#include "IconMenu.h" +#include "AppUtils.h" +#include "..\TortoiseShell\resource.h" +#include "LoglistCommonResource.h" +#include "SysProgressDlg.h" +#include "ProgressDlg.h" + +IMPLEMENT_DYNAMIC(CGitTagCompareList, CHintCtrl) + +BEGIN_MESSAGE_MAP(CGitTagCompareList, CHintCtrl) + ON_WM_CONTEXTMENU() +END_MESSAGE_MAP() + +BOOL CGitTagCompareList::m_bSortLogical = FALSE; + +enum IDGITRCL +{ + IDGITRCL_MYLOG = 1, + IDGITRCL_THEIRLOG, + IDGITRCL_COMPARE, + IDGITRCL_DELETELOCAL, + IDGITRCL_DELETEREMOTE, + IDGITRCL_PUSH, + IDGITRCL_FETCH, +}; + +enum IDGITRCLH +{ + IDGITRCLH_HIDEUNCHANGED = 1, +}; + +static bool SortPredicate(bool sortLogical, const CString& e1, const CString& e2) +{ + if (sortLogical) + return StrCmpLogicalW(e1, e2) < 0; + return e1.Compare(e2) < 0; +} + +CGitTagCompareList::CGitTagCompareList() + : CHintCtrl() + , colTag(0) + , colDiff(0) + , colMyHash(0) + , colMyMessage(0) + , colTheirHash(0) + , colTheirMessage(0) +{ + m_bSortLogical = !CRegDWORD(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoStrCmpLogical", 0, false, HKEY_CURRENT_USER); + if (m_bSortLogical) + m_bSortLogical = !CRegDWORD(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoStrCmpLogical", 0, false, HKEY_LOCAL_MACHINE); + m_bHideEqual = CRegDWORD(L"Software\\TortoiseGit\\TagCompareHideEqual", FALSE); +} + +void CGitTagCompareList::Init() +{ + int index = 0; + colTag = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_PROC_TAG))); + colDiff = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_STATUSLIST_COLSTATUS))); + colMyHash = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_LOCALHASH))); + colMyMessage = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_LOCALMESSAGE))); + colTheirHash = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_REMOTEHASH))); + colTheirMessage = InsertColumn(index++, CString(MAKEINTRESOURCE(IDS_TAGCOMPARE_REMOTEMESSAGE))); + + SetWindowTheme(m_hWnd, L"Explorer", nullptr); +} + +int CGitTagCompareList::Fill(const CString& remote, CString& err) +{ m_remote = remote; m_TagList.clear(); DeleteAllItems(); @@ -201,164 +201,164 @@ int CGitTagCompareList::Fill(const CString& remote, CString& err) else ShowText(L"", true); - return 0; -} - -void CGitTagCompareList::AddEntry(git_repository* repo, const CString& tag, const CGitHash* myHash, const CGitHash* theirHash) -{ - TagEntry entry; - entry.name = tag; - if (myHash) - entry.myHash = *myHash; - if (theirHash) - entry.theirHash = *theirHash; - - CAutoCommit oldCommit; - if (myHash) - { - if (!git_commit_lookup(oldCommit.GetPointer(), repo, (const git_oid*)&myHash->m_hash)) - entry.myMessage = CGitRefCompareList::GetCommitMessage(oldCommit); - } - - CAutoCommit newCommit; - if (theirHash) - { - if (!git_commit_lookup(newCommit.GetPointer(), repo, (const git_oid*)&theirHash->m_hash)) - entry.theirMessage = CGitRefCompareList::GetCommitMessage(newCommit); - } - - if (myHash && theirHash) - { - if (*myHash == *theirHash) - entry.diffstate.LoadString(IDS_TAGCOMPARE_SAME); - else - entry.diffstate.LoadString(IDS_TAGCOMPARE_DIFFER); - } - else if (myHash) - entry.diffstate.LoadString(IDS_TAGCOMPARE_ONLYLOCAL); - else - entry.diffstate.LoadString(IDS_TAGCOMPARE_ONLYREMOTE); - m_TagList.emplace_back(entry); -} - -void CGitTagCompareList::Show() -{ - DeleteAllItems(); - int index = 0; - for (const auto& entry : m_TagList) - { - if (entry.myHash == entry.theirHash && m_bHideEqual) - continue; - - InsertItem(index, entry.name); - SetItemText(index, colDiff, entry.diffstate); - if (!entry.myHash.IsEmpty()) - SetItemText(index, colMyHash, entry.myHash.ToString().Left(g_Git.GetShortHASHLength())); - SetItemText(index, colMyMessage, entry.myMessage); - if (!entry.theirHash.IsEmpty()) - SetItemText(index, colTheirHash, entry.theirHash.ToString().Left(g_Git.GetShortHASHLength())); - SetItemText(index, colTheirMessage, entry.theirMessage); - index++; - } - for (int i = 0; i < GetHeaderCtrl()->GetItemCount(); ++i) - SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER); -} - -void CGitTagCompareList::OnContextMenu(CWnd *pWnd, CPoint point) -{ - if (pWnd == this) - { - OnContextMenuList(pWnd, point); - } - else if (pWnd == GetHeaderCtrl()) - { - OnContextMenuHeader(pWnd, point); - } -} - -void CGitTagCompareList::OnContextMenuList(CWnd * /*pWnd*/, CPoint point) -{ - int selIndex = GetSelectionMark(); - if (selIndex < 0 || (size_t)selIndex >= m_TagList.size()) - return; - - CString tag = m_TagList[selIndex].name; - tag.Replace(L"^{}", L""); - CGitHash myHash = m_TagList[selIndex].myHash; - CGitHash theirHash = m_TagList[selIndex].theirHash; - CIconMenu popup; - popup.CreatePopupMenu(); - CString logStr; - if (!myHash.IsEmpty()) - { - logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)myHash.ToString()); - popup.AppendMenuIcon(IDGITRCL_MYLOG, logStr, IDI_LOG); - } - - if (myHash != theirHash) - { - if (!theirHash.IsEmpty()) - { - logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)theirHash.ToString()); - popup.AppendMenuIcon(IDGITRCL_THEIRLOG, logStr, IDI_LOG); - } - - if (!myHash.IsEmpty() && !theirHash.IsEmpty()) - popup.AppendMenuIcon(IDGITRCL_COMPARE, IDS_LOG_POPUP_COMPAREWITHPREVIOUS, IDI_DIFF); - - popup.AppendMenu(MF_SEPARATOR); - - if (!theirHash.IsEmpty()) - popup.AppendMenuIcon(IDGITRCL_FETCH, IDS_MENUFETCH, IDI_UPDATE); - - if (!myHash.IsEmpty()) - popup.AppendMenuIcon(IDGITRCL_PUSH, IDS_MENUPUSH, IDI_COMMIT); - - } - popup.AppendMenu(MF_SEPARATOR); - - if (!myHash.IsEmpty()) - popup.AppendMenuIcon(IDGITRCL_DELETELOCAL, IDS_DELETE_LOCALTAG, IDI_DELETE); - - if (!theirHash.IsEmpty()) - popup.AppendMenuIcon(IDGITRCL_DELETEREMOTE, IDS_DELETE_REMOTETAG, IDI_DELETE); - - int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this); - switch (cmd) - { - case IDGITRCL_MYLOG: - case IDGITRCL_THEIRLOG: - { - CString sCmd; - sCmd.Format(L"/command:log /path:\"%s\" /endrev:\"%s\"", (LPCTSTR)g_Git.m_CurrentDir, cmd == IDGITRCL_MYLOG ? (LPCTSTR)myHash.ToString() : (LPCTSTR)theirHash.ToString()); - CAppUtils::RunTortoiseGitProc(sCmd); - break; - } - case IDGITRCL_COMPARE: - { - CString sCmd; - sCmd.Format(L"/command:showcompare /path:\"%s\" /revision1:\"%s\" /revision2:\"%s\"", (LPCTSTR)g_Git.m_CurrentDir, (LPCTSTR)myHash.ToString(), (LPCTSTR)theirHash.ToString()); - if (!!(GetAsyncKeyState(VK_SHIFT) & 0x8000)) - sCmd += L" /alternative"; - CAppUtils::RunTortoiseGitProc(sCmd); - break; - } - case IDGITRCL_DELETELOCAL: - { + return 0; +} + +void CGitTagCompareList::AddEntry(git_repository* repo, const CString& tag, const CGitHash* myHash, const CGitHash* theirHash) +{ + TagEntry entry; + entry.name = tag; + if (myHash) + entry.myHash = *myHash; + if (theirHash) + entry.theirHash = *theirHash; + + CAutoCommit oldCommit; + if (myHash) + { + if (!git_commit_lookup(oldCommit.GetPointer(), repo, (const git_oid*)&myHash->m_hash)) + entry.myMessage = CGitRefCompareList::GetCommitMessage(oldCommit); + } + + CAutoCommit newCommit; + if (theirHash) + { + if (!git_commit_lookup(newCommit.GetPointer(), repo, (const git_oid*)&theirHash->m_hash)) + entry.theirMessage = CGitRefCompareList::GetCommitMessage(newCommit); + } + + if (myHash && theirHash) + { + if (*myHash == *theirHash) + entry.diffstate.LoadString(IDS_TAGCOMPARE_SAME); + else + entry.diffstate.LoadString(IDS_TAGCOMPARE_DIFFER); + } + else if (myHash) + entry.diffstate.LoadString(IDS_TAGCOMPARE_ONLYLOCAL); + else + entry.diffstate.LoadString(IDS_TAGCOMPARE_ONLYREMOTE); + m_TagList.emplace_back(entry); +} + +void CGitTagCompareList::Show() +{ + DeleteAllItems(); + int index = 0; + for (const auto& entry : m_TagList) + { + if (entry.myHash == entry.theirHash && m_bHideEqual) + continue; + + InsertItem(index, entry.name); + SetItemText(index, colDiff, entry.diffstate); + if (!entry.myHash.IsEmpty()) + SetItemText(index, colMyHash, entry.myHash.ToString().Left(g_Git.GetShortHASHLength())); + SetItemText(index, colMyMessage, entry.myMessage); + if (!entry.theirHash.IsEmpty()) + SetItemText(index, colTheirHash, entry.theirHash.ToString().Left(g_Git.GetShortHASHLength())); + SetItemText(index, colTheirMessage, entry.theirMessage); + index++; + } + for (int i = 0; i < GetHeaderCtrl()->GetItemCount(); ++i) + SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER); +} + +void CGitTagCompareList::OnContextMenu(CWnd *pWnd, CPoint point) +{ + if (pWnd == this) + { + OnContextMenuList(pWnd, point); + } + else if (pWnd == GetHeaderCtrl()) + { + OnContextMenuHeader(pWnd, point); + } +} + +void CGitTagCompareList::OnContextMenuList(CWnd * /*pWnd*/, CPoint point) +{ + int selIndex = GetSelectionMark(); + if (selIndex < 0 || (size_t)selIndex >= m_TagList.size()) + return; + + CString tag = m_TagList[selIndex].name; + tag.Replace(L"^{}", L""); + CGitHash myHash = m_TagList[selIndex].myHash; + CGitHash theirHash = m_TagList[selIndex].theirHash; + CIconMenu popup; + popup.CreatePopupMenu(); + CString logStr; + if (!myHash.IsEmpty()) + { + logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)myHash.ToString()); + popup.AppendMenuIcon(IDGITRCL_MYLOG, logStr, IDI_LOG); + } + + if (myHash != theirHash) + { + if (!theirHash.IsEmpty()) + { + logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)theirHash.ToString()); + popup.AppendMenuIcon(IDGITRCL_THEIRLOG, logStr, IDI_LOG); + } + + if (!myHash.IsEmpty() && !theirHash.IsEmpty()) + popup.AppendMenuIcon(IDGITRCL_COMPARE, IDS_LOG_POPUP_COMPAREWITHPREVIOUS, IDI_DIFF); + + popup.AppendMenu(MF_SEPARATOR); + + if (!theirHash.IsEmpty()) + popup.AppendMenuIcon(IDGITRCL_FETCH, IDS_MENUFETCH, IDI_UPDATE); + + if (!myHash.IsEmpty()) + popup.AppendMenuIcon(IDGITRCL_PUSH, IDS_MENUPUSH, IDI_COMMIT); + + } + popup.AppendMenu(MF_SEPARATOR); + + if (!myHash.IsEmpty()) + popup.AppendMenuIcon(IDGITRCL_DELETELOCAL, IDS_DELETE_LOCALTAG, IDI_DELETE); + + if (!theirHash.IsEmpty()) + popup.AppendMenuIcon(IDGITRCL_DELETEREMOTE, IDS_DELETE_REMOTETAG, IDI_DELETE); + + int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this); + switch (cmd) + { + case IDGITRCL_MYLOG: + case IDGITRCL_THEIRLOG: + { + CString sCmd; + sCmd.Format(L"/command:log /path:\"%s\" /endrev:\"%s\"", (LPCTSTR)g_Git.m_CurrentDir, cmd == IDGITRCL_MYLOG ? (LPCTSTR)myHash.ToString() : (LPCTSTR)theirHash.ToString()); + CAppUtils::RunTortoiseGitProc(sCmd); + break; + } + case IDGITRCL_COMPARE: + { + CString sCmd; + sCmd.Format(L"/command:showcompare /path:\"%s\" /revision1:\"%s\" /revision2:\"%s\"", (LPCTSTR)g_Git.m_CurrentDir, (LPCTSTR)myHash.ToString(), (LPCTSTR)theirHash.ToString()); + if (!!(GetAsyncKeyState(VK_SHIFT) & 0x8000)) + sCmd += L" /alternative"; + CAppUtils::RunTortoiseGitProc(sCmd); + break; + } + case IDGITRCL_DELETELOCAL: + { CString csMessage; csMessage.Format(IDS_PROC_DELETEBRANCHTAG, (LPCTSTR)tag); - if (MessageBox(csMessage, L"TortoiseGit", MB_YESNO | MB_ICONQUESTION) != IDYES) - return; - - g_Git.DeleteRef(L"refs/tags/" + tag); + if (MessageBox(csMessage, L"TortoiseGit", MB_YESNO | MB_ICONQUESTION) != IDYES) + return; + + g_Git.DeleteRef(L"refs/tags/" + tag); CString err; if (Fill(m_remote, err)) - MessageBox(err, L"TortoiseGit", MB_ICONERROR); - break; - } - case IDGITRCL_DELETEREMOTE: - { + MessageBox(err, L"TortoiseGit", MB_ICONERROR); + break; + } + case IDGITRCL_DELETEREMOTE: + { CString csMessage; csMessage.Format(IDS_PROC_DELETEBRANCHTAG, (LPCTSTR)tag); if (MessageBox(csMessage, L"TortoiseGit", MB_YESNO | MB_ICONQUESTION) != IDYES) @@ -386,57 +386,57 @@ void CGitTagCompareList::OnContextMenuList(CWnd * /*pWnd*/, CPoint point) if (ret) MessageBox(err, L"TortoiseGit", MB_ICONERROR); - BringWindowToTop(); - break; - } - case IDGITRCL_PUSH: - { - CProgressDlg dlg; - dlg.m_GitCmd.Format(L"git.exe push --force \"%s\" refs/tags/%s", (LPCTSTR)m_remote, (LPCTSTR)tag); - dlg.DoModal(); - + BringWindowToTop(); + break; + } + case IDGITRCL_PUSH: + { + CProgressDlg dlg; + dlg.m_GitCmd.Format(L"git.exe push --force \"%s\" refs/tags/%s", (LPCTSTR)m_remote, (LPCTSTR)tag); + dlg.DoModal(); + CString err; if (Fill(m_remote, err)) - MessageBox(err, L"TortoiseGit", MB_ICONERROR); - - break; - } - case IDGITRCL_FETCH: - { - CProgressDlg dlg; - dlg.m_GitCmd.Format(L"git.exe fetch \"%s\" refs/tags/%s:refs/tags/%s", (LPCTSTR)m_remote, (LPCTSTR)tag, (LPCTSTR)tag); - dlg.DoModal(); - + MessageBox(err, L"TortoiseGit", MB_ICONERROR); + + break; + } + case IDGITRCL_FETCH: + { + CProgressDlg dlg; + dlg.m_GitCmd.Format(L"git.exe fetch \"%s\" refs/tags/%s:refs/tags/%s", (LPCTSTR)m_remote, (LPCTSTR)tag, (LPCTSTR)tag); + dlg.DoModal(); + CString err; if (Fill(m_remote, err)) - MessageBox(err, L"TortoiseGit", MB_ICONERROR); - - break; - } - } -} - -static void AppendMenuChecked(CMenu &menu, UINT nTextID, UINT_PTR nItemID, BOOL checked = FALSE, BOOL enabled = TRUE) -{ - CString text; - text.LoadString(nTextID); - menu.AppendMenu(MF_STRING | (enabled ? MF_ENABLED : MF_DISABLED) | (checked ? MF_CHECKED : MF_UNCHECKED), nItemID, text); -} - -void CGitTagCompareList::OnContextMenuHeader(CWnd * /*pWnd*/, CPoint point) -{ - CMenu popup; - if (popup.CreatePopupMenu()) - { - AppendMenuChecked(popup, IDS_HIDEUNCHANGED, IDGITRCLH_HIDEUNCHANGED, m_bHideEqual); - - int selection = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this); - switch (selection) - { - case IDGITRCLH_HIDEUNCHANGED: - m_bHideEqual = !m_bHideEqual; - Show(); - break; - } - } -} + MessageBox(err, L"TortoiseGit", MB_ICONERROR); + + break; + } + } +} + +static void AppendMenuChecked(CMenu &menu, UINT nTextID, UINT_PTR nItemID, BOOL checked = FALSE, BOOL enabled = TRUE) +{ + CString text; + text.LoadString(nTextID); + menu.AppendMenu(MF_STRING | (enabled ? MF_ENABLED : MF_DISABLED) | (checked ? MF_CHECKED : MF_UNCHECKED), nItemID, text); +} + +void CGitTagCompareList::OnContextMenuHeader(CWnd * /*pWnd*/, CPoint point) +{ + CMenu popup; + if (popup.CreatePopupMenu()) + { + AppendMenuChecked(popup, IDS_HIDEUNCHANGED, IDGITRCLH_HIDEUNCHANGED, m_bHideEqual); + + int selection = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this); + switch (selection) + { + case IDGITRCLH_HIDEUNCHANGED: + m_bHideEqual = !m_bHideEqual; + Show(); + break; + } + } +} -- 2.11.4.GIT