-
Notifications
You must be signed in to change notification settings - Fork 1
/
RotateDialog.cpp
93 lines (69 loc) · 2.19 KB
/
RotateDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// RotateDialog.cpp : implementation file
//
#include "stdafx.h"
#include "TWainApp.h"
#include "RotateDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRotateDialog dialog
CRotateDialog::CRotateDialog(CWnd* pParent /*=NULL*/)
: CDialog(CRotateDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CRotateDialog)
//}}AFX_DATA_INIT
parentDlg = (CTWainAppDlg*)pParent;
}
void CRotateDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRotateDialog)
DDX_Control(pDX, IDC_STATIC_VALUE, m_value);
DDX_Control(pDX, IDC_SLIDER, m_slider);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRotateDialog, CDialog)
//{{AFX_MSG_MAP(CRotateDialog)
ON_WM_HSCROLL()
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER, OnReleasedcaptureSlider)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRotateDialog message handlers
BOOL CRotateDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_slider.SetTicFreq(5);
m_slider.SetLineSize(1);
m_slider.SetRange(-30, 30, TRUE);
m_slider.SetPos(0);
m_value.SetWindowText("0");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRotateDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CRotateDialog::OnReleasedcaptureSlider(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int nCurrentSliderValue = m_slider.GetPos();
CString strCurrentSliderValue = "";
strCurrentSliderValue.Format("%d", nCurrentSliderValue);
m_value.SetWindowText(strCurrentSliderValue);
parentDlg->RotatePicture(m_nSelectedIndex, nCurrentSliderValue);
*pResult = 0;
}
void CRotateDialog::OnClose()
{
// TODO: Add your message handler code here and/or call default
parentDlg->IsSaveRotate(m_nSelectedIndex, m_cxSelectedImage);
CDialog::OnClose();
}