LRESULT COptionTreeSpinnerButton::WM_EditDown(WPARAM wParam, LPARAM lParam)
{
    // Update value
    // -- Wrap around
    if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
    {
        if ((_GetValue() - 1) < m_dRangeBottom)
        {
            SetEditDouble(m_dRangeTop);
        }
        else
        {
            SetEditDouble(_GetValue() - 1);
        }
    }
    // -- No wrap around
    else
    {
        if ((_GetValue() - 1) >= m_dRangeBottom)
        {
            SetEditDouble(_GetValue() - 1);
        }
    }

    // Force redraw
    Invalidate();

    // Update window
    UpdateWindow();

    return 0;
}
示例#2
0
void
CachedExtentTree::_Delete(CachedExtent* node)
{
	if (node == NULL)
		return;
	_Delete(_GetValue(node->left));
	_Delete(_GetValue(node->right));
	node->Delete();
}
示例#3
0
void
CachedExtentTree::_DumpInOrder(CachedExtent* node) const
{
	if (node == NULL)
		return;
	_DumpInOrder(_GetValue(node->left));
	node->Info();
	_DumpInOrder(_GetValue(node->right));
}
示例#4
0
void CUpDownClass::_Down()
{
	int nPos = _GetValue();
	if (nPos > m_nLower) {
		nPos--;
	} else if (m_dwStyle & UDS_WRAP) {
		nPos = m_nUpper;
	}
	_UpdateValue(nPos);
}
示例#5
0
	raw Pipe::Read()
	{
		raw data = null;
		uint32 size = 0;
		if (_IsServer)
		{
			size = _GetValue(11);
			data = new byte[size];
			memcpy(data, (raw)((uint32)_Data + VF_PIPE_PRTCSIZE + _Volume), size);
			_SetFlag(2, 0);
		}
		else
		{
			size = _GetValue(7);
			data = new byte[size];
			memcpy(data, (raw)((uint32)_Data + VF_PIPE_PRTCSIZE), size);
			_SetFlag(1, 0);
		}
		return data;
	}
示例#6
0
	bool Pipe::Connect(pcstr pid)
	{
		Close();
		_IsServer = false;
		_Id = str::Copy(pid);
		pcwstr cs16_id = str::ToStrW(_Id);
		_Mapping = OpenFileMapping(
			FILE_MAP_READ|FILE_MAP_WRITE, FALSE, cs16_id);
		if(GetLastError() != ERROR_SUCCESS)
			return false;
		if(!_BeginUpdate()) 
			return false;
		_Volume = _GetValue(2);
		return true;
	}
示例#7
0
	uint32 Pipe::GetReadSize()
	{
		uint32 size = _GetValue(_IsServer ? 7 : 11);
		return size;
	}
