1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2015 - 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 // CPatchViewDlg dialog
28 IMPLEMENT_DYNAMIC(CPatchViewDlg
, CDialog
)
30 CPatchViewDlg::CPatchViewDlg(CWnd
* pParent
/*=NULL*/)
31 : CDialog(CPatchViewDlg::IDD
, pParent
)
32 , m_ParentDlg(nullptr)
37 CPatchViewDlg::~CPatchViewDlg()
41 void CPatchViewDlg::DoDataExchange(CDataExchange
* pDX
)
43 CDialog::DoDataExchange(pDX
);
44 DDX_Control(pDX
, IDC_PATCH
, m_ctrlPatchView
);
47 BEGIN_MESSAGE_MAP(CPatchViewDlg
, CDialog
)
53 // CPatchViewDlg message handlers
55 BOOL
CPatchViewDlg::OnInitDialog()
57 CDialog::OnInitDialog();
59 m_ctrlPatchView
.Init(-1);
61 m_ctrlPatchView
.SetUDiffStyle();
63 return TRUE
; // return TRUE unless you set the focus to a control
64 // EXCEPTION: OCX Property Pages should return FALSE
67 void CPatchViewDlg::SetText(const CString
& text
)
69 m_ctrlPatchView
.Call(SCI_SETREADONLY
, FALSE
);
70 m_ctrlPatchView
.SetText(text
);
71 m_ctrlPatchView
.Call(SCI_SETREADONLY
, TRUE
);
74 m_ctrlPatchView
.Call(SCI_GOTOPOS
, 0);
76 m_ctrlPatchView
.GetClientRect(rect
);
77 m_ctrlPatchView
.Call(SCI_SETSCROLLWIDTH
, rect
.Width() - 4);
81 void CPatchViewDlg::ClearView()
86 void CPatchViewDlg::OnSize(UINT nType
, int cx
, int cy
)
88 CDialog::OnSize(nType
, cx
, cy
);
90 if (this->IsWindowVisible())
94 GetDlgItem(IDC_PATCH
)->MoveWindow(0, 0, cx
, cy
);
96 m_ctrlPatchView
.GetClientRect(rect
);
97 m_ctrlPatchView
.Call(SCI_SETSCROLLWIDTH
, rect
.Width() - 4);
101 void CPatchViewDlg::OnMoving(UINT fwSide
, LPRECT pRect
)
105 m_ParentDlg
->GetPatchViewParentWnd()->GetWindowRect(&parentRect
);
106 if (abs(parentRect
.right
- pRect
->left
) < STICKYSIZE
)
108 int width
= pRect
->right
- pRect
->left
;
109 pRect
->left
= parentRect
.right
;
110 pRect
->right
= pRect
->left
+ width
;
112 CDialog::OnMoving(fwSide
, pRect
);
115 void CPatchViewDlg::OnClose()
118 m_ParentDlg
->TogglePatchView();