cleanup .gitignore
[TortoiseGit.git] / src / TortoiseProc / PatchViewDlg.cpp
blob07ed8c5a0f991399df2de4076d8ac36877b98046
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-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.
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);
79 CRect rect2;
80 m_ctrlPatchView.GetClientRect(rect);
81 m_ctrlPatchView.Call(SCI_SETSCROLLWIDTH, rect.Width() - 4);
85 void CPatchViewDlg::OnMoving(UINT fwSide, LPRECT pRect)
87 #define STICKYSIZE 5
88 RECT parentRect;
89 this->m_ParentCommitDlg->GetWindowRect(&parentRect);
90 if (abs(parentRect.right - pRect->left) < STICKYSIZE)
92 int width = pRect->right - pRect->left;
93 pRect->left = parentRect.right;
94 pRect->right = pRect->left + width;
96 CDialog::OnMoving(fwSide, pRect);
99 void CPatchViewDlg::OnDestroy()
101 CDialog::OnDestroy();
103 this->m_ParentCommitDlg->ShowViewPatchText(true);
106 void CPatchViewDlg::OnClose()
108 CDialog::OnClose();
109 this->DestroyWindow();