// PageDuengunLeafTrigger.cpp : implementation file // #include "stdafx.h" #include "worldcreator.h" #include "PageDuengunLeafTrigger.h" #include "RBspScene.h" #include "RBspSceneManager.h" #include "SceneManager.h" #include "WorldCreatorView.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPageDuengunLeafTrigger property page IMPLEMENT_DYNCREATE(CPageDuengunLeafTrigger, CPropertyPage) CPageDuengunLeafTrigger::CPageDuengunLeafTrigger() : CPropertyPage(CPageDuengunLeafTrigger::IDD) { //{{AFX_DATA_INIT(CPageDuengunLeafTrigger) m_BTriggerInput = FALSE; m_TriggerValue = -1; //}}AFX_DATA_INIT m_iLeafData = -1; } CPageDuengunLeafTrigger::~CPageDuengunLeafTrigger() { } void CPageDuengunLeafTrigger::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPageDuengunLeafTrigger) DDX_Control(pDX, IDC_TREE1, m_ctrlTriggerTree); DDX_Control(pDX, IDC_EDIT1, m_ctrlLeafIndex); DDX_Check(pDX, IDC_INSERT, m_BTriggerInput); DDX_Radio(pDX, IDC_RADIO1, m_TriggerValue); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPageDuengunLeafTrigger, CPropertyPage) //{{AFX_MSG_MAP(CPageDuengunLeafTrigger) ON_WM_PAINT() ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1) ON_BN_CLICKED(IDC_LEAFINDEX, OnLeafindex) ON_BN_CLICKED(IDC_INSERT, OnInsert) // ON_NOTIFY(LVN_BEGINDRAG, IDC_LIST3, OnBegindragList3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPageDuengunLeafTrigger message handlers void CPageDuengunLeafTrigger::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here int iLeaf = -1; CString strLeafIndex; if(CSceneManager::m_RBspSceneManager.m_pCurrentBspScene != NULL) { iLeaf = CSceneManager::m_RBspSceneManager.m_pCurrentBspScene->GetLeafIndex(); // if(iLeaf != m_iLeafData) // { m_iLeafData = iLeaf; strLeafIndex.Format("Current LeafNode Index : %d",iLeaf); m_ctrlLeafIndex.SetWindowText(strLeafIndex); //UpdateData(FALSE); //m_ctrlLeafIndex.Invalidate(TRUE); // } } else { iLeaf = -1; strLeafIndex.Format("Current LeafNode Not Exist"); m_ctrlLeafIndex.SetWindowText(strLeafIndex); //UpdateData(FALSE); //m_ctrlLeafIndex.Invalidate(TRUE); } // Do not call CPropertyPage::OnPaint() for painting messages } void CPageDuengunLeafTrigger::OnChangeEdit1() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CPropertyPage::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. //m_ctrlLeafIndex.Print((CDC *)this,PRF_CHECKVISIBLE); // TODO: Add your control notification handler code here } void CPageDuengunLeafTrigger::OnLeafindex() { // TODO: Add your control notification handler code here int iLeaf = -1; CString strLeafIndex; if(CSceneManager::m_RBspSceneManager.m_pCurrentBspScene != NULL) { iLeaf = CSceneManager::m_RBspSceneManager.m_pCurrentBspScene->GetLeafIndex(); // if(iLeaf != m_iLeafData) // { m_iLeafData = iLeaf; strLeafIndex.Format("Current LeafNode Index : %d",iLeaf); m_ctrlLeafIndex.SetWindowText(strLeafIndex); //UpdateData(FALSE); //m_ctrlLeafIndex.Invalidate(TRUE); // } } else { iLeaf = -1; strLeafIndex.Format("Current LeafNode Not Exist"); m_ctrlLeafIndex.SetWindowText(strLeafIndex); //UpdateData(FALSE); //m_ctrlLeafIndex.Invalidate(TRUE); } } BOOL CPageDuengunLeafTrigger::OnInitDialog() { CPropertyPage::OnInitDialog(); m_imgIcon.Create(IDB_TREEICON,16,2,RGB(0,128,128)); m_ctrlTriggerTree.SetImageList(&m_imgIcon,TVSIL_NORMAL); TV_INSERTSTRUCT tvInsert; tvInsert.hParent = NULL; tvInsert.hInsertAfter = TVI_LAST; tvInsert.item.mask = TVIF_TEXT; tvInsert.item.state = 0; tvInsert.item.stateMask = 0; tvInsert.item.cchTextMax = 50; tvInsert.item.iSelectedImage = 1; tvInsert.item.cChildren = 0; tvInsert.item.pszText = "Root"; tvInsert.item.iImage = 0; m_Root = m_ctrlTriggerTree.InsertItem(&tvInsert); m_ctrlTriggerTree.Expand(m_Root,TVE_EXPAND); // TODO: Add extra initialization here /* DWORD dwStyle; dwStyle = m_ctrlTrigger.SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0 ,0); dwStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES ; m_ctrlTrigger.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE, 0,dwStyle ); m_ctrlTrigger.InsertColumn(0,"±Í¼Ó Leaf",LVCFMT_LEFT,230); m_ctrlTrigger.InsertColumn(1,"Æ®¸®°Å¿¡ µî·ÏµÈ Event °¹¼ö", LVCFMT_LEFT,530); */ return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CPageDuengunLeafTrigger::OnInsert() { // TODO: Add your control notification handler code here UpdateData(TRUE); // RBsp Trigger : 99 if(m_BTriggerInput) { CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd; CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView(); av->ChangeMouseInterface(99); av->m_iBspTriggerValue = m_TriggerValue; } else { CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd; CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView(); av->ChangeMouseInterface(-1); } } /* void CPageDuengunLeafTrigger::OnBegindragList3(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // TODO: Add your control notification handler code here *pResult = 0; } */