diff options
23 files changed, 372 insertions, 129 deletions
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index c3a51c36c9..942e84eeb6 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -55,6 +55,8 @@ LLResizeHandle::LLResizeHandle(const LLResizeHandle::Params& p) mImage( NULL ), mMinWidth( p.min_width ), mMinHeight( p.min_height ), + mMaxWidth(S32_MAX), + mMaxHeight(S32_MAX), mCorner( p.corner ) { if( RIGHT_BOTTOM == mCorner) @@ -177,6 +179,11 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_width = mMinWidth; delta_x = x_multiple * (mMinWidth - orig_rect.getWidth()); } + else if (new_width > mMaxWidth) + { + new_width = mMaxWidth; + delta_x = x_multiple * (mMaxWidth - orig_rect.getWidth()); + } S32 new_height = orig_rect.getHeight() + y_multiple * delta_y; if( new_height < mMinHeight ) @@ -184,6 +191,11 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_height = mMinHeight; delta_y = y_multiple * (mMinHeight - orig_rect.getHeight()); } + else if (new_height > mMaxHeight) + { + new_height = mMaxHeight; + delta_y = y_multiple * (mMaxHeight - orig_rect.getHeight()); + } switch( mCorner ) { diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 531eb1db61..5cfe3fb63c 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -56,6 +56,9 @@ public: void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } + void setMaxWidth(S32 width) { mMaxWidth = width;} + void setMaxHeight(S32 height) { mMaxHeight = height;} + private: BOOL pointInHandle( S32 x, S32 y ); @@ -66,7 +69,9 @@ private: LLCoordGL mLastMouseDir; LLPointer<LLUIImage> mImage; S32 mMinWidth; + S32 mMaxWidth; S32 mMinHeight; + S32 mMaxHeight; const ECorner mCorner; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 9ca5a0f480..677d50a0c7 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -124,12 +124,16 @@ void LLToolBar::createContextMenu() { if (!mPopupMenuHandle.get()) { + // Setup bindings specific to this instance for the context menu options + LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); + // Create the context menu + LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -142,6 +146,10 @@ void LLToolBar::createContextMenu() { llwarns << "Unable to load toolbars context menu." << llendl; } + + // Remove this instance's bindings + commit_reg.remove("Toolbars.EnableSetting"); + enable_reg.remove("Toolbars.CheckSetting"); } } @@ -188,12 +196,6 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH (const LLCommandId::Params& command_id, p.commands) - { - mButtonCommands.push_back(command_id); - } - createButtons(); - mNeedsLayout = true; } @@ -203,8 +205,11 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) bool add_command = (command != NULL); + if (add_command) + { mButtonCommands.push_back(commandId); createButtons(); + } return add_command; } @@ -254,11 +259,13 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) if (handle_it_here) { createContextMenu(); + LLContextMenu * menu = (LLContextMenu *) mPopupMenuHandle.get(); if (menu) { menu->show(x, y); + LLMenuGL::showPopup(this, menu, x, y); } } @@ -371,8 +378,8 @@ void LLToolBar::updateLayoutAsNeeded() std::vector<LLToolBarButton*> buttons_in_row; - BOOST_FOREACH(LLToolBarButton* button, mButtons) - { + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { button->reshape(mMinButtonWidth, mButtonHeight); button->autoResize(); @@ -405,8 +412,8 @@ void LLToolBar::updateLayoutAsNeeded() max_row_girth = 0; } - LLRect button_rect; - if (orientation == LLLayoutStack::HORIZONTAL) + LLRect button_rect; + if (orientation == LLLayoutStack::HORIZONTAL) { button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight()); } @@ -451,7 +458,7 @@ void LLToolBar::updateLayoutAsNeeded() reshape(total_girth, getRect().getHeight()); mButtonPanel->reshape(total_girth, max_row_length); - } + } // re-center toolbar buttons mCenteringStack->updateLayout(); diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 9df6f4946f..7047cca948 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -29,13 +29,108 @@ #include "lltoolbarview.h" +#include "lldir.h" +#include "llxmlnode.h" #include "lltoolbar.h" #include "llbutton.h" +#include <boost/foreach.hpp> + LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view"); +LLToolBarView::Toolbar::Toolbar() +: commands("command") +{} + +LLToolBarView::ToolbarSet::ToolbarSet() +: left_toolbar("left_toolbar"), + right_toolbar("right_toolbar"), + bottom_toolbar("bottom_toolbar") +{} + +bool LLToolBarView::load() +{ + LLToolBarView::ToolbarSet toolbar_set; + + // Load the default toolbars.xml file + // *TODO : pick up the user's toolbar setting if existing + std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + + LLXMLNodePtr root; + if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) + { + llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + return false; + } + if(!root->hasName("toolbars")) + { + llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; + return false; + } + + // Parse the toolbar settings + LLXUIParser parser; + parser.readXUI(root, toolbar_set, toolbar_file); + if (!toolbar_set.validateBlock()) + { + llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; + return false; + } + + // Add commands to each toolbar + // *TODO: factorize that code : tricky with Blocks though, simple lexical approach fails + LLCommandManager& mgr = LLCommandManager::instance(); + + if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) + { + LLCommandId* commandId = new LLCommandId(command); + if (mgr.getCommand(*commandId)) + { + mToolbarLeft->addCommand(*commandId); + } + else + { + llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; + } + } + } + if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) + { + LLCommandId* commandId = new LLCommandId(command); + if (mgr.getCommand(*commandId)) + { + mToolbarRight->addCommand(*commandId); + } + else + { + llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; + } + } + } + if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) + { + LLCommandId* commandId = new LLCommandId(command); + if (mgr.getCommand(*commandId)) + { + mToolbarBottom->addCommand(*commandId); + } + else + { + llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; + } + } + } + return true; +} + LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) : LLUICtrl(p), mToolbarLeft(NULL), @@ -59,6 +154,10 @@ BOOL LLToolBarView::postBuild() mToolbarLeft = getChild<LLToolBar>("toolbar_left"); mToolbarRight = getChild<LLToolBar>("toolbar_right"); mToolbarBottom = getChild<LLToolBar>("toolbar_bottom"); + + // Load the toolbars from the settings + load(); + return TRUE; } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 2e7885f391..0f16b89ecc 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -39,18 +39,36 @@ class LLUICtrlFactory; class LLToolBarView : public LLUICtrl { public: + // Xui structure of the toolbar panel struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {}; + + // Note: valid children for LLToolBarView are stored in this registry + typedef LLDefaultChildRegistry child_registry_t; - virtual ~LLToolBarView(); - /*virtual*/ BOOL postBuild(); + // Xml structure of the toolbars.xml setting + // Those live in a toolbars.xml found in app_settings (for the default) and in + // the user folder for the user specific (saved) settings + struct Toolbar : public LLInitParam::Block<Toolbar> + { + Multiple<LLCommandId::Params> commands; + Toolbar(); + }; + struct ToolbarSet : public LLInitParam::Block<ToolbarSet> + { + Optional<Toolbar> left_toolbar, + right_toolbar, + bottom_toolbar; + ToolbarSet(); + }; + // Derived methods + virtual ~LLToolBarView(); + virtual BOOL postBuild(); virtual void draw(); + // Toolbar view interface with the rest of the world bool hasCommand(const LLCommandId& commandId) const; - // valid children for LLToolBarView are stored in this registry - typedef LLDefaultChildRegistry child_registry_t; - protected: friend class LLUICtrlFactory; LLToolBarView(const Params&); @@ -58,6 +76,10 @@ protected: void initFromParams(const Params&); private: + // Loads the toolbars from the existing user or default settings + bool load(); // return false if load fails + + // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 597a1dd603..38d6ff0f58 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1423,6 +1423,7 @@ set(viewer_APPSETTINGS_FILES app_settings/settings_files.xml app_settings/settings_per_account.xml app_settings/std_bump.ini + app_settings/toolbars.xml app_settings/trees.xml app_settings/ultra_graphics.xml app_settings/viewerart.xml diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml new file mode 100644 index 0000000000..55327ea919 --- /dev/null +++ b/indra/newview/app_settings/toolbars.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<toolbars> + <bottom_toolbar> + <command name="chat"/> + <command name="speak"/> + <command name="places"/> + <command name="people"/> + <command name="profile"/> + <command name="view"/> + <command name="move"/> + <command name="howto"/> + </bottom_toolbar> + <left_toolbar> + <command name="avatar"/> + <command name="inventory"/> + <command name="snapshot"/> + <command name="search"/> + <command name="shop"/> + <command name="move_objects"/> + <command name="minimap"/> + <command name="preferences"/> + </left_toolbar> +</toolbars>
\ No newline at end of file diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 7a60903950..55c63edd74 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -400,7 +400,7 @@ void LLBottomTray::onMouselookModeOut() { mIsInLiteMode = false; mBottomTrayLite->setVisible(FALSE); - mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); + //mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); setVisible(TRUE); } @@ -413,8 +413,8 @@ void LLBottomTray::onMouselookModeIn() getParent()->addChild(mBottomTrayLite); mBottomTrayLite->setShape(getLocalRect()); - mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); - mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); + //mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); + //mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); mIsInLiteMode = true; } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index cf0374075a..fb3abb132b 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -95,7 +95,7 @@ LLChatBar::LLChatBar() mGestureCombo(NULL), mObserver(NULL) { - setIsChrome(TRUE); + //setIsChrome(TRUE); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 4de6976534..4602533736 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2449,8 +2449,10 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; + + LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); + LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); if(nearby_chat) { nearby_chat->addMessage(chat); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 361912a5cb..07e94f957a 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -57,11 +57,13 @@ static const S32 RESIZE_BAR_THICKNESS = 3; -LLNearbyChat::LLNearbyChat(const LLSD& key) - : LLDockableFloater(NULL, false, false, key) + +static LLRegisterPanelClassWrapper<LLNearbyChat> t_panel_nearby_chat("panel_nearby_chat"); + +LLNearbyChat::LLNearbyChat() + : LLPanel() ,mChatHistory(NULL) { - } LLNearbyChat::~LLNearbyChat() @@ -86,54 +88,12 @@ BOOL LLNearbyChat::postBuild() mChatHistory = getChild<LLChatHistory>("chat_history"); - if(!LLDockableFloater::postBuild()) + if(!LLPanel::postBuild()) return false; - - if (getDockControl() == NULL) - { - setDockControl(new LLDockControl( - LLFloaterReg::getInstance("chat_bar"), this, - getDockTongue(), LLDockControl::TOP, boost::bind(&LLNearbyChat::getAllowedRect, this, _1))); - } - - //fix for EXT-4621 - //chrome="true" prevents floater from stilling capture - setIsChrome(true); - //chrome="true" hides floater caption - if (mDragHandle) - mDragHandle->setTitleVisible(TRUE); - + return true; } - -void LLNearbyChat::applySavedVariables() -{ - if (mRectControl.size() > 1) - { - const LLRect& rect = LLFloater::getControlGroup()->getRect(mRectControl); - if(!rect.isEmpty() && rect.isValid()) - { - reshape(rect.getWidth(), rect.getHeight()); - setRect(rect); - } - } - - - if(!LLFloater::getControlGroup()->controlExists(mDocStateControl)) - { - setDocked(true); - } - else - { - if (mDocStateControl.size() > 1) - { - bool dockState = LLFloater::getControlGroup()->getBOOL(mDocStateControl); - setDocked(dockState); - } - } -} - std::string appendTime() { time_t utc_time; @@ -229,18 +189,9 @@ void LLNearbyChat::setVisible(BOOL visible) } } - LLDockableFloater::setVisible(visible); + LLPanel::setVisible(visible); } -void LLNearbyChat::onOpen(const LLSD& key ) -{ - LLDockableFloater::onOpen(key); -} - -void LLNearbyChat::setRect (const LLRect &rect) -{ - LLDockableFloater::setRect(rect); -} void LLNearbyChat::getAllowedRect(LLRect& rect) { @@ -263,9 +214,9 @@ void LLNearbyChat::updateChatHistoryStyle() //static void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) { - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); - if(nearby_chat) - nearby_chat->updateChatHistoryStyle(); + //LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + //if(nearby_chat) + // nearby_chat->updateChatHistoryStyle(); } bool isWordsName(const std::string& name) @@ -339,7 +290,8 @@ void LLNearbyChat::loadHistory() //static LLNearbyChat* LLNearbyChat::getInstance() { - return LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); + return chat_bar->findChild<LLNearbyChat>("nearby_chat"); } //////////////////////////////////////////////////////////////////////////////// @@ -367,7 +319,7 @@ BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) if(mChatHistory) mChatHistory->setFocus(TRUE); - return LLDockableFloater::handleMouseDown(x, y, mask); + return LLPanel::handleMouseDown(x, y, mask); } void LLNearbyChat::draw() @@ -380,5 +332,5 @@ void LLNearbyChat::draw() setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); } - LLDockableFloater::draw(); + LLPanel::draw(); } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 2ea79797f8..5ef584c8ff 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -1,4 +1,4 @@ -/** + /** * @file llnearbychat.h * @brief nearby chat history scrolling panel implementation * @@ -27,17 +27,17 @@ #ifndef LL_LLNEARBYCHAT_H_ #define LL_LLNEARBYCHAT_H_ -#include "lldockablefloater.h" #include "llscrollbar.h" #include "llviewerchat.h" +#include "llfloater.h" class LLResizeBar; class LLChatHistory; -class LLNearbyChat: public LLDockableFloater +class LLNearbyChat: public LLPanel { public: - LLNearbyChat(const LLSD& key); + LLNearbyChat(); ~LLNearbyChat(); BOOL postBuild (); @@ -54,12 +54,8 @@ public: /*virtual*/ void onFocusLost(); /*virtual*/ void onFocusReceived(); - /*virtual*/ void onOpen (const LLSD& key); - /*virtual*/ void setVisible(BOOL visible); - - virtual void setRect (const LLRect &rect); - + virtual void updateChatHistoryStyle(); static void processChatHistoryStyleUpdate(const LLSD& newvalue); @@ -69,7 +65,6 @@ public: static LLNearbyChat* getInstance(); private: - virtual void applySavedVariables(); void getAllowedRect (LLRect& rect); diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 185acb1414..258aa9a8bf 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -49,6 +49,8 @@ #include "llrootview.h" #include "llviewerchat.h" +#include "llresizehandle.h" + S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; // legacy callback glue @@ -414,8 +416,7 @@ LLCtrlListInterface* LLGestureComboList::getListInterface() LLNearbyChatBar::LLNearbyChatBar(const LLSD& key) : LLFloater(key), mChatBox(NULL) -{ - mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); +{ mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); } //virtual @@ -437,6 +438,10 @@ BOOL LLNearbyChatBar::postBuild() mChatBox->setEnableLineHistory(TRUE); mChatBox->setFont(LLViewerChat::getChatFont()); + + LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat"); + show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this)); + mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator"); mOutputMonitor->setVisible(FALSE); @@ -678,6 +683,25 @@ void LLNearbyChatBar::sendChat( EChatType type ) } } + +void LLNearbyChatBar::onToggleNearbyChatPanel() +{ + LLView* nearby_chat = getChildView("nearby_chat"); + + if (nearby_chat->getVisible()) + { + nearby_chat->setVisible(FALSE); + reshape(getRect().getWidth(), 60); + mResizeHandle[0]->setMaxHeight(60); + } + else + { + nearby_chat->setVisible(TRUE); + reshape(getRect().getWidth(), 360); + mResizeHandle[0]->setMaxHeight(S32_MAX); + } +} + void LLNearbyChatBar::onChatBoxCommit() { if (mChatBox->getText().length() > 0) @@ -781,6 +805,7 @@ void LLNearbyChatBar::startChat(const char* line) return; cb->setVisible(TRUE); + cb->setFocus(TRUE); cb->mChatBox->setFocus(TRUE); if (line) @@ -812,15 +837,6 @@ 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 f4a8605e18..1d28a21ef3 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -108,8 +108,6 @@ public: virtual void draw(); - virtual void onClose(bool app_quitting); - std::string getCurrentChat(); virtual BOOL handleKeyHere( KEY key, MASK mask ); @@ -129,6 +127,8 @@ protected: void onChatBoxCommit(); void onChatFontChange(LLFontGL* fontp); + void onToggleNearbyChatPanel(); + static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); EChatType processChatTypeTriggers(EChatType type, std::string &str); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 957b6d5f94..dcf444b048 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -41,6 +41,7 @@ #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance #include "llviewerwindow.h"//for screen channel position +#include "llnearbychatbar.h" //add LLNearbyChatHandler to LLNotificationsUI namespace using namespace LLNotificationsUI; @@ -473,8 +474,9 @@ LLNearbyChatHandler::~LLNearbyChatHandler() void LLNearbyChatHandler::initChannel() { - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); - LLView* chat_box = LLBottomTray::getInstance()->getChildView("chat_box"); + LLNearbyChatBar* chat_bar = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar", LLSD()); + LLView* chat_box = chat_bar->getChatBox(); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); S32 channel_right_bound = nearby_chat->getRect().mRight; mChannel->init(chat_box->getRect().mLeft, channel_right_bound); } @@ -502,7 +504,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not tmp_chat.mText = tmp_chat.mText.substr(3); } - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); + + LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); + { //sometimes its usefull to have no name at all... //if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index de90023f3b..1b767e80d4 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -385,7 +385,7 @@ void LLHandlerUtil::logGroupNoticeToIMGroup( // static void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type) { - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if(nearby_chat) { LLChat chat_msg(notification->getMessage()); diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 02b217fc94..2a08a29842 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -92,8 +92,7 @@ bool LLTipHandler::processNotification(const LLSD& notify) LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); // don't show toast if Nearby Chat is opened - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance< - LLNearbyChat>("nearby_chat", LLSD()); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if (nearby_chat->getVisible()) { return false; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b44e7283da..2ebf41299a 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -180,7 +180,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>); 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/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6435904fee..961c931c02 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2190,7 +2190,7 @@ void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string m // Treat like a system message and put in chat history. chat.mText = av_name.getCompleteName() + ": " + message; - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if(nearby_chat) { nearby_chat->addMessage(chat); @@ -2752,7 +2752,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Note: lie to Nearby Chat, pretending that this is NOT an IM, because // IMs from obejcts don't open IM sessions. - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if(SYSTEM_FROM != name && nearby_chat) { chat.mOwnerID = from_id; diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml new file mode 100644 index 0000000000..9d61c94eb1 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="60" + layout="topleft" + legacy_header_height="20" + single_instance="true" + title="Nearby chat" + save_rect="true" + can_close="true" + can_minimize="true" + help_topic="chat_bar" + min_height="60" + min_width="150" + can_resize="true" + name="chat_bar" + width="380"> + <panel + top="20" + class="panel_nearby_chat" + follow="all" + width="380" + height="0" + visible="false" + filename="panel_nearby_chat.xml" + name="nearby_chat" /> + <panel width="380" height="31" left="0" bottom="-1" follows="left|right|bottom"> + <line_editor + border_style="line" + border_thickness="1" + follows="left|right" + height="23" + label="Click here to chat." + layout="topleft" + left_delta="7" + left="0" + max_length_bytes="1023" + name="chat_box" + text_pad_left="5" + text_pad_right="25" + tool_tip="Press Enter to say, Ctrl+Enter to shout" + top="0" + width="335" /> + <output_monitor + auto_update="true" + follows="right" + draw_border="false" + height="16" + layout="topleft" + left_pad="-24" + mouse_opaque="true" + name="chat_zone_indicator" + top="4" + visible="true" + width="20" /> + <button + follows="right" + is_toggle="true" + width="20" + top="0" + layout="topleft" + left_pad="12" + image_disabled="ComboButton_UpOff" + image_unselected="ComboButton_UpOff" + image_selected="ComboButton_On" + image_pressed="ComboButton_UpSelected" + image_pressed_selected="ComboButton_Selected" + height="23" + name="show_nearby_chat" + tool_tip="Shows/hides nearby chat log"> + </button> + </panel> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 60a39b0bff..092eddaa53 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -46,6 +46,7 @@ <toolbar bottom="395" button_display_mode="icons_with_text" + follows="all" left="20" max_button_width="140" min_button_width="70" @@ -58,15 +59,22 @@ read_only="true" right="-20" side="top" - top="85"> - </toolbar> + top="85" /> + <panel + bevel_style="none" + border="true" + bottom="396" + follows="left|bottom|right" + left="20" + right="-20" + top="396" /> <button - follows="left|bottom" + follows="left|bottom|right" height="23" label="Restore defaults" label_selected="Restore defaults" layout="topleft" - left="20" + left="260" name="btn_restore_defaults" top="415" width="130"> diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml new file mode 100644 index 0000000000..f766236b2e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel + height="300" + follows="all" + layout="topleft" + name="nearby_chat" + help_topic="nearby_chat" + width="320"> + <check_box + bottom_delta="36" + control_name="TranslateChat" + enabled="true" + height="16" + label="Translate chat (powered by Google)" + layout="topleft" + left="5" + name="translate_chat_checkbox" + width="230" /> + <chat_history + parse_urls="true" + bg_readonly_color="ChatHistoryBgColor" + bg_writeable_color="ChatHistoryBgColor" + follows="all" + left="5" + top_delta="17" + layout="topleft" + height="260" + name="chat_history" + parse_highlights="true" + text_color="ChatHistoryTextColor" + text_readonly_color="ChatHistoryTextColor" + right_widget_pad="5" + left_widget_pad="0" + width="315" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 23ea516b86..fa7632920b 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -47,9 +47,6 @@ top="0" side="left" button_display_mode="icons_only"> - <command name="avatar"/> - <command name="build"/> - <command name="chat"/> </toolbar> </layout_panel> <layout_panel name="non_toolbar_panel" @@ -72,9 +69,6 @@ top="0" side="right" button_display_mode="icons_only"> - <command name="avatar"/> - <command name="build"/> - <command name="chat"/> </toolbar> </layout_panel> </layout_stack> @@ -96,9 +90,6 @@ follows="left|right|bottom" button_display_mode="icons_with_text" visible="true"> - <command name="avatar"/> - <command name="build"/> - <command name="chat"/> </toolbar> </layout_panel> </layout_stack> |