-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathColorHCFR.h
219 lines (178 loc) · 7.72 KB
/
ColorHCFR.h
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2005-2011 Association Homecinema Francophone. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
//
// This file is subject to the terms of the GNU General Public License as
// published by the Free Software Foundation. A copy of this license is
// included with this software distribution in the file COPYING.htm. If you
// do not have a copy, you may obtain a copy by writing to the Free
// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details
/////////////////////////////////////////////////////////////////////////////
// Author(s):
// François-Xavier CHABOUD
// Georges GALLERAND
// Benoit SEGUIN
/////////////////////////////////////////////////////////////////////////////
// ColorHCFR.h : main header file for the COLORHCFR application
//
#if !defined(AFX_COLORHCFR_H__377B1C45_C5FB_483D_9410_96B1FCC42EC2__INCLUDED_)
#define AFX_COLORHCFR_H__377B1C45_C5FB_483D_9410_96B1FCC42EC2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "WinAppEx.h"
#include "HelpID.h"
#include "Color.h"
#include "CrashDump.h"
// Return codes for CColorHCFRApp::GetLuxMeasure
#define LUXMETER_OK 0 // Value is OK
#define LUXMETER_NOT_RUNNING 1 // Luxmeter not running
#define LUXMETER_SCALE_TOO_LOW 2 // Scale is too low, and can be changed
#define LUXMETER_SCALE_TOO_HIGH 3 // Scale is too high, and can be changed
#define LUXMETER_SCALE_TOO_LOW_MAX 4 // Scale is too low, and is the highest: cannot measure value
#define LUXMETER_SCALE_TOO_HIGH_MIN 5 // Scale is too high, and is the lowest: cannot measure value
#define LUXMETER_NEW_SCALE_OK 6 // User changed scale and now value can be measured
//////////////////////////////////////////////////////////////////////
// Help handling in property sheets
class CPropertyPageWithHelp : public CPropertyPage
{
DECLARE_DYNAMIC(CPropertyPageWithHelp)
public:
CPropertyPageWithHelp () : CPropertyPage () { m_psp.dwFlags |= PSP_HASHELP; m_psp.hInstance = AfxGetResourceHandle (); }
CPropertyPageWithHelp(UINT nIDTemplate, UINT nIDCaption = 0) : CPropertyPage ( nIDTemplate, nIDCaption ) { m_psp.dwFlags |= PSP_HASHELP; m_psp.hInstance = AfxGetResourceHandle (); }
virtual ~CPropertyPageWithHelp() {}
virtual UINT GetHelpId ( LPSTR lpszTopic ) { return 0; }
afx_msg void OnContextMenu(CWnd* pWnd, CPoint pos);
DECLARE_MESSAGE_MAP()
};
class CPropertySheetWithHelp : public CPropertySheet
{
DECLARE_DYNAMIC(CPropertySheetWithHelp)
public:
CPropertySheetWithHelp() : CPropertySheet() { m_psh.dwFlags |= PSH_HASHELP; }
CPropertySheetWithHelp(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0) : CPropertySheet ( nIDCaption, pParentWnd, iSelectPage ) { m_psh.dwFlags |= PSH_HASHELP; }
CPropertySheetWithHelp(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0) : CPropertySheet ( pszCaption, pParentWnd, iSelectPage ) { m_psh.dwFlags |= PSH_HASHELP; }
virtual ~CPropertySheetWithHelp() {}
afx_msg BOOL CPropertySheetWithHelp::OnHelpInfo ( HELPINFO * pHelpInfo );
afx_msg void OnHelp();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CColorHCFRApp:
// See ColorHCFR.cpp for the implementation of this class
//
#include "ColorHCFRConfig.h"
class CDataSetDoc ; //Ki
CDataSetDoc * GetDataRef(); //Ki
void SetDataRef(CDataSetDoc *m_pRefData); //Ki
void UpdateDataRef(BOOL ActiveDataRef, CDataSetDoc * pDoc); //Ki
CColorHCFRConfig * GetConfig();
class CColorHCFRApp : public CHWinAppEx
{
public:
CColorHCFRConfig *m_pConfig;
CColorReference *m_pColorReference;
CDataSetDoc *m_pReferenceData; //Ki
public:
CColorHCFRApp();
~CColorHCFRApp();
afx_msg void OnFileNew() { CHWinAppEx::OnFileNew (); }
void CreateCIEBitmaps ( BOOL bBackGround = FALSE );
// CIE Bitmaps handling
HANDLE m_hCIEThread; // Background thread creating bitmaps
HANDLE m_hCIEEvent; // Event set when bitmaps are created
// CIE Bitmaps (xy)
CBitmap m_chartBitmap;
CBitmap m_chartBitmap_white;
CBitmap m_lightenChartBitmap;
// CIE Bitmaps (u'v')
CBitmap m_chartBitmap_uv;
CBitmap m_chartBitmap_uv_white;
CBitmap m_lightenChartBitmap_uv;
// CIE Bitmaps (a*b*)
CBitmap m_chartBitmap_ab;
CBitmap m_chartBitmap_ab_white;
CBitmap m_lightenChartBitmap_ab;
// Measuring cursor
HCURSOR m_hCursorMeasure;
HCURSOR m_hSavedCursor;
CWnd * m_pPatternWnd;
void SetPatternWindow ( CWnd * pWnd );
void BringPatternWindowToTop ();
void BeginMeasureCursor ();
void RestoreMeasureCursor ();
void EndMeasureCursor ();
int InMeasureMessageBox(LPCSTR lpText, LPCSTR lpCaption = NULL, UINT uType = MB_OK);
LRESULT CALLBACK MsgBoxHookProc(int nCode, WPARAM wParam, LPARAM lParam);
// LX-1108 luxmeter handling
void StartLuxMeasures ();
BOOL IsLuxmeterRunning ();
void SetLuxmeterValue ( LPCSTR lpszString, DWORD dwStartTick );
void BeginLuxMeasure ();
UINT GetLuxMeasure ( double * pLuxValue );
virtual int Run();
// Luxmeter connection handling
HANDLE m_hLuxThread; // Background thread handling luxmeter
BOOL m_bStopLuxThread; // Flag used to stop background thread
CString m_LuxPort; // COM port, empty when no luxmeter to handle
// Luxmeter values
CRITICAL_SECTION m_LuxCritSec;
char m_RefLuxParams [ 2 ];
double m_CurrentLuxValue;
BOOL m_bLowLuxValue;
BOOL m_bHighLuxValue;
BOOL m_bLowestLuxScale;
BOOL m_bHighestLuxScale;
DWORD m_dwPreviousLuxValueTime;
DWORD m_dwLuxValueTime;
BOOL m_bInsideMeasure;
DWORD m_dwMeasureStartTime;
double m_LastLuxValues [ 8 ];
int m_NbMeasures;
BOOL m_bLastMeasureOutOfRange;
BOOL m_bFirstMeasureWithNewScaleOk;
BOOL m_bLuxMeasureValid;
int m_nFirstValidMeasure;
double m_MeasuredLuxValue;
double m_MeasuredLuxValue_Initial;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CColorHCFRApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CColorHCFRApp)
afx_msg void OnAppAbout();
afx_msg void OnUpdateViewDataSet(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewCiechart(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewColortemphisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewLuminancehisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewGammahisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewNearBlackhisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewNearWhitehisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewRgbhisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewSatLumhisto(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewSatLumshift(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewMeasuresCombo(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CrashDump m_enablesCrashDump;
};
inline CColorHCFRApp * GetColorApp () { return (CColorHCFRApp *) AfxGetApp (); }
inline CColorReference& GetColorReference() {return *(GetColorApp()->m_pColorReference);}
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLORHCFR_H__377B1C45_C5FB_483D_9410_96B1FCC42EC2__INCLUDED_)