コード例 #1
0
ファイル: duSplitter.cpp プロジェクト: tantaishan/MyEcho
void duSplitter::OnMouseLUp(POINT pt)
{
	duPlugin *pFPlugin = GetPluginByName(m_szFName);
	duPlugin *pSPlugin = GetPluginByName(m_szSName);
	
	if (!Plugin_IsValid(pFPlugin) || !Plugin_IsValid(pSPlugin))
		return;

	if (m_fTracking)
	{
		Plugin_ReleaseCapture(this);
		m_fTracking = FALSE;

		duRect rectFirst;
		Plugin_GetRect(pFPlugin, &rectFirst);
		
		duRect rectSplitter;
		Plugin_GetRect(this, &rectSplitter);
		
		duRect rectSecond;
		Plugin_GetRect(pSPlugin, &rectSecond);

		int nDistance = 0;
		if (m_fVert)
		{
			int nFirstMinY  = rectFirst.top + m_nFMinPixel + (m_ptStart.y - rectSplitter.top);
			int nSecondMinY = rectSecond.bottom - m_nSMinPixel - (rectSplitter.bottom - m_ptStart.y);

			if (pt.y < nFirstMinY)
				nDistance = m_ptStart.y - nFirstMinY;
			else if (pt.y >= nFirstMinY && pt.y <= m_ptStart.y)
				nDistance = m_ptStart.y - pt.y;
			else if (pt.y >= m_ptStart.y && pt.y <= nSecondMinY)
				nDistance = m_ptStart.y - pt.y;
			else if (pt.y > nSecondMinY)
				nDistance =  m_ptStart.y - nSecondMinY;

			MoveVert(nDistance);
		}
		else
		{
			int nFirstMinX  = rectFirst.left   + m_nFMinPixel + (m_ptStart.x - rectSplitter.left);
			int nSecondMinX = rectSecond.right - m_nSMinPixel - (rectSplitter.right - m_ptStart.x);

			if (pt.x < nFirstMinX)
				nDistance = m_ptStart.x - nFirstMinX;
			else if (pt.x >= nFirstMinX && pt.x <= m_ptStart.x)
				nDistance = m_ptStart.x - pt.x;
			else if (pt.x >= m_ptStart.x && pt.x <= nSecondMinX)
				nDistance = m_ptStart.x - pt.x;
			else if (pt.x > nSecondMinX)
				nDistance =  m_ptStart.x - nSecondMinX;

			MoveHorz(nDistance);
		}
	}

	Plugin_SetState(this, DU_STATE_NORMAL);
	::InvalidateRect(m_hWnd, NULL, TRUE);
}
コード例 #2
0
ファイル: duGifCtrl.cpp プロジェクト: tantaishan/MyEcho
void duGifCtrl::OnMouseLUp(POINT pt)
{
	if (GetState() == DU_STATE_PRESS)
	{
		Plugin_SetState(this, DU_STATE_NORMAL);
		NotifyUser(DUM_GIFCLICK, NULL, NULL);
	}
}
コード例 #3
0
ファイル: duSplitter.cpp プロジェクト: tantaishan/MyEcho
void duSplitter::OnMouseLDown(POINT pt)
{
	duPlugin *pFPlugin = GetPluginByName(m_szFName);
	duPlugin *pSPlugin = GetPluginByName(m_szSName);
	
	if (!Plugin_IsValid(pFPlugin) || !Plugin_IsValid(pSPlugin))
		return;

	duRect rectSplitter;
	Plugin_GetRect(this, &rectSplitter);
	if (rectSplitter.PtInRect(pt))
	{
		m_ptStart = pt;
		m_rectLast.SetRectEmpty();
		m_fTracking = TRUE;
		Plugin_SetState(this, DU_STATE_PRESS);
		Plugin_SetCapture(this);
		Plugin_Redraw(this, TRUE);
	}
}
コード例 #4
0
ファイル: duSplitter.cpp プロジェクト: tantaishan/MyEcho
void duSplitter::OnMouseLeave(POINT pt)
{
	Plugin_SetState(this, DU_STATE_NORMAL);
	Plugin_Redraw(this, TRUE);
}
コード例 #5
0
ファイル: duSplitter.cpp プロジェクト: tantaishan/MyEcho
void duSplitter::OnMouseMove(POINT pt)
{
	duPlugin *pFPlugin = GetPluginByName(m_szFName);
	duPlugin *pSPlugin = GetPluginByName(m_szSName);
	
	if (!Plugin_IsValid(pFPlugin) || !Plugin_IsValid(pSPlugin))
		return;

	if (GetState() == DU_STATE_NORMAL)
	{
		Plugin_SetState(this, DU_STATE_OVER);
		Plugin_Redraw(this, TRUE);
	}

	if (m_fTracking)
	{
		duRect rectFirst;
		Plugin_GetRect(pFPlugin, &rectFirst);
		
		duRect rectSplitter;
		Plugin_GetRect(this, &rectSplitter);
		
		duRect rectSecond;
		Plugin_GetRect(pSPlugin, &rectSecond);
		duRect rectTracking = rectSplitter;

		if (m_fVert)
		{
			int yOffset = pt.y - m_ptStart.y;
			rectTracking.OffsetRect(0, yOffset);

			int nFirstMinY = rectFirst.top + m_nFMinPixel + (m_ptStart.y - rectSplitter.top);
			int nSecondMinY = rectSecond.bottom - m_nSMinPixel - (rectSplitter.bottom - m_ptStart.y);
            if (pt.y >= nFirstMinY && pt.y <= nSecondMinY)
			{
				OnInvertTracker(m_rectLast);
				OnInvertTracker(rectTracking);
				m_rectLast = rectTracking;
			}
			else
			{
				if (pt.y < nFirstMinY && m_rectLast.top != (rectFirst.top + m_nFMinPixel))
				{
					int nSplitterHeight = m_rectLast.Height();
					rectTracking.top = rectFirst.top + m_nFMinPixel;
					rectTracking.bottom = rectTracking.top + nSplitterHeight;
					OnInvertTracker(m_rectLast);
					OnInvertTracker(rectTracking);
					m_rectLast = rectTracking;
				}

				if (pt.y > nSecondMinY && m_rectLast.bottom != (rectSecond.bottom - m_nSMinPixel))
				{
					int nSplitterHeight = m_rectLast.Height();
					rectTracking.bottom = rectSecond.bottom - m_nSMinPixel;
					rectTracking.top = rectTracking.bottom - nSplitterHeight;
					OnInvertTracker(m_rectLast);
					OnInvertTracker(rectTracking);
					m_rectLast = rectTracking;
				}
			}
		}
		else
		{
			int xOffset = pt.x - m_ptStart.x;
			rectTracking.OffsetRect(xOffset, 0);
			int nFirstMinX  = rectFirst.left   + m_nFMinPixel + (m_ptStart.x - rectSplitter.left);
			int nSecondMinX = rectSecond.right - m_nSMinPixel - (rectSplitter.right - m_ptStart.x);
			if (pt.x >= nFirstMinX && pt.x <= nSecondMinX)
			{
				OnInvertTracker(m_rectLast);
				OnInvertTracker(rectTracking);
				m_rectLast = rectTracking;
			}
			else
			{
				if (pt.x < nFirstMinX && m_rectLast.left != (rectFirst.left + m_nFMinPixel))
				{
					int nSplitterWidth = m_rectLast.Width();
					rectTracking.left = rectFirst.left + m_nFMinPixel;
					rectTracking.right = rectTracking.left + nSplitterWidth;
					OnInvertTracker(m_rectLast);
					OnInvertTracker(rectTracking);
					m_rectLast = rectTracking;
				}

				if (pt.x > nSecondMinX && m_rectLast.right != (rectSecond.right - m_nSMinPixel))
				{
					int nSplitterWidth = m_rectLast.Width();
					rectTracking.right = rectSecond.right - m_nSMinPixel;
					rectTracking.left = rectTracking.right - nSplitterWidth;
					OnInvertTracker(m_rectLast);
					OnInvertTracker(rectTracking);
					m_rectLast = rectTracking;
				}
			}
		}
	
		//static int count = 0;

		//if (rectTracking.Height() != 10)
		//{
		//	__asm int 3;

		//_TRACE("[%d] pointClient  (%d, %d)\r\n", count, pointClient.x, pointClient.y);
		//_TRACE("[%d] m_ptStart (%d, %d)\r\n", count, m_ptStart.x, m_ptStart.y);

		//_TRACE("[%d] rectFirst   (%d, %d, %d, %d)\r\n", count, rectFirst.left, rectFirst.top, rectFirst.right, rectFirst.bottom);
		//_TRACE("[%d] rectSecond  (%d, %d, %d, %d)\r\n", count, rectSecond.left, rectSecond.top, rectSecond.right, rectSecond.bottom);
		//_TRACE("[%d] rectTracking(%d, %d, %d, %d,) Width : %d, Height : %d\r\n", 
		//	count, rectTracking.left, rectTracking.top, rectTracking.right, rectTracking.bottom, rectTracking.Width(), rectTracking.Height());

		//	count++;
		//}
	}
}
コード例 #6
0
ファイル: duComboBox.cpp プロジェクト: blueantst/dulib
void WINAPI duComboBox::OnMouseLDown(POINT pt)
{
	duPoint ptCombo(pt);
	
	duRect rcCombobox;
	Plugin_GetRect(this, &rcCombobox);
	ptCombo.Offset(-rcCombobox.left, -rcCombobox.top);
	
	if (!m_fReadOnly && ::PtInRect(&m_rcFormat, ptCombo))
		duEdit::OnMouseLDown(pt);
	else
	{
		Plugin_SetState(this, DU_STATE_PRESS);
		Plugin_Redraw(this, TRUE);

		RegisterComboListClass();

		ptCombo.x = rcCombobox.left;
		ptCombo.y = rcCombobox.bottom;
		::ClientToScreen(m_hWnd, &ptCombo);

		HWND hwndDesktop = ::GetDesktopWindow();
		int nWindowHeight = CalcListBoxHeight();
		m_hWndListBox = ::CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, lpszComboxClassName, _T(""),
			WS_CHILD, ptCombo.x, ptCombo.y, rcCombobox.Width(), nWindowHeight, hwndDesktop, (HMENU)1001,
			(HINSTANCE)::GetModuleHandle(NULL), (LPVOID)this);

		if (m_hWndListBox == NULL)
			return;

		if (nWindowHeight <= 6)
			::SetWindowPos(m_hWndListBox, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE);
		else
		{
			DWORD dwStartTick =::GetTickCount();
			int nWinHeight = 0;
			int nAnimateCount = (nWindowHeight / 5) + 1;
			int i;
			for (i = 0;i < 6; i++)
			{
				nWinHeight += nAnimateCount;
				if (nWinHeight >= nWindowHeight)
					nWinHeight = nWindowHeight;
					
				if (::GetTickCount() - dwStartTick > 200)
				{
					::SetWindowPos(m_hWndListBox, HWND_TOPMOST, 0, 0, rcCombobox.Width(), nWindowHeight, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOMOVE);
					break;
				}
				
				::SetWindowPos(m_hWndListBox, HWND_TOPMOST, 0, 0, rcCombobox.Width(), nWinHeight, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOMOVE);
				::RedrawWindow(m_hWndListBox, NULL, NULL, RDW_UPDATENOW|RDW_INTERNALPAINT);
				::Sleep(40);
			}
		}
		
		HWND hWndOwner = m_hWnd;
		while (::GetWindowLong(hWndOwner, GWL_STYLE) & WS_CHILD)
			hWndOwner = ::GetParent(hWndOwner);
		

		TrackPopup(this, hWndOwner, m_hWndListBox);
		SetEnd(FALSE);
		m_hWndListBox = NULL;

		Plugin_SetState(this, DU_STATE_NORMAL);
		Plugin_Redraw(this, TRUE);
	}
}
コード例 #7
0
ファイル: duGifCtrl.cpp プロジェクト: tantaishan/MyEcho
void duGifCtrl::OnMouseLDown(POINT pt)
{
	Plugin_SetState(this, DU_STATE_PRESS);
}