OSDN Git Service

Add Many Help button at dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RefLogDlg.cpp
1 // RefLogDlg.cpp : implementation file\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 #include "resource.h"\r
6 #include "RefLogDlg.h"\r
7 #include "git.h"\r
8 \r
9 // CRefLogDlg dialog\r
10 \r
11 IMPLEMENT_DYNAMIC(CRefLogDlg, CResizableStandAloneDialog)\r
12 \r
13 CRefLogDlg::CRefLogDlg(CWnd* pParent /*=NULL*/)\r
14         : CResizableStandAloneDialog(CRefLogDlg::IDD, pParent)\r
15 {\r
16 \r
17 }\r
18 \r
19 CRefLogDlg::~CRefLogDlg()\r
20 {\r
21 }\r
22 \r
23 void CRefLogDlg::DoDataExchange(CDataExchange* pDX)\r
24 {\r
25         CDialog::DoDataExchange(pDX);\r
26         DDX_Control(pDX, IDC_COMBOBOXEX_REF, m_ChooseRef);\r
27         DDX_Control(pDX, IDC_REFLOG_LIST, m_RefList);\r
28 }\r
29 \r
30 \r
31 BEGIN_MESSAGE_MAP(CRefLogDlg, CResizableStandAloneDialog)\r
32         ON_BN_CLICKED(IDOK, &CRefLogDlg::OnBnClickedOk)\r
33         ON_CBN_SELCHANGE(IDC_COMBOBOXEX_REF,   &CRefLogDlg::OnCbnSelchangeRef)\r
34         ON_MESSAGE(MSG_REFLOG_CHANGED,OnRefLogChanged)\r
35 END_MESSAGE_MAP()\r
36 \r
37 LRESULT CRefLogDlg::OnRefLogChanged(WPARAM wParam, LPARAM lParam)\r
38 {\r
39         m_RefList.m_RefMap.clear();\r
40         OnCbnSelchangeRef();\r
41         return 0;\r
42 }\r
43 \r
44 BOOL CRefLogDlg::OnInitDialog()\r
45 {\r
46         CResizableStandAloneDialog::OnInitDialog();\r
47 \r
48         AddAnchor(IDOK,BOTTOM_RIGHT);\r
49         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
50         \r
51         AddAnchor(IDC_REFLOG_LIST,TOP_LEFT,BOTTOM_RIGHT);\r
52         AddAnchor(IDHELP, BOTTOM_RIGHT);\r
53 \r
54         AddOthersToAnchor();\r
55         this->EnableSaveRestore(_T("RefLogDlg"));\r
56 \r
57         STRING_VECTOR list;\r
58         g_Git.GetRefList(list);\r
59 \r
60         if(this->m_CurrentBranch.IsEmpty())\r
61         {\r
62                 m_CurrentBranch.Format(_T("refs/heads/%s"),g_Git.GetCurrentBranch());\r
63         }\r
64 \r
65         m_ChooseRef.SetMaxHistoryItems(0x7FFFFFFF);\r
66         this->m_ChooseRef.AddString(list);\r
67         \r
68 \r
69         this->m_RefList.InsertRefLogColumn();\r
70         //m_RefList.m_logEntries.ParserFromRefLog(_T("master"));\r
71         \r
72         for(int i=0;i<list.size();i++)\r
73         {\r
74                 if(list[i] == m_CurrentBranch)\r
75                 {\r
76                         m_ChooseRef.SetCurSel(i);\r
77                         break;\r
78                 }\r
79         }\r
80 \r
81         OnCbnSelchangeRef();\r
82 \r
83         return TRUE;\r
84 }\r
85 // CRefLogDlg message handlers\r
86 \r
87 void CRefLogDlg::OnBnClickedOk()\r
88 {\r
89         // TODO: Add your control notification handler code here\r
90         OnOK();\r
91 }\r
92 \r
93 void CRefLogDlg::OnCbnSelchangeRef()\r
94 {\r
95         CString ref=m_ChooseRef.GetString();\r
96         if(m_RefList.m_RefMap.find(ref) == m_RefList.m_RefMap.end())\r
97         {\r
98                 m_RefList.m_RefMap[ref].ParserFromRefLog(ref);\r
99         }\r
100         m_RefList.ClearText();\r
101 \r
102         //this->m_logEntries.ParserFromLog();\r
103         m_RefList.SetRedraw(false);\r
104 \r
105         CLogDataVector *plog;\r
106         plog = &m_RefList.m_RefMap[ref];\r
107 \r
108         m_RefList.SetItemCountEx(plog->size());\r
109 \r
110         this->m_RefList.m_arShownList.RemoveAll();\r
111 \r
112         for(unsigned int i=0;i<m_RefList.m_RefMap[ref].size();i++)\r
113         {\r
114                 plog->at(i).m_IsFull=TRUE;\r
115                 this->m_RefList.m_arShownList.Add(&(plog->at(i)));\r
116                 \r
117         }\r
118 \r
119         m_RefList.SetRedraw(true);\r
120 \r
121         m_RefList.Invalidate();\r
122 \r
123 }