better check when to enable statistics button
[TortoiseGit.git] / src / TortoiseProc / PatchViewDlg.cpp
blob44bbef155dfd12a02eb62401371282209cf6ecfa
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011 - 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.
19 // PatchViewDlg.cpp : implementation file
22 #include "stdafx.h"
23 #include "TortoiseProc.h"
24 #include "PatchViewDlg.h"
25 #include "Registry.h"
26 #include "CommitDlg.h"
27 #include "UnicodeUtils.h"
28 // CPatchViewDlg dialog
30 IMPLEMENT_DYNAMIC(CPatchViewDlg, CDialog)
32 CPatchViewDlg::CPatchViewDlg(CWnd* pParent /*=NULL*/)
33 : CDialog(CPatchViewDlg::IDD, pParent)
38 CPatchViewDlg::~CPatchViewDlg()
42 void CPatchViewDlg::DoDataExchange(CDataExchange* pDX)
44 CDialog::DoDataExchange(pDX);
45 DDX_Control(pDX, IDC_PATCH, m_ctrlPatchView);
48 BEGIN_MESSAGE_MAP(CPatchViewDlg, CDialog)
49 ON_WM_SIZE()
50 ON_WM_MOVING()
51 ON_WM_DESTROY()
52 ON_WM_CLOSE()
53 END_MESSAGE_MAP()
55 // CPatchViewDlg message handlers
57 BOOL CPatchViewDlg::OnInitDialog()
59 CDialog::OnInitDialog();
61 m_ctrlPatchView.Init(*m_pProjectProperties);
62 m_ctrlPatchView.SetFont((CString)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));
64 m_ctrlPatchView.SetUDiffStyle();
66 return TRUE; // return TRUE unless you set the focus to a control
67 // EXCEPTION: OCX Property Pages should return FALSE
70 void CPatchViewDlg::OnSize(UINT nType, int cx, int cy)
72 CDialog::OnSize(nType, cx, cy);
74 if (this->IsWindowVisible())
76 CRect rect;
77 GetClientRect(rect);
78 GetDlgItem(IDC_PATCH)->MoveWindow(0, 0, cx, cy);
82 void CPatchViewDlg::OnMoving(UINT fwSide, LPRECT pRect)
84 #define STICKYSIZE 5
85 RECT parentRect;
86 this->m_ParentCommitDlg->GetWindowRect(&parentRect);
87 if (abs(parentRect.right - pRect->left) < STICKYSIZE)
89 int width = pRect->right - pRect->left;
90 pRect->left = parentRect.right;
91 pRect->right = pRect->left + width;
93 CDialog::OnMoving(fwSide, pRect);
96 void CPatchViewDlg::OnDestroy()
98 CDialog::OnDestroy();
100 this->m_ParentCommitDlg->ShowViewPatchText(true);
103 void CPatchViewDlg::OnClose()
105 CDialog::OnClose();
106 this->DestroyWindow();