void COptionTreeSpinnerButton::OnPaint()
{
    // Make sure options aren't NULL
    if (m_otSpinnerOption == NULL)
    {
        return;
    }

    // Declare variables
    CPaintDC dc(this);
    CDC* pDCMem = new CDC;
    CBitmap bpMem;
    CBitmap *bmOld;
    COLORREF crOld;
    HGDIOBJ hOldBrush;
    int nOldBack;
    CRect rcButtonTop, rcButtonBottom, rcClient;
    CString strText;
    HGDIOBJ hOld;

    // Get client rectangle
    GetClientRect(rcClient);

    // Calculate rectangle
    // -- Top
    rcButtonTop.top = rcClient.top;
    rcButtonTop.left = (rcClient.right - 2) - OT_SPINNER_WIDTH;
    rcButtonTop.right = rcClient.right - 2;
    rcButtonTop.bottom = rcClient.Height() / 2;
    m_rcButtonTop = rcButtonTop;
    // -- Bottom
    rcButtonBottom.top = rcButtonTop.bottom;
    rcButtonBottom.left = (rcClient.right - 2) - OT_SPINNER_WIDTH;
    rcButtonBottom.right = rcClient.right - 2;
    rcButtonBottom.bottom = rcClient.bottom;
    m_rcButtonBottom = rcButtonBottom;

    // Create DC
    pDCMem->CreateCompatibleDC(&dc);

    // Create bitmap
    bpMem.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());

    // Select bitmap
    bmOld = pDCMem->SelectObject(&bpMem);

    // Set background mode
    nOldBack = pDCMem->SetBkMode(TRANSPARENT);

    // Set text color
    crOld = pDCMem->SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

    // Select font
    hOld = pDCMem->SelectObject(m_otSpinnerOption->GetNormalFont());

    // Draw control background
    hOldBrush = pDCMem->SelectObject(GetSysColorBrush(COLOR_BTNFACE));
    pDCMem->PatBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), PATCOPY);

    // Wrap around
    if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
    {
        // -- Draw top button
        // -- -- Pressed
        if (m_bTopPressed == TRUE)
        {
            pDCMem->DrawFrameControl(&rcButtonTop, DFC_SCROLL, DFCS_PUSHED | DFCS_SCROLLUP);
        }
        // -- -- UnPressed
        else
        {
            pDCMem->DrawFrameControl(&rcButtonTop, DFC_SCROLL, DFCS_SCROLLUP);
        }

        // -- Draw bottom button
        // -- -- Pressed
        if (m_bBottomPressed == TRUE)
        {
            pDCMem->DrawFrameControl(&rcButtonBottom, DFC_SCROLL, DFCS_PUSHED | DFCS_SCROLLDOWN);
        }
        // -- -- UnPressed
        else
        {
            pDCMem->DrawFrameControl(&rcButtonBottom, DFC_SCROLL, DFCS_SCROLLDOWN);
        }
    }
    // No Wrap around
    else
    {
        // -- Draw top button
        if (_GetValue() >= m_dRangeTop)
        {
            pDCMem->DrawFrameControl(&rcButtonTop, DFC_SCROLL, DFCS_INACTIVE | DFCS_SCROLLUP);
        }
        else
        {
            // -- -- Pressed
            if (m_bTopPressed == TRUE)
            {
                pDCMem->DrawFrameControl(&rcButtonTop, DFC_SCROLL, DFCS_PUSHED | DFCS_SCROLLUP);
            }
            // -- -- UnPressed
            else
            {
                pDCMem->DrawFrameControl(&rcButtonTop, DFC_SCROLL, DFCS_SCROLLUP);
            }
        }

        // -- Draw bottom button
        if (_GetValue() <= m_dRangeBottom)
        {
            pDCMem->DrawFrameControl(&rcButtonBottom, DFC_SCROLL, DFCS_INACTIVE | DFCS_SCROLLDOWN);
        }
        else
        {
            // -- -- Pressed
            if (m_bBottomPressed == TRUE)
            {
                pDCMem->DrawFrameControl(&rcButtonBottom, DFC_SCROLL, DFCS_PUSHED | DFCS_SCROLLDOWN);
            }
            // -- -- UnPressed
            else
            {
                pDCMem->DrawFrameControl(&rcButtonBottom, DFC_SCROLL, DFCS_SCROLLDOWN);
            }
        }
    }

    // Copy to screen
    dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), pDCMem, 0, 0, SRCCOPY);

    // Restore GDI ojects
    pDCMem->SelectObject(bmOld);
    pDCMem->SelectObject(hOldBrush);
    pDCMem->SetBkMode(nOldBack);
    pDCMem->SelectObject(hOld);
    pDCMem->SetTextColor(crOld);

    // Delete objects
    if (pDCMem->GetSafeHdc() != NULL)
    {
        pDCMem->DeleteDC();
    }
    delete pDCMem;
    if (bpMem.GetSafeHandle() != NULL)
    {
        bpMem.DeleteObject();
    }
}
void COptionTreeSpinnerButton::RepeatButton()
{
    // Clear pressed
    m_bBottomPressed = FALSE;
    m_bTopPressed = FALSE;

    // See if we have pressed a button
    if (m_rcButtonTop.PtInRect(m_ptSavePoint) == TRUE)
    {
        // -- Mark bool
        m_bTopPressed = TRUE;

        // -- Update value
        // -- -- Wrap around
        if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
        {
            if ((_GetValue() + 1) > m_dRangeTop)
            {
                SetEditDouble(m_dRangeBottom);
            }
            else
            {
                SetEditDouble(_GetValue() + 1);
            }

        }
        // -- -- No wrap around
        else
        {
            if ((_GetValue() + 1) <= m_dRangeTop)
            {
                SetEditDouble(_GetValue() + 1);
            }
        }
    }
    else if (m_rcButtonBottom.PtInRect(m_ptSavePoint) == TRUE)
    {
        // -- Mark bool
        m_bBottomPressed = TRUE;

        // -- Update value
        // -- -- Wrap around
        if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
        {
            if ((_GetValue() - 1) < m_dRangeBottom)
            {
                SetEditDouble(m_dRangeTop);
            }
            else
            {
                SetEditDouble(_GetValue() - 1);
            }
        }
        // -- -- No wrap around
        else
        {
            if ((_GetValue() - 1) >= m_dRangeBottom)
            {
                SetEditDouble(_GetValue() - 1);
            }
        }
    }

    // Force redraw
    Invalidate();

    // Update window
    UpdateWindow();
}
示例#10
0
void COptionTreeSpinnerButton::OnLButtonDown(UINT nFlags, CPoint point)
{
    // Clear pressed
    m_bBottomPressed = FALSE;
    m_bTopPressed = FALSE;

    // Save point
    m_ptSavePoint = point;

    // See if we have pressed a button
    if (m_rcButtonTop.PtInRect(point) == TRUE)
    {
        // -- Mark bool
        m_bTopPressed = TRUE;

        // -- Update value
        // -- -- Wrap around
        if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
        {
            if ((_GetValue() + 1) > m_dRangeTop)
            {
                SetEditDouble(m_dRangeBottom);
            }
            else
            {
                SetEditDouble(_GetValue() + 1);
            }

        }
        // -- -- No wrap around
        else
        {
            if ((_GetValue() + 1) <= m_dRangeTop)
            {
                SetEditDouble(_GetValue() + 1);
            }
        }
    }
    else if (m_rcButtonBottom.PtInRect(point) == TRUE)
    {
        // -- Mark bool
        m_bBottomPressed = TRUE;

        // -- Update value
        // -- -- Wrap around
        if (GetOption(OT_EDIT_WRAPAROUND) == TRUE)
        {
            if ((_GetValue() - 1) < m_dRangeBottom)
            {
                SetEditDouble(m_dRangeTop);
            }
            else
            {
                SetEditDouble(_GetValue() - 1);
            }
        }
        // -- -- No wrap around
        else
        {
            if ((_GetValue() - 1) >= m_dRangeBottom)
            {
                SetEditDouble(_GetValue() - 1);
            }
        }
    }

    // Force redraw
    Invalidate();

    // Update window
    UpdateWindow();

    // Set repeat timer
    KillTimer(OT_TIMER);
    m_bFirstRepeat = TRUE;
    SetTimer(OT_TIMER, m_nRepeatDelay, NULL);

    CWnd::OnLButtonDown(nFlags, point);
}