-
Notifications
You must be signed in to change notification settings - Fork 1
/
ColorSelectionDialog.cpp
executable file
·139 lines (107 loc) · 4.49 KB
/
ColorSelectionDialog.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
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
// ColorSelectionDialog.cpp : implementation file
//
#include "stdafx.h"
#include "CGWork.h"
#include "ColorSelectionDialog.h"
#include "afxdialogex.h"
// ColorSelectionDialog dialog
IMPLEMENT_DYNAMIC(ColorSelectionDialog, CDialogEx)
ColorSelectionDialog::ColorSelectionDialog(CWnd* pParent /*=NULL*/)
: CDialogEx(ColorSelectionDialog::IDD, pParent)
, silhouette_thickness(0), boundbox_color(RGB(0, 0, 0)), wireframe_color(RGB(0, 0, 0)), background_color(RGB(0, 0, 0)), silhouette_color(RGB(0, 255, 255))
{
}
ColorSelectionDialog::ColorSelectionDialog(COLORREF m_color_wireframe, COLORREF m_boundbox_color, COLORREF m_background_color, COLORREF m_vertex_norm_color, COLORREF m_polygon_norm_color, COLORREF m_silhouette_color, double m_silhouette_thickness, CWnd* pParent)
: CDialogEx(ColorSelectionDialog::IDD, pParent){
wireframe_color = RGB(GetBValue(m_color_wireframe), GetGValue(m_color_wireframe), GetRValue(m_color_wireframe));
boundbox_color = RGB(GetBValue(m_boundbox_color), GetGValue(m_boundbox_color), GetRValue(m_boundbox_color));
background_color = RGB(GetBValue(m_background_color), GetGValue(m_background_color), GetRValue(m_background_color));
vertex_norm_color = RGB(GetBValue(m_vertex_norm_color), GetGValue(m_vertex_norm_color), GetRValue(m_vertex_norm_color));
polygon_norm_color = RGB(GetBValue(m_polygon_norm_color), GetGValue(m_polygon_norm_color), GetRValue(m_polygon_norm_color));
silhouette_color = RGB(GetBValue(m_silhouette_color), GetGValue(m_silhouette_color), GetRValue(m_silhouette_color));
silhouette_thickness = m_silhouette_thickness;
}
ColorSelectionDialog::~ColorSelectionDialog()
{
}
void ColorSelectionDialog::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
double thick = silhouette_thickness;
DDX_Text(pDX, IDC_SILLHUOTTE_THICKNESS, silhouette_thickness);
if (silhouette_thickness <= 0){
CString er("Error, thickness must be larger than 0, using old value.");
silhouette_thickness = thick;
this->MessageBox(er);
}
}
BEGIN_MESSAGE_MAP(ColorSelectionDialog, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON2, &ColorSelectionDialog::OnBackgroundColorClick)
ON_BN_CLICKED(IDC_BUTTON1, &ColorSelectionDialog::OnWireframeColorClick)
ON_BN_CLICKED(IDC_BUTTON3, &ColorSelectionDialog::OnBoundboxColorClick)
ON_BN_CLICKED(IDC_BUTTON5, &ColorSelectionDialog::OnBnClickedButton5)
ON_BN_CLICKED(IDC_BUTTON4, &ColorSelectionDialog::OnBnClickedButton4)
ON_BN_CLICKED(IDC_BUTTON6, &ColorSelectionDialog::OnBnClickedButton6)
ON_EN_CHANGE(IDC_LIGHT_POS_X, &ColorSelectionDialog::OnEnChangeLightPosX)
ON_EN_CHANGE(IDC_SILLHUOTTE_THICKNESS, &ColorSelectionDialog::OnEnChangeSillhuotteThickness)
END_MESSAGE_MAP()
// ColorSelectionDialog message handlers
void ColorSelectionDialog::OnBackgroundColorClick()
{
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
background_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnWireframeColorClick()
{
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
wireframe_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnBoundboxColorClick()
{
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
boundbox_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnBnClickedButton5()
{
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
vertex_norm_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnBnClickedButton4()
{
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
polygon_norm_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnBnClickedButton6()
{
// TODO: Add your control notification handler code here
CColorDialog colorDlg;
if (colorDlg.DoModal() == IDOK) {
silhouette_color = colorDlg.GetColor();
}
}
void ColorSelectionDialog::OnEnChangeLightPosX()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void ColorSelectionDialog::OnEnChangeSillhuotteThickness()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}