OSDN Git Service

b616c1dcd988ac336bf211aa2136f83d048df3e0
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / GitSwitchDlg.cpp
1 // GitSwitch.cpp : implementation file\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 #include "Git.h"\r
6 #include "TortoiseProc.h"\r
7 #include "GitSwitchDlg.h"\r
8 \r
9 \r
10 #include "Messagebox.h"\r
11 \r
12 // CGitSwitchDlg dialog\r
13 \r
14 IMPLEMENT_DYNAMIC(CGitSwitchDlg, CResizableStandAloneDialog)\r
15 \r
16 CGitSwitchDlg::CGitSwitchDlg(CWnd* pParent /*=NULL*/)\r
17         : CResizableStandAloneDialog(CGitSwitchDlg::IDD, pParent)\r
18         ,CChooseVersion(this)\r
19 {\r
20         m_bBranch=FALSE;\r
21 }\r
22 \r
23 CGitSwitchDlg::~CGitSwitchDlg()\r
24 {\r
25 }\r
26 \r
27 void CGitSwitchDlg::DoDataExchange(CDataExchange* pDX)\r
28 {\r
29         CDialog::DoDataExchange(pDX);\r
30         CHOOSE_VERSION_DDX;\r
31                                 \r
32         DDX_Check(pDX,IDC_CHECK_FORCE,this->m_bForce);\r
33         DDX_Check(pDX,IDC_CHECK_TRACK,this->m_bTrack);\r
34         DDX_Check(pDX,IDC_CHECK_BRANCH,this->m_bBranch);\r
35 \r
36         DDX_Text(pDX,IDC_EDIT_BRANCH,this->m_NewBranch);\r
37 }\r
38 \r
39 \r
40 BEGIN_MESSAGE_MAP(CGitSwitchDlg, CResizableStandAloneDialog)\r
41 \r
42         CHOOSE_VERSION_EVENT\r
43         ON_BN_CLICKED(IDC_CHECK_BRANCH, &CGitSwitchDlg::OnBnClickedCheckBranch)\r
44         ON_BN_CLICKED(IDOK, &CGitSwitchDlg::OnBnClickedOk)\r
45         ON_CBN_SELCHANGE(IDC_COMBOBOXEX_BRANCH, &CGitSwitchDlg::OnCbnSelchangeComboboxexBranch)\r
46 END_MESSAGE_MAP()\r
47 \r
48 BOOL CGitSwitchDlg::OnInitDialog()\r
49 {\r
50         CResizableStandAloneDialog::OnInitDialog();\r
51 \r
52         AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
53 \r
54         AddAnchor(IDC_EDIT_BRANCH, TOP_LEFT, TOP_RIGHT);\r
55 \r
56         AddAnchor(IDOK,BOTTOM_RIGHT);\r
57         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
58 \r
59 \r
60         CHOOSE_VERSION_ADDANCHOR;\r
61         Init();\r
62 \r
63         if(m_Base.IsEmpty())\r
64                 SetDefaultChoose(IDC_RADIO_BRANCH);\r
65         else\r
66         {\r
67                 this->GetDlgItem(IDC_COMBOBOXEX_VERSION)->SetWindowTextW(m_Base);\r
68                 SetDefaultChoose(IDC_RADIO_VERSION);\r
69         }\r
70 \r
71         OnBnClickedCheckBranch();\r
72         this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
73 \r
74         return TRUE;\r
75 \r
76 \r
77 }\r
78 // CCreateBranchTagDlg message handlers\r
79 \r
80 void CGitSwitchDlg::OnBnClickedChooseRadioHost()\r
81 {\r
82         // TODO: Add your control notification handler code here\r
83         OnBnClickedChooseRadio();\r
84         OnCbnSelchangeComboboxexBranch();\r
85         OnBnClickedCheckBranch();\r
86         \r
87 }\r
88 \r
89 void CGitSwitchDlg::OnBnClickedOk()\r
90 {\r
91         // TODO: Add your control notification handler code here\r
92         this->UpdateData(TRUE);\r
93         \r
94         UpdateRevsionName();\r
95         //this->m_Version.SaveHistory();\r
96 \r
97         OnOK();\r
98 }\r
99 void CGitSwitchDlg::OnBnClickedCheckBranch()\r
100 {\r
101         // TODO: Add your control notification handler code here\r
102         this->UpdateData(TRUE);\r
103         this->UpdateRevsionName();\r
104         GetDlgItem(IDC_EDIT_BRANCH)->SetWindowTextW(CString(_T("Branch_"))+this->m_VersionName);\r
105 \r
106 #if 0   \r
107         int radio=GetCheckedRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION);\r
108         if(radio==IDC_RADIO_TAGS || radio==IDC_RADIO_VERSION)\r
109         {\r
110                 this->m_bBranch=TRUE;\r
111                 this->UpdateData(FALSE);\r
112                 this->UpdateRevsionName();\r
113                 \r
114         }else\r
115         {\r
116                 this->m_bBranch=FALSE;\r
117                 this->UpdateData(FALSE);\r
118         }\r
119 #endif\r
120         this->GetDlgItem(IDC_EDIT_BRANCH)->EnableWindow(this->m_bBranch);\r
121 }\r
122 \r
123 void CGitSwitchDlg::OnCbnSelchangeComboboxexBranch()\r
124 {\r
125         // TODO: Add your control notification handler code here\r
126         int radio=GetCheckedRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION);\r
127         if(this->m_ChooseVersioinBranch.GetString().Left(6)==_T("origin") && radio==IDC_RADIO_BRANCH )\r
128                 this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(TRUE);\r
129         else\r
130                 this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
131 }\r