// GsPreviewCtrl2.cpp : implementation file // #include "stdafx.h" #include "GsPreviewCtrl2.h" #include "tuanmanage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CGsPreviewCtrl2 CGsPreviewCtrl2::CGsPreviewCtrl2() { } CGsPreviewCtrl2::~CGsPreviewCtrl2() { } BEGIN_MESSAGE_MAP(CGsPreviewCtrl2, CGsPreviewCtrl) //{{AFX_MSG_MAP(CGsPreviewCtrl2) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONDBLCLK() ON_WM_TIMER() ON_WM_CONTEXTMENU() ON_WM_DESTROY() ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP ON_COMMAND(ID_PAT_MODIFY,OnModifyPat) ON_COMMAND(ID_PAT_DEL,OnDelPat) ON_COMMAND(ID_PAT_REDO,OnReBuildPat) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CGsPreviewCtrl2 message handlers void CGsPreviewCtrl2::OnModifyPat() { if (!m_sName.IsEmpty()) { m_PatDlg->OnModifyPat2(m_sName); } } void CGsPreviewCtrl2::OnDelPat() { if (!m_sName.IsEmpty()) { m_PatDlg->OnDelPat2(m_sName); } } void CGsPreviewCtrl2::OnReBuildPat() { if (!m_sName.IsEmpty()) { m_PatDlg->OnReBuildPat2(m_sName); } } void CGsPreviewCtrl2::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_PatDlg->m_cSlidePicture.SetFocus(); if (m_PatDlg != NULL && !m_sName.IsEmpty()) { if(nFlags&0x8000) { if (m_sName != m_PatDlg->m_sCurSelect) { m_PatDlg->Select(m_sName); } } else { bShouldTrigger = TRUE; SetTimer(15,200,NULL); } } CGsPreviewCtrl::OnLButtonDown(nFlags,point); } void CGsPreviewCtrl2::OnLButtonDblClk(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_PatDlg->m_cSlidePicture.SetFocus(); if (m_PatDlg != NULL && !m_sName.IsEmpty()) { bShouldTrigger = FALSE; m_PatDlg->ExitAndSave(m_sName); CGsPreviewCtrl::OnLButtonDblClk(nFlags, point); } } void CGsPreviewCtrl2::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default if(nIDEvent == 15) { KillTimer(nIDEvent); if(bShouldTrigger) PostMessage(WM_LBUTTONDOWN, MK_LBUTTON|0x8000,0); } CGsPreviewCtrl::OnTimer(nIDEvent); } void CGsPreviewCtrl2::OnContextMenu(CWnd* pWnd, CPoint point) { // TODO: Add your message handler code here if ( !m_PatDlg->m_bInitMode && m_PatDlg != NULL && !m_sName.IsEmpty()) { m_PatDlg->Select(m_sName); CMenu menu; menu.LoadMenu(IDR_MENU_PAT); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this); } else { m_PatDlg->Select(m_sName); CMenu menu; menu.LoadMenu(IDR_MENU_PAT2); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this); } } void CGsPreviewCtrl2::OnDestroy() { CGsPreviewCtrl::OnDestroy(); // TODO: Add your message handler code here clearAll(); } void CGsPreviewCtrl2::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_PatDlg->m_cSlidePicture.SetFocus(); CGsPreviewCtrl::OnRButtonDown(nFlags, point); }