Beispiel #1
0
int CEnHeaderCtrl::GetNextVisibleItem(int nItem, BOOL bNext) const
{
	CIntArray aOrder;
	int nNumItems = GetItemOrder(aOrder);
	
	int nPos = GetItemPosition(nItem, aOrder);
	
	if (nPos != -1)
	{
		if (bNext)
		{
			while (++nPos < nNumItems)
			{
				nItem = OrderToIndex(nPos);

				if (IsItemVisible(nItem) && GetItemWidth(nItem))
					return nItem;
			}
		}
		else
		{
			while (nPos--)
			{
				nItem = OrderToIndex(nPos);
				
				if (IsItemVisible(nItem) && GetItemWidth(nItem))
					return nItem;
			}
		}
	}

	// outside range
	return -1;
}
void ZMeshViewList::RecalcBounds(void)
{
    MRECT r = GetClientRect();

    //m_pLeft->SetBounds(r.x, r.y, LEFTRIGHT_WIDTH, r.h);
    //m_pRight->SetBounds(r.x+r.w-LEFTRIGHT_WIDTH, r.y, LEFTRIGHT_WIDTH, r.h);
    m_pBmLeft->SetBounds(r.x, r.y, LEFTRIGHT_WIDTH, r.h);
    m_pBmRight->SetBounds(r.x+r.w-LEFTRIGHT_WIDTH, r.y, LEFTRIGHT_WIDTH, r.h);

    int nVisibleCount = GetVisibleCount();
    int nItemWidth = GetItemWidth();
    int nItemCount = GetItemCount();
    if(m_nItemStartIndex+nVisibleCount>nItemCount) {
        m_nItemStartIndex = nItemCount - nVisibleCount;
        if(m_nItemStartIndex<0) m_nItemStartIndex = 0;
    }

    int nCount = GetItemCount();

    if(m_nItemStartIndex>0) m_pBmLeft->Enable(true);
    else m_pBmLeft->Enable(false);
    //if(m_nItemStartIndex+nVisibleCount<nCount) m_pRight->Enable(true);
    //else m_pRight->Enable(false);
    if(m_nItemStartIndex+nVisibleCount<nCount) m_pBmRight->Enable(true);
    else m_pBmRight->Enable(false);

    for(int i=0; i<nCount; i++) {
        MWidget* pChild = GetItem(i);
        pChild->SetBounds(r.x+LEFTRIGHT_WIDTH+(i-m_nItemStartIndex)*nItemWidth, r.y, nItemWidth, r.h);
        if(i-m_nItemStartIndex<0 || i-m_nItemStartIndex>=nVisibleCount) pChild->Show(false);
        else pChild->Show(true);
    }
}
Beispiel #3
0
void SListPanel::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
{
	if (ShouldArrangeHorizontally())
	{
		const EListItemAlignment ListItemAlignment = ItemAlignment.Get();
		const float AllottedWidth = AllottedGeometry.Size.X;
		const float ItemPadding = GetItemPadding(AllottedGeometry, ListItemAlignment);
		const float LocalItemWidth = GetItemWidth(AllottedGeometry, ListItemAlignment);
		const float TotalItemSize = LocalItemWidth + ItemPadding;
		const int32 NumChildren = Children.Num();

		if (TotalItemSize > 0.0f && NumChildren > 0)
		{
			int32 NumColumns = FMath::Clamp(FMath::CeilToInt(AllottedWidth / TotalItemSize) - 1, 1, NumChildren);
			PreferredRowNum = FMath::CeilToInt(NumChildren / (float)NumColumns);
		}
		else
		{
			PreferredRowNum = 1;
		}
	}
	else
	{
		PreferredRowNum = NumDesiredItems.Get();
	}

}
void CHeaderCtrlExt::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default

	HDHITTESTINFO ht;
	::GetCursorPos(&ht.pt);
	ScreenToClient(&ht.pt);
	int nIndex = (int)SendMessage(HDM_HITTEST, 0, (LPARAM)&ht);
	if(nIndex >= 0)
	{
		if(ht.flags == HHT_ONDIVOPEN)
		{
			int nItem = FindVisibleItem(nIndex);
			if(nItem >= 0)
			{
				if(GetItemWidth(nItem) > 0)
				{
					NMHEADER nmh;
					nmh.hdr.code = HDN_DIVIDERDBLCLICK;
					nmh.hdr.hwndFrom = m_hWnd;
					nmh.hdr.idFrom = GetDlgCtrlID();
					nmh.iButton = 0;
					nmh.iItem = nItem;
					nmh.pitem = NULL;	// not used for HDN_DIVIDERDBLCLICK
					GetParent()->SendMessage(WM_NOTIFY, (WPARAM)nmh.hdr.idFrom, (LPARAM)&nmh);
				}
			}
		}
	}

	CHeaderCtrl::OnLButtonDblClk(nFlags, point);
}
Beispiel #5
0
void CPitchGraphEditor::HighlightItem(CPoint point)
{
	int MouseY = (point.y - m_GraphRect.top) - (m_GraphRect.Height() / 2);
	int ItemWidth = GetItemWidth();
	int ItemHeight = GetItemHeight();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = -(MouseY * 255) / m_GraphRect.Height();
	int LastItem = m_iHighlightedItem;
	int LastValue = m_iHighlightedValue;

	if (ItemValue < -128)
		ItemValue = -128;
	if (ItemValue > 127)
		ItemValue = 127;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	if (m_GraphRect.PtInRect(point) == 0 || ItemIndex < 0 || unsigned(ItemIndex) >= m_pSequence->GetItemCount()) {
		m_iHighlightedItem = -1;
		m_iHighlightedValue = 0;
	}
	
	if (m_iHighlightedItem != LastItem || m_iHighlightedValue != LastValue) {
		RedrawWindow(NULL);
	}
}
Beispiel #6
0
int CEnHeaderCtrl::GetItemWidths(CIntArray& aWidths) const
{
	int nItem = GetItemCount();
	aWidths.SetSize(nItem);

	while (nItem--)
		aWidths[nItem] = GetItemWidth(nItem);

	return aWidths.GetSize();
}
Beispiel #7
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);
}
	TextList::TextList( WTYPE tp, unsigned hints, int nId, Win* _parent, SelectType st, BorderType bt, crect* rect )
		: VListWin( tp, hints, nId, _parent, st, bt, rect ),
		  valid( false )
	{
		GC gc( this );
		gc.Set( GetFont() );
		cpoint ts = gc.GetTextExtents( ABCString );
		fontW = ( ts.x / ABCStringLen );
		fontH = ts.y + 2;
		this->SetItemSize( fontH + 1, GetItemWidth() ); //+1 for border if current
	}
