From 4601aef70abe611a2a25b3e236cc089ff2bcb6af Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 9 Sep 2009 04:27:06 +0000 Subject: merge -r 1586-1593 https://svn.aws.productengine.com/secondlife/pe/stable-2 -> viewer-2.0.0-3 Fixes: EXT-839 EXT-859 EXT-868 EXT-795 EXT-861 EXT-678 EXT-848 EXT-873 --- indra/llui/llcombobox.cpp | 12 +++++++- indra/llui/llcombobox.h | 4 ++- indra/llui/lldockablefloater.cpp | 34 +++++++++++++++++++++ indra/llui/lldockablefloater.h | 9 ++++++ indra/llui/llfiltereditor.cpp | 1 + indra/llui/lllineeditor.cpp | 3 +- indra/llui/lllineeditor.h | 1 + indra/llui/llmenugl.cpp | 34 +++++++++++++++++++-- indra/llui/llmenugl.h | 4 ++- indra/llui/llscrolllistctrl.h | 2 +- indra/newview/llbottomtray.cpp | 34 ++++++++++----------- indra/newview/llchiclet.cpp | 35 ++++++++++++++++++++++ indra/newview/llchiclet.h | 20 ++++++++++++- indra/newview/llgrouplist.cpp | 8 ++++- indra/newview/lllocationinputctrl.cpp | 2 +- indra/newview/llnavigationbar.cpp | 2 +- indra/newview/llsearchcombobox.cpp | 15 ++++------ indra/newview/llsyswellwindow.cpp | 23 ++++++++++++-- indra/newview/llsyswellwindow.h | 1 + indra/newview/llviewerwindow.cpp | 5 ++++ .../skins/default/xui/en/panel_activeim_row.xml | 11 ++++++- .../skins/default/xui/en/panel_bottomtray.xml | 3 +- .../default/xui/en/widgets/location_input.xml | 1 + .../default/xui/en/widgets/search_combo_box.xml | 1 + 24 files changed, 220 insertions(+), 45 deletions(-) (limited to 'indra') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index ef0d4c1c03..58aeb61728 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -78,6 +78,7 @@ LLComboBox::ItemParams::ItemParams() LLComboBox::Params::Params() : allow_text_entry("allow_text_entry", false), + allow_new_values("allow_new_values", false), show_text_as_tentative("show_text_as_tentative", true), max_chars("max_chars", 20), list_position("list_position", BELOW), @@ -97,6 +98,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mTextEntryTentative(p.show_text_as_tentative), mHasAutocompletedText(false), mAllowTextEntry(p.allow_text_entry), + mAllowNewValues(p.allow_new_values), mMaxChars(p.max_chars), mPrearrangeCallback(p.prearrange_callback()), mTextEntryCallback(p.text_entry_callback()), @@ -621,7 +623,15 @@ void LLComboBox::hideList() if (mList->getVisible()) { // assert selection in list - mList->selectNthItem(mLastSelectedIndex); + if(mAllowNewValues) + { + // mLastSelectedIndex = -1 means that we entered a new value, don't select + // any of existing items in this case. + if(mLastSelectedIndex >= 0) + mList->selectNthItem(mLastSelectedIndex); + } + else + mList->selectNthItem(mLastSelectedIndex); mButton->setToggleState(FALSE); mList->setVisible(FALSE); diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 018d472d62..68cbfeeeeb 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -78,7 +78,8 @@ public: : public LLInitParam::Block { Optional allow_text_entry, - show_text_as_tentative; + show_text_as_tentative, + allow_new_values; Optional max_chars; Optional prearrange_callback, text_entry_callback, @@ -224,6 +225,7 @@ protected: private: BOOL mAllowTextEntry; + BOOL mAllowNewValues; S32 mMaxChars; BOOL mTextEntryTentative; commit_callback_t mPrearrangeCallback; diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 5243f67a76..29f78f6290 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -34,10 +34,14 @@ #include "lldockablefloater.h" +//static +LLDockableFloater* LLDockableFloater::instance = NULL; + LLDockableFloater::LLDockableFloater(LLDockControl* dockControl, const LLSD& key, const Params& params) : LLFloater(key, params), mDockControl(dockControl) { + resetInstance(); } LLDockableFloater::~LLDockableFloater() @@ -51,12 +55,42 @@ BOOL LLDockableFloater::postBuild() return LLView::postBuild(); } +void LLDockableFloater::resetInstance() +{ + if (instance != this) + { + if (instance != NULL && instance->isDocked()) + { + //closeFloater() is not virtual + if (instance->canClose()) + { + instance->closeFloater(); + } + else + { + instance->setVisible(FALSE); + } + } + instance = this; + } +} + +void LLDockableFloater::setVisible(BOOL visible) +{ + if(visible && isDocked()) + { + resetInstance(); + } + LLFloater::setVisible(visible); +} + void LLDockableFloater::setDocked(bool docked, bool pop_on_undock) { if (mDockControl.get() != NULL) { if (docked) { + resetInstance(); mDockControl.get()->on(); } else diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index da86889c33..b977888803 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -52,6 +52,14 @@ public: /* virtula */BOOL postBuild(); /* virtual */void setDocked(bool docked, bool pop_on_undock = true); /* virtual */void draw(); + /*virtual*/ void setVisible(BOOL visible); + +private: + /** + * Provides unique of dockable floater. + * If dockable floater already exists it should be closed. + */ + void resetInstance(); protected: void setDockControl(LLDockControl* dockControl); @@ -61,6 +69,7 @@ protected: private: std::auto_ptr mDockControl; LLUIImagePtr mDockTongue; + static LLDockableFloater* instance; }; #endif /* LL_DOCKABLEFLOATER_H */ diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index 7d6a4007a2..26b5f2e182 100644 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp @@ -44,6 +44,7 @@ LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p) line_editor_p.rect(getLocalRect()); line_editor_p.follows.flags(FOLLOWS_ALL); line_editor_p.text_pad_right(getRect().getHeight()); + line_editor_p.revert_on_esc(false); line_editor_p.keystroke_callback(boost::bind(&LLUICtrl::onCommit, this)); mFilterEditor = LLUICtrlFactory::create(line_editor_p); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 5435b9ffbf..ede67ad17d 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -97,6 +97,7 @@ LLLineEditor::Params::Params() background_image_focused("background_image_focused"), select_on_focus("select_on_focus", false), handle_edit_keys_directly("handle_edit_keys_directly", false), + revert_on_esc("revert_on_esc", true), commit_on_focus_lost("commit_on_focus_lost", true), ignore_tab("ignore_tab", true), cursor_color("cursor_color"), @@ -130,7 +131,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mMinHPixels(0), // computed in updateTextPadding() below mMaxHPixels(0), // computed in updateTextPadding() below mCommitOnFocusLost( p.commit_on_focus_lost ), - mRevertOnEsc( TRUE ), + mRevertOnEsc( p.revert_on_esc ), mKeystrokeCallback( p.keystroke_callback() ), mIsSelecting( FALSE ), mSelectionStart( 0 ), diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 0986ce5a87..a024f48cc6 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -90,6 +90,7 @@ public: Optional select_on_focus, handle_edit_keys_directly, + revert_on_esc, commit_on_focus_lost, ignore_tab; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 2bc4f009cc..e0bb6bd5d3 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3371,6 +3371,34 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) return handled; } +BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +{ + BOOL handled = false; + LLMenuGL* const pMenu = dynamic_cast(getVisibleMenu()); + + if (pMenu) + { + //handle ESCAPE and RETURN key + handled = LLPanel::handleKey(key, mask, called_from_parent); + if (!handled) + { + if (pMenu->getHighlightedItem()) + { + handled = pMenu->handleKey(key, mask, TRUE); + } + else + { + //highlight first enabled one + pMenu->highlightNextItem(NULL); + handled = true; + } + } + } + + return handled; + +} + void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) @@ -3380,17 +3408,17 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) LLView::reshape(width, height, called_from_parent); } -BOOL LLMenuHolderGL::hasVisibleMenu() const +LLView* const LLMenuHolderGL::getVisibleMenu() const { for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; if (viewp->getVisible() && dynamic_cast(viewp) == NULL) { - return TRUE; + return viewp; } } - return FALSE; + return NULL; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 0bf6301f93..8309fedf7f 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -772,8 +772,10 @@ public: // Close context menus on right mouse up not handled by menus. /*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask ); + virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual const LLRect getMenuRect() const { return getLocalRect(); } - virtual BOOL hasVisibleMenu() const; + LLView*const getVisibleMenu() const; + virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;} static void setActivatedItem(LLMenuItemGL* item); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index bbf8e86660..49a49499ef 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -350,7 +350,7 @@ public: void sortOnce(S32 column, BOOL ascending); // manually call this whenever editing list items in place to flag need for resorting - void setNeedsSort() { mSorted = false; } + void setNeedsSort(bool val = true) { mSorted = !val; } void dirtyColumns(); // some operation has potentially affected column layout or ordering protected: diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index b47787bd5f..d166715038 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -37,12 +37,12 @@ #include "llchiclet.h" #include "llfloaterreg.h" #include "llflyoutbutton.h" +#include "llimpanel.h" // for LLIMFloater #include "lllayoutstack.h" #include "llnearbychatbar.h" #include "llsplitbutton.h" #include "llsyswellwindow.h" #include "llfloatercamera.h" -#include "llimpanel.h" LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL), @@ -119,6 +119,7 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) } } +// *TODO Vadim: why void* ? void* LLBottomTray::createNearbyChatBar(void* userdata) { return new LLNearbyChatBar(); @@ -126,30 +127,19 @@ void* LLBottomTray::createNearbyChatBar(void* userdata) LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id) { - if(session_id.isNull()) - { - return NULL; - } - - LLFloaterIMPanel* im = LLIMMgr::getInstance()->findFloaterBySession(session_id); - if (!im) - { - return NULL; //should never happen - } + LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(session_id); - switch(im->getDialogType()) + switch (im_chiclet_type) { - case IM_NOTHING_SPECIAL: + case LLIMChiclet::TYPE_IM: return getChicletPanel()->createChiclet(session_id); - break; - case IM_SESSION_GROUP_START: - case IM_SESSION_INVITE: + case LLIMChiclet::TYPE_GROUP: return getChicletPanel()->createChiclet(session_id); - break; - default: - return NULL; + case LLIMChiclet::TYPE_UNKNOWN: break; } + + return NULL; } //virtual @@ -273,4 +263,10 @@ void LLBottomTray::showCameraAndMoveControls(BOOL visible) { mCamPanel->setVisible(visible); mMovementPanel->setVisible(visible); + + if (!visible) + { + LLFloaterReg::hideFloaterInstance("moveview"); + LLFloaterReg::hideFloaterInstance("camera"); + } } diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index e54b068d47..9ce194c712 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -214,6 +214,37 @@ void LLIMChiclet::draw() gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE); } +// static +LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id) +{ + EType type = TYPE_UNKNOWN; + LLFloaterIMPanel* im = NULL; + + if(session_id.isNull()) + return type; + + if (!(im = LLIMMgr::getInstance()->findFloaterBySession(session_id))) + { + llassert_always(0 && "IM session not found"); // should never happen + return type; + } + + switch(im->getDialogType()) + { + case IM_NOTHING_SPECIAL: + type = TYPE_IM; + break; + case IM_SESSION_GROUP_START: + case IM_SESSION_INVITE: + type = TYPE_GROUP; + break; + default: + break; + } + + return type; +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -224,6 +255,7 @@ LLIMP2PChiclet::Params::Params() , speaker("speaker") , show_speaker("show_speaker") { + // *TODO Vadim: Get rid of hardcoded values. rect(LLRect(0, 25, 45, 0)); avatar_icon.name("avatar_icon"); @@ -1028,11 +1060,14 @@ BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +// *TODO Vadim: Move this out of llchiclet.cpp. + LLTalkButton::Params::Params() : speak_button("speak_button") , show_button("show_button") , monitor("monitor") { + // *TODO Vadim: move hardcoded labels (!) and other params to XUI. speak_button.name("left"); speak_button.label("Speak"); speak_button.label_selected("Speak"); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index f96dfb69ec..91f55915ed 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -272,6 +272,11 @@ private: class LLIMChiclet : public LLChiclet { public: + enum EType { + TYPE_UNKNOWN, + TYPE_IM, + TYPE_GROUP + }; /*virtual*/ ~LLIMChiclet() {}; @@ -306,6 +311,19 @@ public: */ /*virtual*/ void draw(); + /** + * Determine whether given ID refers to a group or an IM chat session. + * + * This is used when we need to chose what IM chiclet (P2P/group) + * class to instantiate. + * + * @param session_id session ID. + * @return TYPE_GROUP in case of group chat session, + * TYPE_IM in case of P2P session, + * TYPE_UNKNOWN otherwise. + */ + static EType getIMSessionType(const LLUUID& session_id); + /** * The action taken on mouse down event. * @@ -368,7 +386,7 @@ public: Params(); }; - void setOtherParticipantId(const LLUUID& other_participant_id); + /* virtual */ void setOtherParticipantId(const LLUUID& other_participant_id); /*virtual*/ void setShowSpeaker(bool show); diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 73d3a60701..cddc67cb0a 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -77,14 +77,20 @@ BOOL LLGroupList::update(const std::string& name_filter) const LLGroupData& group_data = gAgent.mGroups.get(i); if (name_filter != LLStringUtil::null && !findInsensitive(group_data.mName, name_filter)) continue; - addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM); + addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM); // ADD_SORTED can only sort by first column anyway } + // Force sorting the list. + updateSort(); + // add "none" to list at top { std::string loc_none = LLTrans::getString("GroupsNone"); if (name_filter == LLStringUtil::null || findInsensitive(loc_none, name_filter)) addItem(LLUUID::null, loc_none, highlight_id.isNull(), ADD_TOP); + + // Prevent the "none" item from being sorted. + setNeedsSort(false); } group_list->selectByValue(highlight_id); diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index d8c89690e8..1d9220cf3d 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -324,7 +324,7 @@ BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) { BOOL result = LLComboBox::handleKeyHere(key, mask); - if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0) + if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0 && !mList->getVisible()) { showList(); } diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index c283b3a05f..0da572dd24 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -300,8 +300,8 @@ void LLNavigationBar::onSearchCommit() if(!search_query.empty()) { LLSearchHistory::getInstance()->addEntry(search_query); - invokeSearch(mSearchComboBox->getValue().asString()); } + invokeSearch(search_query); } void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata) diff --git a/indra/newview/llsearchcombobox.cpp b/indra/newview/llsearchcombobox.cpp index c903f40f3f..29d31e8b56 100644 --- a/indra/newview/llsearchcombobox.cpp +++ b/indra/newview/llsearchcombobox.cpp @@ -152,19 +152,16 @@ void LLSearchComboBox::onSelectionCommit() { std::string search_query = getSimple(); LLStringUtil::trim(search_query); - if(search_query.empty()) - { - mTextEntry->setText(search_query); - setControlValue(search_query); - - return; - } - remove(search_query); - add(search_query, ADD_TOP); mTextEntry->setText(search_query); setControlValue(search_query); + if(!search_query.empty()) + { + remove(search_query); + add(search_query, ADD_TOP); + } + LLUICtrl::onCommit(); } diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 2ff0c6833c..98428bf0f7 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -181,7 +181,7 @@ void LLSysWellWindow::setVisible(BOOL visible) if(mChannel) mChannel->setShowToasts(!visible); - LLFloater::setVisible(visible); + LLDockableFloater::setVisible(visible); } //--------------------------------------------------------------------------------- @@ -331,11 +331,28 @@ void LLSysWellWindow::sessionRemoved(const LLUUID& sessionId) //--------------------------------------------------------------------------------- LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) : - LLScrollingPanel(LLPanel::Params()), mParent(parent) + LLScrollingPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_activeim_row.xml", NULL); - mChiclet = getChild("chiclet"); + // Choose which of the pre-created chiclets (IM/group) to use. + // The other one gets hidden. + + LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(sessionId); + switch (im_chiclet_type) + { + case LLIMChiclet::TYPE_GROUP: + mChiclet = getChild("group_chiclet"); + childSetVisible("p2p_chiclet", false); + break; + case LLIMChiclet::TYPE_UNKNOWN: // assign mChiclet a non-null value anyway + case LLIMChiclet::TYPE_IM: + mChiclet = getChild("p2p_chiclet"); + childSetVisible("group_chiclet", false); + break; + } + + // Initialize chiclet. mChiclet->setCounter(chicletCounter); mChiclet->setSessionId(sessionId); mChiclet->setIMSessionName(name); diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index ef0974b428..d76147b489 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -69,6 +69,7 @@ public: virtual void setVisible(BOOL visible); void adjustWindowPosition(); void toggleWindow(); + /*virtua*/BOOL canClose() { return FALSE; } // Handlers void onItemClick(LLSysWellItem* item); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index a088006c53..e5d0e3ebb2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2073,6 +2073,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { return TRUE; } + //some of context menus use this container, let context menu handle navigation keys + if(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)) + { + return TRUE; + } // Traverses up the hierarchy LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); diff --git a/indra/newview/skins/default/xui/en/panel_activeim_row.xml b/indra/newview/skins/default/xui/en/panel_activeim_row.xml index f5af8e7b30..4dc4a9ff46 100644 --- a/indra/newview/skins/default/xui/en/panel_activeim_row.xml +++ b/indra/newview/skins/default/xui/en/panel_activeim_row.xml @@ -11,7 +11,7 @@ bevel_style="in" bg_alpha_color="0 0 0 0"> + + -- cgit v1.2.3