diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 2 | ||||
-rw-r--r-- | indra/llui/llcombobox.cpp | 33 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 3 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 1 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llmultifloater.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 38 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 18 | ||||
-rw-r--r-- | indra/llui/llradiogroup.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llsearcheditor.h | 2 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 33 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 58 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 1 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 5 |
17 files changed, 163 insertions, 60 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 1067c3f1d5..e12776f83a 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -826,9 +826,6 @@ void LLAccordionCtrlTab::draw() LLLocalClipRect clip(child_rect); drawChild(root_rect,mContainerPanel); } - - - gGL.getTexUnit(0)->disable(); } } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 59b551a16d..6a1e3a9425 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -217,7 +217,7 @@ public: void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); LLPointer<LLUIImage> getImageOverlay() { return mImageOverlay; } LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } - + void autoResize(); // resize with label of current btn state void resize(LLUIString label); // resize with label input void setLabel( const LLStringExplicit& label); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index c1d512e148..3a8efadaa4 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -706,14 +706,17 @@ void LLComboBox::onListMouseUp() void LLComboBox::onItemSelected(const LLSD& data) { - setValue(data); - - if (mAllowTextEntry && mLastSelectedIndex != -1) + mLastSelectedIndex = getCurrentIndex(); + if (mLastSelectedIndex != -1) { - gFocusMgr.setKeyboardFocus(mTextEntry); - mTextEntry->selectAll(); - } + setLabel(getSelectedItemLabel()); + if (mAllowTextEntry) + { + gFocusMgr.setKeyboardFocus(mTextEntry); + mTextEntry->selectAll(); + } + } // hiding the list reasserts the old value stored in the text editor/dropdown button hideList(); @@ -1080,24 +1083,6 @@ LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p) mLabelColumnIndex(p.label_column) {} -void LLIconsComboBox::setValue(const LLSD& value) -{ - BOOL found = mList->selectByValue(value); - if (found) - { - LLScrollListItem* item = mList->getFirstSelected(); - if (item) - { - setLabel(getSelectedItemLabel()); - } - mLastSelectedIndex = mList->getFirstSelectedIndex(); - } - else - { - mLastSelectedIndex = -1; - } -} - const std::string LLIconsComboBox::getSelectedItemLabel(S32 column) const { mButton->setImageOverlay(LLComboBox::getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 965061ead2..f0bd432f3a 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -221,7 +221,6 @@ protected: LLPointer<LLUIImage> mArrowImage; LLUIString mLabel; BOOL mHasAutocompletedText; - S32 mLastSelectedIndex; private: BOOL mAllowTextEntry; @@ -232,6 +231,7 @@ private: commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; boost::signals2::connection mTopLostSignalConnection; + S32 mLastSelectedIndex; }; // A combo box with icons for the list of items. @@ -247,7 +247,6 @@ public: Params(); }; - /*virtual*/ void setValue(const LLSD& value); /*virtual*/ const std::string getSelectedItemLabel(S32 column = 0) const; private: diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4cb336f7ea..ab14c08948 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1354,7 +1354,6 @@ void LLFloater::bringToFront( S32 x, S32 y ) // virtual void LLFloater::setVisibleAndFrontmost(BOOL take_focus) { - LLUI::clearPopups(); setVisible(TRUE); setFrontmost(take_focus); } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0d56c5ed31..fb4a9d032d 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3455,7 +3455,7 @@ 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<LLMenuBarGL*>(viewp) == NULL) + if (viewp->getVisible() && dynamic_cast<LLMenuGL*>(viewp) != NULL) { return viewp; } @@ -3478,8 +3478,7 @@ BOOL LLMenuHolderGL::hideMenus() for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - // clicks off of menu do not hide menu bar - if (dynamic_cast<LLMenuBarGL*>(viewp) == NULL && viewp->getVisible()) + if (dynamic_cast<LLMenuGL*>(viewp) != NULL && viewp->getVisible()) { viewp->setVisible(FALSE); } diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 33d47a3f0e..4af9108329 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -352,6 +352,13 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) if (floater && floater->canClose() && floater->isCloseable()) { floater->closeFloater(); + + // EXT-5695 (Tabbed IM window loses focus if close any tabs by Ctrl+W) + // bring back focus on tab container if there are any tab left + if(mTabContainer->getTabCount() > 0) + { + mTabContainer->setFocus(TRUE); + } } return TRUE; } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 5816cef6af..d7424cf05a 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -402,7 +402,9 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mRespondedTo(false), mPriority(p.priority), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL), + mIsReusable(false) { if (p.functor.name.isChosen()) { @@ -416,6 +418,11 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mTemporaryResponder = true; } + if(p.responder.isProvided()) + { + mResponderObj = p.responder; + } + mId.generate(); init(p.name, p.form_elements); } @@ -425,7 +432,9 @@ LLNotification::LLNotification(const LLSD& sd) : mTemporaryResponder(false), mRespondedTo(false), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL), + mIsReusable(false) { mId.generate(); mSubstitutions = sd["substitutions"]; @@ -452,6 +461,7 @@ LLSD LLNotification::asLLSD() output["expiry"] = mExpiresAt; output["priority"] = (S32)mPriority; output["responseFunctor"] = mResponseFunctorName; + output["reusable"] = mIsReusable; return output; } @@ -479,7 +489,9 @@ void LLNotification::updateFrom(LLNotificationPtr other) mForm = other->mForm; mResponseFunctorName = other->mResponseFunctorName; mRespondedTo = other->mRespondedTo; + mResponse = other->mResponse; mTemporaryResponder = other->mTemporaryResponder; + mIsReusable = other->isReusable(); update(); } @@ -556,14 +568,16 @@ std::string LLNotification::getSelectedOptionName(const LLSD& response) void LLNotification::respond(const LLSD& response) { + // *TODO may remove mRespondedTo and use mResponce.isDefined() in isRespondedTo() mRespondedTo = true; + mResponse = response; // look up the functor LLNotificationFunctorRegistry::ResponseFunctor functor = LLNotificationFunctorRegistry::instance().getFunctor(mResponseFunctorName); // and then call it functor(asLLSD(), response); - if (mTemporaryResponder) + if (mTemporaryResponder && !isReusable()) { LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); mResponseFunctorName = ""; @@ -597,6 +611,16 @@ void LLNotification::setResponseFunctor(std::string const &responseFunctorName) mTemporaryResponder = false; } +void LLNotification::setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb) +{ + if(mTemporaryResponder) + { + LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); + } + + LLNotificationFunctorRegistry::instance().registerFunctor(mResponseFunctorName, cb); +} + bool LLNotification::payloadContainsAll(const std::vector<std::string>& required_fields) const { for(std::vector<std::string>::const_iterator required_fields_it = required_fields.begin(); @@ -856,8 +880,12 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt if (wasFound) { abortProcessing = mChanged(payload); - mItems.erase(pNotification); - onDelete(pNotification); + // do not delete the notification to make LLChatHistory::appendMessage add notification panel to IM window + if( ! pNotification->isReusable() ) + { + mItems.erase(pNotification); + onDelete(pNotification); + } } } return abortProcessing; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 8d993b71d7..400491a154 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -296,6 +296,7 @@ public: Optional<LLSD> form_elements; Optional<LLDate> time_stamp; Optional<LLNotificationContext*> context; + Optional<void*> responder; struct Functor : public LLInitParam::Choice<Functor> { @@ -317,6 +318,7 @@ public: form_elements("form_elements") { time_stamp = LLDate::now(); + responder = NULL; } Params(const std::string& _name) @@ -329,6 +331,7 @@ public: functor.name = _name; name = _name; time_stamp = LLDate::now(); + responder = NULL; } }; @@ -341,9 +344,12 @@ private: LLDate mExpiresAt; bool mCancelled; bool mRespondedTo; // once the notification has been responded to, this becomes true + LLSD mResponse; bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; + void* mResponderObj; + bool mIsReusable; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -384,6 +390,8 @@ public: void setResponseFunctor(std::string const &responseFunctorName); + void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb); + typedef enum e_response_template_type { WITHOUT_DEFAULT_BUTTON, @@ -423,6 +431,10 @@ public: void respond(const LLSD& sd); + void* getResponder() { return mResponderObj; } + + void setResponder(void* responder) { mResponderObj = responder; } + void setIgnored(bool ignore); bool isCancelled() const @@ -435,6 +447,8 @@ public: return mRespondedTo; } + const LLSD& getResponse() { return mResponse; } + bool isIgnored() const { return mIgnored; @@ -504,6 +518,10 @@ public: { return mId; } + + bool isReusable() { return mIsReusable; } + + void setReusable(bool reusable) { mIsReusable = reusable; } // comparing two notifications normally means comparing them by UUID (so we can look them // up quickly this way) diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 4087b484aa..e27792dc1d 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -106,7 +106,6 @@ LLRadioGroup::LLRadioGroup(const LLRadioGroup::Params& p) void LLRadioGroup::initFromParams(const Params& p) { - LLUICtrl::initFromParams(p); for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); it != p.items().end(); ++it) @@ -124,6 +123,9 @@ void LLRadioGroup::initFromParams(const Params& p) LLRadioCtrl* item = LLUICtrlFactory::create<LLRadioCtrl>(item_params, this); mRadioButtons.push_back(item); } + + // call this *after* setting up mRadioButtons so we can handle setValue() calls + LLUICtrl::initFromParams(p); } @@ -138,10 +140,6 @@ BOOL LLRadioGroup::postBuild() { mRadioButtons[0]->setTabStop(true); } - if (mControlVariable) - { - setSelectedIndex(mControlVariable->getValue().asInteger()); - } return TRUE; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 18ec5b51dd..77caaaa425 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -630,9 +630,7 @@ void LLScrollListCtrl::calcColumnWidths() LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex); if (!cellp) continue; - // get text value width only for text cells - column->mMaxContentWidth = cellp->isText() ? - llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth) : column->mMaxContentWidth; + column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth); } max_item_width += column->mMaxContentWidth; diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index 714aca9337..785d0633dc 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -66,6 +66,8 @@ public: } }; + void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } + protected: LLSearchEditor(const Params&); friend class LLUICtrlFactory; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 851fb966ec..5f4b16ec9e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -246,7 +246,7 @@ LLTextBase::~LLTextBase() { // Menu, like any other LLUICtrl, is deleted by its parent - gMenuHolder - clearSegments(); + mSegments.clear(); } void LLTextBase::initFromParams(const LLTextBase::Params& p) @@ -350,6 +350,8 @@ void LLTextBase::drawSelectionBackground() S32 segment_line_start = segmentp->getStart() + segment_offset; S32 segment_line_end = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd); + if (segment_line_start > segment_line_end) break; + S32 segment_width = 0; S32 segment_height = 0; @@ -361,8 +363,11 @@ void LLTextBase::drawSelectionBackground() selection_rect.mLeft += segment_width; } - // if selection spans end of current segment... - if (selection_right > segment_line_end) + // if selection_right == segment_line_end then that means we are the first character of the next segment + // or first character of the next line, in either case we want to add the length of the current segment + // to the selection rectangle and continue. + // if selection right > segment_line_end then selection spans end of current segment... + if (selection_right >= segment_line_end) { // extend selection slightly beyond end of line // to indicate selection of newline character (use "n" character to determine width) @@ -1813,11 +1818,18 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, const LLTextSegmentPtr segmentp = *line_seg_iter; S32 segment_line_start = segmentp->getStart() + line_seg_offset; - S32 segment_line_length = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd - 1) - segment_line_start; + S32 segment_line_length = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd) - segment_line_start; S32 text_width, text_height; - segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height); - if (local_x < start_x + text_width // cursor to left of right edge of text - || (hit_past_end_of_line && (segmentp->getEnd() >= line_iter->mDocIndexEnd - 1))) // or this segment wraps to next line + bool newline = segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height); + + // if we've reached a line of text *below* the mouse cursor, doc index is first character on that line + if (hit_past_end_of_line && local_y - mVisibleTextRect.mBottom + visible_region.mBottom > line_iter->mRect.mTop) + { + pos = segment_line_start; + break; + } + if (local_x < start_x + text_width // cursor to left of right edge of text + || newline) // or this line ends with a newline, set doc pos to newline char { // Figure out which character we're nearest to. S32 offset; @@ -1841,6 +1853,13 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, pos = segment_line_start + offset; break; } + else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd - 1) + { + // segment wraps to next line, so just set doc pos to start of next line (represented by mDocIndexEnd) + pos = llmin(getLength(), line_iter->mDocIndexEnd); + break; + } + start_x += text_width; } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 5121ef5351..b049895526 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -207,7 +207,7 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) // Counterclockwise quad will face the viewer if( filled ) - { + { gGL.begin( LLRender::QUADS ); gGL.vertex2i(left, top); gGL.vertex2i(left, bottom); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 35428e4227..e8e3459673 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -310,7 +310,6 @@ LLUrlEntryAgent::LLUrlEntryAgent() boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_agent.xml"; mIcon = "Generic_Person"; - mTooltip = LLTrans::getString("TooltipAgentUrl"); mColor = LLUIColorTable::instance().getColor("AgentLinkColor"); } @@ -323,6 +322,38 @@ void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id, callObservers(id.asString(), first + " " + last); } +std::string LLUrlEntryAgent::getTooltip(const std::string &string) const +{ + // return a tooltip corresponding to the URL type instead of the generic one + std::string url = getUrl(string); + + if (LLStringUtil::endsWith(url, "/mute")) + { + return LLTrans::getString("TooltipAgentMute"); + } + if (LLStringUtil::endsWith(url, "/unmute")) + { + return LLTrans::getString("TooltipAgentUnmute"); + } + if (LLStringUtil::endsWith(url, "/im")) + { + return LLTrans::getString("TooltipAgentIM"); + } + if (LLStringUtil::endsWith(url, "/pay")) + { + return LLTrans::getString("TooltipAgentPay"); + } + if (LLStringUtil::endsWith(url, "/offerteleport")) + { + return LLTrans::getString("TooltipAgentOfferTeleport"); + } + if (LLStringUtil::endsWith(url, "/requestfriend")) + { + return LLTrans::getString("TooltipAgentRequestFriend"); + } + return LLTrans::getString("TooltipAgentUrl"); +} + std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) @@ -346,6 +377,31 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } else if (gCacheName->getFullName(agent_id, full_name)) { + // customize label string based on agent SLapp suffix + if (LLStringUtil::endsWith(url, "/mute")) + { + return LLTrans::getString("SLappAgentMute") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/unmute")) + { + return LLTrans::getString("SLappAgentUnmute") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/im")) + { + return LLTrans::getString("SLappAgentIM") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/pay")) + { + return LLTrans::getString("SLappAgentPay") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/offerteleport")) + { + return LLTrans::getString("SLappAgentOfferTeleport") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/requestfriend")) + { + return LLTrans::getString("SLappAgentRequestFriend") + " " + full_name; + } return full_name; } else diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index c947ef7259..84d0968779 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -169,6 +169,7 @@ class LLUrlEntryAgent : public LLUrlEntryBase public: LLUrlEntryAgent(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getTooltip(const std::string &string) const; private: void onAgentNameReceived(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d34083a384..781c111474 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -152,7 +152,7 @@ LLView::~LLView() //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; if (LLView::sIsDrawing) { - llwarns << "Deleting view " << mName << " during UI draw() phase" << llendl; + lldebugs << "Deleting view " << mName << " during UI draw() phase" << llendl; } // llassert(LLView::sIsDrawing == FALSE); @@ -1325,7 +1325,6 @@ void LLView::drawChildren() localRectToScreen(viewp->getRect(),&screenRect); if ( rootRect.overlaps(screenRect) && LLUI::sDirtyRect.overlaps(screenRect)) { - glMatrixMode(GL_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f); @@ -1349,8 +1348,6 @@ void LLView::drawChildren() } --sDepth; } - - gGL.getTexUnit(0)->disable(); } void LLView::dirtyRect() |