void CHeaderCtrlExt::BeginDragDivider()
{
	SetCapture();

	m_nItemWidth = GetItemWidth(m_nDraggingItem);

	// check if dragging full window is enabled
	::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bDragFullWindow, 0);
	m_ptDragMove = m_ptDragStart;
	if(! m_bDragFullWindow)DrawDragDivider();
}
Beispiel #10
0
void CGraphEditor::DrawBackground(CDC *pDC, int Lines, bool DrawMarks, int MarkOffset) const
{
	const COLORREF COL_BACKGROUND	= 0x000000;
	const COLORREF COL_BOTTOM		= 0x404040;
	const COLORREF COL_HORZ_BAR		= 0x202020;

	// Fill background
	pDC->FillSolidRect(m_ClientRect, COL_BACKGROUND);
	pDC->FillSolidRect(m_GraphRect.left, m_GraphRect.top, 1, m_GraphRect.bottom, COL_BOTTOM);

	// Fill bottom area
	pDC->FillSolidRect(m_BottomRect, COL_BOTTOM);

	if (m_pSequence) {
		int ItemWidth = GetItemWidth();

		// Draw horizontal bars
		int count = m_pSequence->GetItemCount();
		for (int i = 1; i < count; i += 2) {
			int x = m_GraphRect.left + i * ItemWidth + 1;
			int y = m_GraphRect.top + 1;
			int w = ItemWidth;
			int h = m_GraphRect.Height() - 2;
			pDC->FillSolidRect(x, y, w, h, COL_HORZ_BAR);
		}
	}

	int marker = MarkOffset;

	if (Lines > 0) {
		int StepHeight = m_GraphRect.Height() / Lines;

		// Draw vertical bars
		for (int i = 0; i < Lines + 1; ++i) {
			int x = m_GraphRect.left + 1;
			int y = m_GraphRect.top + StepHeight * i;
			int w = m_GraphRect.Width() - 2;
			int h = 1;
	
			if (DrawMarks) {
				if ((++marker + 1) % 12 == 0) {
					pDC->FillSolidRect(x, y, w, StepHeight, COL_HORZ_BAR);
				}
			}

			pDC->FillSolidRect(x, y, w, h, COLOR_LINES);
		}
	}
}
BOOL CFlatHeaderCtrl::SetItemEx(INT iPos, HDITEMEX* phditemex)
{
	if(iPos>=m_arrayHdrItemEx.GetSize())
		return FALSE;

	BOOL bUpdate = FALSE;

	HDITEM hditem;
	hditem.mask = HDI_WIDTH;
	if(!GetItem(iPos, &hditem))
		return FALSE;

	HDITEMEX hditemex = *phditemex;

	if(hditemex.nStyle&HDF_EX_AUTOWIDTH)
	{
		TCHAR szText[FLATHEADER_TEXT_MAX];

		HDITEM hdi;
		hdi.mask = HDI_WIDTH|HDI_FORMAT|HDI_TEXT|HDI_IMAGE|HDI_BITMAP;
		hdi.pszText = szText;
		hdi.cchTextMax = sizeof(szText);
		VERIFY(GetItem(iPos, &hdi));

		hditem.cxy = GetItemWidth(&hdi, hditemex.nStyle&HDF_EX_INCLUDESORT ? TRUE:FALSE);
		bUpdate = TRUE;
	}

	if(!(hditemex.nStyle&HDF_EX_FIXEDWIDTH))
	{
		if(hditem.cxy < hditemex.iMinWidth)
		{
			hditem.cxy = hditemex.iMinWidth;
			bUpdate = TRUE;
		}

		if(hditem.cxy > hditemex.iMaxWidth && hditemex.iMaxWidth > 0)
		{
			hditem.cxy = hditemex.iMaxWidth;
			bUpdate = TRUE;
		}
	}

	if(bUpdate)
		SetItem(iPos, &hditem);

	m_arrayHdrItemEx.SetAt(iPos, hditemex);
	return TRUE;
}
Beispiel #12
0
int CEnHeaderCtrl::GetLastVisibleItem() const
{
	CIntArray aOrder;
	int nOrder = GetItemOrder(aOrder);

	while (nOrder--)
	{
		int nItem = aOrder[nOrder];

		if (IsItemVisible(nItem) && GetItemWidth(nItem))
			return nItem;
	}

	// all hidden
	return -1;
}
Beispiel #13
0
void CArpeggioGraphEditor::ModifyItem(CPoint point, bool Redraw)
{
	int ItemWidth = GetItemWidth();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = GetItemValue(point.y);

	if (ItemIndex < 0 || ItemIndex >= (int)m_pSequence->GetItemCount())
		return;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	m_pSequence->SetItem(ItemIndex, ItemValue);

	CGraphEditor::ModifyItem(point, Redraw);
}
Beispiel #14
0
int CEnHeaderCtrl::GetFirstVisibleItem() const
{
	CIntArray aItems;
	int nNumItem = GetItemOrder(aItems);
	
	for (int nOrder = 0; nOrder < nNumItem; nOrder++)
	{
		int nItem = aItems[nOrder];

		if (IsItemVisible(nItem) && GetItemWidth(nItem))
			return nItem;
	}
	
	// all hidden
	return -1;
}
Beispiel #15
0
void CNoiseEditor::ModifyItem(CPoint point, bool Redraw)
{
	int ItemValue;
	int ItemWidth = GetItemWidth();
	int ItemHeight = GetItemHeight();

	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;

	int Offset = 36 * ItemHeight - 1;

	if (point.y >= Offset) {

		if (m_iLastIndex == ItemIndex)
			return;

		m_iLastIndex = ItemIndex;

		if (point.y >= Offset && point.y < Offset + 10) {
			// Square
			ItemValue = m_pSequence->GetItem(ItemIndex) ^ S5B_MODE_SQUARE;
		}
		else if (point.y >= Offset + 11 && point.y < Offset + 21) {
			// Noise
			ItemValue = m_pSequence->GetItem(ItemIndex) ^ S5B_MODE_NOISE;
		}
		else
			return;
	}
	else {

		ItemValue = m_iItems - (((point.y - m_GraphRect.top) + (ItemHeight / 2)) / ItemHeight);

		if (ItemValue < 0)
			ItemValue = 0;
		if (ItemValue > m_iItems)
			ItemValue = m_iItems;

		ItemValue |= m_pSequence->GetItem(ItemIndex) & 0xC0;
	}

	if (ItemIndex < 0 || ItemIndex >= (int)m_pSequence->GetItemCount())
		return;

	m_pSequence->SetItem(ItemIndex, ItemValue);

	CGraphEditor::ModifyItem(point, Redraw);
}
Beispiel #16
0
float SListPanel::GetLinePadding(const FGeometry& AllottedGeometry, const int32 LineStartIndex) const
{
	const int32 NumItemsLeft = Children.Num() - LineStartIndex;
	if(NumItemsLeft <= 0)
	{
		return 0.0f;
	}

	const float LocalItemWidth = GetItemWidth(AllottedGeometry);
	const int32 NumItemsWide = LocalItemWidth > 0 ? FMath::FloorToInt(AllottedGeometry.Size.X / LocalItemWidth) : 0;
	const int32 NumItemsOnLine = FMath::Min(NumItemsLeft, NumItemsWide);

	// Subtract a tiny amount from the available width to avoid floating point precision problems when arranging children
	static const float FloatingPointPrecisionOffset = 0.001f;

	return (AllottedGeometry.Size.X - FloatingPointPrecisionOffset - NumItemsOnLine * LocalItemWidth);
}
BOOL CHeaderCtrlExt::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	// TODO: Add your message handler code here and/or call default

