1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2014 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "TortoiseProc.h"
23 #include "StatGraphDlg.h"
25 #include "MessageBox.h"
28 #include "PathUtils.h"
29 #include "StringUtils.h"
30 #include "UnicodeUtils.h"
33 #include "BrowseRefsDlg.h"
34 #include "SmartHandle.h"
35 #include "LogOrdering.h"
37 #define WM_TGIT_REFRESH_SELECTION (WM_APP + 1)
39 IMPLEMENT_DYNAMIC(CLogDlg
, CResizableStandAloneDialog
)
40 CLogDlg::CLogDlg(CWnd
* pParent
/*=NULL*/)
41 : CResizableStandAloneDialog(CLogDlg::IDD
, pParent
)
43 , m_currentChangedArray(NULL
)
45 , m_bFollowRenames(false)
47 , m_bSelectionMustBeSingle(true)
49 , m_bShowLocalBranches(true)
50 , m_bShowRemoteBranches(true)
53 , m_bWalkBehavior(FALSE
)
54 , m_bFirstParent(false)
55 , m_bWholeProject(FALSE
)
56 , m_iCompressedGraph(0)
58 , m_bSelectionMustBeContinuous(false)
63 , m_pNotifyWindow(NULL
)
70 m_bFilterWithRegex
= !!CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE
);
73 str
=g_Git
.m_CurrentDir
;
74 str
.Replace(_T(":"),_T("_"));
75 str
=CString(_T("Software\\TortoiseGit\\LogDialog\\AllBranch\\"))+str
;
77 m_regbAllBranch
=CRegDWORD(str
,FALSE
);
79 m_bAllBranch
=m_regbAllBranch
;
81 str
= g_Git
.m_CurrentDir
;
82 str
.Replace(_T(":"),_T("_"));
83 m_regShowWholeProject
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ShowWholeProject\\") + str
, FALSE
);
84 m_bWholeProject
= m_regShowWholeProject
;
85 m_regbShowTags
= CRegDWORD(_T("Software\\TortoiseGit\\LogDialog\\ShowTags\\") + str
, TRUE
);
86 m_bShowTags
= !!m_regbShowTags
;
87 m_regbShowLocalBranches
= CRegDWORD(_T("Software\\TortoiseGit\\LogDialog\\ShowLocalBranches\\") + str
, TRUE
);
88 m_bShowLocalBranches
= !!m_regbShowLocalBranches
;
89 m_regbShowRemoteBranches
= CRegDWORD(_T("Software\\TortoiseGit\\LogDialog\\ShowRemoteBranches\\") + str
, TRUE
);
90 m_bShowRemoteBranches
= !!m_regbShowRemoteBranches
;
92 m_bShowUnversioned
= CRegDWORD(_T("Software\\TortoiseGit\\AddBeforeCommit"), TRUE
);
94 m_bShowGravatar
= !!CRegDWORD(_T("Software\\TortoiseGit\\EnableGravatar"), FALSE
);
95 m_regbShowGravatar
= CRegDWORD(_T("Software\\TortoiseGit\\LogDialog\\ShowGravatar\\") + str
, m_bShowGravatar
);
96 m_bShowGravatar
= !!m_regbShowGravatar
;
102 m_regbAllBranch
= m_bAllBranch
;
103 m_regbShowTags
= m_bShowTags
;
104 m_regbShowLocalBranches
= m_bShowLocalBranches
;
105 m_regbShowRemoteBranches
= m_bShowRemoteBranches
;
106 m_regbShowGravatar
= m_bShowGravatar
;
108 m_CurrentFilteredChangedArray
.RemoveAll();
112 void CLogDlg::DoDataExchange(CDataExchange
* pDX
)
114 CResizableStandAloneDialog::DoDataExchange(pDX
);
115 DDX_Control(pDX
, IDC_LOGLIST
, m_LogList
);
116 DDX_Control(pDX
, IDC_LOGMSG
, m_ChangedFileListCtrl
);
117 DDX_Control(pDX
, IDC_PROGRESS
, m_LogProgress
);
118 DDX_Control(pDX
, IDC_SPLITTERTOP
, m_wndSplitter1
);
119 DDX_Control(pDX
, IDC_SPLITTERBOTTOM
, m_wndSplitter2
);
120 DDX_Text(pDX
, IDC_SEARCHEDIT
, m_LogList
.m_sFilterText
);
121 DDX_Control(pDX
, IDC_DATEFROM
, m_DateFrom
);
122 DDX_Control(pDX
, IDC_DATETO
, m_DateTo
);
123 DDX_Control(pDX
, IDC_LOG_JUMPTYPE
, m_JumpType
);
124 DDX_Control(pDX
, IDC_LOG_JUMPUP
, m_JumpUp
);
125 DDX_Control(pDX
, IDC_LOG_JUMPDOWN
, m_JumpDown
);
126 DDX_Text(pDX
, IDC_LOGINFO
, m_sLogInfo
);
127 DDX_Check(pDX
, IDC_LOG_ALLBRANCH
,m_bAllBranch
);
128 DDX_Check(pDX
, IDC_SHOWWHOLEPROJECT
,m_bWholeProject
);
129 DDX_Check(pDX
, IDC_WALKBEHAVIOUR
, m_bWalkBehavior
);
130 DDX_Control(pDX
, IDC_SEARCHEDIT
, m_cFilter
);
131 DDX_Control(pDX
, IDC_STATIC_REF
, m_staticRef
);
132 DDX_Control(pDX
, IDC_PIC_AUTHOR
, m_gravatar
);
135 BEGIN_MESSAGE_MAP(CLogDlg
, CResizableStandAloneDialog
)
138 ON_NOTIFY(LVN_ITEMCHANGED
, IDC_LOGLIST
, OnLvnItemchangedLoglist
)
139 ON_NOTIFY(LVN_ITEMCHANGED
, IDC_LOGMSG
, OnLvnItemchangedLogmsg
)
140 ON_NOTIFY(EN_LINK
, IDC_MSGVIEW
, OnEnLinkMsgview
)
141 ON_BN_CLICKED(IDC_STATBUTTON
, OnBnClickedStatbutton
)
143 ON_MESSAGE(WM_TGIT_REFRESH_SELECTION
, OnRefreshSelection
)
144 ON_MESSAGE(WM_FILTEREDIT_INFOCLICKED
, OnClickedInfoIcon
)
145 ON_MESSAGE(WM_FILTEREDIT_CANCELCLICKED
, OnClickedCancelFilter
)
147 ON_MESSAGE(MSG_LOAD_PERCENTAGE
,OnLogListLoading
)
149 ON_EN_CHANGE(IDC_SEARCHEDIT
, OnEnChangeSearchedit
)
151 ON_NOTIFY(DTN_DATETIMECHANGE
, IDC_DATETO
, OnDtnDatetimechangeDateto
)
152 ON_NOTIFY(DTN_DATETIMECHANGE
, IDC_DATEFROM
, OnDtnDatetimechangeDatefrom
)
153 ON_CBN_SELCHANGE(IDC_LOG_JUMPTYPE
, &CLogDlg::OnCbnSelchangeJumpType
)
154 ON_COMMAND(IDC_LOG_JUMPUP
, &CLogDlg::OnBnClickedJumpUp
)
155 ON_COMMAND(IDC_LOG_JUMPDOWN
, &CLogDlg::OnBnClickedJumpDown
)
156 ON_BN_CLICKED(IDC_WALKBEHAVIOUR
, OnBnClickedWalkBehaviour
)
157 ON_BN_CLICKED(IDC_VIEW
, OnBnClickedView
)
158 ON_BN_CLICKED(IDC_SHOWWHOLEPROJECT
, OnBnClickShowWholeProject
)
159 ON_NOTIFY(LVN_COLUMNCLICK
,IDC_LOGLIST
, OnLvnColumnclick
)
160 ON_COMMAND(MSG_FETCHED_DIFF
, OnBnClickedHidepaths
)
161 ON_BN_CLICKED(IDC_LOG_ALLBRANCH
, OnBnClickedAllBranch
)
163 ON_NOTIFY(DTN_DROPDOWN
, IDC_DATEFROM
, &CLogDlg::OnDtnDropdownDatefrom
)
164 ON_NOTIFY(DTN_DROPDOWN
, IDC_DATETO
, &CLogDlg::OnDtnDropdownDateto
)
166 ON_BN_CLICKED(IDC_REFRESH
, &CLogDlg::OnBnClickedRefresh
)
167 ON_STN_CLICKED(IDC_STATIC_REF
, &CLogDlg::OnBnClickedBrowseRef
)
168 ON_COMMAND(ID_LOGDLG_REFRESH
, &CLogDlg::OnBnClickedRefresh
)
169 ON_COMMAND(ID_LOGDLG_FIND
, &CLogDlg::OnFind
)
170 ON_COMMAND(ID_LOGDLG_FOCUSFILTER
, &CLogDlg::OnFocusFilter
)
171 ON_COMMAND(ID_EDIT_COPY
, &CLogDlg::OnEditCopy
)
172 ON_MESSAGE(MSG_REFLOG_CHANGED
, OnRefLogChanged
)
173 ON_REGISTERED_MESSAGE(WM_TASKBARBTNCREATED
, OnTaskbarBtnCreated
)
175 ON_REGISTERED_MESSAGE(CGitStatusListCtrl::GITSLNM_ITEMCHANGED
, &CLogDlg::OnFileListCtrlItemChanged
)
183 JumpType_AuthorEmail
,
184 JumpType_CommitterEmail
,
194 void CLogDlg::SetParams(const CTGitPath
& orgPath
, const CTGitPath
& path
, CString hightlightRevision
, CString range
, int limit
)
198 m_hightlightRevision
= hightlightRevision
;
200 if (!(range
.IsEmpty() || range
== _T("HEAD")))
201 m_bAllBranch
= BST_UNCHECKED
;
206 if (::IsWindow(m_hWnd
))
210 void CLogDlg::SetFilter(const CString
& findstr
, LONG findtype
, bool findregex
)
212 m_LogList
.m_sFilterText
= findstr
;
214 m_LogList
.m_SelectedFilters
= findtype
;
215 m_LogList
.m_bFilterWithRegex
= m_bFilterWithRegex
= findregex
;
218 BOOL
CLogDlg::OnInitDialog()
221 CResizableStandAloneDialog::OnInitDialog();
222 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
224 // Let the TaskbarButtonCreated message through the UIPI filter. If we don't
225 // do this, Explorer would be unable to send that message to our window if we
226 // were running elevated. It's OK to make the call all the time, since if we're
227 // not elevated, this is a no-op.
228 CHANGEFILTERSTRUCT cfs
= { sizeof(CHANGEFILTERSTRUCT
) };
229 typedef BOOL STDAPICALLTYPE
ChangeWindowMessageFilterExDFN(HWND hWnd
, UINT message
, DWORD action
, PCHANGEFILTERSTRUCT pChangeFilterStruct
);
230 CAutoLibrary hUser
= AtlLoadSystemLibraryUsingFullPath(_T("user32.dll"));
233 ChangeWindowMessageFilterExDFN
*pfnChangeWindowMessageFilterEx
= (ChangeWindowMessageFilterExDFN
*)GetProcAddress(hUser
, "ChangeWindowMessageFilterEx");
234 if (pfnChangeWindowMessageFilterEx
)
236 pfnChangeWindowMessageFilterEx(m_hWnd
, WM_TASKBARBTNCREATED
, MSGFLT_ALLOW
, &cfs
);
239 m_pTaskbarList
.Release();
240 if (FAILED(m_pTaskbarList
.CoCreateInstance(CLSID_TaskbarList
)))
241 m_pTaskbarList
= nullptr;
243 m_hAccel
= LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_ACC_LOGDLG
));
245 // use the state of the "stop on copy/rename" option from the last time
248 // set the font to use in the log message view, configured in the settings dialog
249 CAppUtils::CreateFontForLogs(m_logFont
);
250 GetDlgItem(IDC_MSGVIEW
)->SetFont(&m_logFont
);
251 // automatically detect URLs in the log message and turn them into links
252 GetDlgItem(IDC_MSGVIEW
)->SendMessage(EM_AUTOURLDETECT
, TRUE
, NULL
);
253 // make the log message rich edit control send a message when the mouse pointer is over a link
254 GetDlgItem(IDC_MSGVIEW
)->SendMessage(EM_SETEVENTMASK
, NULL
, ENM_LINK
);
256 // "unrelated paths" should be in gray color
259 // set up the columns
260 m_LogList
.DeleteAllItems();
262 m_LogList
.m_Path
=m_path
;
263 m_LogList
.m_hasWC
= m_LogList
.m_bShowWC
= !g_GitAdminDir
.IsBareRepo(g_Git
.m_CurrentDir
);
264 m_LogList
.InsertGitColumn();
267 m_LogList
.m_Path
.Reset();
269 m_ChangedFileListCtrl
.Init(GITSLC_COLEXT
| GITSLC_COLSTATUS
|GITSLC_COLADD
|GITSLC_COLDEL
, _T("LogDlg"), (GITSLC_POPALL
^ (GITSLC_POPIGNORE
|GITSLC_POPRESTORE
)), false, m_LogList
.m_hasWC
, GITSLC_COLEXT
| GITSLC_COLSTATUS
| GITSLC_COLADD
| GITSLC_COLDEL
);
271 GetDlgItem(IDC_LOGLIST
)->UpdateData(FALSE
);
275 m_tooltips
.Create(this);
276 CheckRegexpTooltip();
280 // the filter control has a 'cancel' button (the red 'X'), we need to load its bitmap
281 m_cFilter
.SetCancelBitmaps(IDI_CANCELNORMAL
, IDI_CANCELPRESSED
);
282 m_cFilter
.SetInfoIcon(IDI_LOGFILTER
);
283 m_cFilter
.SetValidator(this);
285 AdjustControlSize(IDC_LOG_ALLBRANCH
);
286 AdjustControlSize(IDC_SHOWWHOLEPROJECT
);
288 GetClientRect(m_DlgOrigRect
);
289 m_LogList
.GetClientRect(m_LogListOrigRect
);
290 GetDlgItem(IDC_MSGVIEW
)->GetClientRect(m_MsgViewOrigRect
);
291 m_ChangedFileListCtrl
.GetClientRect(m_ChgOrigRect
);
293 m_DateFrom
.SendMessage(DTM_SETMCSTYLE
, 0, MCS_WEEKNUMBERS
|MCS_NOTODAY
|MCS_NOTRAILINGDATES
|MCS_NOSELCHANGEONNAV
);
294 m_DateTo
.SendMessage(DTM_SETMCSTYLE
, 0, MCS_WEEKNUMBERS
|MCS_NOTODAY
|MCS_NOTRAILINGDATES
|MCS_NOSELCHANGEONNAV
);
296 m_staticRef
.SetURL(CString());
299 AddAnchor(IDC_STATIC_REF
, TOP_LEFT
);
300 //AddAnchor(IDC_BUTTON_BROWSE_REF, TOP_LEFT);
301 AddAnchor(IDC_FROMLABEL
, TOP_LEFT
);
302 AddAnchor(IDC_DATEFROM
, TOP_LEFT
);
303 AddAnchor(IDC_TOLABEL
, TOP_LEFT
);
304 AddAnchor(IDC_DATETO
, TOP_LEFT
);
307 AddAnchor(IDC_SEARCHEDIT
, TOP_LEFT
, TOP_RIGHT
);
308 AddAnchor(IDC_LOG_JUMPTYPE
, TOP_RIGHT
);
309 AddAnchor(IDC_LOG_JUMPUP
, TOP_RIGHT
);
310 AddAnchor(IDC_LOG_JUMPDOWN
, TOP_RIGHT
);
312 AddAnchor(IDC_LOGLIST
, TOP_LEFT
, TOP_RIGHT
);
313 AddAnchor(IDC_SPLITTERTOP
, TOP_LEFT
, TOP_RIGHT
);
314 AddAnchor(IDC_MSGVIEW
, TOP_LEFT
, BOTTOM_RIGHT
);
315 AddAnchor(IDC_PIC_AUTHOR
, TOP_RIGHT
);
316 AddAnchor(IDC_SPLITTERBOTTOM
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
317 AddAnchor(IDC_LOGMSG
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
319 AddAnchor(IDC_LOGINFO
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
320 AddAnchor(IDC_WALKBEHAVIOUR
, BOTTOM_LEFT
);
321 AddAnchor(IDC_VIEW
, BOTTOM_LEFT
);
322 AddAnchor(IDC_LOG_ALLBRANCH
,BOTTOM_LEFT
);
323 AddAnchor(IDC_SHOWWHOLEPROJECT
, BOTTOM_LEFT
);
324 AddAnchor(IDC_REFRESH
, BOTTOM_LEFT
);
325 AddAnchor(IDC_STATBUTTON
, BOTTOM_RIGHT
);
326 AddAnchor(IDC_PROGRESS
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
327 AddAnchor(IDOK
, BOTTOM_RIGHT
);
328 AddAnchor(IDCANCEL
, BOTTOM_RIGHT
);
329 AddAnchor(IDHELP
, BOTTOM_RIGHT
);
331 m_LogList
.m_ShowMask
&= ~CGit::LOG_INFO_LOCAL_BRANCHES
;
332 if (m_bAllBranch
== BST_CHECKED
)
333 m_LogList
.m_ShowMask
|=CGit::LOG_INFO_ALL_BRANCH
;
334 else if (m_bAllBranch
== BST_INDETERMINATE
)
335 m_LogList
.m_ShowMask
|= CGit::LOG_INFO_LOCAL_BRANCHES
;
337 m_LogList
.m_ShowMask
&=~CGit::LOG_INFO_ALL_BRANCH
;
339 HandleShowLabels(m_bShowTags
, LOGLIST_SHOWTAGS
);
340 HandleShowLabels(m_bShowLocalBranches
, LOGLIST_SHOWLOCALBRANCHES
);
341 HandleShowLabels(m_bShowRemoteBranches
, LOGLIST_SHOWREMOTEBRANCHES
);
343 // SetPromptParentWindow(m_hWnd);
344 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_AUTHOREMAIL
)));
345 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_COMMITTEREMAIL
)));
346 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_MERGEPOINT
)));
347 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_PARENT1
)));
348 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_PARENT2
)));
349 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_TAG
)));
350 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_TAG_FF
)));
351 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_BRANCH
)));
352 m_JumpType
.AddString(CString(MAKEINTRESOURCE(IDS_PROC_BRANCH_FF
)));
353 m_JumpType
.SetCurSel(0);
354 m_JumpUp
.SetIcon((HICON
)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_JUMPUP
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
));
355 m_JumpDown
.SetIcon((HICON
)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_JUMPDOWN
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
));
358 CenterWindow(CWnd::FromHandle(hWndExplorer
));
359 EnableSaveRestore(_T("LogDlg"));
361 DWORD yPos1
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\LogDlgSizer1"));
362 DWORD yPos2
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\LogDlgSizer2"));
363 RECT rcDlg
, rcLogList
, rcChgMsg
;
364 GetClientRect(&rcDlg
);
365 m_LogList
.GetWindowRect(&rcLogList
);
366 ScreenToClient(&rcLogList
);
367 m_ChangedFileListCtrl
.GetWindowRect(&rcChgMsg
);
368 ScreenToClient(&rcChgMsg
);
372 m_wndSplitter1
.GetWindowRect(&rectSplitter
);
373 ScreenToClient(&rectSplitter
);
374 int delta
= yPos1
- rectSplitter
.top
;
376 if ((rcLogList
.bottom
+ delta
> rcLogList
.top
)&&(rcLogList
.bottom
+ delta
< rcChgMsg
.bottom
- 30))
378 m_wndSplitter1
.SetWindowPos(NULL
, rectSplitter
.left
, yPos1
, 0, 0, SWP_NOSIZE
);
385 m_wndSplitter2
.GetWindowRect(&rectSplitter
);
386 ScreenToClient(&rectSplitter
);
387 int delta
= yPos2
- rectSplitter
.top
;
389 if ((rcChgMsg
.top
+ delta
< rcChgMsg
.bottom
)&&(rcChgMsg
.top
+ delta
> rcLogList
.top
+ 30))
391 m_wndSplitter2
.SetWindowPos(NULL
, rectSplitter
.left
, yPos2
, 0, 0, SWP_NOSIZE
);
400 // the dialog is used to select revisions
401 // enable the OK button if appropriate
406 // the dialog is used to just view log messages
407 // hide the OK button and set text on Cancel button to OK
408 GetDlgItemText(IDOK
, temp
);
409 SetDlgItemText(IDCANCEL
, temp
);
410 GetDlgItem(IDOK
)->ShowWindow(SW_HIDE
);
413 // first start a thread to obtain the log messages without
414 // blocking the dialog
416 //m_tFrom = (DWORD)-1;
418 // scroll to user selected or current revision
419 if (!m_hightlightRevision
.IsEmpty() && m_hightlightRevision
.GetLength() >= GIT_HASH_SIZE
)
420 m_LogList
.m_lastSelectedHash
= m_hightlightRevision
;
423 if (g_Git
.GetHash(m_LogList
.m_lastSelectedHash
, _T("HEAD")))
424 MessageBox(g_Git
.GetGitLastErr(_T("Could not get HEAD hash.")), _T("TortoiseGit"), MB_ICONERROR
);
427 if (g_Git
.GetConfigValueBool(_T("tgit.logshowpatch")))
430 m_LogList
.FetchLogAsync(this);
434 GetDlgItem(IDC_LOGLIST
)->SetFocus();
436 m_History
.SetMaxHistoryItems((LONG
)CRegDWORD(_T("Software\\TortoiseGit\\MaxRefHistoryItems"), 5));
438 reg
.Format(_T("Software\\TortoiseGit\\History\\log-refs\\%s"), g_Git
.m_CurrentDir
);
439 reg
.Replace(_T(':'),_T('_'));
440 m_History
.Load(reg
, _T("ref"));
446 LRESULT
CLogDlg::OnLogListLoading(WPARAM wParam
, LPARAM
/*lParam*/)
450 if( cur
== GITLOG_START
)
453 temp
.LoadString(IDS_PROGRESSWAIT
);
455 this->m_LogList
.ShowText(temp
, true);
457 // We use a progress bar while getting the logs
458 m_LogProgress
.SetRange32(0, 100);
459 m_LogProgress
.SetPos(0);
462 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NORMAL
);
463 m_pTaskbarList
->SetProgressValue(m_hWnd
, 0, 100);
466 GetDlgItem(IDC_PROGRESS
)->ShowWindow(TRUE
);
468 DialogEnableWindow(IDC_WALKBEHAVIOUR
, FALSE
);
469 DialogEnableWindow(IDC_STATBUTTON
, FALSE
);
470 //DialogEnableWindow(IDC_REFRESH, FALSE);
471 DialogEnableWindow(IDC_VIEW
, FALSE
);
474 else if( cur
== GITLOG_END
)
476 if(this->m_LogList
.HasText())
478 this->m_LogList
.ClearText();
480 UpdateLogInfoLabel();
483 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NOPROGRESS
);
485 DialogEnableWindow(IDC_SHOWWHOLEPROJECT
, !m_bFollowRenames
&& !m_path
.IsEmpty());
487 DialogEnableWindow(IDC_STATBUTTON
, !(m_LogList
.m_arShownList
.IsEmpty() || m_LogList
.m_arShownList
.GetCount() == 1 && m_LogList
.m_bShowWC
));
488 DialogEnableWindow(IDC_REFRESH
, TRUE
);
489 DialogEnableWindow(IDC_VIEW
, TRUE
);
490 DialogEnableWindow(IDC_WALKBEHAVIOUR
, TRUE
);
491 // PostMessage(WM_TIMER, LOGFILTER_TIMER);
492 GetDlgItem(IDC_PROGRESS
)->ShowWindow(FALSE
);
493 //CTime time=m_LogList.GetOldestTime();
495 m_LogList
.GetTimeRange(begin
,end
);
497 if(m_LogList
.m_From
== -1)
498 m_DateFrom
.SetTime(&begin
);
500 if(m_LogList
.m_To
== -1)
501 m_DateTo
.SetTime(&end
);
507 if(this->m_LogList
.HasText())
509 this->m_LogList
.ClearText();
510 this->m_LogList
.Invalidate();
512 UpdateLogInfoLabel();
513 m_LogProgress
.SetPos(cur
);
516 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NORMAL
);
517 m_pTaskbarList
->SetProgressValue(m_hWnd
, cur
, 100);
522 void CLogDlg::SetDlgTitle()
524 if (m_sTitle
.IsEmpty())
525 GetWindowText(m_sTitle
);
527 if (m_LogList
.m_Path
.IsEmpty() || m_orgPath
.GetWinPathString().IsEmpty())
529 CAppUtils::SetWindowTitle(m_hWnd
, g_Git
.m_CurrentDir
, m_sTitle
);
532 CAppUtils::SetWindowTitle(m_hWnd
, m_orgPath
.GetWinPathString(), m_sTitle
);
535 void CLogDlg::CheckRegexpTooltip()
537 CWnd
*pWnd
= GetDlgItem(IDC_SEARCHEDIT
);
538 // Since tooltip describes regexp features, show it only if regexps are enabled.
539 if (m_bFilterWithRegex
)
541 m_tooltips
.AddTool(pWnd
, IDS_LOG_FILTER_REGEX_TT
);
544 m_tooltips
.DelTool(pWnd
);
547 void CLogDlg::EnableOKButton()
551 // the dialog is used to select revisions
552 if (m_bSelectionMustBeSingle
)
554 // enable OK button if only a single revision is selected
555 DialogEnableWindow(IDOK
, (m_LogList
.GetSelectedCount()==1));
557 else if (m_bSelectionMustBeContinuous
)
558 DialogEnableWindow(IDOK
, (m_LogList
.GetSelectedCount()!=0)&&(m_LogList
.IsSelectionContinuous()));
560 DialogEnableWindow(IDOK
, m_LogList
.GetSelectedCount()!=0);
563 DialogEnableWindow(IDOK
, TRUE
);
566 bool LookLikeGitHash(const CString
& msg
, int &pos
)
569 for (; pos
< msg
.GetLength(); ++pos
)
571 if (msg
[pos
] >= '0' && msg
[pos
] <= '9' || msg
[pos
] >= 'a' && msg
[pos
] <= 'f')
577 return c
>= g_Git
.GetShortHASHLength() && c
<= GIT_HASH_SIZE
* 2;
580 return c
>= g_Git
.GetShortHASHLength() && c
<= GIT_HASH_SIZE
* 2;
583 std::vector
<CHARRANGE
> FindGitHashPositions(const CString
& msg
, int offset
)
585 std::vector
<CHARRANGE
> result
;
586 offset
= offset
< 0 ? 0 : offset
;
588 while (offset
< msg
.GetLength())
591 TCHAR e
= msg
[offset
];
595 if (msg
.Mid(offset
, 11) == _T("git-svn-id:")
596 || msg
.Mid(offset
, 14) == _T("Signed-off-by:")
597 || msg
.Mid(offset
, 10) == _T("Change-Id:")
601 while (offset
< msg
.GetLength())
603 if (msg
[offset
++] == '\n')
609 else if (e
>= 'A' && e
<= 'Z' || e
>= 'h' && e
<= 'z')
614 } while (offset
< msg
.GetLength() && (e
>= 'A' && e
<= 'Z' || e
>= 'a' && e
<= 'z' || e
>= '0' && e
<= '9'));
616 else if (e
>= 'a' && e
<= 'g' || e
>= '0' && e
<= '9')
623 if (LookLikeGitHash(msg
, offset
))
625 TCHAR d
= offset
< msg
.GetLength() ? msg
[offset
] : '\0';
626 if (!((d
>= 'A' && d
<= 'Z') || (d
>= 'a' && d
<= 'z') || (d
>= '0' && d
<= '9')))
628 CHARRANGE range
= { old
, offset
};
629 result
.push_back(range
);
643 BOOL
FindGitHash(const CString
& msg
, int offset
, CWnd
*pWnd
)
645 std::vector
<CHARRANGE
> positions
= FindGitHashPositions(msg
, offset
);
646 CAppUtils::SetCharFormat(pWnd
, CFM_LINK
, CFE_LINK
, positions
);
648 return positions
.empty() ? FALSE
: TRUE
;
651 void CLogDlg::FillLogMessageCtrl(bool bShow
/* = true*/)
653 // we fill here the log message rich edit control,
654 // and also populate the changed files list control
655 // according to the selected revision(s).
657 CRichEditCtrl
* pMsgView
= (CRichEditCtrl
*)GetDlgItem(IDC_MSGVIEW
);
658 // empty the log message view
659 pMsgView
->SetWindowText(_T(" "));
661 // empty the changed files list
662 m_ChangedFileListCtrl
.SetRedraw(FALSE
);
663 // InterlockedExchange(&m_bNoDispUpdates, TRUE);
664 m_currentChangedArray
= NULL
;
665 m_ChangedFileListCtrl
.DeleteAllItems();
667 // if we're not here to really show a selected revision, just
668 // get out of here after clearing the views, which is what is intended
669 // if that flag is not set.
673 m_ChangedFileListCtrl
.Invalidate();
674 // InterlockedExchange(&m_bNoDispUpdates, FALSE);
675 m_ChangedFileListCtrl
.SetRedraw(TRUE
);
676 m_gravatar
.LoadGravatar();
680 // depending on how many revisions are selected, we have to do different
682 int selCount
= m_LogList
.GetSelectedCount();
685 // if nothing is selected, we have nothing more to do
686 // InterlockedExchange(&m_bNoDispUpdates, FALSE);
687 m_ChangedFileListCtrl
.SetRedraw(TRUE
);
688 m_gravatar
.LoadGravatar();
691 else if (selCount
== 1)
693 // if one revision is selected, we have to fill the log message view
694 // with the corresponding log message, and also fill the changed files
696 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
697 int selIndex
= m_LogList
.GetNextSelectedItem(pos
);
698 if (selIndex
>= m_LogList
.m_arShownList
.GetCount())
700 // InterlockedExchange(&m_bNoDispUpdates, FALSE);
701 m_ChangedFileListCtrl
.SetRedraw(TRUE
);
704 Locker
lock(m_LogList
.m_critSec_AsyncDiff
);
705 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(selIndex
));
708 // set the log message text
709 pMsgView
->SetWindowText(CString(MAKEINTRESOURCE(IDS_HASH
)) + _T(": ") + pLogEntry
->m_CommitHash
.ToString() + _T("\r\n\r\n"));
710 // turn bug ID's into links if the bugtraq: properties have been set
711 // and we can find a match of those in the log message
713 pMsgView
->SetSel(-1,-1);
715 SecureZeroMemory(&format
, sizeof(CHARFORMAT2
));
716 format
.cbSize
= sizeof(CHARFORMAT2
);
717 format
.dwMask
= CFM_BOLD
;
718 format
.dwEffects
= CFE_BOLD
;
719 pMsgView
->SendMessage(EM_SETCHARFORMAT
, SCF_SELECTION
, (LPARAM
)&format
);
721 CString msg
=_T("* ");
722 msg
+=pLogEntry
->GetSubject();
723 pMsgView
->ReplaceSel(msg
);
725 pMsgView
->SetSel(-1,-1);
726 format
.dwEffects
= 0;
727 pMsgView
->SendMessage(EM_SETCHARFORMAT
, SCF_SELECTION
, (LPARAM
)&format
);
730 msg
+=pLogEntry
->GetBody();
732 if(!pLogEntry
->m_Notes
.IsEmpty())
734 msg
+= _T("\n*") + CString(MAKEINTRESOURCE(IDS_NOTES
)) + _T("* ");
735 msg
+= pLogEntry
->m_Notes
;
739 CString tagInfo
= m_LogList
.GetTagInfo(pLogEntry
);
740 if(!tagInfo
.IsEmpty())
741 tagInfo
= _T("\n*") + CString(MAKEINTRESOURCE(IDS_PROC_LOG_TAGINFO
)) + _T("*\n\n") + tagInfo
;
744 pMsgView
->ReplaceSel(msg
);
747 pMsgView
->GetWindowText(text
);
748 // the rich edit control doesn't count the CR char!
749 // to be exact: CRLF is treated as one char.
752 FindGitHash(text
, text
.Find('\n'), pMsgView
);
753 m_LogList
.m_ProjectProperties
.FindBugID(text
, pMsgView
);
754 if (((DWORD
)CRegStdDWORD(_T("Software\\TortoiseGit\\StyleCommitMessages"), TRUE
)) == TRUE
)
755 CAppUtils::FormatTextInRichEditControl(pMsgView
);
760 pMsgView
->SendMessage(EM_EXSETSEL
, NULL
, (LPARAM
)&range
);
762 CString matchpath
=this->m_path
.GetGitPathString();
764 int count
= pLogEntry
->GetFiles(&m_LogList
).GetCount();
765 for (int i
= 0 ; i
< count
&& (!matchpath
.IsEmpty()); ++i
)
767 if( m_bWholeProject
)
770 ((CTGitPath
&)pLogEntry
->GetFiles(&m_LogList
)[i
]).m_Action
&= ~(CTGitPath::LOGACTIONS_HIDE
|CTGitPath::LOGACTIONS_GRAY
);
772 if(pLogEntry
->GetFiles(&m_LogList
)[i
].GetGitPathString().Left(matchpath
.GetLength()) != matchpath
&& pLogEntry
->GetFiles(&m_LogList
)[i
].GetGitOldPathString().Left(matchpath
.GetLength()) != matchpath
)
774 if (m_iHidePaths
== 1)
775 ((CTGitPath
&)pLogEntry
->GetFiles(&m_LogList
)[i
]).m_Action
|= CTGitPath::LOGACTIONS_HIDE
;
776 else if (m_iHidePaths
== 2)
777 ((CTGitPath
&)pLogEntry
->GetFiles(&m_LogList
)[i
]).m_Action
|= CTGitPath::LOGACTIONS_GRAY
;
781 m_ChangedFileListCtrl
.UpdateWithGitPathList(pLogEntry
->GetFiles(&m_LogList
));
782 m_ChangedFileListCtrl
.m_CurrentVersion
=pLogEntry
->m_CommitHash
;
783 if (pLogEntry
->m_CommitHash
.IsEmpty() && m_bShowUnversioned
)
785 m_ChangedFileListCtrl
.UpdateUnRevFileList(pLogEntry
->GetUnRevFiles());
786 m_ChangedFileListCtrl
.Show(GITSLC_SHOWVERSIONED
| GITSLC_SHOWUNVERSIONED
);
789 m_ChangedFileListCtrl
.Show(GITSLC_SHOWVERSIONED
);
791 m_ChangedFileListCtrl
.SetBusyString(CString(MAKEINTRESOURCE(IDS_PROC_LOG_FETCHINGFILES
)));
793 if(!pLogEntry
->m_IsDiffFiles
)
794 m_ChangedFileListCtrl
.SetBusy(TRUE
);
796 m_ChangedFileListCtrl
.SetBusy(FALSE
);
798 m_ChangedFileListCtrl
.SetRedraw(TRUE
);
799 m_gravatar
.LoadGravatar(pLogEntry
->GetAuthorEmail());
806 // more than one revision is selected:
807 // the log message view must be emptied
808 // the changed files list contains all the changed paths from all
809 // selected revisions, with 'doubles' removed
810 m_currentChangedPathList
= GetChangedPathsFromSelectedRevisions(true);
811 m_gravatar
.LoadGravatar();
815 // InterlockedExchange(&m_bNoDispUpdates, FALSE);
817 if (m_currentChangedArray
)
819 m_ChangedFileListCtrl
.SetItemCountEx(m_currentChangedArray
->GetCount());
820 m_ChangedFileListCtrl
.RedrawItems(0, m_currentChangedArray
->GetCount());
822 else if (m_currentChangedPathList
.GetCount())
824 m_ChangedFileListCtrl
.SetItemCountEx(m_currentChangedPathList
.GetCount());
825 m_ChangedFileListCtrl
.RedrawItems(0, m_currentChangedPathList
.GetCount());
829 m_ChangedFileListCtrl
.SetItemCountEx(0);
830 m_ChangedFileListCtrl
.Invalidate();
833 // sort according to the settings
834 if (m_nSortColumnPathList
> 0)
835 SetSortArrow(&m_ChangedFileListCtrl
, m_nSortColumnPathList
, m_bAscendingPathList
);
837 SetSortArrow(&m_ChangedFileListCtrl
, -1, false);
838 m_ChangedFileListCtrl
.SetRedraw(TRUE
);
842 void CLogDlg::FillPatchView(bool onlySetTimer
)
844 if (!::IsWindow(this->m_patchViewdlg
.m_hWnd
))
847 KillTimer(LOG_FILLPATCHVTIMER
);
850 SetTimer(LOG_FILLPATCHVTIMER
, 100, nullptr);
854 POSITION posLogList
= m_LogList
.GetFirstSelectedItemPosition();
855 if (posLogList
== nullptr)
857 m_patchViewdlg
.ClearView();
858 return; // nothing is selected, get out of here
861 GitRev
* pLogEntry
= reinterpret_cast<GitRev
* >(m_LogList
.m_arShownList
.SafeGetAt(m_LogList
.GetNextSelectedItem(posLogList
)));
862 if (pLogEntry
== nullptr || m_LogList
.GetNextSelectedItem(posLogList
) != -1)
864 m_patchViewdlg
.ClearView();
868 POSITION pos
= m_ChangedFileListCtrl
.GetFirstSelectedItemPosition();
874 if (CAppUtils::GetMsysgitVersion() > 0x01080100)
875 diffContext
= g_Git
.GetConfigValueInt32(_T("diff.context"), -1);
877 g_Git
.GetUnifiedDiff(CTGitPath(), pLogEntry
->m_CommitHash
.ToString() + _T("~1"), pLogEntry
->m_CommitHash
.ToString(), &outA
, false, false, diffContext
);
878 out
= CUnicodeUtils::GetUnicode(outA
);
884 int nSelect
= m_ChangedFileListCtrl
.GetNextSelectedItem(pos
);
885 CTGitPath
* p
= (CTGitPath
*)m_ChangedFileListCtrl
.GetItemData(nSelect
);
886 if (p
&& !(p
->m_Action
&CTGitPath::LOGACTIONS_UNVER
))
889 if (pLogEntry
->m_CommitHash
.IsEmpty())
890 cmd
.Format(_T("git.exe diff HEAD -- \"%s\""), p
->GetGitPathString());
892 cmd
.Format(_T("git.exe diff %s^%d..%s -- \"%s\""), pLogEntry
->m_CommitHash
.ToString(), p
->m_ParentNo
+ 1, pLogEntry
->m_CommitHash
.ToString(), p
->GetGitPathString());
893 g_Git
.Run(cmd
, &out
, CP_UTF8
);
898 m_patchViewdlg
.SetText(out
);
901 void CLogDlg::TogglePatchView()
903 m_patchViewdlg
.m_pProjectProperties
= &m_LogList
.m_ProjectProperties
;
904 m_patchViewdlg
.m_ParentDlg
= this;
905 if (!IsWindow(m_patchViewdlg
.m_hWnd
))
907 BOOL viewPatchEnabled
= FALSE
;
908 viewPatchEnabled
= g_Git
.GetConfigValueBool(_T("tgit.logshowpatch"));
909 if (viewPatchEnabled
== FALSE
)
910 g_Git
.SetConfigValue(_T("tgit.logshowpatch"), _T("true"));
911 m_patchViewdlg
.Create(IDD_PATCH_VIEW
, this);
912 m_patchViewdlg
.m_ctrlPatchView
.Call(SCI_SETSCROLLWIDTHTRACKING
, TRUE
);
914 this->GetWindowRect(&rect
);
916 m_patchViewdlg
.ShowWindow(SW_SHOW
);
917 m_patchViewdlg
.SetWindowPos(nullptr, rect
.right
, rect
.top
, rect
.Width(), rect
.Height(), SWP_NOACTIVATE
| SWP_NOOWNERZORDER
| SWP_NOZORDER
);
923 g_Git
.SetConfigValue(_T("tgit.logshowpatch"), _T("false"));
924 m_patchViewdlg
.ShowWindow(SW_HIDE
);
925 m_patchViewdlg
.DestroyWindow();
929 LRESULT
CLogDlg::OnFileListCtrlItemChanged(WPARAM
/*wparam*/, LPARAM
/*lparam*/)
935 void CLogDlg::OnMoving(UINT fwSide
, LPRECT pRect
)
937 __super::OnMoving(fwSide
, pRect
);
939 if (!::IsWindow(m_patchViewdlg
.m_hWnd
))
943 m_patchViewdlg
.GetWindowRect(&patchrect
);
944 if (!::IsWindow(m_hWnd
))
948 GetWindowRect(&thisrect
);
949 if (patchrect
.left
== thisrect
.right
)
951 m_patchViewdlg
.SetWindowPos(nullptr, patchrect
.left
- (thisrect
.left
- pRect
->left
), patchrect
.top
- (thisrect
.top
- pRect
->top
), 0, 0, SWP_NOACTIVATE
| SWP_NOOWNERZORDER
| SWP_NOSIZE
| SWP_NOZORDER
);
955 void CLogDlg::OnSizing(UINT fwSide
, LPRECT pRect
)
957 __super::OnSizing(fwSide
, pRect
);
959 if (!::IsWindow(this->m_patchViewdlg
.m_hWnd
))
962 CRect thisrect
, patchrect
;
963 this->GetWindowRect(thisrect
);
964 this->m_patchViewdlg
.GetWindowRect(patchrect
);
965 if (thisrect
.right
!= patchrect
.left
)
968 patchrect
.left
-= (thisrect
.right
- pRect
->right
);
969 patchrect
.right
-= (thisrect
.right
- pRect
->right
);
971 if (patchrect
.bottom
== thisrect
.bottom
)
972 patchrect
.bottom
-= (thisrect
.bottom
- pRect
->bottom
);
973 if (patchrect
.top
== thisrect
.top
)
974 patchrect
.top
-= thisrect
.top
- pRect
->top
;
975 m_patchViewdlg
.MoveWindow(patchrect
);
978 void CLogDlg::OnBnClickedRefresh()
983 void CLogDlg::Refresh (bool clearfilter
/*autoGoOnline*/)
986 m_LogList
.Refresh(clearfilter
);
989 FillLogMessageCtrl(false);
994 BOOL
CLogDlg::Cancel()
999 void CLogDlg::SaveSplitterPos()
1003 CRegDWORD regPos1
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\LogDlgSizer1"));
1004 CRegDWORD regPos2
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\LogDlgSizer2"));
1006 m_wndSplitter1
.GetWindowRect(&rectSplitter
);
1007 ScreenToClient(&rectSplitter
);
1008 regPos1
= rectSplitter
.top
;
1009 m_wndSplitter2
.GetWindowRect(&rectSplitter
);
1010 ScreenToClient(&rectSplitter
);
1011 regPos2
= rectSplitter
.top
;
1015 void CLogDlg::OnCancel()
1017 this->ShowWindow(SW_HIDE
);
1019 // canceling means stopping the working thread if it's still running.
1020 m_LogList
.SafeTerminateAsyncDiffThread();
1021 if (this->IsThreadRunning())
1023 m_LogList
.SafeTerminateThread();
1028 __super::OnCancel();
1031 void CLogDlg::CopyChangedSelectionToClipBoard()
1034 POSITION posLogList
= m_LogList
.GetFirstSelectedItemPosition();
1035 if (posLogList
== nullptr)
1036 return; // nothing is selected, get out of here
1040 // CGitRev* pLogEntry = reinterpret_cast<CGitRev* >(m_LogList.m_arShownList.SafeGetAt(m_LogList.GetNextSelectedItem(pos)));
1043 POSITION pos
= m_ChangedFileListCtrl
.GetFirstSelectedItemPosition();
1046 int nItem
= m_ChangedFileListCtrl
.GetNextSelectedItem(pos
);
1047 CTGitPath
*path
= (CTGitPath
*)m_ChangedFileListCtrl
.GetItemData(nItem
);
1049 sPaths
+= path
->GetGitPathString();
1050 sPaths
+= _T("\r\n");
1056 // only one revision is selected in the log dialog top pane
1057 // but multiple items could be selected in the changed items list
1058 POSITION pos
= m_ChangedFileListCtrl
.GetFirstSelectedItemPosition();
1061 int nItem
= m_ChangedFileListCtrl
.GetNextSelectedItem(pos
);
1062 LogChangedPath
* changedlogpath
= pLogEntry
->pArChangedPaths
->SafeGetAt(nItem
);
1064 if ((m_cHidePaths
.GetState() & 0x0003)==BST_CHECKED
)
1066 // some items are hidden! So find out which item the user really selected
1067 INT_PTR selRealIndex
= -1;
1068 for (INT_PTR hiddenindex
=0; hiddenindex
<pLogEntry
->pArChangedPaths
->GetCount(); ++hiddenindex
)
1070 if (pLogEntry
->pArChangedPaths
->SafeGetAt(hiddenindex
)->sPath
.Left(m_sRelativeRoot
.GetLength()).Compare(m_sRelativeRoot
)==0)
1072 if (selRealIndex
== nItem
)
1074 changedlogpath
= pLogEntry
->pArChangedPaths
->SafeGetAt(hiddenindex
);
1081 sPaths
+= changedlogpath
->sPath
;
1082 sPaths
+= _T("\r\n");
1088 CStringUtils::WriteAsciiStringToClipboard(sPaths
, GetSafeHwnd());
1092 void CLogDlg::OnContextMenu(CWnd
* pWnd
, CPoint point
)
1094 // we have three separate context menus:
1095 // one for the branch label in the upper left
1096 // one shown on the log message list control,
1097 // one shown in the changed-files list control
1098 if (pWnd
== GetDlgItem(IDC_STATIC_REF
))
1101 if (!popup
.CreatePopupMenu())
1105 popup
.AppendMenuIcon(++cnt
, IDS_MENUREFBROWSE
);
1106 popup
.SetDefaultItem(cnt
);
1107 popup
.AppendMenuIcon(++cnt
, _T("HEAD"));
1108 popup
.AppendMenuIcon(++cnt
, IDS_ALL
);
1109 popup
.EnableMenuItem(cnt
, m_bFollowRenames
);
1110 popup
.AppendMenuIcon(++cnt
, IDS_PROC_LOG_SELECT_LOCAL_BRANCHES
);
1111 popup
.EnableMenuItem(cnt
, m_bFollowRenames
);
1113 if (m_History
.GetCount() > 0)
1115 popup
.AppendMenu(MF_SEPARATOR
, 0);
1116 for (size_t i
= 0; i
< m_History
.GetCount(); ++i
)
1118 CString entry
= m_History
.GetEntry(i
);
1119 if (entry
.GetLength() > 150)
1120 entry
= entry
.Left(150) + _T("...");
1121 popup
.AppendMenuIcon(cnt
++, entry
);
1125 int cmd
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, point
.x
, point
.y
, this, 0);
1130 OnBnClickedBrowseRef();
1134 m_LogList
.m_ShowMask
&= ~(CGit::LOG_INFO_ALL_BRANCH
| CGit::LOG_INFO_LOCAL_BRANCHES
);
1135 m_bAllBranch
= BST_UNCHECKED
;
1138 SetRange(g_Git
.GetCurrentBranch(true));
1142 m_bAllBranch
= BST_CHECKED
;
1143 m_LogList
.m_ShowMask
|= CGit::LOG_INFO_ALL_BRANCH
;
1147 m_bAllBranch
= BST_INDETERMINATE
;
1148 m_LogList
.m_ShowMask
|= CGit::LOG_INFO_LOCAL_BRANCHES
;
1150 else if (cmd
>= offset
)
1152 SetRange(m_History
.GetEntry(cmd
- offset
));
1153 m_History
.AddEntry(m_LogList
.m_sRange
);
1160 FillLogMessageCtrl(false);
1164 int selCount
= m_LogList
.GetSelectedCount();
1165 if ((selCount
== 1)&&(pWnd
== GetDlgItem(IDC_MSGVIEW
)))
1167 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
1170 selIndex
= m_LogList
.GetNextSelectedItem(pos
);
1172 GitRev
*pRev
= ((GitRev
*)m_LogList
.m_arShownList
[selIndex
]);
1174 if ((point
.x
== -1) && (point
.y
== -1))
1177 GetDlgItem(IDC_MSGVIEW
)->GetClientRect(&rect
);
1178 ClientToScreen(&rect
);
1179 point
= rect
.CenterPoint();
1181 CString sMenuItemText
;
1183 if (popup
.CreatePopupMenu())
1185 long start
= -1, end
= -1;
1186 auto pEdit
= (CRichEditCtrl
*)GetDlgItem(IDC_MSGVIEW
);
1187 pEdit
->GetSel(start
, end
);
1188 // add the 'default' entries
1189 popup
.AppendMenuIcon(WM_COPY
, IDS_SCIEDIT_COPY
, IDI_COPYCLIP
);
1191 popup
.EnableMenuItem(WM_COPY
, MF_BYCOMMAND
| MF_DISABLED
| MF_GRAYED
);
1192 popup
.AppendMenu(MF_SEPARATOR
);
1193 sMenuItemText
.LoadString(IDS_STATUSLIST_CONTEXT_COPYEXT
);
1194 popup
.AppendMenuIcon(EM_SETSEL
, sMenuItemText
, IDI_COPYCLIP
);
1195 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1196 sMenuItemText
.LoadString(IDS_EDIT_NOTES
);
1197 popup
.AppendMenuIcon( CGitLogList::ID_EDITNOTE
, sMenuItemText
, IDI_EDIT
);
1199 int cmd
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, point
.x
, point
.y
, this, 0);
1203 break; // no command selected
1206 pEdit
->SetRedraw(FALSE
);
1207 int oldLine
= pEdit
->GetFirstVisibleLine();
1208 pEdit
->SetSel(0, -1);
1210 pEdit
->SetSel(start
, end
);
1211 int newLine
= pEdit
->GetFirstVisibleLine();
1212 pEdit
->LineScroll(oldLine
- newLine
);
1213 pEdit
->SetRedraw(TRUE
);
1214 pEdit
->RedrawWindow();
1218 ::SendMessage(GetDlgItem(IDC_MSGVIEW
)->GetSafeHwnd(), cmd
, 0, -1);
1220 case CGitLogList::ID_EDITNOTE
:
1221 CAppUtils::EditNote(pRev
);
1222 this->FillLogMessageCtrl(true);
1229 void CLogDlg::OnOK()
1231 // since the log dialog is also used to select revisions for other
1232 // dialogs, we have to do some work before closing this dialog
1233 if (GetFocus() != GetDlgItem(IDOK
))
1234 return; // if the "OK" button doesn't have the focus, do nothing: this prevents closing the dialog when pressing enter
1236 m_LogList
.SafeTerminateAsyncDiffThread();
1237 if (this->IsThreadRunning())
1239 m_LogList
.SafeTerminateThread();
1242 // check that one and only one row is selected
1243 if (m_LogList
.GetSelectedCount() == 1)
1245 // get the selected row
1246 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
1247 int selIndex
= m_LogList
.GetNextSelectedItem(pos
);
1248 if (selIndex
< m_LogList
.m_arShownList
.GetCount())
1250 // all ok, pick up the revision
1251 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(selIndex
));
1253 m_sSelectedHash
= pLogEntry
->m_CommitHash
;
1261 if (!GetDlgItem(IDOK
)->IsWindowVisible() && GetFocus() != GetDlgItem(IDCANCEL
))
1262 return; // the Cancel button works as the OK button. But if the cancel button has not the focus, do nothing.
1266 GetDlgItemText(IDOK
, buttontext
);
1267 temp
.LoadString(IDS_MSGBOX_CANCEL
);
1268 if (temp
.Compare(buttontext
) != 0)
1269 __super::OnOK(); // only exit if the button text matches, and that will match only if the thread isn't running anymore
1270 m_bCancelled
= TRUE
;
1271 m_selectedRevs
.Clear();
1272 m_selectedRevsOneRange
.Clear();
1273 if (m_pNotifyWindow
)
1275 int selIndex
= m_LogList
.GetSelectionMark();
1278 PLOGENTRYDATA pLogEntry
= NULL
;
1279 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
1280 pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(m_LogList
.GetNextSelectedItem(pos
)));
1281 m_selectedRevs
.AddRevision(pLogEntry
->Rev
);
1282 git_revnum_t lowerRev
= pLogEntry
->Rev
;
1283 git_revnum_t higherRev
= lowerRev
;
1286 pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(m_LogList
.GetNextSelectedItem(pos
)));
1287 git_revnum_t rev
= pLogEntry
->Rev
;
1288 m_selectedRevs
.AddRevision(pLogEntry
->Rev
);
1291 if (higherRev
< rev
)
1294 if (m_sFilterText
.IsEmpty() && m_nSortColumn
== 0 && IsSelectionContinuous())
1296 m_selectedRevsOneRange
.AddRevRange(lowerRev
, higherRev
);
1298 BOOL bSentMessage
= FALSE
;
1299 if (m_LogList
.GetSelectedCount() == 1)
1301 // if only one revision is selected, check if the path/url with which the dialog was started
1302 // was directly affected in that revision. If it was, then check if our path was copied from somewhere.
1303 // if it was copied, use the copy from revision as lowerRev
1304 if ((pLogEntry
)&&(pLogEntry
->pArChangedPaths
)&&(lowerRev
== higherRev
))
1306 CString sUrl
= m_path
.GetGitPathString();
1307 if (!m_path
.IsUrl())
1309 sUrl
= GetURLFromPath(m_path
);
1311 sUrl
= sUrl
.Mid(m_sRepositoryRoot
.GetLength());
1312 for (int cp
= 0; cp
< pLogEntry
->pArChangedPaths
->GetCount(); ++cp
)
1314 LogChangedPath
* pData
= pLogEntry
->pArChangedPaths
->SafeGetAt(cp
);
1317 if (sUrl
.Compare(pData
->sPath
) == 0)
1319 if (!pData
->sCopyFromPath
.IsEmpty())
1321 lowerRev
= pData
->lCopyFromRev
;
1322 m_pNotifyWindow
->SendMessage(WM_REVSELECTED
, m_wParam
& (MERGE_REVSELECTSTART
), lowerRev
);
1323 m_pNotifyWindow
->SendMessage(WM_REVSELECTED
, m_wParam
& (MERGE_REVSELECTEND
), higherRev
);
1324 m_pNotifyWindow
->SendMessage(WM_REVLIST
, m_selectedRevs
.GetCount(), (LPARAM
)&m_selectedRevs
);
1325 bSentMessage
= TRUE
;
1332 if ( !bSentMessage
)
1334 m_pNotifyWindow
->SendMessage(WM_REVSELECTED
, m_wParam
& (MERGE_REVSELECTSTART
| MERGE_REVSELECTMINUSONE
), lowerRev
);
1335 m_pNotifyWindow
->SendMessage(WM_REVSELECTED
, m_wParam
& (MERGE_REVSELECTEND
| MERGE_REVSELECTMINUSONE
), higherRev
);
1336 m_pNotifyWindow
->SendMessage(WM_REVLIST
, m_selectedRevs
.GetCount(), (LPARAM
)&m_selectedRevs
);
1337 if (m_selectedRevsOneRange
.GetCount())
1338 m_pNotifyWindow
->SendMessage(WM_REVLISTONERANGE
, 0, (LPARAM
)&m_selectedRevsOneRange
);
1343 CRegDWORD reg
= CRegDWORD(_T("Software\\TortoiseGit\\ShowAllEntry"));
1348 void CLogDlg::DoDiffFromLog(INT_PTR selIndex
, GitRev
* rev1
, GitRev
* rev2
, bool /*blame*/, bool /*unified*/)
1350 DialogEnableWindow(IDOK
, FALSE
);
1351 // SetPromptApp(&theApp);
1352 theApp
.DoWaitCursor(1);
1355 GetTempPath(temppath
);
1358 file1
.Format(_T("%s%s_%s%s"),
1360 (*m_currentChangedArray
)[selIndex
].GetBaseFilename(),
1361 rev1
->m_CommitHash
.ToString().Left(g_Git
.GetShortHASHLength()),
1362 (*m_currentChangedArray
)[selIndex
].GetFileExtension());
1365 file2
.Format(_T("%s\\%s_%s%s"),
1367 (*m_currentChangedArray
)[selIndex
].GetBaseFilename(),
1368 rev2
->m_CommitHash
.ToString().Left(g_Git
.GetShortHASHLength()),
1369 (*m_currentChangedArray
)[selIndex
].GetFileExtension());
1372 CTGitPath
&path
= (CTGitPath
&)(*m_currentChangedArray
)[selIndex
];
1374 if (g_Git
.GetOneFile(rev1
->m_CommitHash
.ToString(), path
, file1
))
1377 out
.Format(IDS_STATUSLIST_CHECKOUTFILEFAILED
, path
.GetGitPathString(), rev1
->m_CommitHash
.ToString(), file1
);
1378 CMessageBox::Show(nullptr, g_Git
.GetGitLastErr(out
, CGit::GIT_CMD_GETONEFILE
), _T("TortoiseGit"), MB_OK
);
1379 theApp
.DoWaitCursor(-1);
1383 if (g_Git
.GetOneFile(rev2
->m_CommitHash
.ToString(), path
, file2
))
1386 out
.Format(IDS_STATUSLIST_CHECKOUTFILEFAILED
, path
.GetGitPathString(), rev2
->m_CommitHash
.ToString(), file2
);
1387 CMessageBox::Show(nullptr, g_Git
.GetGitLastErr(out
, CGit::GIT_CMD_GETONEFILE
), _T("TortoiseGit"), MB_OK
);
1388 theApp
.DoWaitCursor(-1);
1393 CAppUtils::DiffFlags flags
;
1394 CAppUtils::StartExtDiff(file1
,file2
,_T("A"),_T("B"),
1395 g_Git
.CombinePath(path
), g_Git
.CombinePath(path
),
1396 rev1
->m_CommitHash
.ToString(), rev2
->m_CommitHash
.ToString(),
1399 theApp
.DoWaitCursor(-1);
1403 BOOL
CLogDlg::PreTranslateMessage(MSG
* pMsg
)
1405 // Skip Ctrl-C when copying text out of the log message or search filter
1406 bool bSkipAccelerator
= (pMsg
->message
== WM_KEYDOWN
&& (pMsg
->wParam
== 'C' || pMsg
->wParam
== VK_INSERT
) && (GetFocus() == GetDlgItem(IDC_MSGVIEW
) || GetFocus() == GetDlgItem(IDC_SEARCHEDIT
)) && GetKeyState(VK_CONTROL
) & 0x8000);
1407 if (pMsg
->message
== WM_KEYDOWN
&& pMsg
->wParam
=='\r')
1409 if (GetFocus()==GetDlgItem(IDC_LOGLIST
))
1411 if (CRegDWORD(_T("Software\\TortoiseGit\\DiffByDoubleClickInLog"), FALSE
))
1413 m_LogList
.DiffSelectedRevWithPrevious();
1417 if (GetFocus() == GetDlgItem(IDC_SEARCHEDIT
))
1419 KillTimer(LOGFILTER_TIMER
);
1421 m_LogList
.Refresh(FALSE
);
1422 FillLogMessageCtrl(false);
1425 if (m_hAccel
&& !bSkipAccelerator
)
1427 int ret
= TranslateAccelerator(m_hWnd
, m_hAccel
, pMsg
);
1432 if(::IsWindow(m_tooltips
.m_hWnd
))
1433 m_tooltips
.RelayEvent(pMsg
);
1434 return __super::PreTranslateMessage(pMsg
);
1438 BOOL
CLogDlg::OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
)
1440 //if (this->IsThreadRunning())
1441 if(m_LogList
.m_bNoDispUpdates
)
1443 // only show the wait cursor over the list control
1445 ((pWnd
== GetDlgItem(IDC_LOGLIST
))||
1446 (pWnd
== GetDlgItem(IDC_MSGVIEW
))||
1447 (pWnd
== GetDlgItem(IDC_LOGMSG
))))
1449 HCURSOR hCur
= LoadCursor(NULL
, MAKEINTRESOURCE(IDC_WAIT
));
1454 if ((pWnd
) && (pWnd
== GetDlgItem(IDC_MSGVIEW
)))
1455 return CResizableStandAloneDialog::OnSetCursor(pWnd
, nHitTest
, message
);
1457 HCURSOR hCur
= LoadCursor(NULL
, MAKEINTRESOURCE(IDC_ARROW
));
1459 return CResizableStandAloneDialog::OnSetCursor(pWnd
, nHitTest
, message
);
1462 void CLogDlg::OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
1464 LPNMLISTVIEW pNMLV
= reinterpret_cast<LPNMLISTVIEW
>(pNMHDR
);
1466 //if (this->IsThreadRunning())
1467 if(m_LogList
.m_bNoDispUpdates
)
1469 if (pNMLV
->iItem
>= 0)
1471 this->m_LogList
.m_nSearchIndex
= pNMLV
->iItem
;
1472 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(pNMLV
->iItem
));
1473 if (pLogEntry
== nullptr)
1475 m_LogList
.m_lastSelectedHash
= pLogEntry
->m_CommitHash
;
1476 if (pNMLV
->iSubItem
!= 0)
1478 if ((pNMLV
->iItem
== m_LogList
.m_arShownList
.GetCount()))
1480 // remove the selected state
1481 if (pNMLV
->uChanged
& LVIF_STATE
)
1483 m_LogList
.SetItemState(pNMLV
->iItem
, 0, LVIS_SELECTED
);
1484 FillLogMessageCtrl();
1486 UpdateLogInfoLabel();
1490 if (pNMLV
->uChanged
& LVIF_STATE
)
1492 FillLogMessageCtrl();
1498 m_LogList
.m_lastSelectedHash
.Empty();
1499 FillLogMessageCtrl();
1503 UpdateLogInfoLabel();
1506 void CLogDlg::OnLvnItemchangedLogmsg(NMHDR
* /*pNMHDR*/, LRESULT
* /*pResult*/)
1508 UpdateLogInfoLabel();
1511 void CLogDlg::OnEnLinkMsgview(NMHDR
*pNMHDR
, LRESULT
*pResult
)
1513 ENLINK
*pEnLink
= reinterpret_cast<ENLINK
*>(pNMHDR
);
1514 if (pEnLink
->msg
== WM_LBUTTONUP
)
1517 GetDlgItemText(IDC_MSGVIEW
, msg
);
1518 msg
.Replace(_T("\r\n"), _T("\n"));
1519 url
= msg
.Mid(pEnLink
->chrg
.cpMin
, pEnLink
->chrg
.cpMax
-pEnLink
->chrg
.cpMin
);
1520 auto findResult
= m_LogList
.m_ProjectProperties
.FindBugIDPositions(msg
);
1521 if (std::find_if(findResult
.begin(), findResult
.end(),
1522 [=] (const CHARRANGE
&cr
) -> bool { return cr
.cpMin
== pEnLink
->chrg
.cpMin
&& cr
.cpMax
== pEnLink
->chrg
.cpMax
; }
1523 ) != findResult
.end())
1525 url
= m_LogList
.m_ProjectProperties
.GetBugIDUrl(url
);
1526 url
= GetAbsoluteUrlFromRelativeUrl(url
);
1528 if (::PathIsURL(url
))
1529 ShellExecute(this->m_hWnd
, _T("open"), url
, NULL
, NULL
, SW_SHOWDEFAULT
);
1533 if (LookLikeGitHash(url
, pos
))
1536 for (int i
= 0; i
< m_LogList
.m_arShownList
.GetCount(); ++i
)
1538 GitRev
*rev
= (GitRev
*)m_LogList
.m_arShownList
.SafeGetAt(i
);
1540 if (rev
->m_CommitHash
.ToString().Left(url
.GetLength()) == url
)
1542 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
1545 int index
= m_LogList
.GetNextSelectedItem(pos
);
1547 m_LogList
.SetItemState(index
, 0, LVIS_SELECTED
);
1549 m_LogList
.SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
1550 m_LogList
.EnsureVisible(i
, FALSE
);
1551 m_LogList
.SetSelectionMark(i
);
1553 PostMessage(WM_TGIT_REFRESH_SELECTION
, 0, 0);
1559 CMessageBox::ShowCheck(GetSafeHwnd(), IDS_PROC_LOG_JUMPNOTFOUND
, IDS_APPNAME
, 1, IDI_INFORMATION
, IDS_OKBUTTON
, 0, 0, _T("NoJumpNotFoundWarning"), IDS_MSGBOX_DONOTSHOWAGAIN
);
1566 void CLogDlg::OnBnClickedStatbutton()
1568 if (this->IsThreadRunning())
1570 if (m_LogList
.m_arShownList
.IsEmpty() || m_LogList
.m_arShownList
.GetCount() == 1 && m_LogList
.m_bShowWC
)
1571 return; // nothing or just the working copy changes are shown, so no statistics.
1572 // the statistics dialog expects the log entries to be sorted by date
1573 SortByColumn(3, false);
1576 m_LogList
.RecalculateShownList(&dlg
.m_ShowList
);
1578 dlg
.m_path
= m_orgPath
;
1580 // restore the previous sorting
1581 SortByColumn(m_nSortColumn
, m_bAscending
);
1582 OnTimer(LOGFILTER_TIMER
);
1585 void CLogDlg::MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
)
1587 CRect rcWndPicAuthor
, rcWndMsgView
;
1588 pWndRef
->GetWindowRect(rcWndMsgView
);
1589 ScreenToClient(rcWndMsgView
);
1590 pWndTarget
->GetWindowRect(rcWndPicAuthor
);
1591 ScreenToClient(rcWndPicAuthor
);
1592 int diff
= rcWndMsgView
.top
- rcWndPicAuthor
.top
;
1593 rcWndPicAuthor
.top
+= diff
;
1594 rcWndPicAuthor
.bottom
+= diff
;
1595 pWndTarget
->MoveWindow(rcWndPicAuthor
);
1598 void CLogDlg::DoSizeV1(int delta
)
1601 RemoveAnchor(IDC_LOGLIST
);
1602 RemoveAnchor(IDC_SPLITTERTOP
);
1603 RemoveAnchor(IDC_MSGVIEW
);
1604 RemoveAnchor(IDC_PIC_AUTHOR
);
1605 RemoveAnchor(IDC_SPLITTERBOTTOM
);
1606 RemoveAnchor(IDC_LOGMSG
);
1607 CSplitterControl::ChangeHeight(&m_LogList
, delta
, CW_TOPALIGN
);
1608 CSplitterControl::ChangeHeight(GetDlgItem(IDC_MSGVIEW
), -delta
, CW_BOTTOMALIGN
);
1609 MoveToSameTop(GetDlgItem(IDC_MSGVIEW
), GetDlgItem(IDC_PIC_AUTHOR
));
1610 AddAnchor(IDC_LOGLIST
, TOP_LEFT
, TOP_RIGHT
);
1611 AddAnchor(IDC_SPLITTERTOP
, TOP_LEFT
, TOP_RIGHT
);
1612 AddAnchor(IDC_MSGVIEW
, TOP_LEFT
, BOTTOM_RIGHT
);
1613 AddAnchor(IDC_PIC_AUTHOR
, TOP_RIGHT
);
1614 AddAnchor(IDC_SPLITTERBOTTOM
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
1615 AddAnchor(IDC_LOGMSG
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
1619 m_LogList
.Invalidate();
1620 GetDlgItem(IDC_MSGVIEW
)->Invalidate();
1621 m_gravatar
.Invalidate();
1625 void CLogDlg::DoSizeV2(int delta
)
1628 RemoveAnchor(IDC_LOGLIST
);
1629 RemoveAnchor(IDC_SPLITTERTOP
);
1630 RemoveAnchor(IDC_MSGVIEW
);
1631 RemoveAnchor(IDC_PIC_AUTHOR
);
1632 RemoveAnchor(IDC_SPLITTERBOTTOM
);
1633 RemoveAnchor(IDC_LOGMSG
);
1634 CSplitterControl::ChangeHeight(GetDlgItem(IDC_MSGVIEW
), delta
, CW_TOPALIGN
);
1635 CSplitterControl::ChangeHeight(&m_ChangedFileListCtrl
, -delta
, CW_BOTTOMALIGN
);
1636 AddAnchor(IDC_LOGLIST
, TOP_LEFT
, TOP_RIGHT
);
1637 AddAnchor(IDC_SPLITTERTOP
, TOP_LEFT
, TOP_RIGHT
);
1638 AddAnchor(IDC_MSGVIEW
, TOP_LEFT
, BOTTOM_RIGHT
);
1639 AddAnchor(IDC_PIC_AUTHOR
, TOP_RIGHT
);
1640 AddAnchor(IDC_SPLITTERBOTTOM
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
1641 AddAnchor(IDC_LOGMSG
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
1645 GetDlgItem(IDC_MSGVIEW
)->Invalidate();
1646 m_ChangedFileListCtrl
.Invalidate();
1647 m_gravatar
.Invalidate();
1651 void CLogDlg::AdjustMinSize()
1653 // adjust the minimum size of the dialog to prevent the resizing from
1654 // moving the list control too far down.
1655 CRect rcChgListView
;
1656 m_ChangedFileListCtrl
.GetClientRect(rcChgListView
);
1658 m_LogList
.GetClientRect(rcLogList
);
1660 SetMinTrackSize(CSize(m_DlgOrigRect
.Width(),
1661 m_DlgOrigRect
.Height()-m_ChgOrigRect
.Height()-m_LogListOrigRect
.Height()-m_MsgViewOrigRect
.Height()
1662 +rcChgListView
.Height()+rcLogList
.Height()+60));
1665 LRESULT
CLogDlg::DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
)
1669 if (wParam
== IDC_SPLITTERTOP
)
1671 SPC_NMHDR
* pHdr
= (SPC_NMHDR
*) lParam
;
1672 DoSizeV1(pHdr
->delta
);
1674 else if (wParam
== IDC_SPLITTERBOTTOM
)
1676 SPC_NMHDR
* pHdr
= (SPC_NMHDR
*) lParam
;
1677 DoSizeV2(pHdr
->delta
);
1682 return CResizableDialog::DefWindowProc(message
, wParam
, lParam
);
1685 void CLogDlg::SetSplitterRange()
1687 if ((m_LogList
)&&(m_ChangedFileListCtrl
))
1690 m_LogList
.GetWindowRect(rcTop
);
1691 ScreenToClient(rcTop
);
1693 GetDlgItem(IDC_MSGVIEW
)->GetWindowRect(rcMiddle
);
1694 ScreenToClient(rcMiddle
);
1695 m_wndSplitter1
.SetRange(rcTop
.top
+30, rcMiddle
.bottom
-20);
1697 m_ChangedFileListCtrl
.GetWindowRect(rcBottom
);
1698 ScreenToClient(rcBottom
);
1699 m_wndSplitter2
.SetRange(rcMiddle
.top
+30, rcBottom
.bottom
-20);
1703 LRESULT
CLogDlg::OnClickedInfoIcon(WPARAM
/*wParam*/, LPARAM lParam
)
1705 // FIXME: x64 version would get this function called with unexpected parameters.
1709 RECT
* rect
= (LPRECT
)lParam
;
1712 point
= CPoint(rect
->left
, rect
->bottom
);
1713 #define LOGMENUFLAGS(x) (MF_STRING | MF_ENABLED | (m_LogList.m_SelectedFilters & x ? MF_CHECKED : MF_UNCHECKED))
1715 if (popup
.CreatePopupMenu())
1717 temp
.LoadString(IDS_LOG_FILTER_SUBJECT
);
1718 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_SUBJECT
), LOGFILTER_SUBJECT
, temp
);
1720 temp
.LoadString(IDS_LOG_FILTER_MESSAGES
);
1721 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_MESSAGES
), LOGFILTER_MESSAGES
, temp
);
1723 temp
.LoadString(IDS_LOG_FILTER_PATHS
);
1724 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_PATHS
), LOGFILTER_PATHS
, temp
);
1726 temp
.LoadString(IDS_LOG_FILTER_AUTHORS
);
1727 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_AUTHORS
), LOGFILTER_AUTHORS
, temp
);
1729 temp
.LoadString(IDS_LOG_FILTER_EMAILS
);
1730 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_EMAILS
), LOGFILTER_EMAILS
, temp
);
1732 temp
.LoadString(IDS_LOG_FILTER_REVS
);
1733 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_REVS
), LOGFILTER_REVS
, temp
);
1735 temp
.LoadString(IDS_LOG_FILTER_REFNAME
);
1736 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_REFNAME
), LOGFILTER_REFNAME
, temp
);
1738 if (m_LogList
.m_bShowBugtraqColumn
== TRUE
) {
1739 temp
.LoadString(IDS_LOG_FILTER_BUGIDS
);
1740 popup
.AppendMenu(LOGMENUFLAGS(LOGFILTER_BUGID
), LOGFILTER_BUGID
, temp
);
1743 temp
.LoadString(IDS_LOG_FILTER_TOGGLE
);
1744 popup
.AppendMenu(MF_STRING
| MF_ENABLED
, LOGFILTER_TOGGLE
, temp
);
1746 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1748 temp
.LoadString(IDS_LOG_FILTER_REGEX
);
1749 popup
.AppendMenu(MF_STRING
| MF_ENABLED
| (m_bFilterWithRegex
? MF_CHECKED
: MF_UNCHECKED
), LOGFILTER_REGEX
, temp
);
1752 int selection
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, point
.x
, point
.y
, this, 0);
1756 if (selection
== LOGFILTER_REGEX
)
1758 m_bFilterWithRegex
= !m_bFilterWithRegex
;
1759 CRegDWORD b
= CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE
);
1760 b
= m_bFilterWithRegex
;
1761 m_LogList
.m_bFilterWithRegex
= m_bFilterWithRegex
;
1763 CheckRegexpTooltip();
1765 else if (selection
== LOGFILTER_TOGGLE
)
1767 m_LogList
.m_SelectedFilters
= (~m_LogList
.m_SelectedFilters
) & LOGFILTER_ALL
;
1772 m_LogList
.m_SelectedFilters
^= selection
;
1775 // Reload only if a search text is entered
1776 if (m_LogList
.HasFilterText())
1777 SetTimer(LOGFILTER_TIMER
, 1000, NULL
);
1783 LRESULT
CLogDlg::OnClickedCancelFilter(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
1786 KillTimer(LOGFILTER_TIMER
);
1788 m_LogList
.m_sFilterText
.Empty();
1790 theApp
.DoWaitCursor(1);
1791 CStoreSelection
storeselection(this);
1792 FillLogMessageCtrl(false);
1794 m_LogList
.RemoveFilter();
1799 m_LogList
.GetTimeRange(begin
,end
);
1800 m_DateFrom
.SetTime(&begin
);
1801 m_DateTo
.SetTime(&end
);
1803 theApp
.DoWaitCursor(-1);
1804 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_HIDE
);
1805 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_SHOW
);
1806 GetDlgItem(IDC_SEARCHEDIT
)->SetFocus();
1807 UpdateLogInfoLabel();
1813 void CLogDlg::SetFilterCueText()
1815 CString
temp(MAKEINTRESOURCE(IDS_LOG_FILTER_BY
));
1818 if (m_LogList
.m_SelectedFilters
& LOGFILTER_SUBJECT
)
1820 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_SUBJECT
));
1823 if (m_LogList
.m_SelectedFilters
& LOGFILTER_MESSAGES
)
1825 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1827 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_MESSAGES
));
1830 if (m_LogList
.m_SelectedFilters
& LOGFILTER_PATHS
)
1832 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1834 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_PATHS
));
1837 if (m_LogList
.m_SelectedFilters
& LOGFILTER_AUTHORS
)
1839 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1841 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_AUTHORS
));
1844 if (m_LogList
.m_SelectedFilters
& LOGFILTER_EMAILS
)
1846 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1848 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_EMAILS
));
1851 if (m_LogList
.m_SelectedFilters
& LOGFILTER_REVS
)
1853 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1855 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_REVS
));
1858 if (m_LogList
.m_SelectedFilters
& LOGFILTER_REFNAME
)
1860 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1862 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_REFNAME
));
1865 if (m_LogList
.m_SelectedFilters
& LOGFILTER_BUGID
)
1867 if (temp
.ReverseFind(_T(' ')) != temp
.GetLength() - 1)
1869 temp
+= CString(MAKEINTRESOURCE(IDS_LOG_FILTER_BUGIDS
));
1872 // to make the cue banner text appear more to the right of the edit control
1873 temp
= _T(" ")+temp
;
1874 m_cFilter
.SetCueBanner(temp
.TrimRight());
1877 bool CLogDlg::Validate(LPCTSTR string
)
1879 if (!m_bFilterWithRegex
)
1881 std::tr1::wregex pat
;
1882 return m_LogList
.ValidateRegexp(string
, pat
, false);
1886 void CLogDlg::OnTimer(UINT_PTR nIDEvent
)
1888 if (nIDEvent
== LOGFTIME_TIMER
)
1890 KillTimer(LOGFTIME_TIMER
);
1892 m_LogList
.Refresh(FALSE
);
1893 FillLogMessageCtrl(false);
1895 else if (nIDEvent
== LOG_FILLPATCHVTIMER
)
1899 else if (nIDEvent
== LOGFILTER_TIMER
)
1901 KillTimer(LOGFILTER_TIMER
);
1903 m_LogList
.Refresh(FALSE
);
1904 FillLogMessageCtrl(false);
1907 /* we will use git built-in grep to filter log */
1908 if (this->IsThreadRunning())
1910 // thread still running! So just restart the timer.
1911 SetTimer(LOGFILTER_TIMER
, 1000, NULL
);
1914 CWnd
* focusWnd
= GetFocus();
1915 bool bSetFocusToFilterControl
= ((focusWnd
!= GetDlgItem(IDC_DATEFROM
))&&(focusWnd
!= GetDlgItem(IDC_DATETO
))
1916 && (focusWnd
!= GetDlgItem(IDC_LOGLIST
)));
1917 if (m_LogList
.m_sFilterText
.IsEmpty())
1919 DialogEnableWindow(IDC_STATBUTTON
, !(((this->IsThreadRunning())||(m_LogList
.m_arShownList
.IsEmpty()))));
1920 // do not return here!
1921 // we also need to run the filter if the filter text is empty:
1922 // 1. to clear an existing filter
1923 // 2. to rebuild the m_arShownList after sorting
1925 theApp
.DoWaitCursor(1);
1926 CStoreSelection
storeselection(this);
1927 KillTimer(LOGFILTER_TIMER
);
1928 FillLogMessageCtrl(false);
1930 // now start filter the log list
1931 m_LogList
.StartFilter();
1933 if ( m_LogList
.GetItemCount()==1 )
1935 m_LogList
.SetSelectionMark(0);
1936 m_LogList
.SetItemState(0, LVIS_SELECTED
, LVIS_SELECTED
);
1938 theApp
.DoWaitCursor(-1);
1939 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_HIDE
);
1940 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_SHOW
);
1941 if (bSetFocusToFilterControl
)
1942 GetDlgItem(IDC_SEARCHEDIT
)->SetFocus();
1943 UpdateLogInfoLabel();
1945 } // if (nIDEvent == LOGFILTER_TIMER)
1946 else if (nIDEvent
== LOG_HEADER_ORDER_TIMER
)
1948 KillTimer(LOG_HEADER_ORDER_TIMER
);
1949 CLogOrdering orderDlg
;
1950 if (orderDlg
.DoModal() == IDOK
)
1953 DialogEnableWindow(IDC_STATBUTTON
, !(((this->IsThreadRunning())||(m_LogList
.m_arShownList
.IsEmpty() || m_LogList
.m_arShownList
.GetCount() == 1 && m_LogList
.m_bShowWC
))));
1954 __super::OnTimer(nIDEvent
);
1957 void CLogDlg::OnDtnDatetimechangeDateto(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
1962 m_DateTo
.GetTime(_time
);
1964 CTime
time(_time
.GetYear(), _time
.GetMonth(), _time
.GetDay(), 23, 59, 59);
1965 if (time
.GetTime() != m_LogList
.m_To
)
1967 m_LogList
.m_To
= (DWORD
)time
.GetTime();
1968 SetTimer(LOGFTIME_TIMER
, 10, NULL
);
1973 CMessageBox::Show(NULL
,_T("Invalidate Parameter"),_T("TortoiseGit"),MB_OK
|MB_ICONERROR
);
1979 void CLogDlg::OnDtnDatetimechangeDatefrom(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
1985 m_DateFrom
.GetTime(_time
);
1987 CTime
time(_time
.GetYear(), _time
.GetMonth(), _time
.GetDay(), 0, 0, 0);
1988 if (time
.GetTime() != m_LogList
.m_From
)
1990 m_LogList
.m_From
= (DWORD
)time
.GetTime();
1991 SetTimer(LOGFTIME_TIMER
, 10, NULL
);
1996 CMessageBox::Show(NULL
,_T("Invalidate Parameter"),_T("TortoiseGit"),MB_OK
|MB_ICONERROR
);
2002 void CLogDlg::OnCbnSelchangeJumpType()
2004 // reserved for future use
2007 void CLogDlg::OnBnClickedJumpUp()
2009 int sel
= m_JumpType
.GetCurSel();
2010 if (sel
< 0) return;
2011 JumpType jumpType
= (JumpType
)sel
;
2016 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2019 index
= m_LogList
.GetNextSelectedItem(pos
);
2020 if (index
== 0) return;
2022 GitRev
* data
= (GitRev
*)m_LogList
.m_arShownList
.SafeGetAt(index
);
2023 if (jumpType
== JumpType_AuthorEmail
)
2024 strValue
= data
->GetAuthorEmail();
2025 else if (jumpType
== JumpType_CommitterEmail
)
2026 strValue
= data
->GetCommitterEmail();
2027 else if (jumpType
== JumpType_Parent1
)
2028 hashValue
= data
->m_CommitHash
;
2029 else if (jumpType
== JumpType_Parent2
)
2030 hashValue
= data
->m_CommitHash
;
2031 else if (jumpType
== JumpType_TagFF
)
2032 hashValue
= data
->m_CommitHash
;
2033 else if (jumpType
== JumpType_BranchFF
)
2034 hashValue
= data
->m_CommitHash
;
2036 m_LogList
.SetItemState(index
, 0, LVIS_SELECTED
);
2043 index
= m_LogList
.GetNextSelectedItem(pos
);
2044 m_LogList
.SetItemState(index
, 0, LVIS_SELECTED
);
2046 m_LogList
.SetSelectionMark(-1);
2048 for (int i
= index
- 1; i
>= 0; i
--)
2051 GitRev
* data
= (GitRev
*)m_LogList
.m_arShownList
.SafeGetAt(i
);
2052 if (jumpType
== JumpType_AuthorEmail
)
2053 found
= strValue
== data
->GetAuthorEmail();
2054 else if (jumpType
== JumpType_CommitterEmail
)
2055 found
= strValue
== data
->GetCommitterEmail();
2056 else if (jumpType
== JumpType_MergePoint
)
2057 found
= data
->ParentsCount() > 1;
2058 else if (jumpType
== JumpType_Parent1
)
2060 if (data
->m_ParentHash
.size() > 0)
2061 found
= data
->m_ParentHash
[0] == hashValue
;
2063 else if (jumpType
== JumpType_Parent2
)
2065 if (data
->m_ParentHash
.size() > 1)
2066 found
= data
->m_ParentHash
[1] == hashValue
;
2068 else if (jumpType
== JumpType_Tag
|| jumpType
== JumpType_TagFF
)
2070 STRING_VECTOR refList
= m_LogList
.m_HashMap
[data
->m_CommitHash
];
2071 for (size_t j
= 0; j
< refList
.size(); ++j
)
2073 if (refList
[j
].Left(10) == _T("refs/tags/"))
2080 if (found
&& jumpType
== JumpType_TagFF
)
2081 found
= g_Git
.IsFastForward(hashValue
, data
->m_CommitHash
);
2083 else if (jumpType
== JumpType_Branch
|| jumpType
== JumpType_BranchFF
)
2085 STRING_VECTOR refList
= m_LogList
.m_HashMap
[data
->m_CommitHash
];
2086 for (size_t j
= 0; j
< refList
.size(); ++j
)
2088 if (refList
[j
].Left(11) == _T("refs/heads/") || refList
[j
].Left(13) == _T("refs/remotes/"))
2095 if (found
&& jumpType
== JumpType_BranchFF
)
2096 found
= g_Git
.IsFastForward(hashValue
, data
->m_CommitHash
);
2101 m_LogList
.SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
2102 m_LogList
.EnsureVisible(i
, FALSE
);
2103 m_LogList
.SetSelectionMark(i
);
2108 CMessageBox::ShowCheck(GetSafeHwnd(), IDS_PROC_LOG_JUMPNOTFOUND
, IDS_APPNAME
, 1, IDI_INFORMATION
, IDS_OKBUTTON
, 0, 0, _T("NoJumpNotFoundWarning"), IDS_MSGBOX_DONOTSHOWAGAIN
);
2111 void CLogDlg::OnBnClickedJumpDown()
2113 int jumpType
= m_JumpType
.GetCurSel();
2114 if (jumpType
< 0) return;
2119 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2122 index
= m_LogList
.GetNextSelectedItem(pos
);
2123 if (index
== 0) return;
2125 GitRev
* data
= (GitRev
*)m_LogList
.m_arShownList
.SafeGetAt(index
);
2126 if (jumpType
== JumpType_AuthorEmail
)
2127 strValue
= data
->GetAuthorEmail();
2128 else if (jumpType
== JumpType_CommitterEmail
)
2129 strValue
= data
->GetCommitterEmail();
2130 else if (jumpType
== JumpType_Parent1
)
2132 if (data
->m_ParentHash
.size() > 0)
2133 hashValue
= data
->m_ParentHash
.at(0);
2137 else if (jumpType
== JumpType_Parent2
)
2139 if (data
->m_ParentHash
.size() > 1)
2140 hashValue
= data
->m_ParentHash
.at(1);
2144 else if (jumpType
== JumpType_TagFF
)
2145 hashValue
= data
->m_CommitHash
;
2146 else if (jumpType
== JumpType_BranchFF
)
2147 hashValue
= data
->m_CommitHash
;
2149 m_LogList
.SetItemState(index
, 0, LVIS_SELECTED
);
2156 index
= m_LogList
.GetNextSelectedItem(pos
);
2157 m_LogList
.SetItemState(index
, 0, LVIS_SELECTED
);
2159 m_LogList
.SetSelectionMark(-1);
2161 for (int i
= index
+ 1; i
< m_LogList
.GetItemCount(); ++i
)
2164 GitRev
* data
= (GitRev
*)m_LogList
.m_arShownList
.SafeGetAt(i
);
2165 if (jumpType
== JumpType_AuthorEmail
)
2166 found
= strValue
== data
->GetAuthorEmail();
2167 else if (jumpType
== JumpType_CommitterEmail
)
2168 found
= strValue
== data
->GetCommitterEmail();
2169 else if (jumpType
== JumpType_MergePoint
)
2170 found
= data
->ParentsCount() > 1;
2171 else if (jumpType
== JumpType_Parent1
)
2172 found
= data
->m_CommitHash
== hashValue
;
2173 else if (jumpType
== JumpType_Parent2
)
2174 found
= data
->m_CommitHash
== hashValue
;
2175 else if (jumpType
== JumpType_Tag
|| jumpType
== JumpType_TagFF
)
2177 STRING_VECTOR refList
= m_LogList
.m_HashMap
[data
->m_CommitHash
];
2178 for (size_t j
= 0; j
< refList
.size(); ++j
)
2180 if (refList
[j
].Left(10) == _T("refs/tags/"))
2187 if (found
&& jumpType
== JumpType_TagFF
)
2188 found
= g_Git
.IsFastForward(data
->m_CommitHash
, hashValue
);
2190 else if (jumpType
== JumpType_Branch
|| jumpType
== JumpType_BranchFF
)
2192 STRING_VECTOR refList
= m_LogList
.m_HashMap
[data
->m_CommitHash
];
2193 for (size_t j
= 0; j
< refList
.size(); ++j
)
2195 if (refList
[j
].Left(11) == _T("refs/heads/") || refList
[j
].Left(13) == _T("refs/remotes/"))
2202 if (found
&& jumpType
== JumpType_BranchFF
)
2203 found
= g_Git
.IsFastForward(data
->m_CommitHash
, hashValue
);
2208 m_LogList
.SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
2209 m_LogList
.EnsureVisible(i
, FALSE
);
2210 m_LogList
.SetSelectionMark(i
);
2215 CMessageBox::ShowCheck(GetSafeHwnd(), IDS_PROC_LOG_JUMPNOTFOUND
, IDS_APPNAME
, 1, IDI_INFORMATION
, IDS_OKBUTTON
, 0, 0, _T("NoJumpNotFoundWarning"), IDS_MSGBOX_DONOTSHOWAGAIN
);
2218 CTGitPathList
CLogDlg::GetChangedPathsFromSelectedRevisions(bool /*bRelativePaths*/ /* = false */, bool /*bUseFilter*/ /* = true */)
2220 CTGitPathList pathList
;
2223 if (m_sRepositoryRoot
.IsEmpty() && (bRelativePaths
== false))
2225 m_sRepositoryRoot
= GetRepositoryRoot(m_path
);
2227 if (m_sRepositoryRoot
.IsEmpty() && (bRelativePaths
== false))
2230 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2235 int nextpos
= m_LogList
.GetNextSelectedItem(pos
);
2236 if (nextpos
>= m_arShownList
.GetCount())
2238 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(nextpos
));
2239 LogChangedPathArray
* cpatharray
= pLogEntry
->pArChangedPaths
;
2240 for (INT_PTR cpPathIndex
= 0; cpPathIndex
<cpatharray
->GetCount(); ++cpPathIndex
)
2242 LogChangedPath
* cpath
= cpatharray
->SafeGetAt(cpPathIndex
);
2246 if (!bRelativePaths
)
2247 path
.SetFromGit(m_sRepositoryRoot
);
2248 path
.AppendPathString(cpath
->sPath
);
2250 ((m_cHidePaths
.GetState() & 0x0003)!=BST_CHECKED
)||
2251 (cpath
->sPath
.Left(m_sRelativeRoot
.GetLength()).Compare(m_sRelativeRoot
)==0))
2252 pathList
.AddPath(path
);
2257 pathList
.RemoveDuplicates();
2262 void CLogDlg::SortByColumn(int /*nSortColumn*/, bool /*bAscending*/)
2270 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscRevSort());
2272 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescRevSort());
2278 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscActionSort());
2280 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescActionSort());
2286 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscAuthorSort());
2288 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescAuthorSort());
2294 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscDateSort());
2296 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescDateSort());
2299 case 4: // Message or bug id
2300 if (m_bShowBugtraqColumn
)
2303 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscBugIDSort());
2305 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescBugIDSort());
2308 // fall through here
2312 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::AscMessageSort());
2314 std::sort(m_logEntries
.begin(), m_logEntries
.end(), CLogDataVector::DescMessageSort());
2324 void CLogDlg::OnLvnColumnclick(NMHDR
*pNMHDR
, LRESULT
*pResult
)
2326 if (this->IsThreadRunning())
2327 return; //no sorting while the arrays are filled
2329 LPNMLISTVIEW pNMLV
= reinterpret_cast<LPNMLISTVIEW
>(pNMHDR
);
2330 const int nColumn
= pNMLV
->iSubItem
;
2331 m_bAscending
= nColumn
== m_nSortColumn
? !m_bAscending
: TRUE
;
2332 m_nSortColumn
= nColumn
;
2333 SortByColumn(m_nSortColumn
, m_bAscending
);
2334 SetSortArrow(&m_LogList
, m_nSortColumn
, !!m_bAscending
);
2335 SortShownListArray();
2336 m_LogList
.Invalidate();
2337 UpdateLogInfoLabel();
2339 UNREFERENCED_PARAMETER(pNMHDR
);
2343 SetTimer(LOG_HEADER_ORDER_TIMER
, 10, nullptr);
2346 void CLogDlg::SortShownListArray()
2348 // make sure the shown list still matches the filter after sorting.
2349 OnTimer(LOGFILTER_TIMER
);
2350 // clear the selection states
2351 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2354 m_LogList
.SetItemState(m_LogList
.GetNextSelectedItem(pos
), 0, LVIS_SELECTED
);
2356 m_LogList
.SetSelectionMark(-1);
2359 void CLogDlg::SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
)
2361 if (control
== NULL
)
2363 // set the sort arrow
2364 CHeaderCtrl
* pHeader
= control
->GetHeaderCtrl();
2365 HDITEM HeaderItem
= {0};
2366 HeaderItem
.mask
= HDI_FORMAT
;
2367 for (int i
=0; i
<pHeader
->GetItemCount(); ++i
)
2369 pHeader
->GetItem(i
, &HeaderItem
);
2370 HeaderItem
.fmt
&= ~(HDF_SORTDOWN
| HDF_SORTUP
);
2371 pHeader
->SetItem(i
, &HeaderItem
);
2375 pHeader
->GetItem(nColumn
, &HeaderItem
);
2376 HeaderItem
.fmt
|= (bAscending
? HDF_SORTUP
: HDF_SORTDOWN
);
2377 pHeader
->SetItem(nColumn
, &HeaderItem
);
2381 int CLogDlg::m_nSortColumnPathList
= 0;
2382 bool CLogDlg::m_bAscendingPathList
= false;
2384 void CLogDlg::OnBnClickedHidepaths()
2386 FillLogMessageCtrl();
2387 m_ChangedFileListCtrl
.Invalidate();
2390 void CLogDlg::UpdateLogInfoLabel()
2395 long selectedrevs
= 0;
2396 long selectedfiles
= 0;
2397 int count
= (int)m_LogList
.m_arShownList
.GetCount();
2401 rev1
= (reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(0)))->m_CommitHash
;
2402 if(this->m_LogList
.m_bShowWC
&& rev1
.IsEmpty()&&(count
>1))
2404 rev1
= (reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(start
)))->m_CommitHash
;
2405 //pLogEntry = reinterpret_cast<PLOGENTRYDATA>(m_arShownList.SafeGetAt(m_arShownList.GetCount()-1));
2406 rev2
= (reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(count
-1)))->m_CommitHash
;
2407 selectedrevs
= m_LogList
.GetSelectedCount();
2409 selectedfiles
= m_ChangedFileListCtrl
.GetSelectedCount();
2412 sTemp
.Format(IDS_PROC_LOG_STATS
,
2414 rev2
.ToString().Left(g_Git
.GetShortHASHLength()), rev1
.ToString().Left(g_Git
.GetShortHASHLength()), selectedrevs
, selectedfiles
);
2416 if(selectedrevs
== 1)
2418 CString str
=m_ChangedFileListCtrl
.GetStatisticsString(true);
2419 str
.Replace(_T('\n'), _T(' '));
2420 sTemp
+= _T("\r\n") + str
;
2427 void CLogDlg::OnDtnDropdownDatefrom(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
2429 // the date control should not show the "today" button
2430 CMonthCalCtrl
* pCtrl
= m_DateFrom
.GetMonthCalCtrl();
2432 SetWindowLongPtr(pCtrl
->GetSafeHwnd(), GWL_STYLE
, LONG_PTR(pCtrl
->GetStyle() | MCS_NOTODAY
));
2436 void CLogDlg::OnDtnDropdownDateto(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
2438 // the date control should not show the "today" button
2439 CMonthCalCtrl
* pCtrl
= m_DateTo
.GetMonthCalCtrl();
2441 SetWindowLongPtr(pCtrl
->GetSafeHwnd(), GWL_STYLE
, LONG_PTR(pCtrl
->GetStyle() | MCS_NOTODAY
));
2445 void CLogDlg::OnSize(UINT nType
, int cx
, int cy
)
2447 __super::OnSize(nType
, cx
, cy
);
2452 void CLogDlg::OnRefresh()
2456 this->m_LogProgress
.SetPos(0);
2462 void CLogDlg::OnFocusFilter()
2464 GetDlgItem(IDC_SEARCHEDIT
)->SetFocus();
2467 void CLogDlg::OnEditCopy()
2469 if (GetFocus() == &m_ChangedFileListCtrl
)
2470 CopyChangedSelectionToClipBoard();
2472 m_LogList
.CopySelectionToClipBoard();
2475 CString
CLogDlg::GetAbsoluteUrlFromRelativeUrl(const CString
& url
)
2477 // is the URL a relative one?
2478 if (url
.Left(2).Compare(_T("^/")) == 0)
2480 // URL is relative to the repository root
2481 CString url1
= m_sRepositoryRoot
+ url
.Mid(1);
2482 TCHAR buf
[INTERNET_MAX_URL_LENGTH
] = { 0 };
2483 DWORD len
= url
.GetLength();
2484 if (UrlCanonicalize((LPCTSTR
)url1
, buf
, &len
, 0) == S_OK
)
2485 return CString(buf
, len
);
2488 else if (url
[0] == '/')
2490 // URL is relative to the server's hostname
2492 // find the server's hostname
2493 int schemepos
= m_sRepositoryRoot
.Find(_T("//"));
2496 sHost
= m_sRepositoryRoot
.Left(m_sRepositoryRoot
.Find('/', schemepos
+3));
2497 CString url1
= sHost
+ url
;
2498 TCHAR buf
[INTERNET_MAX_URL_LENGTH
] = { 0 };
2499 DWORD len
= url
.GetLength();
2500 if (UrlCanonicalize((LPCTSTR
)url
, buf
, &len
, 0) == S_OK
)
2501 return CString(buf
, len
);
2508 void CLogDlg::ShowGravatar()
2510 m_gravatar
.EnableGravatar(m_bShowGravatar
);
2511 RemoveAnchor(IDC_MSGVIEW
);
2512 if (m_gravatar
.IsGravatarEnabled())
2515 GetDlgItem(IDC_MSGVIEW
)->GetWindowRect(&rect
);
2516 ScreenToClient(&rect
);
2517 m_gravatar
.GetWindowRect(&rect2
);
2518 ScreenToClient(&rect2
);
2519 rect
.right
= rect2
.left
;
2520 GetDlgItem(IDC_MSGVIEW
)->MoveWindow(&rect
);
2521 m_gravatar
.ShowWindow(SW_SHOW
);
2526 GetDlgItem(IDC_MSGVIEW
)->GetWindowRect(&rect
);
2527 ScreenToClient(&rect
);
2528 m_gravatar
.GetWindowRect(&rect2
);
2529 ScreenToClient(&rect2
);
2530 rect
.right
= rect2
.right
;
2531 GetDlgItem(IDC_MSGVIEW
)->MoveWindow(&rect
);
2532 m_gravatar
.ShowWindow(SW_HIDE
);
2534 AddAnchor(IDC_MSGVIEW
, TOP_LEFT
, BOTTOM_RIGHT
);
2538 void CLogDlg::OnEnChangeSearchedit()
2541 if (!m_LogList
.HasFilterText())
2543 CStoreSelection
storeselection(this);
2544 // clear the filter, i.e. make all entries appear
2545 theApp
.DoWaitCursor(1);
2546 KillTimer(LOGFILTER_TIMER
);
2547 FillLogMessageCtrl(false);
2550 //m_LogList.StartFilter();
2552 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
2553 m_arShownList
.RemoveAll();
2554 for (DWORD i
=0; i
<m_logEntries
.size(); ++i
)
2556 if (IsEntryInDateRange(i
))
2557 m_arShownList
.Add(m_logEntries
[i
]);
2559 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
2560 m_LogList
.DeleteAllItems();
2561 m_LogList
.SetItemCountEx(ShownCountWithStopped());
2562 m_LogList
.RedrawItems(0, ShownCountWithStopped());
2563 m_LogList
.SetRedraw(false);
2564 ResizeAllListCtrlCols();
2565 m_LogList
.SetRedraw(true);
2567 theApp
.DoWaitCursor(-1);
2568 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_HIDE
);
2569 GetDlgItem(IDC_SEARCHEDIT
)->ShowWindow(SW_SHOW
);
2570 GetDlgItem(IDC_SEARCHEDIT
)->SetFocus();
2571 DialogEnableWindow(IDC_STATBUTTON
, !(((this->IsThreadRunning())||(m_LogList
.m_arShownList
.IsEmpty()))));
2574 if (Validate(m_LogList
.m_sFilterText
))
2575 SetTimer(LOGFILTER_TIMER
, 1000, NULL
);
2577 KillTimer(LOGFILTER_TIMER
);
2581 void CLogDlg::OnBnClickedAllBranch()
2583 // m_bAllBranch is not auto-toggled by MFC, we have to handle it manually (in order to prevent the indeterminate state)
2585 m_LogList
.m_ShowMask
&=~ (CGit::LOG_INFO_LOCAL_BRANCHES
| CGit::LOG_INFO_ALL_BRANCH
);
2589 m_bAllBranch
= BST_UNCHECKED
;
2590 m_ChangedFileListCtrl
.m_sDisplayedBranch
= m_LogList
.GetRange();
2594 m_bAllBranch
= BST_CHECKED
;
2595 m_LogList
.m_ShowMask
|=CGit::LOG_INFO_ALL_BRANCH
;
2596 m_ChangedFileListCtrl
.m_sDisplayedBranch
.Empty();
2599 // need to save value here, so that log dialogs started from now on also have AllBranch activated
2600 m_regbAllBranch
= m_bAllBranch
;
2606 FillLogMessageCtrl(false);
2609 void CLogDlg::OnBnClickedFollowRenames()
2611 if(m_bFollowRenames
)
2613 m_LogList
.m_ShowMask
|= CGit::LOG_INFO_FOLLOW
;
2614 m_LogList
.m_ShowMask
&=~ CGit::LOG_INFO_LOCAL_BRANCHES
;
2618 m_bAllBranch
= FALSE
;
2619 m_LogList
.m_ShowMask
&=~ CGit::LOG_INFO_ALL_BRANCH
;
2624 m_LogList
.m_ShowMask
&= ~CGit::LOG_INFO_FOLLOW
;
2626 DialogEnableWindow(IDC_LOG_ALLBRANCH
, !m_bFollowRenames
);
2627 DialogEnableWindow(IDC_SHOWWHOLEPROJECT
, !m_bFollowRenames
&& !m_path
.IsEmpty());
2631 FillLogMessageCtrl(false);
2634 void CLogDlg::HandleShowLabels(bool var
, int flag
)
2637 m_LogList
.m_ShowRefMask
|= flag
;
2639 m_LogList
.m_ShowRefMask
&= ~flag
;
2641 if ((m_LogList
.m_ShowFilter
& CGitLogListBase::FILTERSHOW_REFS
) && !(m_LogList
.m_ShowFilter
& CGitLogListBase::FILTERSHOW_ANYCOMMIT
))
2643 // Remove commits where labels are not shown.
2645 FillLogMessageCtrl(false);
2650 m_LogList
.Invalidate();
2654 void CLogDlg::OnBnClickedCompressedGraph()
2658 if (m_iCompressedGraph
== 2)
2659 m_LogList
.m_ShowFilter
= CGitLogListBase::FILTERSHOW_REFS
;
2660 else if (m_iCompressedGraph
== 1)
2661 m_LogList
.m_ShowFilter
= static_cast<CGitLogListBase::FilterShow
>(CGitLogListBase::FILTERSHOW_REFS
| CGitLogListBase::FILTERSHOW_MERGEPOINTS
);
2663 m_LogList
.m_ShowFilter
= CGitLogListBase::FILTERSHOW_ALL
;
2666 FillLogMessageCtrl(false);
2669 void CLogDlg::OnBnClickedBrowseRef()
2671 CString newRef
= CBrowseRefsDlg::PickRef(false, m_LogList
.GetRange(), gPickRef_All
, true);
2672 if(newRef
.IsEmpty())
2675 m_History
.AddEntry(newRef
);
2680 m_LogList
.m_ShowMask
&= ~(CGit::LOG_INFO_ALL_BRANCH
| CGit::LOG_INFO_LOCAL_BRANCHES
);
2681 m_bAllBranch
= BST_UNCHECKED
;
2685 FillLogMessageCtrl(false);
2688 void CLogDlg::ShowStartRef()
2690 //Show ref name on top
2691 if(!::IsWindow(m_hWnd
))
2693 if (m_LogList
.m_ShowMask
& (CGit::LOG_INFO_ALL_BRANCH
| CGit::LOG_INFO_LOCAL_BRANCHES
))
2695 switch (m_LogList
.m_ShowMask
& (CGit::LOG_INFO_ALL_BRANCH
| CGit::LOG_INFO_LOCAL_BRANCHES
))
2697 case CGit::LOG_INFO_ALL_BRANCH
:
2698 m_staticRef
.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_LOG_ALLBRANCHES
)));
2701 case CGit::LOG_INFO_LOCAL_BRANCHES
:
2702 m_staticRef
.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_LOG_LOCAL_BRANCHES
)));
2706 m_staticRef
.Invalidate(TRUE
);
2707 m_tooltips
.DelTool(GetDlgItem(IDC_STATIC_REF
));
2711 CString showStartRef
= m_LogList
.GetRange();
2712 if (showStartRef
.IsEmpty() || showStartRef
== _T("HEAD"))
2714 showStartRef
.Empty();
2716 if (g_Git
.Run(L
"git.exe symbolic-ref HEAD", &showStartRef
, NULL
, CP_UTF8
))
2717 showStartRef
= CString(MAKEINTRESOURCE(IDS_PROC_LOG_NOBRANCH
));
2718 showStartRef
.Trim(L
"\r\n\t ");
2722 showStartRef
= g_Git
.StripRefName(showStartRef
);
2724 m_staticRef
.SetWindowText(showStartRef
);
2725 CWnd
*pWnd
= GetDlgItem(IDC_STATIC_REF
);
2726 m_tooltips
.AddTool(pWnd
, showStartRef
);
2727 m_staticRef
.Invalidate(TRUE
);
2730 void CLogDlg::SetRange(const CString
& range
)
2732 m_LogList
.SetRange(range
);
2733 m_ChangedFileListCtrl
.m_sDisplayedBranch
= range
;
2738 static void AppendMenuChecked(CMenu
&menu
, UINT nTextID
, UINT_PTR nItemID
, BOOL checked
= FALSE
, BOOL enabled
= TRUE
)
2741 text
.LoadString(nTextID
);
2742 menu
.AppendMenu(MF_STRING
| (enabled
? MF_ENABLED
: MF_DISABLED
) | (checked
? MF_CHECKED
: MF_UNCHECKED
), nItemID
, text
);
2745 #define WALKBEHAVIOUR_FIRSTPARENT 1
2746 #define WALKBEHAVIOUR_FOLLOWRENAMES 2
2747 #define WALKBEHAVIOUR_COMPRESSEDGRAPH 3
2748 #define WALKBEHAVIOUR_LABELEDCOMMITS 4
2749 #define WALKBEHAVIOUR_NOMERGES 5
2751 void CLogDlg::OnBnClickedWalkBehaviour()
2754 if (popup
.CreatePopupMenu())
2756 AppendMenuChecked(popup
, IDS_WALKBEHAVIOUR_FIRSTPARENT
, WALKBEHAVIOUR_FIRSTPARENT
, m_bFirstParent
);
2757 AppendMenuChecked(popup
, IDS_WALKBEHAVIOUR_NOMERGES
, WALKBEHAVIOUR_NOMERGES
, m_bNoMerges
);
2758 AppendMenuChecked(popup
, IDS_WALKBEHAVIOUR_FOLLOWRENAMES
, WALKBEHAVIOUR_FOLLOWRENAMES
, m_bFollowRenames
, !(m_path
.IsEmpty() || m_path
.IsDirectory()));
2759 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
2760 AppendMenuChecked(popup
, IDS_WALKBEHAVIOUR_COMPRESSED
, WALKBEHAVIOUR_COMPRESSEDGRAPH
, m_iCompressedGraph
== 1);
2761 AppendMenuChecked(popup
, IDS_WALKBEHAVIOUR_LABELEDCOMMITS
, WALKBEHAVIOUR_LABELEDCOMMITS
, m_iCompressedGraph
== 2);
2765 GetDlgItem(IDC_WALKBEHAVIOUR
)->GetWindowRect(&rect
);
2766 int selection
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, rect
.left
, rect
.top
, this, 0);
2769 case WALKBEHAVIOUR_FIRSTPARENT
:
2770 m_bFirstParent
= !m_bFirstParent
;
2771 OnBnClickedFirstParent();
2773 case WALKBEHAVIOUR_NOMERGES
:
2774 m_bNoMerges
= !m_bNoMerges
;
2775 OnBnClickedFirstParent(); // OnBnClickedFirstParent handles both cases: m_bFirstParent and m_bNoMerges
2777 case WALKBEHAVIOUR_FOLLOWRENAMES
:
2778 m_bFollowRenames
= !m_bFollowRenames
;
2779 OnBnClickedFollowRenames();
2781 case WALKBEHAVIOUR_COMPRESSEDGRAPH
:
2782 m_iCompressedGraph
= (m_iCompressedGraph
== 1 ? 0 : 1);
2783 OnBnClickedCompressedGraph();
2785 case WALKBEHAVIOUR_LABELEDCOMMITS
:
2786 m_iCompressedGraph
= (m_iCompressedGraph
== 2 ? 0 : 2);
2787 OnBnClickedCompressedGraph();
2792 m_bWalkBehavior
= (m_bFirstParent
|| m_bNoMerges
|| m_bFollowRenames
|| m_iCompressedGraph
);
2797 #define VIEW_HIDEPATHS 1
2798 #define VIEW_GRAYPATHS 2
2799 #define VIEW_SHOWTAGS 3
2800 #define VIEW_SHOWLOCALBRANCHES 4
2801 #define VIEW_SHOWREMOTEBRANCHES 5
2802 #define VIEW_SHOWGRAVATAR 6
2803 #define VIEW_SHOWPATCH 7
2805 void CLogDlg::OnBnClickedView()
2808 if (popup
.CreatePopupMenu())
2810 AppendMenuChecked(popup
, IDS_SHOWFILES_HIDEPATHS
, VIEW_HIDEPATHS
, m_iHidePaths
== 1);
2811 AppendMenuChecked(popup
, IDS_SHOWFILES_GRAYPATHS
, VIEW_GRAYPATHS
, m_iHidePaths
== 2);
2812 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
2813 CMenu showLabelsMenu
;
2814 if (showLabelsMenu
.CreatePopupMenu())
2816 AppendMenuChecked(showLabelsMenu
, IDS_VIEW_SHOWTAGLABELS
, VIEW_SHOWTAGS
, m_bShowTags
);
2817 AppendMenuChecked(showLabelsMenu
, IDS_VIEW_SHOWLOCALBRANCHLABELS
, VIEW_SHOWLOCALBRANCHES
, m_bShowLocalBranches
);
2818 AppendMenuChecked(showLabelsMenu
, IDS_VIEW_SHOWREMOTEBRANCHLABELS
, VIEW_SHOWREMOTEBRANCHES
, m_bShowRemoteBranches
);
2819 popup
.AppendMenu(MF_STRING
| MF_POPUP
, (UINT
)showLabelsMenu
.m_hMenu
, (CString
)MAKEINTRESOURCE(IDS_VIEW_LABELS
));
2821 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
2822 AppendMenuChecked(popup
, IDS_VIEW_SHOWGRAVATAR
, VIEW_SHOWGRAVATAR
, m_bShowGravatar
);
2823 AppendMenuChecked(popup
, IDS_MENU_VIEWPATCH
, VIEW_SHOWPATCH
, IsWindow(this->m_patchViewdlg
.m_hWnd
));
2827 GetDlgItem(IDC_VIEW
)->GetWindowRect(&rect
);
2828 int selection
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, rect
.left
, rect
.top
, this, 0);
2831 case VIEW_HIDEPATHS
:
2832 if (m_iHidePaths
== 1)
2836 OnBnClickedHidepaths();
2838 case VIEW_GRAYPATHS
:
2839 if (m_iHidePaths
== 2)
2843 OnBnClickedHidepaths();
2846 m_bShowTags
= !m_bShowTags
;
2847 HandleShowLabels(m_bShowTags
, LOGLIST_SHOWTAGS
);
2849 case VIEW_SHOWLOCALBRANCHES
:
2850 m_bShowLocalBranches
= !m_bShowLocalBranches
;
2851 HandleShowLabels(m_bShowLocalBranches
, LOGLIST_SHOWLOCALBRANCHES
);
2853 case VIEW_SHOWREMOTEBRANCHES
:
2854 m_bShowRemoteBranches
= !m_bShowRemoteBranches
;
2855 HandleShowLabels(m_bShowRemoteBranches
, LOGLIST_SHOWREMOTEBRANCHES
);
2857 case VIEW_SHOWGRAVATAR
:
2859 m_bShowGravatar
= !m_bShowGravatar
;
2863 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2866 int selIndex
= m_LogList
.GetNextSelectedItem(pos
);
2867 int moreSel
= m_LogList
.GetNextSelectedItem(pos
);
2870 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_LogList
.m_arShownList
.SafeGetAt(selIndex
));
2872 email
= pLogEntry
->GetAuthorEmail();
2875 m_gravatar
.LoadGravatar(email
);
2878 case VIEW_SHOWPATCH
:
2887 void CLogDlg::OnBnClickedFirstParent()
2889 if(this->m_bFirstParent
)
2890 m_LogList
.m_ShowMask
|=CGit::LOG_INFO_FIRST_PARENT
;
2892 m_LogList
.m_ShowMask
&=~CGit::LOG_INFO_FIRST_PARENT
;
2895 m_LogList
.m_ShowMask
|= CGit::LOG_INFO_NO_MERGE
;
2897 m_LogList
.m_ShowMask
&= ~CGit::LOG_INFO_NO_MERGE
;
2901 FillLogMessageCtrl(false);
2905 void CLogDlg::OnBnClickShowWholeProject()
2909 if(this->m_bWholeProject
)
2911 m_LogList
.m_Path
.Reset();
2915 m_LogList
.m_Path
=m_path
;
2917 m_regShowWholeProject
= m_bWholeProject
;
2923 FillLogMessageCtrl(false);
2927 LRESULT
CLogDlg::OnRefLogChanged(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
2933 LRESULT
CLogDlg::OnTaskbarBtnCreated(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
2935 m_pTaskbarList
.Release();
2936 m_pTaskbarList
.CoCreateInstance(CLSID_TaskbarList
);
2937 SetUUIDOverlayIcon(m_hWnd
);
2941 LRESULT
CLogDlg::OnRefreshSelection(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
2943 // it's enough to deselect, then select again one item of the whole selection
2944 int selMark
= m_LogList
.GetSelectionMark();
2947 m_LogList
.SetSelectionMark(selMark
);
2948 m_LogList
.SetItemState(selMark
, 0, LVIS_SELECTED
);
2949 m_LogList
.SetItemState(selMark
, LVIS_SELECTED
, LVIS_SELECTED
);