diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 2 | ||||
-rw-r--r-- | indra/newview/llbottomtray.cpp | 30 | ||||
-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 | 57 |
7 files changed, 72 insertions, 64 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7ab9f36b87..238e4296cf 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 79e6c7b66b..bcb89b379e 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"); @@ -223,7 +223,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"); @@ -270,7 +270,8 @@ LLBottomTray::~LLBottomTray() // *TODO Vadim: why void* ? void* LLBottomTray::createNearbyChatBar(void* userdata) { - return new LLNearbyChatBar(); + //return new LLNearbyChatBar(); + return NULL; } LLNearbyChatBar* LLBottomTray::getNearbyChatBar() @@ -536,10 +537,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"); @@ -576,7 +577,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"); @@ -881,6 +882,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") @@ -902,13 +904,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"); @@ -932,7 +934,7 @@ void LLBottomTray::onContextMenuItemClicked(const LLSD& userdata) else if (item == "select_all") { edit_box->selectAll(); - } + }*/ } void LLBottomTray::log(LLView* panel, const std::string& descr) @@ -1115,7 +1117,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) if(delta_panel > 0) { lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; - mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); + //mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); } log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel"); @@ -1141,8 +1143,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 fecc6d91bd..30fd631d4f 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -127,6 +127,7 @@ #include "llscriptfloater.h" #include "llfloatermodelpreview.h" #include "llcommandhandler.h" +#include "llnearbychatbar.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -177,6 +178,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 5893259d96..6381f58f63 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2467,38 +2467,43 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Traverses up the hierarchy if( keyboard_focus ) { - LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL; - // arrow keys move avatar while chatting hack - if (chat_editor && chat_editor->hasFocus()) + LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChatBar>("chat_bar"); + + if (nearby_chat) { - // If text field is empty, there's no point in trying to move - // cursor with arrow keys, so allow movement - if (chat_editor->getText().empty() - || gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) + LLLineEditor* chat_editor = nearby_chat->getChatBox(); + + // arrow keys move avatar while chatting hack + if (chat_editor && chat_editor->hasFocus()) { - // let Control-Up and Control-Down through for chat line history, - if (!(key == KEY_UP && mask == MASK_CONTROL) - && !(key == KEY_DOWN && mask == MASK_CONTROL)) + // If text field is empty, there's no point in trying to move + // cursor with arrow keys, so allow movement + if (chat_editor->getText().empty() + || gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) { - switch(key) + // let Control-Up and Control-Down through for chat line history, + if (!(key == KEY_UP && mask == MASK_CONTROL) + && !(key == KEY_DOWN && mask == MASK_CONTROL)) { - case KEY_LEFT: - case KEY_RIGHT: - case KEY_UP: - case KEY_DOWN: - case KEY_PAGE_UP: - case KEY_PAGE_DOWN: - case KEY_HOME: - // when chatbar is empty or ArrowKeysAlwaysMove set, - // pass arrow keys on to avatar... - return FALSE; - default: - break; + switch(key) + { + case KEY_LEFT: + case KEY_RIGHT: + case KEY_UP: + case KEY_DOWN: + case KEY_PAGE_UP: + case KEY_PAGE_DOWN: + case KEY_HOME: + // when chatbar is empty or ArrowKeysAlwaysMove set, + // pass arrow keys on to avatar... + return FALSE; + default: + break; + } } } } } - if (keyboard_focus->handleKey(key, mask, FALSE)) { return TRUE; @@ -2529,11 +2534,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; } } |