OSDN Git Service

Compiler warnings removal Numerous tweaks to remove compiler warnings where solution...
[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         AddAnchor(IDC_BRANCH_REMOTE, TOP_RIGHT);\r
48         AddAnchor(IDC_BRANCH_SOURCE, TOP_LEFT);\r
49 \r
50         AddAnchor(IDC_REMOTE, TOP_LEFT, TOP_RIGHT);\r
51         AddAnchor(IDC_URL, TOP_LEFT,TOP_RIGHT);\r
52 \r
53         AddAnchor(IDC_URL_GROUP, TOP_LEFT,TOP_RIGHT);\r
54         AddAnchor(IDC_OPTION_GROUP, TOP_LEFT,TOP_RIGHT);\r
55         AddAnchor(IDC_BRANCH_GROUP, TOP_LEFT,TOP_RIGHT);\r
56 \r
57         AddAnchor(IDC_STATIC_REMOTE, TOP_RIGHT);\r
58 \r
59         AddAnchor(IDOK,BOTTOM_RIGHT);\r
60         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
61 \r
62         m_RemoteURL.SetURLHistory(TRUE);\r
63         m_RemoteURL.LoadHistory(_T("Software\\TortoiseGit\\History\\PushURLS"), _T("url"));\r
64         m_RemoteURL.SetCurSel(0);\r
65 \r
66 \r
67         m_RemoteURL.EnableWindow(FALSE);\r
68         CheckRadioButton(IDC_RD_REMOTE,IDC_RD_URL,IDC_RD_REMOTE);\r
69 \r
70         STRING_VECTOR list;\r
71 \r
72         if(!g_Git.GetRemoteList(list))\r
73         {       \r
74                 for(unsigned int i=0;i<list.size();i++)\r
75                         m_Remote.AddString(list[i]);\r
76         }\r
77 \r
78         int current=0;\r
79         if(!g_Git.GetBranchList(list,&current))\r
80         {\r
81                 for(unsigned int i=0;i<list.size();i++)\r
82                         m_BranchSource.AddString(list[i]);\r
83         }\r
84         m_BranchSource.SetCurSel(current);\r
85         \r
86         m_BranchRemote.LoadHistory(_T("Software\\TortoiseGit\\History\\RemoteBranch"), _T("branch"));\r
87         m_BranchRemote.SetCurSel(0);\r
88 \r
89         //m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
90         return TRUE;\r
91 }\r
92 \r
93 // CPushDlg message handlers\r
94 \r
95 void CPushDlg::OnBnClickedRd()\r
96 {\r
97         // TODO: Add your control notification handler code here\r
98         // TODO: Add your control notification handler code here\r
99         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
100         {\r
101                 m_Remote.EnableWindow(TRUE);\r
102                 m_RemoteURL.EnableWindow(FALSE);;\r
103         }\r
104         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
105         {\r
106                 m_Remote.EnableWindow(FALSE);\r
107                 m_RemoteURL.EnableWindow(TRUE);\r
108         }\r
109 }\r
110 \r
111 \r
112 void CPushDlg::OnCbnSelchangeBranchSource()\r
113 {\r
114         // TODO: Add your control notification handler code here\r
115         m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
116 }\r
117 \r
118 void CPushDlg::OnBnClickedOk()\r
119 {\r
120         // TODO: Add your control notification handler code here\r
121         CResizableStandAloneDialog::UpdateData(TRUE);\r
122 \r
123         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
124         {\r
125                 m_URL=m_Remote.GetString();\r
126         }\r
127         if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
128         {\r
129                 m_URL=m_RemoteURL.GetString();\r
130         }\r
131 \r
132         this->m_BranchRemoteName=m_BranchRemote.GetString();\r
133         this->m_BranchSourceName=m_BranchSource.GetString();\r
134 \r
135         this->m_RemoteURL.SaveHistory();\r
136         this->m_BranchRemote.SaveHistory();\r
137         CResizableStandAloneDialog::OnOK();\r
138 }\r