diff options
author | Leslie Linden <leslie@lindenlab.com> | 2011-10-05 16:28:40 -0700 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2011-10-05 16:28:40 -0700 |
commit | 93e3c8e4a51dd60c202bc2e3f11b9ae850b2b6c8 (patch) | |
tree | fddefdec4836432e37ec062fc29ff88711abd9be /indra/llui/llbutton.cpp | |
parent | 1c4d540afd488c5b64102fc14ea65433855f802a (diff) |
EXP-1280 FIX -- Minimized floaters associated with toolbar buttons should change the state of their parent button
* Toolbar buttons now display green when its corresponding floater is open or
minimized.
* Made changes to buttons so flash time and rate is configurable
* Removed unused "highlight_color" attribute from LLButton
* Implemented "isVisible" function for toolbar button floaters. It returns true
when the floater is visible or minimized.
* Toolbar floater unminimize now also puts focus to the floater
* All commands now specify their "is_running_function" for toolbar button state
* ButtonFlashCount and ButtonFlashRate have been moved to button.xml settings
and are now configurable on the button. Toolbar buttons are set to never
flash and this functionality is used to show which buttons have windows open.
* All toybox buttons show hover glow even when disabled
Reviewed by Richard.
Diffstat (limited to 'indra/llui/llbutton.cpp')
-rw-r--r-- | indra/llui/llbutton.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index f259e8027e..c9ee62296f 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -83,7 +83,6 @@ LLButton::Params::Params() label_color_selected("label_color_selected"), // requires is_toggle true label_color_disabled("label_color_disabled"), label_color_disabled_selected("label_color_disabled_selected"), - highlight_color("highlight_color"), image_color("image_color"), image_color_disabled("image_color_disabled"), image_overlay_color("image_overlay_color", LLColor4::white), @@ -99,10 +98,13 @@ LLButton::Params::Params() scale_image("scale_image", true), hover_glow_amount("hover_glow_amount"), commit_on_return("commit_on_return", true), + display_pressed_state("display_pressed_state", true), use_draw_context_alpha("use_draw_context_alpha", true), badge("badge"), handle_right_mouse("handle_right_mouse"), - held_down_delay("held_down_delay") + held_down_delay("held_down_delay"), + button_flash_count("button_flash_count"), + button_flash_rate("button_flash_rate") { addSynonym(is_toggle, "toggle"); changeDefault(initial_value, LLSD(false)); @@ -136,7 +138,6 @@ LLButton::LLButton(const LLButton::Params& p) mSelectedLabelColor(p.label_color_selected()), mDisabledLabelColor(p.label_color_disabled()), mDisabledSelectedLabelColor(p.label_color_disabled_selected()), - mHighlightColor(p.highlight_color()), mImageColor(p.image_color()), mFlashBgColor(p.flash_color()), mDisabledImageColor(p.image_color_disabled()), @@ -159,12 +160,15 @@ LLButton::LLButton(const LLButton::Params& p) mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), mForcePressedState(false), + mDisplayPressedState(p.display_pressed_state), mLastDrawCharsCount(0), mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), mUseDrawContextAlpha(p.use_draw_context_alpha), - mHandleRightMouse(p.handle_right_mouse) + mHandleRightMouse(p.handle_right_mouse), + mButtonFlashCount(p.button_flash_count), + mButtonFlashRate(p.button_flash_rate) { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>()); @@ -570,15 +574,13 @@ void LLButton::draw() { F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); bool flash = FALSE; - static LLUICachedControl<F32> button_flash_rate("ButtonFlashRate", 0); - static LLUICachedControl<S32> button_flash_count("ButtonFlashCount", 0); if( mFlashing ) { F32 elapsed = mFlashingTimer.getElapsedTimeF32(); - S32 flash_count = S32(elapsed * button_flash_rate * 2.f); + S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f); // flash on or off? - flash = (flash_count % 2 == 0) || flash_count > S32((F32)button_flash_count * 2.f); + flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f); } bool pressed_by_keyboard = FALSE; @@ -607,7 +609,7 @@ void LLButton::draw() LLColor4 glow_color = LLColor4::white; LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; LLUIImage* imagep = NULL; - if (pressed) + if (pressed && mDisplayPressedState) { imagep = selected ? mImagePressedSelected : mImagePressed; } @@ -800,7 +802,7 @@ void LLButton::draw() S32 center_y = getLocalRect().getCenterY(); //FUGLY HACK FOR "DEPRESSED" BUTTONS - if (pressed) + if (pressed && mDisplayPressedState) { center_y--; center_x++; @@ -873,7 +875,7 @@ void LLButton::draw() S32 y_offset = 2 + (getRect().getHeight() - 20)/2; - if (pressed) + if (pressed && mDisplayPressedState) { y_offset--; x++; |