Git Property Page: get latest change in new thread
[TortoiseGit.git] / src / TortoiseShell / GITPropertyPage.h
blobacdf4e6f48678820c3272ca3c802811ee48cfe98
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2006 - Stefan Kueng
4 // Copyright (C) 2008-2013 - 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.
20 #pragma once
21 #include "ShellUpdater.h"
22 #include "git2.h"
24 #define ListView_GetItemTextEx(hwndLV, i, iSubItem_, __buf) \
25 { \
26 int nLen = 1024;\
27 int nRes;\
28 LV_ITEM _ms_lvi;\
29 _ms_lvi.iSubItem = iSubItem_;\
30 do\
32 nLen += 2;\
33 _ms_lvi.cchTextMax = nLen;\
34 if (__buf)\
35 delete[] __buf;\
36 __buf = new TCHAR[nLen];\
37 _ms_lvi.pszText = __buf;\
38 nRes = (int)::SendMessage((hwndLV), LVM_GETITEMTEXT, (WPARAM)(i), (LPARAM)(LV_ITEM *)&_ms_lvi);\
39 } while (nRes == nLen-1);\
41 #define GetDlgItemTextEx(hwndDlg, _id, __buf) \
43 int nLen = 1024;\
44 int nRes;\
45 do\
47 nLen *= 2;\
48 if (__buf)\
49 delete [] __buf;\
50 __buf = new TCHAR[nLen];\
51 nRes = GetDlgItemText(hwndDlg, _id, __buf, nLen);\
52 } while (nRes == nLen-1);\
55 /**
56 * \ingroup TortoiseShell
57 * Displays and updates all controls on the property page. The property
58 * page itself is shown by explorer.
60 class CGitPropertyPage
62 public:
63 CGitPropertyPage(const std::vector<stdstring> &filenames);
64 virtual ~CGitPropertyPage();
66 /**
67 * Sets the window handle.
68 * \param hwnd the handle.
70 virtual void SetHwnd(HWND hwnd);
71 /**
72 * Callback function which receives the window messages of the
73 * property page. See the Win32 API for PropertySheets for details.
75 virtual BOOL PageProc(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
77 const static UINT m_UpdateLastCommit;
79 protected:
80 /**
81 * Initializes the property page.
83 virtual void InitWorkfileView();
84 void DisplayCommit(git_commit * commit, UINT hashLabel, UINT subjectLabel, UINT authorLabel, UINT dateLabel);
85 static void LogThreadEntry(void *param);
86 int LogThread();
87 void Time64ToTimeString(__time64_t time, TCHAR * buf, size_t buflen);
88 void PageProcOnCommand(WPARAM wParam);
89 void RunCommand(const tstring& command);
91 HWND m_hwnd;
92 std::vector<stdstring> filenames;
93 /**
94 * Were executable, assumeValid or skip-worktree flags changes
96 bool m_bChanged;