void CMSOffice2007DemoView::OnFontsize()
{
	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonComboBox* pSizeCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_FONT_FONTSIZE));
	if (pSizeCombo == NULL)
	{
		return;
	}

	int nSize = GetTwipSize(pSizeCombo->GetEditText());

	if (nSize == -2 || (nSize >= 0 && nSize < 20) || nSize > 32760)
	{
		// Restore current size:
		pSizeCombo->SetEditText (TwipsToPointString (GetCharFormatSelection ().yHeight));

		MessageBox (_T("The number must be between 1 and 1638."));                               
		return;
	}

	if (nSize > 0)
	{
		CCharFormat cf;
		cf.dwMask = CFM_SIZE;
		cf.yHeight = nSize;

		SetCharFormat(cf);
	}
}
Beispiel #2
0
	void CSimPetriDoc::OnUpdateSetMarking(CCmdUI *pCmdUI)
	{
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_MEMORY_MK))
			return;
		CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_MEMORY_MK));

		if(mkComboBox->GetCurSel() == -1) pCmdUI->Enable(FALSE);
	}
Beispiel #3
0
COLORREF CRibbonAppDoc::GetColor(void)
{
    CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx*) AfxGetMainWnd())->GetRibbonBar();
    ASSERT_VALID(pRibbon);

    CMFCRibbonColorButton* pColor = DYNAMIC_DOWNCAST(
       CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR));
    // Get the selected color
    return pColor->GetColor();
}
Beispiel #4
0
	void CSimPetriDoc::OnDeletememoMk()
	{
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_MEMORY_MK))
			return;
		CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_MEMORY_MK));

		savedStates.eraseMemorySlot(mkComboBox->GetCurSel());
		RefreshMemoryComboBox();
	}
void CDataServerCenterView::OnButtonLineColor()
{
	// TODO: 在此添加命令处理程序代码
	CMFCRibbonBar *pRibbon = ((CFrameWndEx*)AfxGetMainWnd())->GetRibbonBar(); 
	ASSERT_VALID(pRibbon); 
	CMFCRibbonColorButton *m_pLineColorButton; 
	m_pLineColorButton = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, pRibbon->FindByID(ID_BUTTON_LINECOLOR));

	((CSpectrumCompareDlg *)(this->pSpectrumCompareDlg))->m_LineColor=m_pLineColorButton->GetColor();

}
Beispiel #6
0
// Return the factor of zooming the rectangle
double CRibbonAppDoc::GetSliderFactor(void)
{
    // Get a pointer to the ribbon bar
    CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx*) AfxGetMainWnd())->GetRibbonBar();
    ASSERT_VALID(pRibbon);

    CMFCRibbonSlider* pSlider = DYNAMIC_DOWNCAST(CMFCRibbonSlider, pRibbon->FindByID(ID_RECT_SLIDER));
    // Get current position
    int position =pSlider->GetPos();
    return (double)position/(double)pSlider->GetRangeMax();
}
Beispiel #7
0
	void CSimPetriDoc::OnSetMarking()
	{
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_MEMORY_MK))
			return;
		CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_MEMORY_MK));
		int select = mkComboBox->GetCurSel();
		if(select != -1)
		{
			savedStates.at(select)->load();
			UpdateAllViews(NULL);
		}
	}
void CMSOffice2007DemoView::OnFontColor()
{
	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonColorButton* pFontColorBtn = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR));

	if (pFontColorBtn != NULL)
	{
		COLORREF color = pFontColorBtn->GetColor();
		CRichEditView::OnColorPick(color == -1 ? ::GetSysColor(COLOR_WINDOWTEXT) : color);
	}
}
Beispiel #9
0
	void CSimPetriDoc::OnTimeSlider2()
	{
		//Obtenir les sliders
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_TIME_SLIDER1)) return;
		CMFCRibbonSlider* pSlider1 = static_cast<CMFCRibbonSlider*>(pRibbon->FindByID(ID_TIME_SLIDER1));
		if(!pRibbon->FindByID(ID_TIME_SLIDER2)) return;
		CMFCRibbonSlider* pSlider2 = static_cast<CMFCRibbonSlider*>(pRibbon->FindByID(ID_TIME_SLIDER2));

		//Définir l'unité de temps
		millisecondsPerStep = pSlider2->GetPos();
		pSlider1->SetPos(pSlider2->GetPos());
	}
void CMSOffice2007DemoView::OnPagelayoutIndentRight()
{
	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonEdit* pEdit = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_PAGELAYOUT_INDENT_RIGHT));

	WPD_PARAFORMAT pf;
	pf.cbSize = sizeof(PARAFORMAT);
	pf.dwMask = PFM_RIGHTINDENT;
	pf.dxRightIndent = _ttol(pEdit->GetEditText()) * 10;

	SetParaFormat(pf);
}
Beispiel #11
0
	void CSimPetriDoc::RefreshPlacesComboBox()
	{
		if(ompMode)
		{
			//Obtenir la combo box
			CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
			if(!pRibbon->FindByID(ID_OMPP_INITIAL))
				return;
			CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_OMPP_INITIAL));

			//Rafraîchir la combo box
			mkComboBox->RemoveAllItems();
			for(auto it=drawingElements.rbegin(); it!=drawingElements.rend(); ++it)
				if((*it)->Type() == CElement::PLACE)
					mkComboBox->AddItem((*it)->shortID);
		}
	}
