void CCreateBranchTagDlg::OnVersionChanged() { int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION); if (radio == IDC_RADIO_BRANCH) OnCbnSelchangeComboboxexBranch(); else GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE); }
BOOL CCreateBranchTagDlg::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); CHOOSE_VERSION_ADDANCHOR; AddAnchor(IDC_GROUP_BRANCH, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT); AddAnchor(IDOK,BOTTOM_RIGHT); AddAnchor(IDCANCEL,BOTTOM_RIGHT); AddAnchor(IDHELP, BOTTOM_RIGHT); AddAnchor(IDC_GROUP_MESSAGE,TOP_LEFT,BOTTOM_RIGHT); AddAnchor(IDC_EDIT_MESSAGE,TOP_LEFT,BOTTOM_RIGHT); this->AddOthersToAnchor(); if(m_Base.IsEmpty()) { this->SetDefaultChoose(IDC_RADIO_HEAD); } else { this->SetDefaultChoose(IDC_RADIO_VERSION); this->GetDlgItem(IDC_COMBOBOXEX_VERSION)->SetWindowTextW(m_Base); } Init(); this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE); CString sWindowTitle; if(this->m_bIsTag) { sWindowTitle = _T("Create Tag"); this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Tag")); this->GetDlgItem(IDC_CHECK_SIGN)->EnableWindow(!g_Git.GetConfigValue(_T("user.signingkey")).IsEmpty()); } else { sWindowTitle = _T("Create Branch"); this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Branch")); this->GetDlgItem(IDC_EDIT_MESSAGE)->EnableWindow(false); this->GetDlgItem(IDC_CHECK_SIGN)->ShowWindow(SW_HIDE); } CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle); // show the switch checkbox if we are a create branch dialog this->GetDlgItem(IDC_CHECK_SWITCH)->ShowWindow( !m_bIsTag ); CWnd* pHead = GetDlgItem(IDC_RADIO_HEAD); CString HeadText; pHead->GetWindowText( HeadText ); pHead->SetWindowText( HeadText + " (" + g_Git.GetCurrentBranch() + ")"); EnableSaveRestore(_T("BranchTagDlg")); //Create the ToolTip control if( !m_ToolTip.Create(this)) { TRACE0("Unable to create the ToolTip!"); } else { m_ToolTip.AddTool(GetDlgItem(IDC_CHECK_FORCE), _T("Force creationg of branch/tag - even if already exists.")); m_ToolTip.AddTool(GetDlgItem(IDC_CHECK_SIGN), _T("Requires GPG and a key without passphrase.")); m_ToolTip.Activate(TRUE); } OnCbnSelchangeComboboxexBranch(); return TRUE; }
BOOL CCreateBranchTagDlg::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); CHOOSE_VERSION_ADDANCHOR; AddAnchor(IDC_GROUP_BRANCH, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT); AddAnchor(IDOK,BOTTOM_RIGHT); AddAnchor(IDCANCEL,BOTTOM_RIGHT); AddAnchor(IDHELP, BOTTOM_RIGHT); AddAnchor(IDC_GROUP_MESSAGE,TOP_LEFT,BOTTOM_RIGHT); AddAnchor(IDC_EDIT_MESSAGE,TOP_LEFT,BOTTOM_RIGHT); this->AddOthersToAnchor(); AdjustControlSize(IDC_RADIO_BRANCH); AdjustControlSize(IDC_RADIO_TAGS); AdjustControlSize(IDC_RADIO_VERSION); AdjustControlSize(IDC_CHECK_TRACK); AdjustControlSize(IDC_CHECK_FORCE); AdjustControlSize(IDC_CHECK_SWITCH); AdjustControlSize(IDC_CHECK_SIGN); this->SetDefaultChoose(IDC_RADIO_HEAD); InitChooseVersion(); this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE); CString sWindowTitle; if(this->m_bIsTag) { sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGS_TITLE_CREATETAG)); this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_TAG))); this->GetDlgItem(IDC_CHECK_SIGN)->EnableWindow(!g_Git.GetConfigValue(_T("user.signingkey")).IsEmpty()); } else { sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGS_TITLE_CREATEBRANCH)); this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_BRANCH))); this->GetDlgItem(IDC_EDIT_MESSAGE)->EnableWindow(FALSE); this->GetDlgItem(IDC_CHECK_SIGN)->ShowWindow(SW_HIDE); } CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle); // show the switch checkbox if we are a create branch dialog this->GetDlgItem(IDC_CHECK_SWITCH)->ShowWindow(!m_bIsTag && !GitAdminDir::IsBareRepo(g_Git.m_CurrentDir)); CWnd* pHead = GetDlgItem(IDC_RADIO_HEAD); CString HeadText; pHead->GetWindowText( HeadText ); pHead->SetWindowText( HeadText + " (" + g_Git.GetCurrentBranch() + ")"); AdjustControlSize(IDC_RADIO_HEAD); EnableSaveRestore(_T("BranchTagDlg")); m_tooltips.AddTool(GetDlgItem(IDC_CHECK_FORCE), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_FORCE_TT))); m_tooltips.AddTool(GetDlgItem(IDC_CHECK_SIGN), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_SIGN_TT))); m_tooltips.AddTool(GetDlgItem(IDC_CHECK_TRACK), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_TRACK_TT))); m_tooltips.Activate(TRUE); OnCbnSelchangeComboboxexBranch(); return TRUE; }