Allow to use libgit2 for unified diff
[TortoiseGit.git] / src / TortoiseProc / LogOrdering.cpp
blobe1fd7a796c5598447bb31f64c17a4dc7ca146e60
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2013 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "TortoiseProc.h"
21 #include "LogOrdering.h"
22 #include "Git.h"
23 #include "registry.h"
25 IMPLEMENT_DYNAMIC(CLogOrdering, CDialog)
26 CLogOrdering::CLogOrdering(CWnd* pParent /*=NULL*/)
27 : CDialog(CLogOrdering::IDD, pParent)
31 CLogOrdering::~CLogOrdering()
35 void CLogOrdering::DoDataExchange(CDataExchange* pDX)
37 CDialog::DoDataExchange(pDX);
38 DDX_Control(pDX, IDC_COMBOBOXEX_ORDERING, m_cLogOrdering);
41 BEGIN_MESSAGE_MAP(CLogOrdering, CDialog)
42 END_MESSAGE_MAP()
44 BOOL CLogOrdering::OnInitDialog()
46 CDialog::OnInitDialog();
48 int ind = m_cLogOrdering.AddString(CString(MAKEINTRESOURCE(IDS_LOG_CHRONOLOGICALREVERSEDORDER)));
49 m_cLogOrdering.SetItemData(ind, CGit::LOG_ORDER_CHRONOLOGIALREVERSED);
50 ind = m_cLogOrdering.AddString(_T("--topo-order ") + CString(MAKEINTRESOURCE(IDS_TORTOISEGITDEFAULT)));
51 m_cLogOrdering.SetItemData(ind, CGit::LOG_ORDER_TOPOORDER);
52 ind = m_cLogOrdering.AddString(_T("--date-order"));
53 m_cLogOrdering.SetItemData(ind, CGit::LOG_ORDER_DATEORDER);
55 DWORD curOrder = CRegDWORD(_T("Software\\TortoiseGit\\LogOrderBy"), CGit::LOG_ORDER_TOPOORDER);
56 for (int i = 0; i < m_cLogOrdering.GetCount(); ++i)
57 if (m_cLogOrdering.GetItemData(i) == curOrder)
58 m_cLogOrdering.SetCurSel(i);
60 UpdateData(FALSE);
62 return TRUE;
65 void CLogOrdering::OnOK()
67 UpdateData();
69 if (m_cLogOrdering.GetCurSel() != CB_ERR)
70 CRegDWORD(_T("Software\\TortoiseGit\\LogOrderBy")) = (DWORD)m_cLogOrdering.GetItemData(m_cLogOrdering.GetCurSel());
72 __super::OnOK();