From e298c2ded8e25a28127c668cf30a74a25c139041 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 16 Nov 2012 22:36:12 +0200 Subject: CHUI-487, CHUI-488 FIXED (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): implemented FUI button flashing; clean up code --- indra/llui/llflashtimer.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 indra/llui/llflashtimer.cpp (limited to 'indra/llui/llflashtimer.cpp') diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp new file mode 100644 index 0000000000..c572a83ff5 --- /dev/null +++ b/indra/llui/llflashtimer.cpp @@ -0,0 +1,80 @@ +/** + * @file llflashtimer.cpp + * @brief LLFlashTimer class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "../newview/llviewerprecompiledheaders.h" + +#include "llflashtimer.h" +#include "../newview/llviewercontrol.h" +#include "lleventtimer.h" + +LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) + : LLEventTimer(period) + , mCallback(cb) + , mCurrentTickCount(0) + , mIsFlashing(false) +{ + mEventTimer.stop(); + + // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. + // Due to Timer is implemented as derived class from EventTimer it is impossible to change period + // in runtime. So, both settings are made as required restart. + mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount")); + if (mPeriod<=0) + { + mPeriod = gSavedSettings.getF32("FlashPeriod"); + } +} + +BOOL LLFlashTimer::tick() +{ + mIsHighlight = !(mCurrentTickCount % 2); + if (mCallback) + { + mCallback(mIsHighlight); + } + + if (++mCurrentTickCount >= mFlashCount) + { + mEventTimer.stop(); + } + + return FALSE; +} + +void LLFlashTimer::startFlashing() +{ + mCurrentTickCount = 0; + mIsFlashing = true; + mEventTimer.start(); +} + +void LLFlashTimer::stopFlashing() +{ + mIsFlashing = false; + mIsHighlight = false; + mEventTimer.stop(); +} + + -- cgit v1.2.3 From edeeed95416be2679e1ad3d29bab5396dbcccaa2 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 21 Nov 2012 01:41:49 +0200 Subject: CHUI-531 FIXED Poor fps in CHUI viewer --- indra/llui/llflashtimer.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/llui/llflashtimer.cpp') diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index c572a83ff5..2ad86b5751 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -33,15 +33,15 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) : LLEventTimer(period) , mCallback(cb) , mCurrentTickCount(0) - , mIsFlashing(false) + , mIsFlashingInProgress(false) { mEventTimer.stop(); // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. // Due to Timer is implemented as derived class from EventTimer it is impossible to change period // in runtime. So, both settings are made as required restart. - mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount")); - if (mPeriod<=0) + mFlashCount = 2 * ((count > 0) ? count : gSavedSettings.getS32("FlashCount")); + if (mPeriod <= 0) { mPeriod = gSavedSettings.getF32("FlashPeriod"); } @@ -49,15 +49,18 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) BOOL LLFlashTimer::tick() { - mIsHighlight = !(mCurrentTickCount % 2); + mIsCurrentlyHighlighted = !mIsCurrentlyHighlighted; + if (mCallback) { - mCallback(mIsHighlight); + mCallback(mIsCurrentlyHighlighted); } if (++mCurrentTickCount >= mFlashCount) { mEventTimer.stop(); + mCurrentTickCount = 0; + mIsFlashingInProgress = false; } return FALSE; @@ -65,15 +68,14 @@ BOOL LLFlashTimer::tick() void LLFlashTimer::startFlashing() { - mCurrentTickCount = 0; - mIsFlashing = true; + mIsFlashingInProgress = true; mEventTimer.start(); } void LLFlashTimer::stopFlashing() { - mIsFlashing = false; - mIsHighlight = false; + mIsFlashingInProgress = false; + mIsCurrentlyHighlighted = false; mEventTimer.stop(); } -- cgit v1.2.3 From f37645554ce97026869563aedea8f8c6133d8044 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 23 Nov 2012 13:39:53 +0200 Subject: CHUI-528, CHUI-536, CHUI-538, CHUI-540 ADD. FIX (Built single processor of different types of notifications): repaired LLFlashTimer --- indra/llui/llflashtimer.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'indra/llui/llflashtimer.cpp') diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index 2ad86b5751..de7a4ab265 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -34,6 +34,7 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) , mCallback(cb) , mCurrentTickCount(0) , mIsFlashingInProgress(false) + , mIsCurrentlyHighlighted(false) { mEventTimer.stop(); @@ -58,9 +59,7 @@ BOOL LLFlashTimer::tick() if (++mCurrentTickCount >= mFlashCount) { - mEventTimer.stop(); - mCurrentTickCount = 0; - mIsFlashingInProgress = false; + stopFlashing(); } return FALSE; @@ -69,14 +68,26 @@ BOOL LLFlashTimer::tick() void LLFlashTimer::startFlashing() { mIsFlashingInProgress = true; + mIsCurrentlyHighlighted = true; mEventTimer.start(); } void LLFlashTimer::stopFlashing() { + mEventTimer.stop(); mIsFlashingInProgress = false; mIsCurrentlyHighlighted = false; - mEventTimer.stop(); + mCurrentTickCount = 0; +} + +bool LLFlashTimer::isFlashingInProgress() +{ + return mIsFlashingInProgress; +} + +bool LLFlashTimer::isCurrentlyHighlighted() +{ + return mIsCurrentlyHighlighted; } -- cgit v1.2.3