void CGUIDialog::UpdateVisibility() { if (m_visibleCondition) { if (m_visibleCondition->Get()) Show(); else Close(); } if (m_autoClosing) { // check if our timer is running if (!m_showStartTime) { if (HasProcessed()) // start timer m_showStartTime = CTimeUtils::GetFrameTime(); } else { if (m_showStartTime + m_showDuration < CTimeUtils::GetFrameTime() && !m_closing) { m_bAutoClosed = true; Close(); } } } }
void CGUIDialogProgress::Open(const std::string ¶m /* = "" */) { CLog::Log(LOGDEBUG, "DialogProgress::Open called %s", m_active ? "(already running)!" : ""); { CSingleLock lock(g_graphicsContext); ShowProgressBar(false); } CGUIDialog::Open_Internal(false, param); while (m_active && IsAnimating(ANIM_TYPE_WINDOW_OPEN)) { Progress(); // we should have rendered at least once by now - if we haven't, then // we must be running from fullscreen video or similar where the // calling thread handles rendering (ie not main app thread) but // is waiting on this routine before rendering begins if (!HasProcessed()) break; } }
bool CGUIControl::Animate(unsigned int currentTime) { // check visible state outside the loop, as it could change GUIVISIBLE visible = m_visible; m_transform.Reset(); bool changed = false; CPoint center(GetXPosition() + GetWidth() * 0.5f, GetYPosition() + GetHeight() * 0.5f); for (unsigned int i = 0; i < m_animations.size(); i++) { CAnimation &anim = m_animations[i]; anim.Animate(currentTime, HasProcessed() || visible == DELAYED); // Update the control states (such as visibility) UpdateStates(anim.GetType(), anim.GetProcess(), anim.GetState()); // and render the animation effect changed |= (anim.GetProcess() != ANIM_PROCESS_NONE); anim.RenderAnimation(m_transform, center); /* // debug stuff if (anim.currentProcess != ANIM_PROCESS_NONE) { if (anim.effect == EFFECT_TYPE_ZOOM) { if (IsVisible()) CLog::Log(LOGDEBUG, "Animating control %d with a %s zoom effect %s. Amount is %2.1f, visible=%s", m_controlID, anim.type == ANIM_TYPE_CONDITIONAL ? (anim.lastCondition ? "conditional_on" : "conditional_off") : (anim.type == ANIM_TYPE_VISIBLE ? "visible" : "hidden"), anim.currentProcess == ANIM_PROCESS_NORMAL ? "normal" : "reverse", anim.amount, IsVisible() ? "true" : "false"); } else if (anim.effect == EFFECT_TYPE_FADE) { if (IsVisible()) CLog::Log(LOGDEBUG, "Animating control %d with a %s fade effect %s. Amount is %2.1f. Visible=%s", m_controlID, anim.type == ANIM_TYPE_CONDITIONAL ? (anim.lastCondition ? "conditional_on" : "conditional_off") : (anim.type == ANIM_TYPE_VISIBLE ? "visible" : "hidden"), anim.currentProcess == ANIM_PROCESS_NORMAL ? "normal" : "reverse", anim.amount, IsVisible() ? "true" : "false"); } }*/ } return changed; }
bool CGUIControl::CheckAnimation(ANIMATION_TYPE animType) { // rule out the animations we shouldn't perform if (!IsVisible() || !HasProcessed()) { // hidden or never processed - don't allow exit or entry animations for this control if (animType == ANIM_TYPE_WINDOW_CLOSE) { // could be animating a (delayed) window open anim, so reset it ResetAnimation(ANIM_TYPE_WINDOW_OPEN); return false; } } if (!IsVisible()) { // hidden - only allow hidden anims if we're animating a visible anim if (animType == ANIM_TYPE_HIDDEN && !IsAnimating(ANIM_TYPE_VISIBLE)) { // update states to force it hidden UpdateStates(animType, ANIM_PROCESS_NORMAL, ANIM_STATE_APPLIED); return false; } if (animType == ANIM_TYPE_WINDOW_OPEN) return false; } return true; }