OSDN Git Service

Add EnableSaveRestore at some dialog.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / PushDlg.cpp
1 // PushDlg.cpp : implementation file\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 #include "TortoiseProc.h"\r
6 #include "PushDlg.h"\r
7 \r
8 #include "Git.h"\r
9 // CPushDlg dialog\r
10 \r
11 IMPLEMENT_DYNAMIC(CPushDlg, CResizableStandAloneDialog)\r
12 \r
13 CPushDlg::CPushDlg(CWnd* pParent /*=NULL*/)\r
14         : CResizableStandAloneDialog(CPushDlg::IDD, pParent)\r
15 {\r
16 \r
17 }\r
18 \r
19 CPushDlg::~CPushDlg()\r
20 {\r
21 }\r
22 \r
23 void CPushDlg::DoDataExchange(CDataExchange* pDX)\r
24 {\r
25         CResizableStandAloneDialog::DoDataExchange(pDX);\r
26         DDX_Control(pDX, IDC_BRANCH_REMOTE, this->m_BranchRemote);\r
27         DDX_Control(pDX, IDC_BRANCH_SOURCE, this->m_BranchSource);\r
28         DDX_Control(pDX, IDC_REMOTE, this->m_Remote);\r
29         DDX_Control(pDX, IDC_URL, this->m_RemoteURL);\r
30         DDX_Check(pDX,IDC_FORCE,this->m_bForce);\r
31         DDX_Check(pDX,IDC_PACK,this->m_bPack);\r
32         DDX_Check(pDX,IDC_TAGS,this->m_bTags);\r
33 \r
34 }\r
35 \r
36 \r
37 BEGIN_MESSAGE_MAP(CPushDlg, CResizableStandAloneDialog)\r
38         ON_BN_CLICKED(IDC_RD_REMOTE, &CPushDlg::OnBnClickedRd)\r
39         ON_BN_CLICKED(IDC_RD_URL, &CPushDlg::OnBnClickedRd)\r
40         ON_CBN_SELCHANGE(IDC_BRANCH_SOURCE, &CPushDlg::OnCbnSelchangeBranchSource)\r
41         ON_BN_CLICKED(IDOK, &CPushDlg::OnBnClickedOk)\r
42 END_MESSAGE_MAP()\r
43 \r
44 BOOL CPushDlg::OnInitDialog()\r
45 {\r
46         CResizableStandAloneDialog::OnInitDialog();\r
47         \r
48         AddAnchor(IDC_BRANCH_REMOTE, TOP_RIGHT);\r
49         AddAnchor(IDC_BRANCH_SOURCE, TOP_LEFT);\r
50 \r
51         AddAnchor(IDC_REMOTE, TOP_LEFT, TOP_RIGHT);\r
52         AddAnchor(IDC_URL, TOP_LEFT,TOP_RIGHT);\r
53 \r
54         AddAnchor(IDC_URL_GROUP, TOP_LEFT,TOP_RIGHT);\r
55         AddAnchor(IDC_OPTION_GROUP, TOP_LEFT,TOP_RIGHT);\r
56         AddAnchor(IDC_BRANCH_GROUP, TOP_LEFT,TOP_RIGHT);\r
57 \r
58         AddAnchor(IDC_STATIC_REMOTE, TOP_RIGHT);\r
59 \r
60         AddAnchor(IDOK,BOTTOM_RIGHT);\r
61         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
62 \r
63         EnableSaveRestore(_T("PushDlg"));\r
64 \r
65         m_RemoteURL.SetURLHistory(TRUE);\r
66         m_RemoteURL.LoadHistory(_T("Software\\TortoiseGit\\History\\PushURLS"), _T("url"));\r
67         m_RemoteURL.SetCurSel(0);\r
68 \r
69         m_RemoteURL.EnableWindow(FALSE);\r
70         CheckRadioButton(IDC_RD_REMOTE,IDC_RD_URL,IDC_RD_REMOTE);\r
71 \r
72         STRING_VECTOR list;\r
73 \r
74         if(!g_Git.GetRemoteList(list))\r
75         {       \r
76                 for(unsigned int i=0;i<list.size();i++)\r
77                         m_Remote.AddString(list[i]);\r
78         }\r
79 \r
80         int current=0;\r
81         if(!g_Git.GetBranchList(list,&current))\r
82         {\r
83                 for(unsigned int i=0;i<list.size();i++)\r
84                         m_BranchSource.AddString(list[i]);\r
85         }\r
86         m_BranchSource.SetCurSel(current);\r
87         \r
88         m_BranchRemote.LoadHistory(_T("Software\\TortoiseGit\\History\\RemoteBranch"), _T("branch"));\r
89         m_BranchRemote.SetCurSel(0);\r
90 \r
91         //m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
92 \r
93         \r
94         return TRUE;\r
95 }\r
96 \r
97 // CPushDlg message handlers\r
98 \r
99 void CPushDlg::OnBnClickedRd()\r
100 {\r
101         // TODO: Add your control notification handler code here\r
102         // TODO: Add your control notification handler code here\r
103         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
104         {\r
105                 m_Remote.EnableWindow(TRUE);\r
106                 m_RemoteURL.EnableWindow(FALSE);;\r
107         }\r
108         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
109         {\r
110                 m_Remote.EnableWindow(FALSE);\r
111                 m_RemoteURL.EnableWindow(TRUE);\r
112         }\r
113 }\r
114 \r
115 \r
116 void CPushDlg::OnCbnSelchangeBranchSource()\r
117 {\r
118         // TODO: Add your control notification handler code here\r
119         m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
120 }\r
121 \r
122 void CPushDlg::OnBnClickedOk()\r
123 {\r
124         // TODO: Add your control notification handler code here\r
125         CResizableStandAloneDialog::UpdateData(TRUE);\r
126 \r
127         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
128         {\r
129                 m_URL=m_Remote.GetString();\r
130         }\r
131         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
132         {\r
133                 m_URL=m_RemoteURL.GetString();\r
134         }\r
135 \r
136         this->m_BranchRemoteName=m_BranchRemote.GetString();\r
137         this->m_BranchSourceName=m_BranchSource.GetString();\r
138 \r
139         this->m_RemoteURL.SaveHistory();\r
140         this->m_BranchRemote.SaveHistory();\r
141         CResizableStandAloneDialog::OnOK();\r
142 }\r