// DlgMakeWater.cpp : implementation file // #include "stdafx.h" #include "worldcreator.h" #include "DlgMakeWater.h" #include "MainFrm.h" #include "WorldCreatorView.h" #include "SectorDefine.h" #include ".\dlgmakewater.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDlgMakeWater dialog CDlgMakeWater::CDlgMakeWater(CWnd* pParent /*=NULL*/) : CDialog(CDlgMakeWater::IDD, pParent) { //{{AFX_DATA_INIT(CDlgMakeWater) m_fWaterHeight = 0.0f; m_fWaterPosX = 0.0f; m_fWaterPosY = 0.0f; m_fWaterSizeX = 0.0f; m_fWaterSizeY = 0.0f; m_bWaterRelection = FALSE; m_AlphaWater = 0; //}}AFX_DATA_INIT } void CDlgMakeWater::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgMakeWater) DDX_Text(pDX, IDC_EDIT_WATERHEIGHT, m_fWaterHeight); DDX_Text(pDX, IDC_EDIT_WATERPOSX, m_fWaterPosX); DDX_Text(pDX, IDC_EDIT_WATERPOSY, m_fWaterPosY); DDX_Text(pDX, IDC_EDIT_WATERSIZEX, m_fWaterSizeX); DDX_Text(pDX, IDC_EDIT_WATERSIZEY, m_fWaterSizeY); DDX_Check(pDX, IDC_CHECK_WATERRELECTION, m_bWaterRelection); DDX_Control(pDX, IDC_COLOR_WATER, m_WaterColor); DDX_Text(pDX, IDC_EDIT_WATERALPHA, m_AlphaWater); DDV_MinMaxUInt(pDX, m_AlphaWater, 0, 255); //}}AFX_DATA_MAP DDX_ColourPicker(pDX, IDC_COLOR_WATER, m_cWaterColor); } BEGIN_MESSAGE_MAP(CDlgMakeWater, CDialog) //{{AFX_MSG_MAP(CDlgMakeWater) ON_BN_CLICKED(IDC_BUTTON_WATERRESET, OnButtonWaterreset) ON_EN_CHANGE(IDC_EDIT_WATERHEIGHT, OnChangeEditWaterheight) ON_EN_CHANGE(IDC_EDIT_WATERPOSX, OnChangeEditWaterposx) ON_EN_CHANGE(IDC_EDIT_WATERPOSY, OnChangeEditWaterposy) ON_EN_CHANGE(IDC_EDIT_WATERSIZEX, OnChangeEditWatersizex) ON_EN_CHANGE(IDC_EDIT_WATERSIZEY, OnChangeEditWatersizey) ON_BN_CLICKED(IDC_CHECK_WATERRELECTION, OnCheckWaterrelection) ON_EN_CHANGE(IDC_EDIT_WATERALPHA, OnChangeEditWateralpha) //}}AFX_MSG_MAP ON_BN_CLICKED(IDOK, OnBnClickedOk) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgMakeWater message handlers BOOL CDlgMakeWater::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class switch(pMsg->message) { case WM_KEYDOWN: if(pMsg->wParam==VK_ESCAPE || pMsg->wParam==VK_RETURN) return 0L; } return CDialog::PreTranslateMessage(pMsg); } BOOL CDlgMakeWater::OnInitDialog() { CDialog::OnInitDialog(); m_fWaterSizeX=SECTORSIZE; m_fWaterSizeY=SECTORSIZE; m_fWaterPosX=0.0f; m_fWaterPosY=0.0f; m_fWaterHeight=3000.0f; UpdateData(FALSE); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgMakeWater::OnOK() { // TODO: Add extra validation here CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd; CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView(); av->m_MouseInterface=-1; CDialog::OnOK(); } void CDlgMakeWater::OnButtonWaterreset() { // TODO: Add your control notification handler code here m_fWaterSizeX=SECTORSIZE; m_fWaterSizeY=SECTORSIZE; m_fWaterPosX=0.0f; m_fWaterPosY=0.0f; m_fWaterHeight=3000.0f; UpdateData(FALSE); } void CDlgMakeWater::OnChangeEditWaterheight() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnChangeEditWaterposx() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnChangeEditWaterposy() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnChangeEditWatersizex() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnChangeEditWatersizey() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnCheckWaterrelection() { // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnChangeEditWateralpha() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(); } void CDlgMakeWater::OnBnClickedOk() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. OnOK(); }