7fd59977 |
1 | // Tune.cpp : implementation file |
2 | // |
3 | |
4 | #include "stdafx.h" |
5 | |
6 | #include "Tune.h" |
7 | |
8 | #include "AnimationApp.h" |
9 | #include "Animationdoc.h" |
10 | #include "AnimationView3D.h" |
11 | |
12 | #ifdef _DEBUG |
13 | #define new DEBUG_NEW |
14 | #undef THIS_FILE |
15 | static char THIS_FILE[] = __FILE__; |
16 | #endif |
17 | |
18 | ///////////////////////////////////////////////////////////////////////////// |
19 | // CTune dialog |
20 | |
21 | |
22 | CTune::CTune(CWnd* pParent /*=NULL*/) |
23 | : CDialog(CTune::IDD, pParent) |
24 | { |
25 | //{{AFX_DATA_INIT(CTune) |
26 | m_dAngle = 0.0; |
27 | m_dFocus = 0.0; |
28 | //}}AFX_DATA_INIT |
29 | } |
30 | |
31 | |
32 | void CTune::DoDataExchange(CDataExchange* pDX) |
33 | { |
34 | CDialog::DoDataExchange(pDX); |
35 | //{{AFX_DATA_MAP(CTune) |
36 | DDX_Text(pDX, IDC_APPERTURE, m_dAngle); |
37 | DDV_MinMaxDouble(pDX, m_dAngle, 5., 179.); |
38 | DDX_Text(pDX, IDC_FOCDIST, m_dFocus); |
39 | DDV_MinMaxDouble(pDX, m_dFocus, 1.e-003, 10000000.); |
40 | //}}AFX_DATA_MAP |
41 | } |
42 | |
43 | |
44 | BEGIN_MESSAGE_MAP(CTune, CDialog) |
45 | //{{AFX_MSG_MAP(CTune) |
46 | ON_NOTIFY(UDN_DELTAPOS, IDC_SPINANG, OnDeltaposSpinang) |
47 | ON_NOTIFY(UDN_DELTAPOS, IDC_SPINFOC, OnDeltaposSpinfoc) |
48 | ON_EN_CHANGE(IDC_APPERTURE, OnChangeApperture) |
49 | ON_EN_CHANGE(IDC_FOCDIST, OnChangeFocdist) |
50 | //}}AFX_MSG_MAP |
51 | END_MESSAGE_MAP() |
52 | |
53 | ///////////////////////////////////////////////////////////////////////////// |
54 | // CTune message handlers |
55 | |
56 | void CTune::OnDeltaposSpinang(NMHDR* pNMHDR, LRESULT* pResult) |
57 | { |
58 | NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; |
59 | // TODO: Add your control notification handler code here |
60 | |
61 | if ( pNMUpDown->iDelta > 0 ) { |
62 | if ( m_dAngle > 2. ) |
63 | m_dAngle -= 1. ; |
64 | } |
65 | else { |
66 | if ( m_dAngle < 178. ) |
67 | m_dAngle += 1 ; |
68 | } |
69 | UpdateData ( FALSE ) ; |
70 | |
71 | OnChangeApperture() ; |
72 | |
73 | *pResult = 0; |
74 | } |
75 | |
76 | void CTune::OnDeltaposSpinfoc(NMHDR* pNMHDR, LRESULT* pResult) |
77 | { |
78 | NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; |
79 | // TODO: Add your control notification handler code here |
80 | |
81 | if ( pNMUpDown->iDelta > 0 ) { |
82 | m_dFocus /= 1.1 ; |
83 | } |
84 | else { |
85 | m_dFocus *= 1.1 ; |
86 | } |
87 | UpdateData ( FALSE ) ; |
88 | |
89 | OnChangeFocdist() ; |
90 | |
91 | *pResult = 0; |
92 | } |
93 | |
94 | void CTune::OnChangeApperture() |
95 | { |
96 | // TODO: If this is a RICHEDIT control, the control will not |
97 | // send this notification unless you override the CDialog::OnInitDialog() |
98 | // function to send the EM_SETEVENTMASK message to the control |
99 | // with the ENM_CHANGE flag ORed into the lParam mask. |
100 | |
101 | // TODO: Add your control notification handler code here |
102 | |
103 | ( (CAnimationView3D *) m_pView) ->SetFocal ( m_dFocus , m_dAngle ) ; |
104 | } |
105 | |
106 | void CTune::OnChangeFocdist() |
107 | { |
108 | // TODO: If this is a RICHEDIT control, the control will not |
109 | // send this notification unless you override the CDialog::OnInitDialog() |
110 | // function to send the EM_SETEVENTMASK message to the control |
111 | // with the ENM_CHANGE flag ORed into the lParam mask. |
112 | |
113 | // TODO: Add your control notification handler code here |
114 | |
115 | ( (CAnimationView3D *) m_pView) ->SetFocal ( m_dFocus , m_dAngle ) ; |
116 | } |
117 | |
118 | BOOL CTune::OnCommand(WPARAM wParam, LPARAM lParam) |
119 | { |
120 | // TODO: Add your specialized code here and/or call the base class |
121 | |
122 | return CDialog::OnCommand(wParam, lParam); |
123 | } |
124 | |
125 | BOOL CTune::OnInitDialog() |
126 | { |
127 | CDialog::OnInitDialog(); |
128 | |
129 | // TODO: Add extra initialization here |
130 | |
131 | return TRUE; // return TRUE unless you set the focus to a control |
132 | // EXCEPTION: OCX Property Pages should return FALSE |
133 | } |
134 | |
135 | BOOL CTune::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) |
136 | { |
137 | // TODO: Add your specialized code here and/or call the base class |
138 | |
139 | return CDialog::OnNotify(wParam, lParam, pResult); |
140 | } |