1 // CreateBranchTagDlg.cpp : implementation file
6 #include "TortoiseProc.h"
7 #include "CreateBranchTagDlg.h"
9 #include "Messagebox.h"
11 // CCreateBranchTagDlg dialog
13 IMPLEMENT_DYNAMIC(CCreateBranchTagDlg
, CResizableStandAloneDialog
)
15 CCreateBranchTagDlg::CCreateBranchTagDlg(CWnd
* pParent
/*=NULL*/)
16 : CResizableStandAloneDialog(CCreateBranchTagDlg::IDD
, pParent
),
20 m_bSwitch
= 0; // default switch to checkbox not selected
23 CCreateBranchTagDlg::~CCreateBranchTagDlg()
27 void CCreateBranchTagDlg::DoDataExchange(CDataExchange
* pDX
)
29 CDialog::DoDataExchange(pDX
);
33 DDX_Text(pDX
, IDC_BRANCH_TAG
, this->m_BranchTagName
);
34 DDX_Check(pDX
,IDC_CHECK_FORCE
,this->m_bForce
);
35 DDX_Check(pDX
,IDC_CHECK_TRACK
,this->m_bTrack
);
36 DDX_Check(pDX
,IDC_CHECK_SWITCH
,this->m_bSwitch
);
41 BEGIN_MESSAGE_MAP(CCreateBranchTagDlg
, CResizableStandAloneDialog
)
43 ON_BN_CLICKED(IDOK
, &CCreateBranchTagDlg::OnBnClickedOk
)
44 ON_CBN_SELCHANGE(IDC_COMBOBOXEX_BRANCH
, &CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch
)
47 BOOL
CCreateBranchTagDlg::OnInitDialog()
49 CResizableStandAloneDialog::OnInitDialog();
51 CHOOSE_VERSION_ADDANCHOR
;
53 AddAnchor(IDC_GROUP_BRANCH
, TOP_LEFT
, TOP_RIGHT
);
55 AddAnchor(IDC_GROUP_OPTION
, TOP_LEFT
, TOP_RIGHT
);
57 AddAnchor(IDOK
,BOTTOM_RIGHT
);
58 AddAnchor(IDCANCEL
,BOTTOM_RIGHT
);
60 this->AddOthersToAnchor();
64 this->SetDefaultChoose(IDC_RADIO_HEAD
);
68 this->SetDefaultChoose(IDC_RADIO_VERSION
);
69 this->GetDlgItem(IDC_COMBOBOXEX_VERSION
)->SetWindowTextW(m_Base
);
74 this->GetDlgItem(IDC_CHECK_TRACK
)->EnableWindow(FALSE
);
78 this->SetWindowTextW(_T("Create Tag"));
79 this->GetDlgItem(IDC_LABEL_BRANCH
)->SetWindowTextW(_T("Tag"));
83 this->SetWindowTextW(_T("Create Branch"));
84 this->GetDlgItem(IDC_LABEL_BRANCH
)->SetWindowTextW(_T("Branch"));
86 // show the switch checkbox if we are a create branch dialog
87 this->GetDlgItem(IDC_CHECK_SWITCH
)->ShowWindow( !m_bIsTag
);
88 CWnd
* pHead
= GetDlgItem(IDC_RADIO_HEAD
);
90 pHead
->GetWindowText( HeadText
);
91 pHead
->SetWindowText( HeadText
+ " (" + g_Git
.GetCurrentBranch() + ")");
92 EnableSaveRestore(_T("BranchTagDlg"));
97 // CCreateBranchTagDlg message handlers
99 void CCreateBranchTagDlg::OnBnClickedOk()
101 // TODO: Add your control notification handler code here
102 this->UpdateData(TRUE
);
104 this->m_BranchTagName
.Trim();
105 if(this->m_BranchTagName
.IsEmpty() || this->m_BranchTagName
.Find(' ') >= 0 )
107 CMessageBox::Show(NULL
, IDS_B_T_NOTEMPTY
, IDS_TORTOISEGIT
, MB_OK
);
110 this->UpdateRevsionName();
114 void CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch()
116 // TODO: Add your control notification handler code here
118 if(this->m_ChooseVersioinBranch
.GetString().Left(6)==_T("origin"))
119 this->GetDlgItem(IDC_CHECK_TRACK
)->EnableWindow(TRUE
);
121 this->GetDlgItem(IDC_CHECK_TRACK
)->EnableWindow(FALSE
);
124 this->GetDlgItem(IDC_CHECK_TRACK
)->EnableWindow(FALSE
);