Skip to content

Commit

Permalink
Add a button to ignore changes in comments.
Browse files Browse the repository at this point in the history
Update issue #5
  • Loading branch information
steveking committed Oct 31, 2013
1 parent 02b5f31 commit cffe3a5
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Resources/TortoiseMergeENG.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ END

STRINGTABLE
BEGIN
ID_VIEW_IGNORECOMMENTS "Remove all comments before doing the diff so changes inside comments don't show as different"
ID_LOGOBUTTON "TortoiseMerge"
END

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/ribbon.mfcribbon-ms

Large diffs are not rendered by default.

Binary file added src/Resources/ribbon/Comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Resources/ribbon/ribbonimagelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ Help.png
Settings.png
SaveAs.png
EditEnabled.png
Comment.png
Binary file modified src/Resources/ribbon/ribbonlarge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Resources/ribbon/ribbonlargehdpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Resources/ribbon/ribbonsmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Resources/ribbon/ribbonsmallhdpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 34 additions & 3 deletions src/TortoiseMerge/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
ON_COMMAND(ID_INDICATOR_RIGHTVIEW, &CMainFrame::OnIndicatorRightview)
ON_COMMAND(ID_INDICATOR_BOTTOMVIEW, &CMainFrame::OnIndicatorBottomview)
ON_WM_TIMER()
ON_COMMAND(ID_VIEW_IGNORECOMMENTS, &CMainFrame::OnViewIgnorecomments)
ON_UPDATE_COMMAND_UI(ID_VIEW_IGNORECOMMENTS, &CMainFrame::OnUpdateViewIgnorecomments)
END_MESSAGE_MAP()

static UINT indicators[] =
Expand Down Expand Up @@ -181,6 +183,7 @@ CMainFrame::CMainFrame()
, m_regInlineDiff(L"Software\\TortoiseMerge\\DisplayBinDiff", TRUE)
, m_regUseRibbons(L"Software\\TortoiseMerge\\UseRibbons", TRUE)
, m_regUseTaskDialog(L"Software\\TortoiseMerge\\UseTaskDialog", TRUE)
, m_regIgnoreComments(_T("Software\\TortoiseMerge\\IgnoreComments"), FALSE)
{
m_bOneWay = (0 != ((DWORD)m_regOneWay));
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2005);
Expand Down Expand Up @@ -2925,9 +2928,6 @@ void CMainFrame::LoadIgnoreCommentData()
static bool bLoaded = false;
if (bLoaded)
return;
CRegDWORD regIgnoreComments = CRegDWORD(_T("Software\\TortoiseMerge\\IgnoreComments"), FALSE);
if (DWORD(regIgnoreComments) == FALSE)
return;
CString sPath = CPathUtils::GetAppDataDirectory() + L"IgnoreComments";
if (!PathFileExists(sPath))
{
Expand Down Expand Up @@ -3000,3 +3000,34 @@ void CMainFrame::LoadIgnoreCommentData()
}
bLoaded = true;
}

void CMainFrame::OnViewIgnorecomments()
{
if (CheckForSave(CHFSR_OPTIONS)==IDCANCEL)
return;
m_regIgnoreComments = !DWORD(m_regIgnoreComments);
LoadViews(-1);
}

void CMainFrame::OnUpdateViewIgnorecomments(CCmdUI *pCmdUI)
{
// only enable if we have comments defined for this file extension
CString sExt = CPathUtils::GetFileExtFromPath(m_Data.m_baseFile.GetFilename()).MakeLower();
sExt.TrimLeft(L".");
auto sC = m_IgnoreCommentsMap.find(sExt);
if (sC == m_IgnoreCommentsMap.end())
{
sExt = CPathUtils::GetFileExtFromPath(m_Data.m_yourFile.GetFilename()).MakeLower();
sExt.TrimLeft(L".");
sC = m_IgnoreCommentsMap.find(sExt);
if (sC == m_IgnoreCommentsMap.end())
{
sExt = CPathUtils::GetFileExtFromPath(m_Data.m_theirFile.GetFilename()).MakeLower();
sExt.TrimLeft(L".");
sC = m_IgnoreCommentsMap.find(sExt);
}
}
pCmdUI->Enable(sC != m_IgnoreCommentsMap.end());

pCmdUI->SetCheck(DWORD(m_regIgnoreComments) != 0);
}
3 changes: 3 additions & 0 deletions src/TortoiseMerge/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class CMainFrame : public CFrameWndEx, public CPatchFilesDlgCallBack //CFrameWnd
afx_msg void OnIndicatorRightview();
afx_msg void OnIndicatorBottomview();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnViewIgnorecomments();
afx_msg void OnUpdateViewIgnorecomments(CCmdUI *pCmdUI);

DECLARE_MESSAGE_MAP()
protected:
Expand Down Expand Up @@ -227,6 +229,7 @@ class CMainFrame : public CFrameWndEx, public CPatchFilesDlgCallBack //CFrameWnd
CRegDWORD m_regInlineDiff;
CRegDWORD m_regUseRibbons;
CRegDWORD m_regUseTaskDialog;
CRegDWORD m_regIgnoreComments;

std::map<CString, std::tuple<CString, CString, CString>> m_IgnoreCommentsMap;
public:
Expand Down
5 changes: 5 additions & 0 deletions src/TortoiseMerge/TortoiseMerge.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,9 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="\Development\SVN\TortoiseSVN\src\Resources\TortoiseMergeENG.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
1 change: 1 addition & 0 deletions src/TortoiseMerge/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
#define ID_EDIT_GOTOLINE 32893
#define ID_EDIT_GOTOLINE32895 32895
#define ID_BUTTON2 32896
#define ID_VIEW_IGNORECOMMENTS 32896
#define ID_LOGOBUTTON 32897
#define ID_USEBLOCKS 32914
#define ID_BUTTON20 32916
Expand Down

0 comments on commit cffe3a5

Please sign in to comment.