forked from lianera/archives
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParameter.cpp
108 lines (92 loc) · 2.76 KB
/
Parameter.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
// Parameter.cpp : implementation file
//
#include "stdafx.h"
#include "¶íÂÞ˹·½¿é.h"
#include "Parameter.h"
#include "Manager.h"
#include "Panel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CParameter dialog
extern CManager* pManager;
extern CPanel* pPanel;
CParameter::CParameter(CWnd* pParent /*=NULL*/)
: CDialog(CParameter::IDD, pParent)
{
//{{AFX_DATA_INIT(CParameter)
m_vnPB = 0;
m_vnPL = 0;
m_vnPR = 0;
m_vnPT = 0;
m_hNumber = 0;
m_vNumber = 0;
//}}AFX_DATA_INIT
}
void CParameter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CParameter)
DDX_Control(pDX, IDC_PANELTOP, m_PanelTop);
DDX_Control(pDX, IDC_PANELRIGHT, m_PanelRight);
DDX_Control(pDX, IDC_PANELLEFT, m_PanelLeft);
DDX_Control(pDX, IDC_PANELBOTTOM, m_PanelBottom);
DDX_Slider(pDX, IDC_PANELBOTTOM, m_vnPB);
DDX_Slider(pDX, IDC_PANELLEFT, m_vnPL);
DDX_Slider(pDX, IDC_PANELRIGHT, m_vnPR);
DDX_Slider(pDX, IDC_PANELTOP, m_vnPT);
DDX_Text(pDX, IDC_HNUMBER, m_hNumber);
DDV_MinMaxInt(pDX, m_hNumber, 1, 90);
DDX_Text(pDX, IDC_VNUMBER, m_vNumber);
DDV_MinMaxInt(pDX, m_vNumber, 1, 90);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CParameter, CDialog)
//{{AFX_MSG_MAP(CParameter)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CParameter message handlers
BOOL CParameter::OnInitDialog()
{
CDialog::OnInitDialog();
m_PanelTop .SetRange(pManager->ClientRect.top ,pManager->ClientRect.bottom);
m_PanelBottom .SetRange(pManager->ClientRect.top ,pManager->ClientRect.bottom);
m_PanelLeft .SetRange(pManager->ClientRect.left ,pManager->ClientRect.right);
m_PanelRight .SetRange(pManager->ClientRect.left ,pManager->ClientRect.right);
m_PanelBottom .SetPos(pPanel->PanelRect.bottom);
m_PanelTop .SetPos(pPanel->PanelRect.top);
m_PanelLeft .SetPos(pPanel->PanelRect.left);
m_PanelRight .SetPos(pPanel->PanelRect.right);
m_hNumber =pPanel->nHGridNum;
m_vNumber =pPanel->nVGridNum;
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CParameter::OnClose()
{
CDialog::OnClose();
}
void CParameter::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
pPanel->PanelRect.top =m_vnPT;
pPanel->PanelRect.bottom=m_vnPB;
pPanel->PanelRect.left =m_vnPL;
pPanel->PanelRect.right =m_vnPR;
pPanel->nHGridNum =m_hNumber;
pPanel->nVGridNum =m_vNumber;
pPanel->GridSize.cx =(m_vnPR-m_vnPL)/m_hNumber;
pPanel->GridSize.cy =(m_vnPB-m_vnPT)/m_vNumber;
UpdateData(false);
CDialog::OnOK();
}
void CParameter::OnSound()
{
pManager->Sound=-pManager->Sound;
}