OSDN Git Service

Add EnableSaveRestore at some dialog.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / CreateBranchTagDlg.cpp
1 // CreateBranchTagDlg.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 "CreateBranchTagDlg.h"\r
8 \r
9 #include "Messagebox.h"\r
10 \r
11 // CCreateBranchTagDlg dialog\r
12 \r
13 IMPLEMENT_DYNAMIC(CCreateBranchTagDlg, CResizableStandAloneDialog)\r
14 \r
15 CCreateBranchTagDlg::CCreateBranchTagDlg(CWnd* pParent /*=NULL*/)\r
16         : CResizableStandAloneDialog(CCreateBranchTagDlg::IDD, pParent),\r
17         CChooseVersion(this)\r
18 {\r
19         m_bIsTag=0;\r
20 }\r
21 \r
22 CCreateBranchTagDlg::~CCreateBranchTagDlg()\r
23 {\r
24 }\r
25 \r
26 void CCreateBranchTagDlg::DoDataExchange(CDataExchange* pDX)\r
27 {\r
28         CDialog::DoDataExchange(pDX);\r
29 \r
30         CHOOSE_VERSION_DDX;\r
31 \r
32         DDX_Text(pDX, IDC_BRANCH_TAG, this->m_BranchTagName);\r
33         DDX_Check(pDX,IDC_CHECK_FORCE,this->m_bForce);\r
34         DDX_Check(pDX,IDC_CHECK_TRACK,this->m_bTrack);\r
35 \r
36 }\r
37 \r
38 \r
39 BEGIN_MESSAGE_MAP(CCreateBranchTagDlg, CResizableStandAloneDialog)\r
40         CHOOSE_VERSION_EVENT\r
41         ON_BN_CLICKED(IDOK, &CCreateBranchTagDlg::OnBnClickedOk)\r
42         ON_CBN_SELCHANGE(IDC_COMBOBOXEX_BRANCH, &CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch)\r
43 END_MESSAGE_MAP()\r
44 \r
45 BOOL CCreateBranchTagDlg::OnInitDialog()\r
46 {\r
47         CResizableStandAloneDialog::OnInitDialog();\r
48 \r
49         CHOOSE_VERSION_ADDANCHOR;\r
50 \r
51         AddAnchor(IDC_GROUP_BRANCH, TOP_LEFT, TOP_RIGHT);\r
52         \r
53         AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
54 \r
55         AddAnchor(IDOK,BOTTOM_RIGHT);\r
56         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
57 \r
58         if(m_Base.IsEmpty())\r
59         {\r
60                 this->SetDefaultChoose(IDC_RADIO_HEAD);\r
61         \r
62         }else\r
63         {\r
64                 this->SetDefaultChoose(IDC_RADIO_VERSION);\r
65                 this->GetDlgItem(IDC_COMBOBOXEX_VERSION)->SetWindowTextW(m_Base);\r
66         }\r
67 \r
68         Init();\r
69 \r
70         this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
71 \r
72         if(this->m_bIsTag)\r
73         {\r
74                 this->SetWindowTextW(_T("Create Tag"));\r
75                 this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Tag"));\r
76         }\r
77         else\r
78         {\r
79                 this->SetWindowTextW(_T("Create Branch"));\r
80                 this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Branch"));\r
81         }\r
82         EnableSaveRestore(_T("BranchTagDlg"));\r
83         return TRUE;\r
84 \r
85 \r
86 }\r
87 // CCreateBranchTagDlg message handlers\r
88 \r
89 void CCreateBranchTagDlg::OnBnClickedOk()\r
90 {\r
91         // TODO: Add your control notification handler code here\r
92         this->UpdateData(TRUE);\r
93 \r
94         if(this->m_BranchTagName.Trim().IsEmpty())\r
95         {\r
96                 CMessageBox::Show(NULL,_T("Branch\\Tag name can't empty"),_T("TortiseGit"),MB_OK);\r
97                 return;\r
98         }\r
99         this->UpdateRevsionName();\r
100         OnOK();\r
101 }\r
102 \r
103 void CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch()\r
104 {\r
105         // TODO: Add your control notification handler code here\r
106         \r
107         if(this->m_ChooseVersioinBranch.GetString().Left(6)==_T("origin"))\r
108                 this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(TRUE);\r
109         else\r
110                 this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
111 \r
112         if(this->m_bIsTag)\r
113                 this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
114 }\r