//	return CHeaderCtrl::OnSetCursor(pWnd, nHitTest, message);

	HCURSOR hCursor = NULL;

	HDHITTESTINFO ht;
	::GetCursorPos(&ht.pt);
	ScreenToClient(&ht.pt);
	int nIndex = (int)SendMessage(HDM_HITTEST, 0, (LPARAM)&ht);
	if(nIndex >= 0)
	{
		if(ht.flags == HHT_ONDIVIDER)
		{
//			hCursor = AfxGetApp()->LoadCursor(IDC_HEADER_SIZE);
            hCursor = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
			ASSERT(hCursor != NULL);
		}
		else if(ht.flags == HHT_ONDIVOPEN)
		{
			int nItem = FindVisibleItem(nIndex);
			if(nItem >= 0)
			{
				if(GetItemWidth(nItem) > 0)
				{
//					hCursor = AfxGetApp()->LoadCursor(IDC_HEADER_SIZE);
                    hCursor = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
				}
				else
				{
//					hCursor = AfxGetApp()->LoadCursor(IDC_HEADER_OPEN);
                    hCursor = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
				}
			}
		}
	}

	if(hCursor == NULL)hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);

	::SetCursor(hCursor);

	return TRUE;
}
Beispiel #18
0
void CGraphEditor::CursorChanged(int x)
{
	if (m_pSequence->GetItemCount() == 0)
		return;

	int Width = GetItemWidth();

	if (Width == 0)
		return;

	int Pos = x / Width;

	if (Pos >= (signed)m_pSequence->GetItemCount())
		return;

	int Value = m_pSequence->GetItem(Pos);
	m_pParentWnd->PostMessage(WM_CURSOR_CHANGE, Pos, Value);
}
Beispiel #19
0
BOOL CEnHeaderCtrl::SetItemWidth(int nItem, int nWidth, BOOL bRecalcTooltipRect)
{
	if (nWidth == GetItemWidth(nItem))
		return TRUE;

	HD_ITEM hdi = { 0 };

	hdi.mask = HDI_WIDTH;
	hdi.cxy = nWidth;

	if (SetItem(nItem, &hdi, bRecalcTooltipRect))
	{
		SetTrackedItem(nItem, FALSE);
		return TRUE;
	}

	// else
	return FALSE;
}
Beispiel #20
0
void CGraphEditor::ModifyReleasePoint(CPoint point, bool Redraw)
{
	if (!m_pSequence || !m_pSequence->GetItemCount())
		return;

	int ItemWidth = GetItemWidth();
	int ReleasePoint = (point.x - GRAPH_LEFT + (ItemWidth / 2)) / ItemWidth;

	// Disable loop point by dragging it to far right
	if (ReleasePoint >= (int)m_pSequence->GetItemCount())
		ReleasePoint = -1;

	m_pSequence->SetReleasePoint(ReleasePoint);

	if (Redraw) {
		RedrawWindow(NULL);
		m_pParentWnd->PostMessage(WM_SEQUENCE_CHANGED, 1);
	}
}
Beispiel #21
0
void CEnHeaderCtrl::ShowItem(int nItem, BOOL bShow)
{
	if (ModifyItemFlags(nItem, EHCF_HIDDEN, !bShow))
	{
		// resize as necessary
		if (bShow)
		{
			ASSERT(nItem < m_aItemWidths.GetSize());

			int nWidth = m_aItemWidths[nItem];
			SetItemWidth(nItem, nWidth);
		}
		else // hide
		{
			m_aItemWidths.SetAtGrow(nItem, (WORD)GetItemWidth(nItem));
			SetItemWidth(nItem, 0);
		}
	}
}
Beispiel #22
0
/*!
 *	\brief			Constructor from a Category
 *	\details		Includes preparations for multilevel categories
 *	\param[in]	cat		The reference to a category
 *	\param[in]	level	Currently unused
 *	\param[in]	expanded	Currently unused
 */
