CHUI-487, CHUI-488 W.I.P. #3 (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): implemented conversation's item flashing

master
AlexanderP ProductEngine 2012-11-16 12:38:40 +02:00
parent 0b910871ab
commit 50b69c3f97
7 changed files with 48 additions and 8 deletions

View File

@ -176,7 +176,11 @@ LLButton::LLButton(const LLButton::Params& p)
{
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
if (this->getName() == "chat")
{
bool q = false;
q = !q;
}
if (!p.label_selected.isProvided())
{
mSelectedLabel = mUnselectedLabel;

View File

@ -23,9 +23,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "../newview/llflashtimer.h"
#include "linden_common.h"
#include "llfolderviewitem.h"
#include "llfolderview.h"
#include "llfolderviewmodel.h"
#include "llpanel.h"
@ -142,6 +144,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mArrowSize(p.arrow_size),
mMaxFolderItemOverlap(p.max_folder_item_overlap)
{
mFlashTimer = new LLFlashTimer();
sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
@ -676,12 +680,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
const S32 focus_bottom = getRect().getHeight() - mItemHeight;
const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
const S32 FOCUS_LEFT = 1;
bool flashing = mFlashTimer->isFlashing();
if (flashing? mFlashTimer->isHighlight() : mIsSelected) // always render "current" item (only render other selected items if
// mShowSingleSelection is FALSE) or flashing item
if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLColor4 bg_color = bgColor;
if (!mIsCurSelection)
bool selection = flashing? mFlashTimer->isHighlight() : mIsCurSelection;
if (!selection)
{
// do time-based fade of extra objects
F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f);
@ -701,7 +709,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
getRect().getWidth() - 2,
focus_bottom,
bg_color, hasKeyboardFocus);
if (mIsCurSelection)
if (selection)
{
gl_rect_2d(FOCUS_LEFT,
focus_top,

View File

@ -29,6 +29,7 @@
#include "llview.h"
#include "lluiimage.h"
class LLFlashTimer;
class LLFolderView;
class LLFolderViewModelItem;
class LLFolderViewFolder;
@ -272,6 +273,7 @@ public:
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
LLFlashTimer* mFlashTimer;
};

View File

@ -29,11 +29,13 @@
#include "llflashtimer.h"
#include "llviewercontrol.h"
#include "lleventtimer.h"
LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
: LLEventTimer(period)
, mCallback(cb)
, mCurrentTickCount(0)
, mIsFlashing(false)
{
mEventTimer.stop();
@ -49,8 +51,11 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
BOOL LLFlashTimer::tick()
{
bool blink = !(mCurrentTickCount % 2);
mCallback(blink);
mIsHighlight = !(mCurrentTickCount % 2);
if (mCallback)
{
mCallback(mIsHighlight);
}
if (++mCurrentTickCount >= mFlashCount)
{
@ -63,10 +68,15 @@ BOOL LLFlashTimer::tick()
void LLFlashTimer::startFlashing()
{
mCurrentTickCount = 0;
mIsFlashing = true;
mEventTimer.start();
}
void LLFlashTimer::stopFlashing()
{
mIsFlashing = false;
mIsHighlight = false;
mEventTimer.stop();
}

View File

@ -42,13 +42,15 @@ public:
* @param period - how frequently callback should be called
* @param cb - callback to be called each tick
*/
LLFlashTimer(callback_t cb, S32 count = 0, F32 period = 0.0);
LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0);
~LLFlashTimer() {};
/*virtual*/ BOOL tick();
void startFlashing();
void stopFlashing();
bool isFlashing() {return mIsFlashing;}
bool isHighlight() {return mIsHighlight;}
private:
callback_t mCallback;
@ -57,6 +59,8 @@ private:
*/
S32 mFlashCount;
S32 mCurrentTickCount;
bool mIsHighlight;
bool mIsFlashing;
};
#endif /* LL_FLASHTIMER_H */

View File

@ -1154,6 +1154,7 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
}
}
// Synchronous select the conversation item and the conversation floater
BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget)
{
@ -1596,4 +1597,14 @@ void LLFloaterIMContainer::reSelectConversation()
}
void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id)
{
LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id);
if (widget)
{
widget->;
}
}
// EOF

View File

@ -164,6 +164,7 @@ public:
void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
void setNearbyDistances();
void reSelectConversation();
void flashConversationItemWidget(const LLUUID& session_id);
private:
LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);