/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::pbFixeinzugMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    int i = X / dx;
    int j = maxy-1 - (Y / dy);

    dbw3_assert(i>=0);
    dbw3_assert(j>=0);

    if (i>=maxx || j>=maxy) return;

    short old = einzug[scrollx+i];
    if (old==j+1) einzug[scrollx+i] = 0;
    else einzug[scrollx+i] = short(j+1);
    changed = true;
    CalcRange();
    if (old!=0) {
        pbFixeinzug->Canvas->Pen->Color = clBtnFace;
        pbFixeinzug->Canvas->Brush->Color = clBtnFace;
        pbFixeinzug->Canvas->Rectangle (i*dx+2, (maxy-old)*dy+2, (i+1)*dx-1, (maxy-old+1)*dy-1);
    }
    DrawData (pbFixeinzug, i);
    DeleteCursor();
    cx = i;
    cy = j;
    DeleteRange();
    CalcRange();
    DrawRange();
    DrawCursor();
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::pbFixeinzugPaint(TObject *Sender)
{
    DrawGrid (pbFixeinzug);
    DrawData (pbFixeinzug);
    DrawRange();
    DrawCursor();
}
Beispiel #3
0
void CBarGraphEditor::OnPaint()
{
	ASSERT(m_pBackDC != NULL);

	CPaintDC dc(this);
	
	DrawBackground(m_pBackDC, m_iLevels, false, 0);
	DrawRange(m_pBackDC, m_iLevels, 0);

	// Return now if no sequence is selected
	if (!m_pSequence) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	// Draw items
	int Count = m_pSequence->GetItemCount();

	if (!Count) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	int StepWidth = GetItemWidth();
	int StepHeight = m_GraphRect.Height() / m_iLevels;

	if (m_iHighlightedValue > 0 && m_iHighlightedItem >= 0 && m_iHighlightedItem < Count) {
		int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1;
		int y = m_GraphRect.top + StepHeight * (m_iLevels - m_iHighlightedValue);
		int w = StepWidth;
		int h = StepHeight * m_iHighlightedValue;
		DrawShadowRect(m_pBackDC, x, y, w, h);
	}

	// Draw items
	for (int i = 0; i < Count; i++) {
		int x = m_GraphRect.left + i * StepWidth + 1;
		int y = m_GraphRect.top + StepHeight * (m_iLevels - m_pSequence->GetItem(i));
		int w = StepWidth;
		int h = StepHeight * m_pSequence->GetItem(i);

		if (m_iCurrentPlayPos == i)
			DrawPlayRect(m_pBackDC, x, y, w, h);
		else if ((m_iHighlightedItem == i) && (m_pSequence->GetItem(i) >= m_iHighlightedValue) && !IsEditLine())
			DrawCursorRect(m_pBackDC, x, y, w, h);
		else
			DrawRect(m_pBackDC, x, y, w, h);
	}
	
	DrawLoopPoint(m_pBackDC, StepWidth);
	DrawReleasePoint(m_pBackDC, StepWidth);
	DrawLine(m_pBackDC);

	PaintBuffer(m_pBackDC, &dc);
}
Beispiel #4
0
void CScrollV::DrawControl(CDC &dc, CRect rcUpdate)
{
	int nWidth = m_rc.Width();
	int nHeight = m_rc.Height();

	if(!m_bUpdate)
	{		
		UpdateMemDC(dc, nWidth, nHeight);

		m_memDC.BitBlt(0, 0, nWidth, nHeight, &dc, m_rc.left ,m_rc.top, SRCCOPY);		
		
		if(m_bShowScroll)
		{
			CRect  rcTemp;
			//滚动条背景
			if(m_bHover)
			{
				rcTemp.SetRect(0, 20, nWidth, nHeight -  20);
				DrawRange(m_memDC, rcTemp, 0);
			}

			//滚动块
			rcTemp.SetRect(m_rcBlock.left - m_rc.left, m_rcBlock.top - m_rc.top,m_rcBlock.left - m_rc.left +  m_rcBlock.Width(), m_rcBlock.top - m_rc.top + m_rcBlock.Height());
			int nXPos = m_sizeImage.cx;
			if(m_enButtonState == enBSHover)
			{
				nXPos = m_sizeImage.cx * 2;
			}
			else if(m_enButtonState == enBSDown)
			{
				nXPos = m_sizeImage.cx * 3;
			}
			DrawRange(m_memDC, rcTemp, nXPos);
		}
		 		
	}	


	dc.BitBlt(m_rc.left, m_rc.top, nWidth, nHeight, &m_memDC, 0, 0, SRCCOPY);
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurDown (bool _step)
{
    if (cy>0) {
        DeleteCursor();
        if (!_step) cy--;
        else {
            cy -= 4;
            if (cy<0) cy = 0;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurUp (bool _step)
{
    if (cy<maxy-1) {
        DeleteCursor();
        if (!_step) cy++;
        else {
            cy += 4;
            if (cy>maxy-1) cy = maxy-1;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurRight (bool _step)
{
    if (cx<maxx-1) {
        DeleteCursor();
        if (!_step) cx++;
        else {
            cx += 4;
            if (cx>maxx-1) cx = maxx-1;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurLeft (bool _step)
{
    if (cx>0) {
        DeleteCursor();
        if (!_step) cx--;
        else {
            cx -= 4;
            if (cx<0) cx = 0;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
    switch (Key) {
        case VK_SPACE: {
            DeleteCursor();
            DeleteRange();
            short old = einzug[scrollx+cx];
            if (old==cy+1) einzug[scrollx+cx] = 0;
            else einzug[scrollx+cx] = short(cy+1);
            CalcRange();
            if (old!=0) {
                pbFixeinzug->Canvas->Pen->Color = clBtnFace;
                pbFixeinzug->Canvas->Brush->Color = clBtnFace;
                int x, y;
                if (frm->righttoleft) x = (maxx-cx-1)*dx;
                else x = cx*dx;
                if (frm->toptobottom) y = (old-1)*dy;
                else y = (maxy-old)*dy;
                pbFixeinzug->Canvas->Rectangle (x+2, y+2, x+dx-1, y+dy-1);
            }
            DrawData(pbFixeinzug, cx);
            DrawRange();
            CurMove();
            DrawCursor();
            changed = true;
            break;
        }
        case VK_LEFT:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->righttoleft) CurDirRight();
                else CurDirLeft();
                break;
            }
            if (frm->righttoleft) CurRight(Shift.Contains(ssCtrl));
            else CurLeft (Shift.Contains(ssCtrl));
            break;
        case VK_RIGHT:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->righttoleft) CurDirLeft();
                else CurDirRight();
                break;
            }
            if (frm->righttoleft) CurLeft(Shift.Contains(ssCtrl));
            else CurRight (Shift.Contains(ssCtrl));
            break;
        case VK_UP:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->toptobottom) CurDirDown();
                else CurDirUp();
                break;
            }
            if (frm->toptobottom) CurDown (Shift.Contains(ssCtrl));
            else CurUp (Shift.Contains(ssCtrl));
            break;
        case VK_DOWN:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->toptobottom) CurDirUp();
                else CurDirDown();
                break;
            }
            if (frm->toptobottom) CurUp (Shift.Contains(ssCtrl));
            else CurDown (Shift.Contains(ssCtrl));
            break;
    }
}
Beispiel #10
0
void CArpeggioGraphEditor::OnPaint()
{
	ASSERT(m_pBackDC != NULL);

	CPaintDC dc(this);

	DrawBackground(m_pBackDC, ITEMS, true, m_pSequence->GetSetting() & ARP_SETTING_FIXED ? 2 - m_iScrollOffset : -m_iScrollOffset);
	DrawRange(m_pBackDC, m_iScrollOffset + 10, m_iScrollOffset - 10);

	// Return now if no sequence is selected
	if (!m_pSequence) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	// Draw items
	int Count = m_pSequence->GetItemCount();

	if (!Count) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	int StepWidth = GetItemWidth();
	int StepHeight = m_GraphRect.Height() / ITEMS;

	// One last line
	m_pBackDC->FillSolidRect(m_GraphRect.left + 1, m_GraphRect.top + 20 * StepHeight, m_GraphRect.Width() - 2, 1, COLOR_LINES);

	if (m_iHighlightedItem >= 0 && m_iHighlightedItem < Count) {
		int item = (ITEMS / 2) - m_iHighlightedValue + m_iScrollOffset;
		if (m_pSequence->GetSetting() == ARP_SETTING_FIXED)
			item += (ITEMS / 2);
		if (item >= 0 && item <= 20) {
			int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1;
			int y = m_GraphRect.top + StepHeight * item + 1;
			int w = StepWidth;
			int h = StepHeight - 1;
			DrawShadowRect(m_pBackDC, x, y, w, h);
		}
	}

	// Draw items
	for (int i = 0; i < Count; i++) {
		int item = (ITEMS / 2) - m_pSequence->GetItem(i) + m_iScrollOffset;
		if (m_pSequence->GetSetting() == ARP_SETTING_FIXED)
			item += (ITEMS / 2);
		if (item >= 0 && item <= 20) {
			int x = m_GraphRect.left + i * StepWidth + 1;
			int y = m_GraphRect.top + StepHeight * item;
			int w = StepWidth;
			int h = StepHeight;

			if (m_iCurrentPlayPos == i)
				DrawPlayRect(m_pBackDC, x, y, w, h);
			else if (m_iHighlightedItem == i && (m_pSequence->GetItem(i) == m_iHighlightedValue) && !IsEditLine())
				DrawCursorRect(m_pBackDC, x, y, w, h);
			else
				DrawRect(m_pBackDC, x, y, w, h);
		}
	}

	DrawLoopPoint(m_pBackDC, StepWidth);
	DrawReleasePoint(m_pBackDC, StepWidth);
	DrawLine(m_pBackDC);

	PaintBuffer(m_pBackDC, &dc);
}
Beispiel #11
0
void CNoiseEditor::OnPaint()
{
	ASSERT(m_pBackDC != NULL);

	CPaintDC dc(this);
	
	DrawBackground(m_pBackDC, m_iItems, false, 0);
	DrawRange(m_pBackDC, m_iItems, 0);

	// Return now if no sequence is selected
	if (!m_pSequence) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	// Draw items
	int Count = m_pSequence->GetItemCount();

	if (!Count) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	int StepWidth = GetItemWidth();
	int StepHeight = m_GraphRect.Height() / m_iItems;

	// Draw items
	for (int i = 0; i < Count; i++) {
		// Draw noise frequency
		int item = m_pSequence->GetItem(i) & 0x1F;
		int x = m_GraphRect.left + i * StepWidth + 1;
		int y = m_GraphRect.top + StepHeight * (m_iItems - item);
		int w = StepWidth;
		int h = StepHeight;//* item;
		
		if (m_iCurrentPlayPos == i)
			DrawPlayRect(m_pBackDC, x, y, w, h);
		else
			DrawRect(m_pBackDC, x, y, w, h);

		// Draw switches
		item = m_pSequence->GetItem(i);

		int Offset = h * 36 - 1;

		if (item & S5B_MODE_SQUARE) {
			static const COLORREF BUTTON_COL = COMBINE(0, 160, 160);
			int y = Offset;
			int h = 9;
			m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL);
			m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80));
		}
		else {
			static const COLORREF BUTTON_COL = COMBINE(50, 50, 50);
			int y = Offset;
			int h = 9;
			m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL);
			m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80));
		}

		if (item & S5B_MODE_NOISE) {
			static const COLORREF BUTTON_COL = COMBINE(160, 0, 160);
			int y = Offset + 11;
			int h = 9;
			m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL);
			m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80));
		}
		else {
			static const COLORREF BUTTON_COL = COMBINE(50, 50, 50);
			int y = Offset + 11;
			int h = 9;
			m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL);
			m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80));
		}
	}
	
	DrawLoopPoint(m_pBackDC, StepWidth);
	DrawReleasePoint(m_pBackDC, StepWidth);
	DrawLine(m_pBackDC);

	PaintBuffer(m_pBackDC, &dc);
}
Beispiel #12
0
void CPitchGraphEditor::OnPaint()
{
	ASSERT(m_pBackDC != NULL);

	CPaintDC dc(this);

	DrawBackground(m_pBackDC, 0, false, 0);
	DrawRange(m_pBackDC, 127, -128);

	m_pBackDC->FillSolidRect(m_GraphRect.left, m_GraphRect.top + m_GraphRect.Height() / 2, m_GraphRect.Width(), 1, COLOR_LINES);

	// Return now if no sequence is selected
	if (!m_pSequence) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	// Draw items
	int Count = m_pSequence->GetItemCount();

	if (!Count) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	int StepWidth = GetItemWidth();
	int StepHeight = m_GraphRect.Height() / ITEMS;

	// One last line
	m_pBackDC->FillSolidRect(m_GraphRect.left + 1, m_GraphRect.top + 20 * StepHeight, m_GraphRect.Width() - 2, 1, COLOR_LINES);

	if (m_iHighlightedItem != -1) {
		int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1;
		int y = m_GraphRect.top + m_GraphRect.Height() / 2;
		int w = StepWidth;
		int h = -(m_iHighlightedValue * m_GraphRect.Height()) / 255 ;
		DrawShadowRect(m_pBackDC, x, y, w, h);
	}

	int Value = m_pSequence->GetItem(m_iHighlightedItem);
	bool bHighlight = !IsEditLine();
	if (m_iHighlightedValue > 0) {
		if (m_iHighlightedValue > Value || Value < 0) {
			bHighlight = false;
		}
	}
	else {
		if (m_iHighlightedValue < Value || Value > 0) {
			bHighlight = false;
		}
	}

	// Draw items
	for (int i = 0; i < Count; i++) {
		int item = m_pSequence->GetItem(i);
		int x = m_GraphRect.left + i * StepWidth + 1;
		int y = m_GraphRect.top + m_GraphRect.Height() / 2;
		int w = StepWidth;
		int h = -(item * m_GraphRect.Height()) / 255 ;
		if (h < 0) {
			y += h;
			h = -h;
		}
		if (m_iCurrentPlayPos == i)
			DrawPlayRect(m_pBackDC, x, y, w, h);
		else if (m_iHighlightedItem == i && bHighlight)
			DrawCursorRect(m_pBackDC, x, y, w, h);
		else
			DrawRect(m_pBackDC, x, y, w, h);
	}

	DrawLoopPoint(m_pBackDC, StepWidth);
	DrawReleasePoint(m_pBackDC, StepWidth);
	DrawLine(m_pBackDC);

	PaintBuffer(m_pBackDC, &dc);
}