void CUIControler::CloseTestsFile( std::string filePath )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pFileFoldersCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_SELECT_FILEFOLDER));

	//Find the file in the vector :
	testsFilesMapT::iterator myIt=testsFilesMap.find(filePath);
	if (myIt!=testsFilesMap.end())
	{
		CTestsFile* pFile=myIt->second;
		//
		//Remove al tests from all references :
		for (TestsVector::iterator testsIt=pFile->getTestsVector().begin();
			testsIt!=pFile->getTestsVector().end();testsIt++)
		{
			CTest* pTest=*testsIt;
			//
			pHistoryTree->deleteTest(pTest);
			removeTestFromRibbonCombos(pTest);
		}
		//Now delete the file from the Combo :
		CString strDisplay;strDisplay.Format(_T("%S"),filePath.c_str());
		pFileFoldersCombo->DeleteItem( strDisplay );
		//
		testsFilesMap.erase(myIt);
		CTestsFile::releaseFile(pFile);
	}
}
void CUIControler::addFileToHomeCombo( CString fileName )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pFilesFolder = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_SELECT_FILEFOLDER));

	pFilesFolder->AddItem(fileName,1);
}
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);
	}
}
void CMainFrame::onFontName()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();


	CMFCRibbonFontComboBox* pFontNameCombo = DYNAMIC_DOWNCAST(CMFCRibbonFontComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_FONT_NAME));
	if (pFontNameCombo == NULL)
		return;
	


	chartControl.setFormat(iFormatElement,CChartControl::Format_FontName,pFontNameCombo->GetEditText());
	
	/*
	const CMFCFontInfo* pFontInfo=pFontNameCombo->GetFontDesc(pFontNameCombo->GetCurSel());
	
		pFontInfo->
		AfxMessageBox(pFontInfo->GetFullName());*/
	

	return;
	

}
void CUIControler::addTestsCollectionToRibbonCombos( CTestsFile* pCollection )
{
	/*
	WM_COMPARE_FOCUS_SELTEST
	WM_ANALYSIS_TEST_SELECT
	*/
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pAnalyseTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_ANALYSIS_TEST_SELECT));
	CMFCRibbonComboBox* pCompareTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_COMPARE_FOCUS_SELTEST));
	


	TestsVector::iterator myIt;

	for (myIt = pCollection->getTestsVector().begin(); myIt != pCollection->getTestsVector().end(); myIt++ ){
		//
		CTest* pSession=*myIt;

		//AfxMessageBox(CCommonUtilities::toMFCString(pSession->getName()));
		CString dispName=CCommonUtilities::toMFCString(pSession->getName())+_T("[")+\
			CCommonUtilities::toMFCString(pSession->getDescription())+_T("]");

		pAnalyseTestsCombo->AddItem(CCommonUtilities::toMFCString(dispName),(DWORD_PTR)pSession);
		pCompareTestsCombo->AddItem(CCommonUtilities::toMFCString(pSession->getName()));

	}
}
void CUIControler::removeTestFromRibbonCombos( CTest* pTest )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pAnalyseTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_ANALYSIS_TEST_SELECT));


	DWORD_PTR dwPtr=(DWORD_PTR)pTest;
	pAnalyseTestsCombo->DeleteItem(dwPtr);
}
Exemple #7
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);
	}
void CMainFrame::formatSelectionCombo()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
	{
		return;
	}
	chartControl.setSelectedFormatItem(pFormatSelCombo->GetCurSel());
}
void CMainFrame::setReverse()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();

	chartControl.setFormat(iFormatElement,CChartControl::Format_OrientationReverse,_T(""));
}
Exemple #10
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();
	}
Exemple #11
0
void CMainFrame::OnFormatSizeX()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();


	CMFCRibbonEdit* pEdit = DYNAMIC_DOWNCAST(CMFCRibbonEdit, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SIZEY));
	chartControl.setFormat(iFormatElement,CChartControl::Format_SizeLength,pEdit->GetEditText());
}
void CMyRibbonBar::testUpdate()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
	{
		return;
	}
	pFormatSelCombo->SelectItem(2);
	return;
	int i=pFormatSelCombo->GetCurSel();
}
Exemple #13
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);
		}
	}
Exemple #14
0
void CMainFrame::setText()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();
	//
	//AfxMessageBox(pFormatSelCombo->GetItem(iFormatElement));

	CMFCRibbonEdit* pTextEdit = DYNAMIC_DOWNCAST(CMFCRibbonEdit, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_TEXT));
	//
	//AfxMessageBox(pTextEdit->GetEditText());

	chartControl.setFormat(iFormatElement,CChartControl::Format_Text,pTextEdit->GetEditText());
}
void CUIControler::updateTestAtRibbonCombo( CTest* pTest )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pAnalyseTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_ANALYSIS_TEST_SELECT));


	DWORD_PTR dwPtr=(DWORD_PTR)pTest;
	pAnalyseTestsCombo->DeleteItem(dwPtr);


	CString dispName=CCommonUtilities::toMFCString(pTest->getName())+_T("[")+\
		CCommonUtilities::toMFCString(pTest->getDescription())+_T("]");

	pAnalyseTestsCombo->AddItem(CCommonUtilities::toMFCString(dispName),(DWORD_PTR)pTest);

}
Exemple #16
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);
		}
	}
Exemple #17
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;
			}
	}