Beispiel #12
0
	void CSimPetriDoc::OnOmppInitial()
	{
		//Obtenir la combo box
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_OMPP_INITIAL))
			return;
		CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_OMPP_INITIAL));

		//Déterminer la place
		for(auto it=places.begin(); it!=places.end(); ++it)
			if((*it).first->shortID == mkComboBox->GetItem(mkComboBox->GetCurSel()))
			{
				static_cast<pm::TrackableStepper*>(stepper)->setDeparture((*it).second);
				UpdateAllViews(NULL);
				return;
			}
	}
void CMSOffice2007DemoView::OnEditUndo()
{
	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonUndoButton* pUndoBtn = DYNAMIC_DOWNCAST(CMFCRibbonUndoButton, pRibbon->FindByID(ID_EDIT_UNDO));

	if (pUndoBtn != NULL && pUndoBtn->GetActionNumber() > 0)
	{
		CString str;
		str.Format(_T("Demo: undo %d action(s)"), pUndoBtn->GetActionNumber());

		MessageBox(str);
		return;
	}

	CRichEditView::OnEditUndo();
}
void CMSOffice2007DemoView::OnFontname()
{
	USES_CONVERSION;

	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonFontComboBox* pFontCombo = DYNAMIC_DOWNCAST(CMFCRibbonFontComboBox, pRibbon->FindByID(ID_FONT_FONT));
	if (pFontCombo == NULL)
	{
		return;
	}

	CString strWarning;
	CString strFontName = pFontCombo->GetEditText();
	if (pFontCombo->FindItem(strFontName) == -1)
	{
		// Restore current name:
		pFontCombo->SetEditText (GetCharFormatSelection ().szFaceName);
		strWarning.Format(CString((LPCTSTR)ID_FONT_NOT_FOUND), strFontName);
		AfxMessageBox(strWarning, MB_OK | MB_ICONWARNING);
		return;
	}

	CCharFormat cf;
	cf.szFaceName[0] = NULL;
	cf.dwMask = CFM_FACE | CFM_CHARSET;

	const CMFCFontInfo* pDesc = pFontCombo->GetFontDesc();
	ASSERT_VALID(pDesc);
	ASSERT(pDesc->m_strName.GetLength() < LF_FACESIZE);

#if _MSC_VER >= 1300
	lstrcpyn(cf.szFaceName, pDesc->m_strName, LF_FACESIZE);
#else
	lstrcpynA(cf.szFaceName, T2A((LPTSTR)(LPCTSTR) pDesc->m_strName), LF_FACESIZE);
#endif

	cf.bCharSet = pDesc->m_nCharSet;
	cf.bPitchAndFamily = pDesc->m_nPitchAndFamily;

	SetCharFormat(cf);
}
Beispiel #15
0
	void CSimPetriDoc::RefreshMemoryComboBox()
	{
		//Obtenir la combo box
		CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx *) AfxGetMainWnd())->GetRibbonBar();
		if(!pRibbon->FindByID(ID_MEMORY_MK))
			return;
		CMFCRibbonComboBox* mkComboBox = static_cast<CMFCRibbonComboBox*>(pRibbon->FindByID(ID_MEMORY_MK));

		//Rafraîchir la combo box
		mkComboBox->RemoveAllItems();
		for(unsigned i = 0 ; i < savedStates.size(); i++)
		{
			std::wstring description = savedStates.at(i)->toString();
			CString itemIndex;
			itemIndex.Format(_T("Mémoire n°%d"), i+1);
			mkComboBox->AddItem(itemIndex);
		}

		int index = savedStates.size() -1;
		mkComboBox->SelectItem(index);
	}
void CMSOffice2007DemoView::SyncFont()
{
	USES_CONVERSION;

	CString strFontName;


	// get the current font from the view and update
	WPD_CHARFORMAT cf = GetCharFormatSelection();

	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonFontComboBox* pFontCombo = DYNAMIC_DOWNCAST(CMFCRibbonFontComboBox, pRibbon->FindByID(ID_FONT_FONT));

	if (pFontCombo != NULL && !pFontCombo->HasFocus())
	{
		if ((cf.dwMask &(CFM_FACE|CFM_CHARSET)) == (CFM_FACE|CFM_CHARSET))
		{
#if _MSC_VER >= 1300
			strFontName = cf.szFaceName;
#else
			strFontName = A2T(cf.szFaceName);
#endif
			pFontCombo->SetFont(strFontName, DEFAULT_CHARSET, TRUE);
		}
		else
		{
			pFontCombo->SetText(_T(""));
		}
	}

	CMFCRibbonComboBox* pFontSizeCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_FONT_FONTSIZE));
	if (pFontSizeCombo != NULL)
	{
		pFontSizeCombo->SetEditText(TwipsToPointString(cf.yHeight));
	}

	SetFocus();
}
BOOL CBMPFrame::OnNcActivate(BOOL bActive)
{
	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
	// Activate/Inactivate ribbon context category: 영상처리
	CMFCRibbonBar *pRibbon = ((CMainFrame*)GetTopLevelFrame())->GetRibbonBar();
	if (bActive) {
		pRibbon->ShowContextCategories(ID_IMAGEPROCESSING, TRUE);
		pRibbon->ActivateContextCategory(ID_IMAGEPROCESSING);
	}
	else {
		pRibbon->ShowContextCategories(ID_IMAGEPROCESSING, FALSE);
	}
	pRibbon->RecalcLayout();
	pRibbon->RedrawWindow();

	return CMDIChildWndEx::OnNcActivate(bActive);
}