Use CAutoGeneralHandle
[TortoiseGit.git] / src / TortoiseProc / MergeDlg.cpp
blobe4f687c00ab8262109fa413d54668a2e7d86eb55
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2012 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // MergeDlg.cpp : implementation file
23 #include "stdafx.h"
25 #include "Git.h"
26 #include "TortoiseProc.h"
27 #include "MergeDlg.h"
28 #include "AppUtils.h"
30 #include "Messagebox.h"
31 // CMergeDlg dialog
33 IMPLEMENT_DYNAMIC(CMergeDlg, CResizableStandAloneDialog)
35 CMergeDlg::CMergeDlg(CWnd* pParent /*=NULL*/)
36 : CResizableStandAloneDialog(CMergeDlg::IDD, pParent),
37 CChooseVersion(this)
39 m_pDefaultText = MAKEINTRESOURCE(IDS_PROC_AUTOGENERATEDBYGIT);
40 m_bNoFF=false;
41 m_bSquash=false;
42 m_bNoCommit=false;
45 CMergeDlg::~CMergeDlg()
49 void CMergeDlg::DoDataExchange(CDataExchange* pDX)
51 CDialog::DoDataExchange(pDX);
53 CHOOSE_VERSION_DDX;
55 DDX_Check(pDX,IDC_CHECK_NOFF,this->m_bNoFF);
56 DDX_Check(pDX,IDC_CHECK_SQUASH,this->m_bSquash);
57 DDX_Check(pDX,IDC_CHECK_NOCOMMIT,this->m_bNoCommit);
58 DDX_Control(pDX, IDC_LOGMESSAGE, m_cLogMessage);
62 BEGIN_MESSAGE_MAP(CMergeDlg, CResizableStandAloneDialog)
63 CHOOSE_VERSION_EVENT
64 ON_BN_CLICKED(IDOK, &CMergeDlg::OnBnClickedOk)
65 ON_WM_DESTROY()
66 END_MESSAGE_MAP()
69 BOOL CMergeDlg::OnInitDialog()
71 CResizableStandAloneDialog::OnInitDialog();
72 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
74 CHOOSE_VERSION_ADDANCHOR;
76 AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);
77 AddAnchor(IDC_STATIC_MERGE_MESSAGE,TOP_LEFT,BOTTOM_RIGHT);
78 AddAnchor(IDC_LOGMESSAGE,TOP_LEFT,BOTTOM_RIGHT);
80 AddAnchor(IDOK,BOTTOM_RIGHT);
81 AddAnchor(IDCANCEL,BOTTOM_RIGHT);
82 AddAnchor(IDHELP, BOTTOM_RIGHT);
84 this->AddOthersToAnchor();
86 AdjustControlSize(IDC_RADIO_BRANCH);
87 AdjustControlSize(IDC_RADIO_TAGS);
88 AdjustControlSize(IDC_RADIO_VERSION);
89 AdjustControlSize(IDC_CHECK_SQUASH);
90 AdjustControlSize(IDC_CHECK_NOFF);
91 AdjustControlSize(IDC_CHECK_NOCOMMIT);
93 CheckRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION,IDC_RADIO_BRANCH);
94 this->SetDefaultChoose(IDC_RADIO_BRANCH);
96 CString sWindowTitle;
97 GetWindowText(sWindowTitle);
98 CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle);
100 Init();
102 m_ProjectProperties.ReadProps(CTGitPath(g_Git.m_CurrentDir));
104 m_cLogMessage.Init(m_ProjectProperties);
105 m_cLogMessage.SetFont((CString)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));
106 m_cLogMessage.RegisterContextMenuHandler(this);
108 m_cLogMessage.SetText(m_pDefaultText);
110 EnableSaveRestore(_T("MergeDlg"));
112 return TRUE;
115 // CMergeDlg message handlers
118 void CMergeDlg::OnBnClickedOk()
120 this->UpdateData(TRUE);
122 this->UpdateRevsionName();
124 this->m_strLogMesage = m_cLogMessage.GetText() ;
125 if( m_strLogMesage == CString(this->m_pDefaultText) )
127 m_strLogMesage.Empty();
130 OnOK();
133 void CMergeDlg::OnDestroy()
135 WaitForFinishLoading();
136 __super::OnDestroy();