Exemple #18
0
void CMainFrame::onFontSize()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();


	CMFCRibbonComboBox* pFonSize = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_FONT_SIZE));
	if (pFonSize == NULL)
		return;


	chartControl.setFormat(iFormatElement,CChartControl::Format_FontSize,pFonSize->GetEditText());

	//
}
CFeature* CUIControler::getFeatureByComboID( UINT comboID )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(comboID));
	if (pCombo == NULL)
	{
		return NULL;
	}
	int iSel=pCombo->GetCurSel();
	if (iSel==-1)
	{
		return NULL;
	}
	DWORD_PTR dwData=pCombo->GetItemData(iSel);

	CFeature* pFeature=(CFeature*)dwData;
	return pFeature;
}
void CLineComputeView::OnComboViewBackground()
{

    CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;
    CMFCRibbonComboBox *pComboBox = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pMain->m_wndRibbonBar.FindByID(ID_COMBO_VIEW_BACKGROUND));
    int nCurSel = pComboBox->GetCurSel();
    m_data->m_viewBackgroundColor = nCurSel;
    switch(nCurSel)
    {
    case 1:
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        break;
    case 0:
        glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
        break;
    }
    RenderScene();
}
CTest* CUIControler::getSelectedAnalysisComboTests()
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pAnalyseTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_ANALYSIS_TEST_SELECT));
	if (pAnalyseTestsCombo == NULL)
	{
		return NULL;
	}
	int iSel=pAnalyseTestsCombo->GetCurSel();
	if (iSel==-1)
	{
		return NULL;
	}
	DWORD_PTR dwData=pAnalyseTestsCombo->GetItemData(iSel);

	CTest* pSession=(CTest*)dwData;
	return pSession;
}
Exemple #22
0
void CMainFrame::onShapeHatchingToolCommand( UINT id )
{	
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();

	/*
	#define ID_HATCHING_NONE                32853
	#define ID_HATCHING_CROSS               32854
	#define ID_HATCHING_DIVOT               32855
	#define ID_HATCHING_HORIZONTAL          32856
	#define ID_HATCHING_VERTICAL            32857
	*/
	CString str;
	str.Format(_T("%d"),id-ID_HATCHING_NONE);
	chartControl.setFormat(iFormatElement,CChartControl::Format_ShapeHatch,str);

}
Exemple #23
0
void CMainFrame::setFillColor1()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();

	CMFCRibbonColorButton* pFillColor1Combo = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_FILL_COLOR1));
	if (pFillColor1Combo == NULL)
		return;

	CString str;
	str.Format(_T("%.3d%.3d%.3d"),GetRValue(pFillColor1Combo->GetColor()),
		GetGValue(pFillColor1Combo->GetColor()),
		GetBValue(pFillColor1Combo->GetColor()));
	AfxMessageBox(str);

	chartControl.setFormat(iFormatElement,CChartControl::Format_ShapeColor1,str);
}
Exemple #24
0
void CMainFrame::OnDockingToolCommand( UINT id )
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();


	/*
	#define ID_CHART_DOCK_TOP               32829
	#define ID_CHART_DOCK_LEFT              32830
	#define ID_CHART_DOCK_RIGHT             32831
	#define ID_CHART_DOCK_BOTTOM            32832

	*/
	CString str;
	str.Format(_T("%d"),id-ID_CHART_DOCK_TOP);
	chartControl.setFormat(iFormatElement,CChartControl::Format_OrientationDocking,str);
}
bool CUIControler::getCompareFeatureTargetInfo( UINT comboID,CString& featureName,CFeature::Type& featureType )
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(comboID));
	if (pCombo == NULL)
	{
		return false;
	}
	int iSel=pCombo->GetCurSel();
	if (iSel==-1)
	{
		return false;
	}
	DWORD_PTR dwData=pCombo->GetItemData(iSel);

	featureType=(CFeature::Type)dwData;
	featureName=pCombo->GetItem(iSel);
	return true;
}
Exemple #26
0
void CMainFrame::OnOutlineStyleToolCommand( UINT id )
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();


	/*
	#define ID_OUTLINESTYLE_NOTSET          33100
	#define ID_OUTLINESTYLE_DASH            33101
	#define ID_OUTLINESTYLE_DASHDOT         33102
	#define ID_OUTLINESTYLE_DASHDOTDOT      33103
	#define ID_OUTLINESTYLE_DOT             33104
	#define ID_OUTLINESTYLE_SOLID           33105
	*/
	CString str;
	str.Format(_T("%d"),id-ID_OUTLINESTYLE_NOTSET);
	chartControl.setFormat(iFormatElement,CChartControl::Format_OutlineStyle,str);
}
Exemple #27
0
void CMainFrame::onOutlineWidthToolCommand( UINT id )
{
	

	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();

	/*
	#define ID_OUTLINE_WIDTH_1              
	#define ID_OUTLINE_WIDTH_2              
	#define ID_OUTLINE_WIDTH_3              
	#define ID_OUTLINE_WIDTH_4              
	*/
	CString str;
	str.Format(_T("%d"),id-ID_OUTLINE_WIDTH_1+1);
	chartControl.setFormat(iFormatElement,CChartControl::Format_OutlineSize,str);

}
Exemple #28
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();
}
void CUIControler::OnDeleteTest()
{
	CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	CMFCRibbonComboBox* pTestsCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox,pMainFrame->GetRibbonBar()->FindByID(WM_SELECT_TEST));

	if (pTestsCombo->GetCurSel()==-1)
		return;

	CString strPath=pTestsCombo->GetItem(pTestsCombo->GetCurSel());
	CTest* pTest= (CTest*) pTestsCombo->GetItemData(pTestsCombo->GetCurSel());
	//
	//

	CTestsFile* pFile=pTest->GetTestsFile();
	pHistoryTree->deleteTest(pTest);
	removeTestFromRibbonCombos(pTest);

	//Will also finally delete the mem reference.
	pFile->removeTestFromXML(pTest);
	/*
CString displayText;
	displayText.Format(_T("region name=%S\ndescription=%S"),pTest->getName().c_str(),pTest->getDescription().c_str());
	AfxMessageBox(displayText);
*/

}