Exemplo n.º 1
0
IUISlider*
CUIPanel::addSlider(const std::string& sLabel, int iMin, int iMax, int iPos, bool bButtons, int iInsertAt)
{
  std::map<std::string, CUISlider*>::iterator it = m_mapSliders.find(sLabel);

  if (it != m_mapSliders.end())
    return (*it).second;

  CMFCRibbonSlider* pSlider = new CMFCRibbonSlider(CUIManager::getInstance()->getNextUIID());

  if (!pSlider)
    return NULL;

  pSlider->SetRange(iMin, iMax);
  pSlider->SetPos(iPos);
  pSlider->SetZoomButtons(bButtons);

  m_pPanel->Insert(pSlider, iInsertAt);

  CUISlider* pUISlider = new CUISlider(pSlider);

  m_mapSliders[sLabel] = pUISlider;

  return pUISlider;
}
Exemplo n.º 2
0
void CLineComputeView::OnSliderViewzoom()
{

    CMainFrame *pMain = (CMainFrame *)AfxGetApp()->m_pMainWnd;
    CMFCRibbonSlider *pSlider = DYNAMIC_DOWNCAST(CMFCRibbonSlider, pMain->m_wndRibbonBar.FindByID(ID_SLIDER_VIEWZOOM));
    scale = pSlider->GetPos()/10.0f;
    RenderScene();

}
Exemplo n.º 3
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();
}
Exemplo n.º 4
0
afx_msg BOOL CLineComputeView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
    int wheelCount = zDelta/120;
    GLdouble deltaZoom = (wheelCount>0)? 0.1f: -0.1f;
    CMainFrame *pMain = (CMainFrame *)AfxGetApp()->m_pMainWnd;
    CMFCRibbonSlider *pSlider = DYNAMIC_DOWNCAST(CMFCRibbonSlider, pMain->m_wndRibbonBar.FindByID(ID_SLIDER_VIEWZOOM));
    scale += deltaZoom;
    scale = scale < 0.1? 0.1: scale;
    scale = scale > 10? 10: scale;
    pSlider->SetPos(scale*10);
    RenderScene();
    return true;
}
Exemplo n.º 5
0
void CMainFrame::SetSliderPos (int nPos, UINT nID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> ar;
	m_wndRibbonBar.GetElementsByID (nID, ar);

	for (int i = 0; i < ar.GetSize (); i++)
	{
		CMFCRibbonSlider* pSlider = DYNAMIC_DOWNCAST (CMFCRibbonSlider, ar[i]);
		if (pSlider != NULL)
		{
			if (pSlider->GetPos () != nPos)
			{
				pSlider->SetPos (nPos);
			}
		}
	}
}
Exemplo n.º 6
0
int CMainFrame::GetSliderPos (UINT nID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> ar;
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> ar2;
	m_wndRibbonBar.GetElementsByID (ID_RIBBON_OBTN_5, ar);
	m_wndRibbonBar.GetElementsByID (ID_RIBBON_OBTN_6, ar2);

	ar.Append (ar2);

	int nPos1 = -1;
	int nPos2 = -1;

	for (int k = 0; k < 2; k++)
	{
		for (int i = 0; i < ar.GetSize (); i++)
		{
			CMFCRibbonSlider* pSlider = DYNAMIC_DOWNCAST (CMFCRibbonSlider, ar[i]);
			if (pSlider != NULL)
			{
				if (k == 0)
				{
					if (pSlider->GetID () != nID)
					{
						nPos2 = pSlider->GetPos ();
						nPos1 = nPos2;
						break;
					}
				}
				else
				{
					if (pSlider->GetID () == nID)
					{
						if (pSlider->GetPos () != nPos2)
						{
							nPos1 = pSlider->GetPos ();
						}
					}
				}
			}
		}
	}

	return nPos1;
}