⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmwnd.cpp

📁 3D reconstruction, medical image processing from colons, using intel image processing for based clas
💻 CPP
📖 第 1 页 / 共 3 页
字号:
void RxFMWnd::OnNcLButtonUp(UINT nHitTest, CPoint point) {	if(nHitTest == RXHT_CAPTION && m_bTabVisible)	{		int  nHitTest_Tab = HitTest_Tab(point);		if(nHitTest_Tab > -1)		{			if(!m_bTabFixed)			{				m_nCurTab = nHitTest_Tab;				RedrawNCWnd(RXRS_CAPTION);			}			m_nMsgTab = nHitTest_Tab;			SendMessage(WM_COMMAND, IDFM_NC_TAB_CHANGED);		}	}		CWnd::OnNcLButtonUp(nHitTest, point);}UINT RxFMWnd::OnNcHitTest(CPoint point) {	CRect	rcWindow;	GetWindowRect(rcWindow);	if(m_dwRxStyle & WS_RX_CAPTION)	{		if(rcWindow.top <= point.y && point.y <= rcWindow.top+RXSZ_CAP_HEIGHT)			return RXHT_CAPTION;	}	if(m_dwRxStyle & WS_RX_LOCALIZER && m_bSliderShow)	{		if(m_bSliderVert)		{			if(rcWindow.top+RXSZ_CAP_HEIGHT < point.y && rcWindow.right-RXSZ_LOCAL_HEIGHT <= point.x)				return RXHT_CROP_SLIDER;		}		else		{			if(rcWindow.bottom-RXSZ_LOCAL_HEIGHT <= point.y)				return RXHT_CROP_SLIDER;		}	}	return CWnd::OnNcHitTest(point);}int  RxFMWnd::HitTest_Tab(CPoint point){	CRect		rcWindow;	GetWindowRect(rcWindow);	int			i;	int			nRightPos = rcWindow.right-RXSZ_CAP_GMARGIN-RXSZ_CAP_RMARGIN;	int			nSepCount = 0;	int			nBtnCount = 0;	RX_CAPBUTTON	*pButton;	for(i = 0; i < m_ArrayButton.GetSize(); i++)	{		pButton = (RX_CAPBUTTON *)m_ArrayButton.GetAt(i);		if(pButton->wStatus & RXCBS_VISIBLE)		{			if(pButton->wStatus & RXCBS_SEPARATOR)				nSepCount++;			else				nBtnCount++;		}	}	nRightPos = nRightPos - nSepCount*RXSZ_CAP_SMARGIN - 				nBtnCount*RXSZ_CAP_BUTTON - (nBtnCount > 1 ? (nBtnCount-1)*RXSZ_CAP_BMARGIN : 0);	if(point.x > nRightPos)		return -1;	int			j, k;	int			nTabCount = m_ArrayTab.GetSize();	CRgn		rgn;	RX_CAPTAB	*pTab;	for(i = nTabCount; i >= 0; i--)	{		if(i == nTabCount)			j = m_nCurTab;		else						j = i;		if(i == m_nCurTab)			continue;		pTab = (RX_CAPTAB *)m_ArrayTab.GetAt(j);		POINT	ptPoint[4];		for(k = 0; k < 4; k++)		{			ptPoint[k].x = pTab->ptPoint[k].x + rcWindow.left;			ptPoint[k].y = pTab->ptPoint[k].y + rcWindow.top;		}		rgn.CreatePolygonRgn(ptPoint, 4, WINDING);		if(rgn.PtInRegion(point) && m_nCurTab != j)		{			rgn.DeleteObject();			return j;		}		rgn.DeleteObject();	}	return -1;}int	 RxFMWnd::HitTest_Button(CPoint point){	CRect	rcWindow, rect;	GetWindowRect(rcWindow);	int nLeftPos  = rcWindow.left +RXSZ_CAP_LMARGIN;	int nRightPos = rcWindow.right-RXSZ_CAP_RMARGIN;	rect.top	= rcWindow.top+2;	rect.bottom = rect.top+RXSZ_CAP_BUTTON;	RX_CAPBUTTON	*pButton;	for(int i = m_ArrayButton.GetSize()-1; i >= 0; i--)	{		if(nRightPos > nLeftPos)		{			pButton = (RX_CAPBUTTON *)m_ArrayButton.GetAt(i);			if(pButton->wStatus & RXCBS_VISIBLE)			{				if(pButton->wStatus & RXCBS_SEPARATOR)					nRightPos -= RXSZ_CAP_SMARGIN;				else				{					rect.left   = nRightPos-RXSZ_CAP_BUTTON;					rect.right  = nRightPos;					if(rect.PtInRect(point))						return i;					nRightPos -= (RXSZ_CAP_BUTTON + RXSZ_CAP_BMARGIN);				}			}		}	}	return -1;}int	 RxFMWnd::HitTest_Slider(CPoint point){	CRect	rcWindow, rect;	GetWindowRect(rcWindow);	if(m_bSliderVert)	{		rcWindow.left = rcWindow.right - RXSZ_LOCAL_HEIGHT;		rcWindow.top  = rcWindow.top   + RXSZ_CAP_HEIGHT;		rect.left   = rcWindow.left  + 1;		rect.right  = rcWindow.right - 1;		rect.top    = rcWindow.top+m_nMinPi-RXSZ_LOCAL_GRIP;		rect.bottom = rcWindow.top+m_nMinPi;		if(rect.PtInRect(point))		return 0;		rect.top    = rcWindow.top+m_nMinPi;		rect.bottom = rcWindow.top+m_nMaxPi;		if(rect.PtInRect(point))		return 1;		rect.top    = rcWindow.top+m_nMaxPi;		rect.bottom = rcWindow.top+m_nMaxPi+RXSZ_LOCAL_GRIP;		if(rect.PtInRect(point))		return 2;	}	else	{		rcWindow.top  = rcWindow.bottom - RXSZ_LOCAL_HEIGHT;		rect.top    = rcWindow.top    + 1;		rect.bottom = rcWindow.bottom - 1;		rect.left   = rcWindow.left+m_nMinPi-RXSZ_LOCAL_GRIP;		rect.right  = rcWindow.left+m_nMinPi;		if(rect.PtInRect(point))		return 0;		rect.left   = rcWindow.left+m_nMinPi;		rect.right  = rcWindow.left+m_nMaxPi;		if(rect.PtInRect(point))		return 1;		rect.left   = rcWindow.left+m_nMaxPi;		rect.right  = rcWindow.left+m_nMaxPi+RXSZ_LOCAL_GRIP;		if(rect.PtInRect(point))		return 2;	}	return -1;}/////////////////////////////////////////////////////////////////////////////void RxFMWnd::AddTab(LPCTSTR lpszText){	RX_CAPTAB	*pOldTab;	RX_CAPTAB	*pNewTab = new RX_CAPTAB;	pNewTab->strText	= lpszText;	CWindowDC	dc(this);	CFont	font, *pOldFont;	font.CreateFont(13, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS,					CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, _T("Tahoma"));	pOldFont = dc.SelectObject(&font);	int		nStringSize = dc.GetTextExtent(pNewTab->strText).cx + 10;	dc.SelectObject(pOldFont);	font.DeleteObject();	ReleaseDC(&dc);	int		nPosStart = 10;	int		nTabCount = m_ArrayTab.GetSize();	if(nTabCount > 0)	{		pOldTab   = (RX_CAPTAB *)m_ArrayTab.GetAt(nTabCount-1);		nPosStart = pOldTab->ptPoint[3].x - 4;	}	pNewTab->ptPoint[0].x = nPosStart;	pNewTab->ptPoint[1].x = nPosStart + 8;	pNewTab->ptPoint[2].x = nPosStart + 8 + nStringSize;	pNewTab->ptPoint[3].x = nPosStart + 8 + nStringSize + 8;	pNewTab->ptPoint[0].y = RXSZ_CAP_HEIGHT;	pNewTab->ptPoint[1].y = 3;	pNewTab->ptPoint[2].y = 3;	pNewTab->ptPoint[3].y = RXSZ_CAP_HEIGHT;	m_ArrayTab.Add(pNewTab);}int	 RxFMWnd::GetTabCount(){	return	m_ArrayTab.GetSize();}RX_CAPTAB* RxFMWnd::GetTab(int nIndex){	ASSERT(nIndex > 0 && nIndex < m_ArrayTab.GetSize());	return (RX_CAPTAB *)m_ArrayTab.GetAt(nIndex);}void RxFMWnd::RemoveAllTab(){	for(int i = 0; i < m_ArrayTab.GetSize(); i++)		delete (RX_CAPTAB *)m_ArrayTab.GetAt(i);	m_ArrayTab.RemoveAll();	}void RxFMWnd::SetCurTab(int nIndex, BOOL bRedraw){	m_nCurTab	= nIndex;	if(bRedraw)		RedrawNCWnd(RXRS_CAPTION);}int  RxFMWnd::GetCurTab(){	return m_nCurTab;}int  RxFMWnd::GetMsgTab(){	return m_nMsgTab;}void RxFMWnd::SetTabVisible(BOOL bShow, BOOL bRedraw){	m_bTabVisible = bShow;	if(bRedraw)		RedrawNCWnd(RXRS_CAPTION);}BOOL RxFMWnd::GetTabVisible(){	return m_bTabVisible;}/////////////////////////////////////////////////////////////////////////////void RxFMWnd::AddButton(UINT nID, UINT nBmpID, WORD wStatus){	RX_CAPBUTTON	*pButton = new RX_CAPBUTTON;	pButton->nID		= nID;	pButton->nBmpID		= nBmpID;	pButton->wStatus	= wStatus;	m_ArrayButton.Add(pButton);}int	 RxFMWnd::GetButtonCount(){	return	m_ArrayButton.GetSize();}RX_CAPBUTTON* RxFMWnd::GetButton(UINT nID){	RX_CAPBUTTON	*pButton;	for(int i = 0; i < m_ArrayButton.GetSize(); i++)	{		pButton = (RX_CAPBUTTON *)m_ArrayButton.GetAt(i);		if(pButton->nID == nID)			return pButton;	}	return NULL;}void RxFMWnd::RemoveAllButton(){	for(int i = 0; i < m_ArrayButton.GetSize(); i++)		delete (RX_CAPBUTTON *)m_ArrayButton.GetAt(i);	m_ArrayButton.RemoveAll();	}void RxFMWnd::SetBtnCheck(UINT nID, BOOL bCheck, BOOL bRedraw){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton && (pButton->wStatus&RXCBS_CHECKBOX))	{		if(pButton->wStatus&RXCBS_DISABLED)			return;		if(bCheck)		pButton->wStatus |= RXCBS_CHECK;		else			pButton->wStatus &= ~RXCBS_CHECK;	}	if(bRedraw)		RedrawNCWnd(RXRS_CAPTION);}BOOL RxFMWnd::GetBtnCheck(UINT nID){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton && (pButton->wStatus&RXCBS_CHECKBOX) && (pButton->wStatus&RXCBS_CHECK))		return TRUE;	return FALSE;}void RxFMWnd::SetBtnEnable(UINT nID, BOOL bEnable, BOOL bRedraw){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton)	{		if(bEnable)		pButton->wStatus = (pButton->wStatus & RXCBS_REMOVE) | RXCBS_DISABLED;		else			pButton->wStatus = (pButton->wStatus & RXCBS_REMOVE) | RXCBS_NORMAL;	}	if(bRedraw)		RedrawNCWnd(RXRS_CAPTION);}BOOL RxFMWnd::GetBtnEnable(UINT nID){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton && (pButton->wStatus&RXCBS_DISABLED))		return FALSE;	return TRUE;}void RxFMWnd::SetBtnVisible(UINT nID, BOOL bShow, BOOL bRedraw){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton)	{		if(bShow)		pButton->wStatus |= RXCBS_VISIBLE;		else			pButton->wStatus &= (~RXCBS_VISIBLE);	}	if(bRedraw)		RedrawNCWnd(RXRS_CAPTION);}BOOL RxFMWnd::GetBtnVisible(UINT nID){	RX_CAPBUTTON	*pButton = GetButton(nID);	if(pButton && (pButton->wStatus&RXCBS_VISIBLE))		return TRUE;	return FALSE;}/////////////////////////////////////////////////////////////////////////////int  RxFMWnd::PiToPo(int nPixel, int nRangeMinPi, int nRangeMaxPi){	float	fRatio = (float)(m_nRangeMax - m_nRangeMin) / (float)(nRangeMaxPi - nRangeMinPi);	if(nPixel >= nRangeMaxPi)		return m_nRangeMax;	else if(nPixel <= nRangeMinPi)		return m_nRangeMin;	else		return (int)((nPixel - nRangeMinPi) * fRatio + m_nRangeMin + 0.5f);}int  RxFMWnd::PoToPi(int nPos, int nRangeMinPi, int nRangeMaxPi){	float	fRatio = (float)(nRangeMaxPi - nRangeMinPi) / (float)(m_nRangeMax - m_nRangeMin);	if(nPos >= m_nRangeMax)		return nRangeMaxPi;	else if(nPos <= m_nRangeMin)		return nRangeMinPi;	else		return (int)((nPos - m_nRangeMin) * fRatio + nRangeMinPi + 0.5f);}void RxFMWnd::UpdateSlider(int nIndex){	CRect	rcWindow;	GetWindowRect(rcWindow);	if(m_bSliderVert)	{		if(nIndex == -1 || nIndex == 0)			m_nMinPi = PoToPi(m_nMinPo, RXSZ_LOCAL_BORDER+RXSZ_LOCAL_GRIP,								rcWindow.Height()-RXSZ_CAP_HEIGHT-RXSZ_LOCAL_GRIP-RXSZ_LOCAL_BORDER);		if(nIndex == -1 || nIndex == 1)			m_nMaxPi = PoToPi(m_nMaxPo, RXSZ_LOCAL_BORDER+RXSZ_LOCAL_GRIP,								rcWindow.Height()-RXSZ_CAP_HEIGHT-RXSZ_LOCAL_GRIP-RXSZ_LOCAL_BORDER);	}	else	{		if(nIndex == -1 || nIndex == 0)			m_nMinPi = PoToPi(m_nMinPo, RXSZ_LOCAL_BORDER+RXSZ_LOCAL_GRIP,								rcWindow.Width()-RXSZ_LOCAL_GRIP-RXSZ_LOCAL_BORDER);		if(nIndex == -1 || nIndex == 1)			m_nMaxPi = PoToPi(m_nMaxPo, RXSZ_LOCAL_BORDER+RXSZ_LOCAL_GRIP,								rcWindow.Width()-RXSZ_LOCAL_GRIP-RXSZ_LOCAL_BORDER);	}	RedrawNCWnd(RXRS_CROP_SLIDER);}void RxFMWnd::ShowSlider(BOOL bShow){	m_bSliderShow = bShow;	SetWindowPos(NULL, -1, -1, -1, -1,					SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_DRAWFRAME|SWP_FRAMECHANGED);}void RxFMWnd::SetSliderRange(int nRangeMin, int nRangeMax){	m_nRangeMin = nRangeMin;	m_nRangeMax = nRangeMax;}void RxFMWnd::SetSliderPos(int nPosMin, int nPosMax, BOOL bRedraw){	m_nMinPo = nPosMin;	m_nMaxPo = nPosMax;	if(bRedraw)		UpdateSlider();}void RxFMWnd::GetSliderPos(int &nPosMin, int &nPosMax){	nPosMin = m_nMinPo;	nPosMax = m_nMaxPo;}void RxFMWnd::SetSliderMin(int nPosMin, BOOL bRedraw){	m_nMinPo = nPosMin;	if(bRedraw)		UpdateSlider(0);}int	 RxFMWnd::GetSliderMin(){	return m_nMinPo;}void RxFMWnd::SetSliderMax(int nPosMax, BOOL bRedraw){	m_nMaxPo = nPosMax;	if(bRedraw)		UpdateSlider(1);}int	 RxFMWnd::GetSliderMax(){	return m_nMaxPo;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -