コード例 #1
0
ファイル: GUISliderControl.cpp プロジェクト: FLyrfors/xbmc
bool CGUISliderControl::ProcessSelector(CGUITexture &nib, unsigned int currentTime, float fScale, RangeSelector selector)
{
  bool dirty = false;
  // we render the nib centered at the appropriate percentage, except where the nib
  // would overflow the background image
  if (m_orientation == HORIZONTAL)
  {
    dirty |= nib.SetHeight(nib.GetTextureHeight() * fScale);
    dirty |= nib.SetWidth(nib.GetHeight() * 2);
  }
  else
  {
    dirty |= nib.SetWidth(nib.GetTextureWidth() * fScale);
    dirty |= nib.SetHeight(nib.GetWidth() * 2);
  }
  CAspectRatio ratio(CAspectRatio::AR_KEEP);
  ratio.align = ASPECT_ALIGN_LEFT | ASPECT_ALIGNY_CENTER;
  dirty |= nib.SetAspectRatio(ratio);
  dirty |= nib.Process(currentTime);
  CRect rect = nib.GetRenderRect();

  float offset;
  if (m_orientation == HORIZONTAL)
  {
    offset = GetProportion(selector) * m_width - rect.Width() / 2;
    if (offset > m_width - rect.Width())
      offset = m_width - rect.Width();
    if (offset < 0)
      offset = 0;
    dirty |= nib.SetPosition(m_guiBackground.GetXPosition() + offset, m_guiBackground.GetYPosition());
  }
  else
  {
    offset = GetProportion(selector) * m_height - rect.Height() / 2;
    if (offset > m_height - rect.Height())
      offset = m_height - rect.Height();
    if (offset < 0)
      offset = 0;
    dirty |= nib.SetPosition(m_guiBackground.GetXPosition(), m_guiBackground.GetYPosition() + m_guiBackground.GetHeight() - offset - ((nib.GetHeight() - rect.Height()) / 2 + rect.Height()));
  }
  dirty |= nib.Process(currentTime); // need to process again as the position may have changed

  return dirty;
}
コード例 #2
0
void CGUISliderControl::SendClick()
{
  float percent = 100*GetProportion();
  SEND_CLICK_MESSAGE(GetID(), GetParentID(), MathUtils::round_int(percent));
  if (m_action && (!m_dragging || m_action->fireOnDrag))
  {
    std::string action = StringUtils::Format(m_action->formatString, percent);
    CGUIMessage message(GUI_MSG_EXECUTE, m_controlID, m_parentID);
    message.SetStringParam(action);
    g_windowManager.SendMessage(message);    
  }
}
コード例 #3
0
ファイル: GUISliderControl.cpp プロジェクト: Sky-git/xbmc
void CGUISliderControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
  bool dirty = false;

  dirty |= m_guiBackground.SetPosition( m_posX, m_posY );
  int infoCode = m_iInfoCode;
  if (m_action && (!m_dragging || m_action->fireOnDrag))
    infoCode = m_action->infoCode;
  if (infoCode)
  {
    int val;
    if (g_infoManager.GetInt(val, infoCode))
      SetIntValue(val);
  }

  float fScaleY = m_height == 0 ? 1.0f : m_height / m_guiBackground.GetTextureHeight();

  dirty |= m_guiBackground.SetHeight(m_height);
  dirty |= m_guiBackground.SetWidth(m_width);
  dirty |= m_guiBackground.Process(currentTime);

  // we render the nib centered at the appropriate percentage, except where the nib
  // would overflow the background image
  CGUITexture &nib = (m_bHasFocus && !IsDisabled()) ? m_guiMidFocus : m_guiMid;

  dirty |= nib.SetHeight(nib.GetTextureHeight() * fScaleY);
  dirty |= nib.SetWidth(nib.GetHeight() * 2);
  CAspectRatio ratio(CAspectRatio::AR_KEEP); ratio.align = ASPECT_ALIGN_LEFT | ASPECT_ALIGNY_CENTER;
  dirty |= nib.SetAspectRatio(ratio);
  CRect rect = nib.GetRenderRect();

  float offset = GetProportion() * m_width - rect.Width() / 2;
  if (offset > m_width - rect.Width())
    offset = m_width - rect.Width();
  if (offset < 0)
    offset = 0;
  dirty |= nib.SetPosition(m_guiBackground.GetXPosition() + offset, m_guiBackground.GetYPosition() );
  dirty |= nib.Process(currentTime);

  if (dirty)
    MarkDirtyRegion();

  CGUIControl::Process(currentTime, dirtyregions);
}
コード例 #4
0
ファイル: GUISliderControl.cpp プロジェクト: vanMiez/xbmc
bool CGUISliderControl::ProcessSelector(CGUITexture &nib, unsigned int currentTime, float fScaleY, RangeSelector selector)
{
  bool dirty = false;
  // we render the nib centered at the appropriate percentage, except where the nib
  // would overflow the background image
  dirty |= nib.SetHeight(nib.GetTextureHeight() * fScaleY);
  dirty |= nib.SetWidth(nib.GetHeight() * 2);
  CAspectRatio ratio(CAspectRatio::AR_KEEP);
  ratio.align = ASPECT_ALIGN_LEFT | ASPECT_ALIGNY_CENTER;
  dirty |= nib.SetAspectRatio(ratio);
  CRect rect = nib.GetRenderRect();

  float offset = GetProportion(selector) * m_width - rect.Width() / 2;
  if (offset > m_width - rect.Width())
    offset = m_width - rect.Width();
  if (offset < 0)
    offset = 0;
  dirty |= nib.SetPosition(m_guiBackground.GetXPosition() + offset, m_guiBackground.GetYPosition());
  dirty |= nib.Process(currentTime);

  return dirty;
}
コード例 #5
0
ファイル: GUISliderControl.cpp プロジェクト: Gav1577/xbmc
void CGUISliderControl::Render()
{
    m_guiBackground.SetPosition( m_posX, m_posY );
    if (m_iInfoCode)
        SetIntValue(g_infoManager.GetInt(m_iInfoCode));

    float fScaleX = m_width == 0 ? 1.0f : m_width / m_guiBackground.GetTextureWidth();
    float fScaleY = m_height == 0 ? 1.0f : m_height / m_guiBackground.GetTextureHeight();

    m_guiBackground.SetHeight(m_height);
    m_guiBackground.SetWidth(m_width);
    m_guiBackground.Render();

    float fWidth = (m_guiBackground.GetTextureWidth() - m_guiMid.GetTextureWidth())*fScaleX;

    float fPos = m_guiBackground.GetXPosition() + GetProportion() * fWidth;

    if ((int)fWidth > 1)
    {
        if (m_bHasFocus && !IsDisabled())
        {
            m_guiMidFocus.SetPosition(fPos, m_guiBackground.GetYPosition() );
            m_guiMidFocus.SetWidth(m_guiMidFocus.GetTextureWidth() * fScaleX);
            m_guiMidFocus.SetHeight(m_guiMidFocus.GetTextureHeight() * fScaleY);
            m_guiMidFocus.Render();
        }
        else
        {
            m_guiMid.SetPosition(fPos, m_guiBackground.GetYPosition() );
            m_guiMid.SetWidth(m_guiMid.GetTextureWidth()*fScaleX);
            m_guiMid.SetHeight(m_guiMid.GetTextureHeight()*fScaleY);
            m_guiMid.Render();
        }
    }
    CGUIControl::Render();
}
コード例 #6
0
ファイル: GUISliderControl.cpp プロジェクト: Gav1577/xbmc
void CGUISliderControl::Move(int iNumSteps)
{
    switch (m_iType)
    {
    case SPIN_CONTROL_TYPE_FLOAT:
        m_fValue += m_fInterval * iNumSteps;
        if (m_fValue < m_fStart) m_fValue = m_fStart;
        if (m_fValue > m_fEnd) m_fValue = m_fEnd;
        break;

    case SPIN_CONTROL_TYPE_INT:
        m_iValue += m_iInterval * iNumSteps;
        if (m_iValue < m_iStart) m_iValue = m_iStart;
        if (m_iValue > m_iEnd) m_iValue = m_iEnd;
        break;

    default:
        m_iPercent += m_iInterval * iNumSteps;
        if (m_iPercent < 0) m_iPercent = 0;
        if (m_iPercent > 100) m_iPercent = 100;
        break;
    }
    SEND_CLICK_MESSAGE(GetID(), GetParentID(), MathUtils::round_int(100*GetProportion()));
}
コード例 #7
0
ファイル: SceneShow.cpp プロジェクト: winsel/VS
BOOL CSceneShow::OnInitDialog()
{
	CDialog::OnInitDialog();
	g_SetWndStaticText(this);

	m_stuPicShow.Create(IDD_PICTURE_SHOW, this);
	CRect screenRect;
	GetDlgItem(IDC_STATIC_SHOW)->GetWindowRect(&screenRect);
	ScreenToClient(&screenRect);
	GetProportion(screenRect);
	m_stuPicShow.MoveWindow(screenRect);
	m_stuPicShow.ShowWindow(SW_SHOW);

 	CLIENT_RigisterDrawFun(ChannelAutoDraw, (LDWORD)&m_stuPicShow);
 	m_lPlayHandle = CLIENT_RealPlayEx(m_lLoginId, m_nChannelId, m_stuPicShow.m_hWnd); 

	if (m_nDrawType == isDrawSceneRoads)
	{
		int nIndex = 0;
		CString gDirection[] = {"north", "east north", "east", "east south", "south", "west south", "west", "west north"};
		
		m_cbDirection.ResetContent();
		for(int i = 0; i < 8; i++)
		{
			nIndex = m_cbDirection.AddString(ConvertString(gDirection[i]));
			m_cbDirection.SetItemData(i, i);
		}
		m_cbDirection.SetCurSel(0);

		GetDlgItem(IDC_STATIC_ROADID)->ShowWindow(SW_SHOW);
		GetDlgItem(IDC_EDIT_ROADID)->ShowWindow(SW_SHOW);
		GetDlgItem(IDC_STATIC_DIRECTION)->ShowWindow(SW_SHOW);
		GetDlgItem(IDC_COMBO_DIRECTION)->ShowWindow(SW_SHOW);
	}
	
	CString strDlgName;
	if (m_dlgSourceWindow != NULL)
	{
		if (m_nDrawType == isDrawSceneRoads)
		{
			CConfigTrafficScene* pWnd = (CConfigTrafficScene*)m_dlgSourceWindow;
			pWnd->InPutExitLinesToPictur(&m_stuPicShow, m_fProportionX, m_fProportionY);
			strDlgName = "RoadSet";
		}
		else if (m_nDrawType == isDrawRules)
		{
			switch(m_nSubDrawType)
			{
			case EVENT_IVS_TRAFFICGATE:
				{
					CConfigTrafficGateRule* pWnd = (CConfigTrafficGateRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_FACEDETECT:
				{
					CConfigFaceRule* pWnd = (CConfigFaceRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_WANDERDETECTION:
				{
					CConfigWanderRule* pWnd = (CConfigWanderRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_PASTEDETECTION:
				{
					CConfigPasteRule* pWnd = (CConfigPasteRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_CROSSLINEDETECTION:
				{
					CConfigCrossLineRule* pWnd = (CConfigCrossLineRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_CROSSREGIONDETECTION:
				{
					CConfigCrossRegion* pWnd = (CConfigCrossRegion*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			case EVENT_IVS_RIOTERDETECTION:
				{
					CConfigRioterRule* pWnd = (CConfigRioterRule*)m_dlgSourceWindow;
					pWnd->InputEventRulesInPic(&m_stuPicShow, m_fProportionX, m_fProportionY);
				}
				break;
			default:
				break;
			}
			strDlgName = "RuleSet";
		}
		else if (m_nDrawType == isDrawModuleInfo)
		{
			CConfigModule* pWnd = (CConfigModule*)m_dlgSourceWindow;
			pWnd->InPutExitLinesToPicture(&m_stuPicShow, m_fProportionX, m_fProportionY);
			SetDlgItemText(IDC_BUTTON_REPAINT,ConvertString("Repaint"));
			strDlgName = "DetectandTrackRegionSet";
		}
	}

	SetWindowText(ConvertString(strDlgName));

	for(int i = 0; i < m_nPaintTypeCount; i++)
	{
		if (i == 0)
		{
			GetDlgItem(IDC_RADIO1)->SetWindowText(ConvertString(m_gPaintType[i]));
			GetDlgItem(IDC_RADIO1)->ShowWindow(SW_SHOW);
		}
		else if (i == 1)
		{
			GetDlgItem(IDC_RADIO2)->SetWindowText(ConvertString(m_gPaintType[i]));
			GetDlgItem(IDC_RADIO2)->ShowWindow(SW_SHOW);
		}
		else if (i == 2)
		{
			GetDlgItem(IDC_RADIO3)->SetWindowText(ConvertString(m_gPaintType[i]));
			GetDlgItem(IDC_RADIO3)->ShowWindow(SW_SHOW);
		}
		else if (i == 3)
		{
			GetDlgItem(IDC_RADIO4)->SetWindowText(ConvertString(m_gPaintType[i]));
			GetDlgItem(IDC_RADIO4)->ShowWindow(SW_SHOW);
		}
		else if (i == 4)
		{
			GetDlgItem(IDC_RADIO5)->SetWindowText(ConvertString(m_gPaintType[i]));
			GetDlgItem(IDC_RADIO5)->ShowWindow(SW_SHOW);
		}
	}

	ClearRadioState();
	CButton* cRadio = (CButton*)GetDlgItem(IDC_RADIO1);
	cRadio->SetCheck(TRUE);
	GetSelectPaintType(0);
	m_stuPicShow.m_emSelectScene = m_nSelectPaintType;
	return TRUE;
}