diff options
-rw-r--r-- | indra/newview/llcallfloater.cpp | 97 | ||||
-rw-r--r-- | indra/newview/llcallfloater.h | 20 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/favorites_bar_button.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_voice_controls.xml | 6 |
4 files changed, 128 insertions, 2 deletions
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 56911562e4..a402f59fa1 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -48,6 +48,7 @@ #include "llparticipantlist.h" #include "llspeakers.h" #include "lltransientfloatermgr.h" +#include "llviewerwindow.h" #include "llvoicechannel.h" static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids); @@ -216,6 +217,15 @@ void LLCallFloater::onChange() } } +S32 LLCallFloater::notifyParent(const LLSD& info) +{ + if("size_changes" == info["action"]) + { + reshapeToFitContent(); + return 1; + } + return LLDockableFloater::notifyParent(info); +} ////////////////////////////////////////////////////////////////////////// /// PRIVATE SECTION @@ -755,4 +765,91 @@ void LLCallFloater::reset() mSpeakerManager = NULL; } +void reshape_floater(LLCallFloater* floater, S32 delta_height) +{ + // Try to update floater top side if it is docked(to bottom bar). + // Try to update floater bottom side or top side if it is un-docked. + // If world rect is too small, floater will not be reshaped at all. + + LLRect floater_rect = floater->getRect(); + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + + // floater is docked to bottom bar + if(floater->isDocked()) + { + // can update floater top side + if(floater_rect.mTop + delta_height < world_rect.mTop) + { + floater_rect.set(floater_rect.mLeft, floater_rect.mTop + delta_height, + floater_rect.mRight, floater_rect.mBottom); + } + } + // floater is un-docked + else + { + // can update floater bottom side + if( floater_rect.mBottom - delta_height >= world_rect.mBottom ) + { + floater_rect.set(floater_rect.mLeft, floater_rect.mTop, + floater_rect.mRight, floater_rect.mBottom - delta_height); + } + // could not update floater bottom side, check if we can update floater top side + else if( floater_rect.mTop + delta_height < world_rect.mTop ) + { + floater_rect.set(floater_rect.mLeft, floater_rect.mTop + delta_height, + floater_rect.mRight, floater_rect.mBottom); + } + } + + floater->reshape(floater_rect.getWidth(), floater_rect.getHeight()); + floater->setRect(floater_rect); +} + +void LLCallFloater::reshapeToFitContent() +{ + const S32 ITEM_HEIGHT = getParticipantItemHeight(); + static const S32 MAX_VISIBLE_ITEMS = getMaxVisibleItems(); + + static S32 items_pad = mAvatarList->getItemsPad(); + S32 list_height = mAvatarList->getRect().getHeight(); + S32 items_height = mAvatarList->getItemsRect().getHeight(); + if(items_height <= 0) + { + // make "no one near" text visible + items_height = ITEM_HEIGHT + items_pad; + } + S32 max_list_height = MAX_VISIBLE_ITEMS * ITEM_HEIGHT + items_pad * (MAX_VISIBLE_ITEMS - 1); + max_list_height += 2* mAvatarList->getBorderWidth(); + + S32 delta = items_height - list_height; + // too many items, don't reshape floater anymore, let scroll bar appear. + if(items_height > max_list_height) + { + delta = max_list_height - list_height; + } + + reshape_floater(this, delta); +} + +S32 LLCallFloater::getParticipantItemHeight() +{ + std::vector<LLPanel*> items; + mAvatarList->getItems(items); + if(items.size() > 0) + { + return items[0]->getRect().getHeight(); + } + else + { + return getChild<LLPanel>("non_avatar_caller")->getRect().getHeight(); + } +} + +S32 LLCallFloater::getMaxVisibleItems() +{ + S32 value = 5; // default value, in case convertToS32() fails. + LLStringUtil::convertToS32(getString("max_visible_items"), value); + return value; +} + //EOF diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 7bba244acf..8aba93fc43 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -75,6 +75,11 @@ public: */ /*virtual*/ void onChange(); + /** + * Will reshape floater when participant list size changes + */ + /*virtual*/ S32 notifyParent(const LLSD& info); + static void sOnCurrentChannelChanged(const LLUUID& session_id); private: @@ -215,6 +220,21 @@ private: */ void reset(); + /** + * Reshapes floater to fit participant list height + */ + void reshapeToFitContent(); + + /** + * Returns height of participant list item + */ + S32 getParticipantItemHeight(); + + /** + * Returns predefined max visible participants. + */ + S32 getMaxVisibleItems(); + private: speaker_state_map_t mSpeakerStateMap; LLSpeakerMgr* mSpeakerManager; diff --git a/indra/newview/skins/default/xui/en/favorites_bar_button.xml b/indra/newview/skins/default/xui/en/favorites_bar_button.xml index 361f5a7bc8..dcf9847adb 100644 --- a/indra/newview/skins/default/xui/en/favorites_bar_button.xml +++ b/indra/newview/skins/default/xui/en/favorites_bar_button.xml @@ -3,6 +3,7 @@ <!-- All buttons in the Favorites bar will be created from this one --> <button follows="left|bottom" + font_halign="center" halign="center" height="15" image_disabled="transparent.j2c" @@ -14,10 +15,14 @@ image_pressed="Favorite_Link_Over" image_pressed_selected="Favorite_Link_Over" hover_glow_amount="0.15" + label_shadow="false" layout="topleft" left="0" name="favorites_bar_btn" + pad_bottom="-1" + pad_left="11" + pad_right="7" tab_stop="false" top="0" use_ellipses="true" - width="120" /> + width="140" /> diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml index 474b703ae5..47fd03b8f6 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -5,7 +5,7 @@ can_close="false" height="270" layout="topleft" - min_height="146" + min_height="122" min_width="190" name="floater_voice_controls" title="Voice Controls" @@ -32,6 +32,10 @@ name="no_one_near"> No one near </string> + <string + name="max_visible_items"> + 5 + </string> <panel bevel_style="out" border="true" |