//--------------------------------------------------------------------------- void tTJSNI_BaseSoundBuffer::TimerBeatHandler() { // fade handling if(!Owner) return; // "Owner" indicates the owner object is valid if(!InFading) return; if(BlankLeft) { BlankLeft -= TVP_SB_BEAT_INTERVAL; if(BlankLeft < 0) BlankLeft = 0; } else if(FadeCount) { if(FadeCount == 1) { StopFade(true, true); } else { FadeCount--; tjs_int v; v = GetVolume(); v += DeltaVolume; if(v<0) v = 0; if(v>100000) v = 100000; SetVolume(v); } } }
/** Change the window which the object controls. * The previously selected transparency level is applied to the new window immediately and automatically. */ void Transparency::SetWindow(HWND hWnd) { if (m_hWnd != hWnd) { m_hWnd = hWnd; StopFade(); ForceTransparencyLevel(m_level); } }
/** Set the transparency level. */ void Transparency::SetTransparencyLevel(unsigned char level, bool fade) { m_level = level; if (level == m_curLevel) StopFade(); else if (fade && IsTransparencySupported()) StartFade(); else ForceTransparencyLevel(level); }
void Led::SetBrightness(uint8_t brightness) { if (IsFading()) StopFade(); brightness = constrain(brightness, 0, 255); this->brightness = brightness; WritePWM(); }
//--------------------------------------------------------------------------- void tTJSNI_BaseSoundBuffer::Fade(tjs_int to, tjs_int time, tjs_int blanktime) { // start fading if(!Owner) return; if(time<=0 || blanktime <0) { TVPThrowExceptionMessage(TVPInvalidParam); } // stop current fade if(InFading) StopFade(false, false); // set some parameters DeltaVolume = (to - GetVolume()) * TVP_SB_BEAT_INTERVAL / time; TargetVolume = to; FadeCount = time / TVP_SB_BEAT_INTERVAL; BlankLeft = blanktime; InFading = true; if(FadeCount == 0 && BlankLeft == 0) StopFade(false, true); }
void UIPicButton::Fade () { g_iAlpha++; if (g_iAlpha > 50) { g_iAlpha = 0; StopFade (); if (g_bMouseover == false) { g_bHighlighted = false; } } g_blendop.SourceConstantAlpha = g_iAlpha; InvalidateRect (g_hWnd, &g_Rect, false); }
LRESULT xxxTooltipWndProc(PWND pwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; PTOOLTIPWND pttwnd; CheckLock(pwnd); VALIDATECLASSANDSIZE(pwnd, uMsg, wParam, lParam, FNID_TOOLTIP, WM_NCCREATE); pttwnd = (PTOOLTIPWND)pwnd; switch(uMsg) { case WM_TIMER: xxxTooltipHandleTimer(pttwnd, (UINT)wParam); break; case WM_PAINT: xxxBeginPaint(pwnd, &ps); TooltipRender(pttwnd, ps.hdc); xxxEndPaint(pwnd, &ps); break; case WM_PRINTCLIENT: TooltipRender(pttwnd, (HDC)wParam); break; case WM_ERASEBKGND: break; case WM_NCCREATE: InitTooltipDelay(pttwnd); InitTooltipAnimation(pttwnd); goto CallDWP; case WM_NCDESTROY: CleanupTooltipAnimation(pttwnd); GETPDESK(pttwnd)->dwDTFlags &= ~DF_TOOLTIP; goto CallDWP; case WM_WINDOWPOSCHANGED: if (((LPWINDOWPOS)lParam)->flags & SWP_SHOWWINDOW) { HDC hdc; int cx; int cy; if (!TestEffectUP(TOOLTIPANIMATION)) { SetTooltipTimer(pttwnd, TTT_HIDE, pttwnd->dwHideDelay); goto CallDWP; } hdc = NULL; cx = pttwnd->rcWindow.right - pttwnd->rcWindow.left; cy = pttwnd->rcWindow.bottom - pttwnd->rcWindow.top; /* * At this point we're sure that the window is showing and the size * has been changed and we're in the context of the desktop thread. */ if (TestALPHA(TOOLTIPFADE)) { hdc = CreateFade((PWND)pttwnd, NULL, CMS_TOOLTIP, FADE_SHOW | FADE_TOOLTIP); } else { if (CreateTooltipBitmap(pttwnd, cx, cy)) { hdc = pttwnd->hdcMem; } } if (hdc == NULL) { SetTooltipTimer(pttwnd, TTT_HIDE, 0); goto CallDWP; } xxxSendMessage((PWND)pttwnd, WM_PRINT, (WPARAM)hdc, PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND); /* * Start animation timer */ if (TestFadeFlags(FADE_TOOLTIP)) { StartFade(); SetTooltipTimer(pttwnd, TTT_HIDE, pttwnd->dwHideDelay); } else { pttwnd->dwAnimStart = NtGetTickCount(); SetTooltipTimer(pttwnd, TTT_ANIMATE, TT_ANIMATEDELAY); } } else if (((LPWINDOWPOS)lParam)->flags & SWP_HIDEWINDOW) { if (TestFadeFlags(FADE_TOOLTIP)) { StopFade(); } else { DestroyTooltipBitmap(pttwnd); } } goto CallDWP; default: CallDWP: return xxxDefWindowProc(pwnd, uMsg, wParam, lParam); } return 0; }
COSDFader::~COSDFader() { StopFade(); }