CategoryListItem::CategoryListItem( const Category &cat, int level, bool expanded )
	:
	BListItem( level, expanded ),
	currentColor( cat.categoryColor ),
	currentLabel( cat.categoryName ),
	icon( NULL )
{
	// Creating of the icon depends on height of the item, thus calculate the height first.
	font_height	fh;
	BFont font(be_plain_font);
	font.GetHeight( &fh );
	SetHeight( ceilf( fh.ascent + fh.descent + fh.leading ) );
	
	GetItemWidth();
	
	// Creating the icon. It's a constant, therefore may be created 
	//	immediately after creation of the item. On color update it will be updated too.
	this->icon = CreateIcon( cat.categoryColor, NULL );
	
}	// <-- end of default constructor for CategoryListItem
Beispiel #23
0
void CBarGraphEditor::HighlightItem(CPoint point)
{
	int ItemWidth = GetItemWidth();
	int ItemHeight = GetItemHeight();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = m_iLevels - (((point.y - m_GraphRect.top) + (ItemHeight / 2)) / ItemHeight);
	int LastItem = m_iHighlightedItem;
	int LastValue = m_iHighlightedValue;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	if (m_GraphRect.PtInRect(point) == 0 || unsigned(ItemIndex) >= m_pSequence->GetItemCount()) {
		m_iHighlightedItem = -1;
		m_iHighlightedValue = 0;
	}
	
	if (LastItem != m_iHighlightedItem || LastValue != m_iHighlightedValue)
		RedrawWindow(NULL);
}
Beispiel #24
0
void CArpeggioGraphEditor::HighlightItem(CPoint point)
{
	int ItemWidth = GetItemWidth();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = GetItemValue(point.y);
	int LastItem = m_iHighlightedItem;
	int LastValue = m_iHighlightedValue;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	if (m_GraphRect.PtInRect(point) == 0 || unsigned(ItemIndex) >= m_pSequence->GetItemCount()) { 
		m_iHighlightedItem = -1;
		m_iHighlightedValue = 0;
	}

	if (m_iHighlightedItem != LastItem || m_iHighlightedValue != LastValue) {
		RedrawWindow(NULL);
	}
}
Beispiel #25
0
void CEnHeaderCtrl::TraceVisibleItemWidths(LPCTSTR szKey) const
{
	TRACE(_T("CEnHeaderCtrl::TraceVisibleItemWidths(%s "), szKey);

	CIntArray aItems;
	int nNumItem = GetItemOrder(aItems);

	if (nNumItem)
	{
		for (int nItem = 0; nItem < nNumItem; nItem++)
		{
			if (IsItemVisible(aItems[nItem]))
				TRACE(_T("%d "), GetItemWidth(aItems[nItem]));
		}
	}
	else
	{
		TRACE(_T("empty"));
	}

	TRACE(_T(")\n"));
}
Beispiel #26
0
void CBarGraphEditor::ModifyItem(CPoint point, bool Redraw)
{
	int ItemWidth = GetItemWidth();
	int ItemHeight = GetItemHeight();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = m_iLevels - (((point.y - m_GraphRect.top) + (ItemHeight / 2)) / ItemHeight);

	if (ItemValue < 0)
		ItemValue = 0;
	if (ItemValue > m_iLevels)
		ItemValue = m_iLevels;

	if (ItemIndex < 0 || ItemIndex >= (int)m_pSequence->GetItemCount())
		return;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	m_pSequence->SetItem(ItemIndex, ItemValue);

	CGraphEditor::ModifyItem(point, Redraw);
}
Beispiel #27
0
void CPitchGraphEditor::ModifyItem(CPoint point, bool Redraw)
{
	int MouseY = (point.y - m_GraphRect.top) - (m_GraphRect.Height() / 2);
	int ItemWidth = GetItemWidth();
	int ItemHeight = GetItemHeight();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = -(MouseY * 255) / m_GraphRect.Height();

	if (ItemValue < -128)
		ItemValue = -128;
	if (ItemValue > 127)
		ItemValue = 127;

	if (ItemIndex < 0 || ItemIndex >= (int)m_pSequence->GetItemCount())
		return;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	m_pSequence->SetItem(ItemIndex, ItemValue);

	CGraphEditor::ModifyItem(point, Redraw);
}
Beispiel #28
0
static void OnListUpdate(void)
{
	g_WndList->Create(g_Launcher);
	int count = g_WndList->GetCount();
	g_ImageList->SetCount(count);
	int		width = 0;
	for(int i=0;i<count;i++){
		BOOL	need_destroy;
		HICON hIcon = (*g_WndList)[i]->GetIcon(need_destroy);
		g_ImageList->ReplaceIcon(i, hIcon);
		if(need_destroy)
		{
			DestroyIcon(hIcon);
		}
		int w = GetItemWidth((*g_WndList)[i]->GetTitle());
		if(w>width) width = w;
		if(i==1 && !(*g_WndList)[i]->IsLauncher())
		{
			g_WndList->MoveCursor(1);
		}
	}
	int fw = GetSystemMetrics(SM_CXFRAME) * 2;
	int fh = GetSystemMetrics(SM_CYFRAME) * 2 + (g_Aero ? GetSystemMetrics(SM_CYCAPTION) : 0);
	int ww = width + g_ItemTextX + fw;
	if(ww<g_MinWidth) ww = g_MinWidth;
	if(ww>g_MaxWidth) ww = g_MaxWidth;
	int wh = g_ItemHeight*count + fh;
	int sw = GetSystemMetrics(SM_CXSCREEN);
	int sh = GetSystemMetrics(SM_CYSCREEN);
	int x  = (sw - ww) / 2;
	int y  = (sh - wh) / 2;
	SetWindowPos(g_hWnd, (HWND)HWND_TOPMOST, x, y, ww, wh, SWP_SHOWWINDOW|SWP_NOCOPYBITS);
	
	
	InvalidateRect(g_hWnd, NULL, TRUE);
	CWndInfo::SetActiveWindow(g_hWnd);
}
Beispiel #29
0
/**
 * Arrange the children top-to-bottom with not additional layout info.
 */
