Index: src/TortoiseProc/FileDiffDlg.h =================================================================== --- src/TortoiseProc/FileDiffDlg.h (revision 10930) +++ src/TortoiseProc/FileDiffDlg.h (working copy) @@ -62,6 +62,7 @@ protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void OnOK(); virtual void OnCancel(); virtual BOOL OnInitDialog(); virtual BOOL PreTranslateMessage(MSG* pMsg); Index: src/TortoiseProc/LogDlg.cpp =================================================================== --- src/TortoiseProc/LogDlg.cpp (revision 10930) +++ src/TortoiseProc/LogDlg.cpp (working copy) @@ -158,6 +158,7 @@ ON_REGISTERED_MESSAGE(m_FindDialogMessage, OnFindDialogMessage) ON_BN_CLICKED(IDC_GETALL, OnBnClickedGetall) ON_NOTIFY(NM_DBLCLK, IDC_LOGMSG, OnNMDblclkChangedFileList) + ON_NOTIFY(NM_DBLCLK, IDC_LOGLIST, OnNMDblclkLoglist) ON_WM_CONTEXTMENU() ON_WM_SETCURSOR() ON_BN_CLICKED(IDHELP, OnBnClickedHelp) @@ -1410,6 +1411,21 @@ { // since the log dialog is also used to select revisions for other // dialogs, we have to do some work before closing this dialog + + if (GetFocus() == GetDlgItem(IDC_LOGLIST)) + { + // Return pressed in log list. Do the same as for doubleclick + DiffSelectedRevWithPrevious(); + return; + } + + if (GetFocus() == GetDlgItem(IDC_LOGMSG)) + { + // Return pressed in file list. Do the same as for doubleclick + DiffSelectedFile(); + return; + } + if (GetFocus() != GetDlgItem(IDOK)) return; // if the "OK" button doesn't have the focus, do nothing: this prevents closing the dialog when pressing enter @@ -1495,6 +1511,12 @@ { // a doubleclick on an entry in the changed-files list has happened *pResult = 0; + + DiffSelectedFile(); +} + +void CLogDlg::DiffSelectedFile() +{ if (m_bThreadRunning) return; UpdateLogInfoLabel(); @@ -1519,7 +1541,7 @@ } } rev2--; - // now we have both revisions selected in the log list, so we can do a diff of the doubleclicked + // now we have both revisions selected in the log list, so we can do a diff of the selected // entry in the changed files list with these two revisions. DoDiffFromLog(selIndex, rev1, rev2, false, false); } @@ -1599,6 +1621,56 @@ } } + +void CLogDlg::OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult) +{ + // a doubleclick on an entry in the revision list has happened + *pResult = 0; + + DiffSelectedRevWithPrevious(); +} + +void CLogDlg::DiffSelectedRevWithPrevious() +{ + if (m_bThreadRunning) + return; + UpdateLogInfoLabel(); + int selIndex = m_LogList.GetSelectionMark(); + if (selIndex < 0) + return; + int selCount = m_LogList.GetSelectedCount(); + if (selCount != 1) + return; + int nChanged = m_ChangedFileListCtrl.GetItemCount(); + + // Find selected entry in the log list + POSITION pos = m_LogList.GetFirstSelectedItemPosition(); + PLOGENTRYDATA pLogEntry = reinterpret_cast(m_arShownList.GetAt(m_LogList.GetNextSelectedItem(pos))); + long rev1 = pLogEntry->Rev; + long rev2 = rev1-1; + CString pathURL = GetURLFromPath(m_path); + + if (m_path.IsDirectory() && nChanged == 1) { + // We're looking at the log of a directory and only one file was changed in the revision + // Do diff on that file instead of whole directory + DoDiffFromLog(0, rev1, rev2, false, false); + + } else { + + m_bCancelled = FALSE; + DialogEnableWindow(IDOK, FALSE); + SetPromptApp(&theApp); + theApp.DoWaitCursor(1); + + SVNDiff diff(this, m_hWnd, true); + diff.SetHEADPeg(m_LogRevision); + diff.ShowCompare(CTSVNPath(pathURL), rev2, CTSVNPath(pathURL), rev1); + + theApp.DoWaitCursor(-1); + EnableOKButton(); + } +} + void CLogDlg::DoDiffFromLog(int selIndex, svn_revnum_t rev1, svn_revnum_t rev2, bool blame, bool unified) { DialogEnableWindow(IDOK, FALSE); Index: src/TortoiseProc/FileDiffDlg.cpp =================================================================== --- src/TortoiseProc/FileDiffDlg.cpp (revision 10930) +++ src/TortoiseProc/FileDiffDlg.cpp (working copy) @@ -169,6 +169,9 @@ InterlockedExchange(&m_bThreadRunning, FALSE); CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); } + + // Start with focus on file list + GetDlgItem(IDC_FILELIST)->SetFocus(); return TRUE; } @@ -195,6 +198,7 @@ bool bSuccess = true; RefreshCursor(); m_cFileList.ShowText(CString(MAKEINTRESOURCE(IDS_FILEDIFF_WAIT))); + m_arFileList.clear(); if (m_bDoPegDiff) { bSuccess = DiffSummarizePeg(m_path1, m_peg, m_rev1, m_rev2, m_depth, m_bIgnoreancestry); @@ -214,6 +218,12 @@ m_cFilter.GetWindowText(sFilterText); m_cFileList.SetRedraw(false); Filter(sFilterText); + if (! m_arFileList.empty()) + { + // Highlight first entry in file list + m_cFileList.SetSelectionMark(0); + m_cFileList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); + } int mincol = 0; int maxcol = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1; @@ -782,6 +792,25 @@ return __super::PreTranslateMessage(pMsg); } +void CFileDiffDlg::OnOK() +{ + if (GetFocus() == GetDlgItem(IDC_FILELIST)) + { + // Return pressed in file list. Shiw diff, as for doubleclick + int selIndex = m_cFileList.GetSelectionMark(); + if (selIndex < 0) + return; + if (selIndex >= (int)m_arFileList.size()) + return; + + DoDiff(selIndex, m_bBlame); + return; + } + + __super::OnOK(); +} + + void CFileDiffDlg::OnCancel() { if (m_bThreadRunning) Index: src/TortoiseProc/LogDlg.h =================================================================== --- src/TortoiseProc/LogDlg.h (revision 10930) +++ src/TortoiseProc/LogDlg.h (working copy) @@ -89,6 +89,7 @@ afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnBnClickedGetall(); afx_msg void OnNMDblclkChangedFileList(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnNMDblclkLoglist(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnBnClickedHelp(); afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult); @@ -156,6 +157,8 @@ bool ValidateRegexp(LPCTSTR regexp_str, rpattern& pat, bool bMatchCase = false); void CheckRegexpTooltip(); void GetChangedPaths(std::vector& changedpaths, std::vector& changedlogpaths); + void DiffSelectedFile(); + void DiffSelectedRevWithPrevious(); virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -246,8 +249,8 @@ DWORD m_maxChild; HACCEL m_hAccel; - CStoreSelection* m_pStoreSelection; - CLogDataVector m_logEntries; + CStoreSelection* m_pStoreSelection; + CLogDataVector m_logEntries; }; static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISESVN_REVSELECTED_MSG")); static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISESVN_REVLIST_MSG")); Index: src/Resources/TortoiseProcENG.rc =================================================================== --- src/Resources/TortoiseProcENG.rc (revision 10930) +++ src/Resources/TortoiseProcENG.rc (working copy) @@ -915,9 +915,9 @@ BEGIN LTEXT "Difference between",IDC_DIFFSTATIC1,7,7,125,8 PUSHBUTTON "",IDC_SWITCHLEFTRIGHT,227,7,21,14,BS_ICON - EDITTEXT IDC_FIRSTURL,7,23,186,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_FIRSTURL,7,23,186,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP LTEXT "and",IDC_DIFFSTATIC2,7,34,83,8 - EDITTEXT IDC_SECONDURL,7,47,186,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_SECONDURL,7,47,186,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP CONTROL "",IDC_FILELIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,87,241,155 PUSHBUTTON "HEAD",IDC_REV1BTN,198,23,50,14 PUSHBUTTON "HEAD",IDC_REV2BTN,198,47,50,14