1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2014 - 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
23 #include "TortoiseProc.h"
24 #include "PatchViewDlg.h"
26 #include "UnicodeUtils.h"
27 // CPatchViewDlg dialog
29 IMPLEMENT_DYNAMIC(CPatchViewDlg
, CDialog
)
31 CPatchViewDlg::CPatchViewDlg(CWnd
* pParent
/*=NULL*/)
32 : CDialog(CPatchViewDlg::IDD
, pParent
)
33 , m_ParentDlg(nullptr)
34 , m_pProjectProperties(nullptr)
39 CPatchViewDlg::~CPatchViewDlg()
43 void CPatchViewDlg::DoDataExchange(CDataExchange
* pDX
)
45 CDialog::DoDataExchange(pDX
);
46 DDX_Control(pDX
, IDC_PATCH
, m_ctrlPatchView
);
49 BEGIN_MESSAGE_MAP(CPatchViewDlg
, CDialog
)
55 // CPatchViewDlg message handlers
57 BOOL
CPatchViewDlg::OnInitDialog()
59 CDialog::OnInitDialog();
61 m_ctrlPatchView
.Init(*m_pProjectProperties
);
63 m_ctrlPatchView
.SetUDiffStyle();
65 return TRUE
; // return TRUE unless you set the focus to a control
66 // EXCEPTION: OCX Property Pages should return FALSE
69 void CPatchViewDlg::SetText(const CString
& text
)
71 m_ctrlPatchView
.Call(SCI_SETREADONLY
, FALSE
);
72 m_ctrlPatchView
.SetText(text
);
73 m_ctrlPatchView
.Call(SCI_SETREADONLY
, TRUE
);
76 m_ctrlPatchView
.Call(SCI_GOTOPOS
, 0);
78 m_ctrlPatchView
.GetClientRect(rect
);
79 m_ctrlPatchView
.Call(SCI_SETSCROLLWIDTH
, rect
.Width() - 4);
83 void CPatchViewDlg::ClearView()
88 void CPatchViewDlg::OnSize(UINT nType
, int cx
, int cy
)
90 CDialog::OnSize(nType
, cx
, cy
);
92 if (this->IsWindowVisible())
96 GetDlgItem(IDC_PATCH
)->MoveWindow(0, 0, cx
, cy
);
98 m_ctrlPatchView
.GetClientRect(rect
);
99 m_ctrlPatchView
.Call(SCI_SETSCROLLWIDTH
, rect
.Width() - 4);
103 void CPatchViewDlg::OnMoving(UINT fwSide
, LPRECT pRect
)
107 m_ParentDlg
->GetPatchViewParentWnd()->GetWindowRect(&parentRect
);
108 if (abs(parentRect
.right
- pRect
->left
) < STICKYSIZE
)
110 int width
= pRect
->right
- pRect
->left
;
111 pRect
->left
= parentRect
.right
;
112 pRect
->right
= pRect
->left
+ width
;
114 CDialog::OnMoving(fwSide
, pRect
);
117 void CPatchViewDlg::OnClose()
120 m_ParentDlg
->TogglePatchView();