diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 253 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 25 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 2 | ||||
-rw-r--r-- | indra/newview/llbottomtray.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llnearbychatbar.h | 8 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 13 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_test_toolbar.xml | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/toolbar.xml | 32 |
11 files changed, 238 insertions, 180 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index ac07e6dd0b..31a18dc707 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -33,6 +33,8 @@ #include "llcommandmanager.h" #include "lltrans.h" +// uncomment this and remove the one in llui.cpp when there is an external reference to this translation unit +// thanks, MSVC! //static LLDefaultChildRegistry::Register<LLToolBar> r1("toolbar"); namespace LLToolBarEnums @@ -51,16 +53,40 @@ namespace LLToolBarEnums } using namespace LLToolBarEnums; + +namespace LLInitParam +{ + void TypeValues<ButtonType>::declareValues() + { + declare("icons_only", BTNTYPE_ICONS_ONLY); + declare("icons_with_text", BTNTYPE_ICONS_WITH_TEXT); + } + + void TypeValues<SideType>::declareValues() + { + declare("bottom", SIDE_BOTTOM); + declare("left", SIDE_LEFT); + declare("right", SIDE_RIGHT); + declare("top", SIDE_TOP); + } +} + LLToolBar::Params::Params() : button_display_mode("button_display_mode"), buttons("button"), - side("side"), + side("side", SIDE_TOP), button_icon("button_icon"), button_icon_and_text("button_icon_and_text"), wrap("wrap", true), min_button_width("min_button_width", 0), max_button_width("max_button_width", S32_MAX), - background_image("background_image") + button_height("button_height"), + pad_left("pad_left"), + pad_top("pad_top"), + pad_right("pad_right"), + pad_bottom("pad_bottom"), + pad_between("pad_between"), + button_panel("button_panel") {} LLToolBar::LLToolBar(const LLToolBar::Params& p) @@ -69,11 +95,16 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mSideType(p.side), mWrap(p.wrap), mNeedsLayout(false), - mCenterPanel(NULL), + mButtonPanel(NULL), mCenteringStack(NULL), - mMinButtonWidth(p.min_button_width), - mMaxButtonWidth(p.max_button_width), - mBackgroundImage(p.background_image) + mMinButtonWidth(llmin(p.min_button_width(), p.max_button_width())), + mMaxButtonWidth(llmax(p.max_button_width(), p.min_button_width())), + mButtonHeight(p.button_height), + mPadLeft(p.pad_left), + mPadRight(p.pad_right), + mPadTop(p.pad_top), + mPadBottom(p.pad_bottom), + mPadBetween(p.pad_between) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; @@ -109,35 +140,38 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) center_panel_p.auto_resize = false; center_panel_p.user_resize = false; center_panel_p.fit_content = true; - mCenterPanel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p); - mCenteringStack->addChild(mCenterPanel); + LLLayoutPanel* center_panel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p); + mCenteringStack->addChild(center_panel); + + LLPanel::Params button_panel_p(p.button_panel); + button_panel_p.rect = center_panel->getLocalRect(); + switch(p.side()) + { + case SIDE_LEFT: + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; + break; + case SIDE_RIGHT: + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_RIGHT; + break; + case SIDE_TOP: + button_panel_p.follows.flags = FOLLOWS_TOP|FOLLOWS_LEFT; + break; + case SIDE_BOTTOM: + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; + break; + } + mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p); + center_panel->addChild(mButtonPanel); mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); BOOST_FOREACH (LLToolBarButton::Params button_p, p.buttons) { - // buttons always follow left and top, for all orientations - button_p.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP; button_p.fillFrom(mButtonParams[mButtonType]); - - LLRect button_rect(button_p.rect); - { // remove any offset from button - if (orientation == LLLayoutStack::HORIZONTAL) - { - button_rect.setOriginAndSize(0, 0, mMinButtonWidth, button_rect.getHeight()); - } - else // VERTICAL - { - button_rect.setOriginAndSize(0, 0, mMinButtonWidth, button_rect.getHeight()); - } - } - - // use our calculated rect - button_p.rect = button_rect; LLToolBarButton* buttonp = LLUICtrlFactory::create<LLToolBarButton>(button_p); mButtons.push_back(buttonp); - mCenterPanel->addChild(buttonp); + mButtonPanel->addChild(buttonp); mNeedsLayout = true; } @@ -148,70 +182,93 @@ bool LLToolBar::addCommand(LLCommand * command) // // Init basic toolbar button params // - - LLToolBarButton::Params button_p; - button_p.fillFrom(mButtonParams[mButtonType]); - + LLToolBarButton::Params button_p(mButtonParams[mButtonType]); button_p.name = command->name(); button_p.label = LLTrans::getString(command->labelRef()); button_p.tool_tip = LLTrans::getString(command->tooltipRef()); // - // Set up the button rectangle - // - - S32 btn_width = mMinButtonWidth; - S32 btn_height = mButtonParams[mButtonType].rect.height; - - if ((mSideType == LLToolBarEnums::SIDE_BOTTOM) || (mSideType == LLToolBarEnums::SIDE_TOP)) - { - btn_height = getRect().getHeight(); - } - - LLRect button_rect; - button_rect.setOriginAndSize(0, 0, btn_width, btn_height); - - button_p.rect = button_rect; - - // // Add it to the list of buttons // - LLToolBarButton * toolbar_button = LLUICtrlFactory::create<LLToolBarButton>(button_p); - - toolbar_button->reshape(llclamp(toolbar_button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), toolbar_button->getRect().getHeight()); - mButtons.push_back(toolbar_button); - mCenterPanel->addChild(toolbar_button); + mButtonPanel->addChild(toolbar_button); mNeedsLayout = true; return true; } +void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth) +{ + // make buttons in current row all same girth + BOOST_FOREACH(LLToolBarButton* button, buttons_in_row) + { + if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) + { + button->reshape(llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), max_row_girth); + } + else // VERTICAL + { + button->reshape(max_row_girth, button->getRect().getHeight()); + } + } +} + void LLToolBar::updateLayoutAsNeeded() { if (!mNeedsLayout) return; LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType); - // our terminology for orientation-agnostic layout is that + // our terminology for orientation-agnostic layout is such that // length refers to a distance in the direction we stack the buttons // and girth refers to a distance in the direction buttons wrap - S32 row_running_length = 0; - S32 max_length = (orientation == LLLayoutStack::HORIZONTAL) - ? getRect().getWidth() - : getRect().getHeight(); S32 max_row_girth = 0; - S32 cur_start = 0; - S32 cur_row = 0; + S32 max_row_length = 0; - LLRect panel_rect = mCenterPanel->getLocalRect(); + S32 max_length; + S32 max_total_girth; + S32 cur_start; + S32 cur_row ; + S32 row_pad_start; + S32 row_pad_end; + S32 girth_pad_end; + S32 row_running_length; + + if (orientation == LLLayoutStack::HORIZONTAL) + { + max_length = getRect().getWidth() - mPadLeft - mPadRight; + max_total_girth = getRect().getHeight() - mPadTop - mPadBottom; + row_pad_start = mPadLeft; + row_running_length = row_pad_start; + row_pad_end = mPadRight; + cur_row = mPadTop; + girth_pad_end = mPadBottom; + } + else // VERTICAL + { + max_length = getRect().getHeight() - mPadTop - mPadBottom; + max_total_girth = getRect().getWidth() - mPadLeft - mPadRight; + row_pad_start = mPadTop; + row_running_length = row_pad_start; + row_pad_end = mPadBottom; + cur_row = mPadLeft; + girth_pad_end = mPadRight; + } + + cur_start = row_pad_start; + + + LLRect panel_rect = mButtonPanel->getLocalRect(); std::vector<LLToolBarButton*> buttons_in_row; BOOST_FOREACH(LLToolBarButton* button, mButtons) { + button->reshape(mMinButtonWidth, mButtonHeight); + button->autoResize(); + S32 button_clamped_width = llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth); S32 button_length = (orientation == LLLayoutStack::HORIZONTAL) ? button_clamped_width @@ -220,32 +277,24 @@ void LLToolBar::updateLayoutAsNeeded() ? button->getRect().getHeight() : button_clamped_width; - // handle wrapping - if (row_running_length + button_length > max_length - && cur_start != 0) // not first button in row - { // go ahead and wrap + // wrap if needed + if (mWrap + && row_running_length + button_length > max_length // out of room... + && cur_start != row_pad_start) // ...and not first button in row + { if (orientation == LLLayoutStack::VERTICAL) - { - // row girth is clamped to allowable button widths + { // row girth (width in this case) is clamped to allowable button widths max_row_girth = llclamp(max_row_girth, mMinButtonWidth, mMaxButtonWidth); } + // make buttons in current row all same girth - BOOST_FOREACH(LLToolBarButton* button, buttons_in_row) - { - if (orientation == LLLayoutStack::HORIZONTAL) - { - button->reshape(llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), max_row_girth); - } - else // VERTICAL - { - button->reshape(max_row_girth, button->getRect().getHeight()); - } - } + resizeButtonsInRow(buttons_in_row, max_row_girth); buttons_in_row.clear(); - row_running_length = 0; - cur_start = 0; - cur_row += max_row_girth; + max_row_length = llmax(max_row_length, row_running_length); + row_running_length = row_pad_start; + cur_start = row_pad_start; + cur_row += max_row_girth + mPadBetween; max_row_girth = 0; } @@ -262,34 +311,39 @@ void LLToolBar::updateLayoutAsNeeded() buttons_in_row.push_back(button); - row_running_length += button_length; + row_running_length += button_length + mPadBetween; cur_start = row_running_length; max_row_girth = llmax(button_girth, max_row_girth); } // final resizing in "girth" direction - S32 total_girth = cur_row + max_row_girth; // increment by size of final row + S32 total_girth = cur_row // current row position... + + max_row_girth // ...incremented by size of final row... + + girth_pad_end; // ...plus padding reserved on end + max_row_length = llmax(max_row_length, row_running_length - mPadBetween + row_pad_end); + + resizeButtonsInRow(buttons_in_row, max_row_girth); - // grow and optionally shift toolbar to accomodate buttons + // grow and optionally shift toolbar to accommodate buttons if (orientation == LLLayoutStack::HORIZONTAL) { if (mSideType == SIDE_TOP) { // shift down to maintain top edge - translate(0, getRect().getHeight() - total_girth); + mButtonPanel->translate(0, mButtonPanel->getRect().getHeight() - total_girth); } - reshape(getRect().getWidth(), total_girth); + mButtonPanel->reshape(max_row_length, total_girth); } else // VERTICAL { if (mSideType == SIDE_RIGHT) { // shift left to maintain right edge - translate(getRect().getWidth() - total_girth, 0); + mButtonPanel->translate(mButtonPanel->getRect().getWidth() - total_girth, 0); } - reshape(total_girth, getRect().getHeight()); + mButtonPanel->reshape(total_girth, max_row_length); } - // recenter toolbar buttons + // re-center toolbar buttons mCenteringStack->updateLayout(); // don't clear flag until after we've resized ourselves, to avoid laying out every frame @@ -300,12 +354,6 @@ void LLToolBar::updateLayoutAsNeeded() void LLToolBar::draw() { updateLayoutAsNeeded(); - - { // draw background - LLRect bg_rect; - localRectToOtherView(mCenterPanel->getRect(),&bg_rect, this); - mBackgroundImage->draw(bg_rect); - } LLUICtrl::draw(); } @@ -315,20 +363,3 @@ void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) mNeedsLayout = true; } -namespace LLInitParam -{ - void TypeValues<ButtonType>::declareValues() - { - declare("icons_only", BTNTYPE_ICONS_ONLY); - declare("icons_with_text", BTNTYPE_ICONS_WITH_TEXT); - } - - void TypeValues<SideType>::declareValues() - { - declare("none", SIDE_NONE); - declare("bottom", SIDE_BOTTOM); - declare("left", SIDE_LEFT); - declare("right", SIDE_RIGHT); - declare("top", SIDE_TOP); - } -} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 85cd6d5170..92c289cd3f 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -59,7 +59,6 @@ namespace LLToolBarEnums enum SideType { - SIDE_NONE = 0, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT, @@ -99,11 +98,18 @@ public: Optional<bool> wrap; Optional<S32> min_button_width, - max_button_width; + max_button_width, + button_height; + + Optional<S32> pad_left, + pad_top, + pad_right, + pad_bottom, + pad_between; // get rid of this Multiple<LLToolBarButton::Params> buttons; - Optional<LLUIImage*> background_image; + Optional<LLPanel::Params> button_panel; Params(); }; @@ -122,20 +128,25 @@ protected: private: void updateLayoutAsNeeded(); + void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); std::list<LLToolBarButton*> mButtons; LLToolBarEnums::ButtonType mButtonType; LLLayoutStack* mCenteringStack; LLLayoutStack* mWrapStack; - LLLayoutPanel* mCenterPanel; + LLPanel* mButtonPanel; LLToolBarEnums::SideType mSideType; bool mWrap; bool mNeedsLayout; S32 mMinButtonWidth, - mMaxButtonWidth; - - LLUIImagePtr mBackgroundImage; + mMaxButtonWidth, + mButtonHeight, + mPadLeft, + mPadRight, + mPadTop, + mPadBottom, + mPadBetween; LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; }; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index cc9e17409f..f1db72e5cc 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1493,7 +1493,7 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> <key>ChatBubbleOpacity</key> <map> diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index c8cfe5b51e..7a60903950 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -165,13 +165,13 @@ public: mChatBarContainer(NULL), mGesturePanel(NULL) { - mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); + //mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); buildFromFile("panel_bottomtray_lite.xml"); } BOOL postBuild() { - mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); + //mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); mChatBarContainer = getChild<LLLayoutPanel>("chat_bar_layout_panel"); mGesturePanel = getChild<LLPanel>("gesture_panel"); @@ -224,7 +224,7 @@ LLBottomTray::LLBottomTray(const LLSD&) // before chiclets do that. LLIMMgr::getInstance()->addSessionObserver(this); - mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); + //mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); buildFromFile("panel_bottomtray.xml"); @@ -271,7 +271,8 @@ LLBottomTray::~LLBottomTray() // *TODO Vadim: why void* ? void* LLBottomTray::createNearbyChatBar(void* userdata) { - return new LLNearbyChatBar(); + //return new LLNearbyChatBar(); + return NULL; } LLNearbyChatBar* LLBottomTray::getNearbyChatBar() @@ -537,10 +538,10 @@ BOOL LLBottomTray::postBuild() mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gMenuHolder->addChild(mBottomTrayContextMenu); - mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); - LLHints::registerHintTarget("chat_bar", mNearbyChatBar->LLView::getHandle()); + //mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); + //LLHints::registerHintTarget("chat_bar", mNearbyChatBar->LLView::getHandle()); - mListener.reset(new LLNearbyChatBarListener(*mNearbyChatBar)); + //mListener.reset(new LLNearbyChatBarListener(*mNearbyChatBar)); mChatBarContainer = getChild<LLLayoutPanel>("chat_bar_layout_panel"); mNearbyCharResizeHandlePanel = getChild<LLPanel>("chat_bar_resize_handle_panel"); @@ -577,7 +578,7 @@ BOOL LLBottomTray::postBuild() // Registering Chat Bar to receive Voice client status change notifications. LLVoiceClient::getInstance()->addObserver(this); - mNearbyChatBar->getChatBox()->setContextMenu(NULL); + //mNearbyChatBar->getChatBox()->setContextMenu(NULL); mChicletPanel = getChild<LLChicletPanel>("chiclet_list"); @@ -882,6 +883,7 @@ void LLBottomTray::draw() bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) { std::string item = userdata.asString(); + /* LLLineEditor* edit_box = mNearbyChatBar->findChild<LLLineEditor>("chat_box"); if (item == "can_cut") @@ -903,13 +905,13 @@ bool LLBottomTray::onContextMenuItemEnabled(const LLSD& userdata) else if (item == "can_select_all") { return edit_box->canSelectAll() && (edit_box->getLength()>0); - } + }*/ return true; } void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) -{ +{/* std::string item = userdata.asString(); LLLineEditor* edit_box = mNearbyChatBar->findChild<LLLineEditor>("chat_box"); @@ -933,7 +935,7 @@ void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) else if (item == "select_all") { edit_box->selectAll(); - } + }*/ } void LLBottomTray::log(LLView* panel, const std::string& descr) @@ -1117,8 +1119,8 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) // chatbar should only be shrunk here, not stretched if (shrink_by > 0) { - lldebugs << "Shrinking nearby chat bar by " << shrink_by << " px " << llendl; - mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - shrink_by, mChatBarContainer->getRect().getHeight()); + //lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; + //mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); } log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel"); @@ -1144,8 +1146,8 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) if (buttons_freed_width > 0) { - S32 nearby_needed_width = mDesiredNearbyChatWidth - mNearbyChatBar->getRect().getWidth(); - if (nearby_needed_width > 0) + S32 nearby_needed_width = mDesiredNearbyChatWidth; + if ( 0) { S32 compensative_width = nearby_needed_width > buttons_freed_width ? buttons_freed_width : nearby_needed_width; log(mNearbyChatBar, "before applying compensative width"); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 03ebc344f1..361912a5cb 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -92,7 +92,7 @@ BOOL LLNearbyChat::postBuild() if (getDockControl() == NULL) { setDockControl(new LLDockControl( - LLBottomTray::getInstance()->getNearbyChatBar(), this, + LLFloaterReg::getInstance("chat_bar"), this, getDockTongue(), LLDockControl::TOP, boost::bind(&LLNearbyChat::getAllowedRect, this, _1))); } diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 4b961db5f9..185acb1414 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -411,8 +411,9 @@ LLCtrlListInterface* LLGestureComboList::getListInterface() return mList; } -LLNearbyChatBar::LLNearbyChatBar() -: mChatBox(NULL) +LLNearbyChatBar::LLNearbyChatBar(const LLSD& key) + : LLFloater(key), + mChatBox(NULL) { mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); } @@ -457,19 +458,13 @@ void LLNearbyChatBar::onChatFontChange(LLFontGL* fontp) //static LLNearbyChatBar* LLNearbyChatBar::getInstance() { - return LLBottomTray::getInstance() ? LLBottomTray::getInstance()->getNearbyChatBar() : NULL; -} - -//static -bool LLNearbyChatBar::instanceExists() -{ - return LLBottomTray::instanceExists() && LLBottomTray::getInstance()->getNearbyChatBar() != NULL; + return LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar"); } void LLNearbyChatBar::draw() { displaySpeakingIndicator(); - LLPanel::draw(); + LLFloater::draw(); } std::string LLNearbyChatBar::getCurrentChat() @@ -780,17 +775,12 @@ void LLNearbyChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, // static void LLNearbyChatBar::startChat(const char* line) { - LLBottomTray *bt = LLBottomTray::getInstance(); - - if (!bt) - return; - - LLNearbyChatBar* cb = bt->getNearbyChatBar(); + LLNearbyChatBar* cb = LLNearbyChatBar::getInstance(); if (!cb ) return; - bt->setVisible(TRUE); + cb->setVisible(TRUE); cb->mChatBox->setFocus(TRUE); if (line) @@ -811,7 +801,7 @@ void LLNearbyChatBar::stopChat() if (!bt) return; - LLNearbyChatBar* cb = bt->getNearbyChatBar(); + LLNearbyChatBar* cb = LLNearbyChatBar::getInstance(); if (!cb) return; @@ -822,6 +812,15 @@ void LLNearbyChatBar::stopChat() gAgent.stopTyping(); } +void LLNearbyChatBar::onClose(bool app_quitting) +{ + LLFloater* nearby_chat = LLFloaterReg::findInstance("nearby_chat", LLSD()); + if (nearby_chat) + { + nearby_chat->closeFloater(app_quitting); + } +} + // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. // Otherwise returns input and channel 0. LLWString LLNearbyChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index efddec942f..f4a8605e18 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -93,23 +93,23 @@ private: }; class LLNearbyChatBar -: public LLPanel +: public LLFloater { public: // constructor for inline chat-bars (e.g. hosted in chat history window) - LLNearbyChatBar(); + LLNearbyChatBar(const LLSD& key); ~LLNearbyChatBar() {} virtual BOOL postBuild(); static LLNearbyChatBar* getInstance(); - static bool instanceExists(); - LLLineEditor* getChatBox() { return mChatBox; } virtual void draw(); + virtual void onClose(bool app_quitting); + std::string getCurrentChat(); virtual BOOL handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 375ee3ad33..b44e7283da 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -129,6 +129,7 @@ #include "llscriptfloater.h" #include "llfloatermodelpreview.h" #include "llcommandhandler.h" +#include "llnearbychatbar.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -180,6 +181,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCamera>); LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChat>); + LLFloaterReg::add("chat_bar", "floater_chat_bar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChatBar>); LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCompileQueue>); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index c651e86606..947f0ec184 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2462,7 +2462,12 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Traverses up the hierarchy if( keyboard_focus ) { - LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL; + LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChatBar>("chat_bar"); + + if (nearby_chat) + { + LLLineEditor* chat_editor = nearby_chat->getChatBox(); + // arrow keys move avatar while chatting hack if (chat_editor && chat_editor->hasFocus()) { @@ -2493,7 +2498,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } } - + } if (keyboard_focus->handleKey(key, mask, FALSE)) { return TRUE; @@ -2524,11 +2529,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { - LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL; + LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar")->getChatBox(); if (chat_editor) { // passing NULL here, character will be added later when it is handled by character handler. - LLBottomTray::getInstance()->getNearbyChatBar()->startChat(NULL); + LLNearbyChatBar::getInstance()->startChat(NULL); return TRUE; } } diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml index 85f0f104fc..b58c006b3f 100644 --- a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -13,22 +13,25 @@ width="500" left="0" top="20" - min_width="100" + min_button_width="0" + max_button_width="100" side="top"> <button auto_resize="true" + use_ellipses="true" label="Button"/> <button auto_resize="true" label="Button with long label"/> <button auto_resize="true" + use_ellipses="true" label="Button with longest label of all"/> </toolbar> <toolbar name="test_toolbar_left" follows="left|bottom|top" height="380" - width="100" + width="200" left="0" top="70" - min_width="100" + min_button_width="100" side="left"> <button height="30" label="Button"/> @@ -40,10 +43,9 @@ <toolbar name="test_toolbar_right" follows="right|bottom|top" height="380" - width="100" + width="200" right="500" top="70" - min_width="100" side="right"> <button auto_resize="true" label="Button 1"/> @@ -58,7 +60,7 @@ width="500" left="0" bottom="500" - min_width="100" + min_button_width="100" side="bottom"> <button auto_resize="true" label="Button"/> diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index a7f73c0c7c..45210277b2 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -1,15 +1,21 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<toolbar background_image = "Rounded_Rect"> - <button_icon_and_text - follows="none" - height="30" - chrome="true" - auto_resize="true" - /> - <button_icon - follows="none" - height="30" - chrome="true" - auto_resize="true" - /> +<toolbar button_height="30" + pad_left="5" + pad_right="5" + pad_top="5" + pad_bottom="5" + pad_between="5"> + + <button_panel name="button_panel" + bg_opaque_image="Rounded_Rect" + background_visible="true" + background_opaque="true"/> + <button_icon_and_text follows="left|top" + chrome="true" + use_ellipses="true" + auto_resize="true"/> + <button_icon follows="left|top" + chrome="true" + use_ellipses="true" + auto_resize="true"/> </toolbar> |