void SListPanel::OnArrangeChildren( const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren ) const
{
	if ( ShouldArrangeHorizontally() )
	{
		const EListItemAlignment ListItemAlignment = ItemAlignment.Get();

		// This is a tile view list, arrange items horizontally until there is no more room then create a new row.
		const float AllottedWidth = AllottedGeometry.Size.X;
		const float ItemPadding = GetItemPadding(AllottedGeometry, ListItemAlignment);
		const float HalfItemPadding = ItemPadding * 0.5;

		const float LocalItemWidth = GetItemWidth(AllottedGeometry, ListItemAlignment);
		const float LocalItemHeight = GetItemHeight();

		float WidthSoFar = 0;
		float HeightSoFar = -FMath::FloorToInt(SmoothScrollOffsetInItems * LocalItemHeight) - OverscrollAmount;

		bool bIsNewLine = true;
		for( int32 ItemIndex = 0; ItemIndex < Children.Num(); ++ItemIndex )
		{
			if ( bIsNewLine )
			{
				if ( ListItemAlignment == EListItemAlignment::RightAligned || ListItemAlignment == EListItemAlignment::CenterAligned )
				{
					const float LinePadding = GetLinePadding(AllottedGeometry, ItemIndex);
					if ( ListItemAlignment == EListItemAlignment::RightAligned )
					{
						WidthSoFar += LinePadding;
					}
					else
					{
						const float HalfLinePadding = LinePadding * 0.5;
						WidthSoFar += HalfLinePadding;
					}
				}
			}

			ArrangedChildren.AddWidget(
				AllottedGeometry.MakeChild(Children[ItemIndex].GetWidget(), FVector2D(WidthSoFar + HalfItemPadding, HeightSoFar), FVector2D(LocalItemWidth, LocalItemHeight))
				);
		
			WidthSoFar += LocalItemWidth + ItemPadding;

			if ( WidthSoFar + LocalItemWidth + ItemPadding > AllottedWidth )
			{
				WidthSoFar = 0;
				HeightSoFar += LocalItemHeight;
				bIsNewLine = true;
			}
		}
	}
	else
	{
		if (Children.Num() > 0)
		{
			// This is a normal list, arrange items vertically
			float HeightSoFar = -FMath::FloorToInt(SmoothScrollOffsetInItems * Children[0].GetWidget()->GetDesiredSize().Y)-OverscrollAmount;
			for( int32 ItemIndex = 0; ItemIndex < Children.Num(); ++ItemIndex )
			{
					const FVector2D ItemDesiredSize = Children[ItemIndex].GetWidget()->GetDesiredSize();
					const float LocalItemHeight = ItemDesiredSize.Y;

				// Note that ListPanel does not respect child Visibility.
				// It is simply not useful for ListPanels.
				ArrangedChildren.AddWidget(
					AllottedGeometry.MakeChild( Children[ItemIndex].GetWidget(), FVector2D(0, HeightSoFar), FVector2D(AllottedGeometry.Size.X, LocalItemHeight) )
					);

				HeightSoFar += LocalItemHeight;
			}
		}
	}
}
Beispiel #30
0
float SListPanel::GetItemWidth(const FGeometry& AllottedGeometry) const
{
	return GetItemWidth(AllottedGeometry, ItemAlignment.Get());
}