예제 #1
0
void CRibbonTableButton::NotifyHighlightListItem(int nIndex)
{
	ASSERT_VALID(this);

	if (m_pPopupMenu != NULL)
	{
		if (nIndex < 0)
		{
			m_nRows = m_nColumns = 0;
		}
		else
		{
			m_nRows = nIndex / CELLS_X + 1;
			m_nColumns = (nIndex % CELLS_X) + 1;
		}

		CString strCaption = lpszDefaultCaption;
		if (m_nColumns > 0 && m_nRows > 0)
		{
			strCaption.Format(_T("%dx%d Table"), m_nColumns, m_nRows);
		}

		SetGroupName(0, strCaption);
		RedrawIcons();
	}

	CMFCRibbonGallery::NotifyHighlightListItem(nIndex);
}
예제 #2
0
void CRibbonTableButton::OnShowPopupMenu()
{
	ASSERT_VALID(this);

	m_nRows = m_nColumns = 0;
	SetGroupName(0, lpszDefaultCaption);

	CMFCRibbonGallery::OnShowPopupMenu();
}
예제 #3
0
void CPVRChannelGroupInternal::CheckGroupName(void)
{
  CSingleLock lock(m_critSection);

  /* check whether the group name is still correct, or channels will fail to load after the language setting changed */
  CStdString strNewGroupName = g_localizeStrings.Get(m_bRadio ? 19216 : 19217);
  if (!m_strGroupName.Equals(strNewGroupName))
  {
    SetGroupName(strNewGroupName, true);
    UpdateChannelPaths();
  }
}
예제 #4
0
void
CDisplayVars::SetDisplayVars( DisplayVars *pDV, CDocument *pDC )
{

	SetGroupEnabled( pDV->m_GroupEnabled );

	SetPrimaryLevel( pDV->m_PrimaryLevel );
	SetSecondaryLevel( pDV->m_SecondaryLevel );
	SetTertiaryLevel( pDV->m_TertiaryLevel );
	
	SetModeConserved( pDV->m_ModeConserved );

	// Where do we make the call for this?
	SetLastShadeLevel( pDV->m_LastShadeLevel );

	SetResidueMode( pDV->m_ResidueMode );

	// Copy Those to these ...
	SetDiffMode( pDV->m_DiffMode );

	SetPropStyle( pDV->m_PropStyle );

	SetConsSubStyle ( pDV->m_ConsSubStyle );

	SetTitleColors ( pDV->m_TitleTextColor, pDV->m_TitleBkColor);

	// Copy property ...
	m_DisplayVars.m_Property.CopyVars( pDV->m_Property );

	m_DisplayVars.m_StcGroup.CopyVars( pDV->m_StcGroup );

	//
	SetGroupName( pDV->m_GroupName );

	CPtrList& listGN = pDV->m_GroupList;

	CGenedocDoc *pDoc = (CGenedocDoc *)pDC;

	POSITION tPos = listGN.GetHeadPosition();

	while ( tPos != NULL ) {
		CGeneSegment * pCGSeg = (CGeneSegment *)listGN.GetNext(tPos);

		POSITION sPos = pDoc->pGSFiller->SegDataList.GetHeadPosition();
		while (sPos != NULL ) {

			CGeneSegment *tCGSeg = (CGeneSegment *)pDoc->pGSFiller->SegDataList.GetNext(sPos);

			if ( tCGSeg->GetStyle() != LINESEQUENCE ) continue;

			if ( tCGSeg->GetTitle() == pCGSeg->GetTitle() ) {
				m_DisplayVars.m_GroupList.AddTail ( tCGSeg );
				break;
			}

		}
	}


	// IdentList
	CPtrList& listID = pDV->m_IdentList;

	tPos = listID.GetHeadPosition();

	while ( tPos != NULL ) {
		CGeneSegment * pCGSeg = (CGeneSegment *)listID.GetNext(tPos);

		POSITION sPos = pDoc->pGSFiller->SegDataList.GetHeadPosition();
		while (sPos != NULL ) {

			CGeneSegment *tCGSeg = (CGeneSegment *)pDoc->pGSFiller->SegDataList.GetNext(sPos);

			if ( tCGSeg->GetStyle() != LINESEQUENCE ) continue;

			if ( tCGSeg->GetTitle() == pCGSeg->GetTitle() ) {
				m_DisplayVars.m_IdentList.AddTail ( tCGSeg );
				break;
			}

		}
	}
	SetIdentColors ( pDV->m_IdentTextColor, pDV->m_IdentBkColor);
	SetIdentDisplayStyle( pDV->m_IdentDisplayStyle );


}
예제 #5
0
void GroupListEmoticons::Load()
{
	selection = -1;

	// Load fonts
	groupFont = mir_font_get(_T("Emoticons"), _T("Group Name"), &groupColor);
	emoticonFont = mir_font_get(_T("Emoticons"), _T("Emoticons Text"), &emoticonColor);
	groupBkgColor = mir_color_get(_T("Emoticons"), _T("Group Background"));
	ssd->background = mir_color_get(_T("Emoticons"), _T("Emoticons Background"));

	num_groups = CountGroups();
	groups = (Group *) malloc(num_groups * sizeof(Group));

	char *current_group = ssd->module->emoticons[0]->group;

	int current_id = -1;
	int i;
	for(i = 0; i < ssd->module->emoticons.getCount(); i++)
	{
		Emoticon *e = ssd->module->emoticons[i];
		if (e->IgnoreFor(ssd->module))
			continue;

		if (stricmp(e->group, current_group) != 0 || i == 0)
		{
			if (i != 0)
				groups[current_id].end = i - 1;

			current_group = e->group;
			current_id++;

			SetGroupName(groups[current_id], current_group);
			groups[current_id].start = i;
			groups[current_id].count = 1;
		}
		else 
		{
			groups[current_id].count++;
		}
	}
	groups[current_id].end = i - 1;

	// First calc the width
	window.width = 0;
	for(i = 0; i < num_groups; i++)
	{
		Group &group = groups[i];
		GetMaxEmoticonSize(group);
		group.cols = GetNumOfCols(group.count);

		if (group.name[0] != _T('\0'))
		{
			RECT rc = CalcRect(group.name, groupFont);
			window.width = max(window.width, rc.right - rc.left + 2 * BORDER + 1);
		}

		window.width = max(window.width, group.max_width * group.cols + (group.cols + 1) * BORDER);
	}

	// Now calc the height
	window.height = 0;
	for(i = 0; i < num_groups; i++)
	{
		Group &group = groups[i];
		group.top = window.height;

		int w = window.width - BORDER;

		// Recalc the num of cols
		group.lines = GetNumOfLines(group.count, group.cols);
		
		int new_cols = w / (group.max_width + BORDER);
		int new_lines = GetNumOfLines(group.count, new_cols);
		if (new_lines < group.lines)
		{
			group.cols = new_cols;
			group.lines = new_lines;
		}


		// If there is space left, put it into the emoticons
		group.max_width += (w - group.cols * (group.max_width + BORDER)) / group.cols;

		if (group.name[0] != '\0')
		{
			RECT rc = CalcRect(group.name, groupFont);
			window.height += HeightWithBorders(rc);
		}

		window.height += group.max_height * group.lines + (group.lines + 1) * BORDER;
	}
}