From efa0d701845542e9ef555260fe6d2ad0beeb0760 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 11 Sep 2009 00:33:33 -0700 Subject: Backported clickable object names from 1.23 --- linden/indra/llcommon/CMakeLists.txt | 2 + linden/indra/llcommon/llchat.h | 6 +- linden/indra/llcommon/llcursortypes.cpp | 89 +++++++++ linden/indra/llcommon/llcursortypes.h | 81 ++++++++ linden/indra/llui/llpanel.cpp | 4 +- linden/indra/llui/llpanel.h | 2 +- linden/indra/llui/lltextbox.cpp | 7 +- linden/indra/llui/lltextbox.h | 3 +- linden/indra/llui/lltexteditor.cpp | 16 +- linden/indra/llui/lltexteditor.h | 8 +- linden/indra/llui/llview.cpp | 20 +- linden/indra/llui/llview.h | 5 +- linden/indra/llwindow/llwindow.h | 43 +---- linden/indra/newview/CMakeLists.txt | 3 + linden/indra/newview/app_settings/settings.xml | 19 +- linden/indra/newview/llfloaterabout.cpp | 4 +- linden/indra/newview/llfloaterchat.cpp | 18 +- linden/indra/newview/llfloaterobjectiminfo.cpp | 204 +++++++++++++++++++++ linden/indra/newview/llfloaterobjectiminfo.h | 45 +++++ linden/indra/newview/llgroupnotify.cpp | 4 +- linden/indra/newview/llimpanel.cpp | 4 +- linden/indra/newview/llstylemap.cpp | 37 +++- linden/indra/newview/llstylemap.h | 3 +- linden/indra/newview/llviewermessage.cpp | 50 ++++- linden/indra/newview/skins/default/colors_base.xml | 4 +- .../default/xui/en-us/floater_object_im_info.xml | 54 ++++++ linden/indra/newview/skins/silver/colors_base.xml | 2 + 27 files changed, 643 insertions(+), 94 deletions(-) create mode 100644 linden/indra/llcommon/llcursortypes.cpp create mode 100644 linden/indra/llcommon/llcursortypes.h create mode 100644 linden/indra/newview/llfloaterobjectiminfo.cpp create mode 100644 linden/indra/newview/llfloaterobjectiminfo.h create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_object_im_info.xml (limited to 'linden') diff --git a/linden/indra/llcommon/CMakeLists.txt b/linden/indra/llcommon/CMakeLists.txt index 4001e1f..3f14be6 100644 --- a/linden/indra/llcommon/CMakeLists.txt +++ b/linden/indra/llcommon/CMakeLists.txt @@ -20,6 +20,7 @@ set(llcommon_SOURCE_FILES llcommon.cpp llcrc.cpp llcriticaldamp.cpp + llcursortypes.cpp lldate.cpp llerror.cpp llerrorthread.cpp @@ -90,6 +91,7 @@ set(llcommon_HEADER_FILES llcommon.h llcrc.h llcriticaldamp.h + llcursortypes.h lldarray.h lldarrayptr.h lldate.h diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h index 1bb3f3b..ec86450 100644 --- a/linden/indra/llcommon/llchat.h +++ b/linden/indra/llcommon/llchat.h @@ -77,9 +77,10 @@ public: mAudible(CHAT_AUDIBLE_FULLY), mMuted(FALSE), mTime(0.0), - mPosAgent() + mPosAgent(), + mURL() { } - + std::string mText; // UTF-8 line of text std::string mFromName; // agent or object name LLUUID mFromID; // agent id or object id @@ -89,6 +90,7 @@ public: BOOL mMuted; // pass muted chat to maintain list of chatters F64 mTime; // viewer only, seconds from viewer start LLVector3 mPosAgent; + std::string mURL; }; #endif diff --git a/linden/indra/llcommon/llcursortypes.cpp b/linden/indra/llcommon/llcursortypes.cpp new file mode 100644 index 0000000..858414b --- /dev/null +++ b/linden/indra/llcommon/llcursortypes.cpp @@ -0,0 +1,89 @@ +/** + * @file llcursortypes.cpp + * @brief Cursor types and lookup of types from a string + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llcursortypes.h" + +ECursorType getCursorFromString(const std::string& cursor_string) +{ + static std::map cursor_string_table; + if (cursor_string_table.empty()) + { + cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW; + cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT; + cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND; + cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM; + cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS; + cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE; + cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW; + cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE; + cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS; + cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO; + cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING; + cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB; + cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND; + cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS; + cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE; + cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG; + cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY; + cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI; + cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI; + cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED; + cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED; + cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED; + cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE; + cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE; + cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE; + cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA; + cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN; + cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN; + cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3; + cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT; + cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; + cursor_string_table["UI_CURSOR_TOOLPAY"] = UI_CURSOR_TOOLPAY; + cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; + cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY; + cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE; + cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN; + cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE; + } + + std::map::const_iterator iter = cursor_string_table.find(cursor_string); + + if (iter != cursor_string_table.end()) + { + return (ECursorType)iter->second; + } + + return UI_CURSOR_ARROW; +} + + + diff --git a/linden/indra/llcommon/llcursortypes.h b/linden/indra/llcommon/llcursortypes.h new file mode 100644 index 0000000..9be064f --- /dev/null +++ b/linden/indra/llcommon/llcursortypes.h @@ -0,0 +1,81 @@ +/** + * @file llcursortypes.h + * @brief Cursor types + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLCURSORTYPES_H +#define LL_LLCURSORTYPES_H + +#include "linden_common.h" + +// If you add types here, add them in LLCursor::getCursorFromString +enum ECursorType { + UI_CURSOR_ARROW, + UI_CURSOR_WAIT, + UI_CURSOR_HAND, + UI_CURSOR_IBEAM, + UI_CURSOR_CROSS, + UI_CURSOR_SIZENWSE, + UI_CURSOR_SIZENESW, + UI_CURSOR_SIZEWE, + UI_CURSOR_SIZENS, + UI_CURSOR_NO, + UI_CURSOR_WORKING, + UI_CURSOR_TOOLGRAB, + UI_CURSOR_TOOLLAND, + UI_CURSOR_TOOLFOCUS, + UI_CURSOR_TOOLCREATE, + UI_CURSOR_ARROWDRAG, + UI_CURSOR_ARROWCOPY, // drag with copy + UI_CURSOR_ARROWDRAGMULTI, + UI_CURSOR_ARROWCOPYMULTI, // drag with copy + UI_CURSOR_NOLOCKED, + UI_CURSOR_ARROWLOCKED, + UI_CURSOR_GRABLOCKED, + UI_CURSOR_TOOLTRANSLATE, + UI_CURSOR_TOOLROTATE, + UI_CURSOR_TOOLSCALE, + UI_CURSOR_TOOLCAMERA, + UI_CURSOR_TOOLPAN, + UI_CURSOR_TOOLZOOMIN, + UI_CURSOR_TOOLPICKOBJECT3, + UI_CURSOR_TOOLSIT, + UI_CURSOR_TOOLBUY, + UI_CURSOR_TOOLPAY, + UI_CURSOR_TOOLOPEN, + UI_CURSOR_TOOLPLAY, + UI_CURSOR_TOOLPAUSE, + UI_CURSOR_TOOLMEDIAOPEN, + UI_CURSOR_PIPETTE, + UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) +}; + +ECursorType getCursorFromString(const std::string& cursor_string); + +#endif // LL_LLCURSORTYPES_H diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp index d37517f..05103dc 100644 --- a/linden/indra/llui/llpanel.cpp +++ b/linden/indra/llui/llpanel.cpp @@ -982,12 +982,12 @@ void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void } } -void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*)) +void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value) { LLTextBox* textbox = getChild(id); if (textbox) { - textbox->setClickedCallback(function); + textbox->setClickedCallback(function, value); } } diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h index 46022e5..8dea9b1 100644 --- a/linden/indra/llui/llpanel.h +++ b/linden/indra/llui/llpanel.h @@ -220,7 +220,7 @@ public: // LLButton void childSetAction(const std::string& id, void(*function)(void*), void* value); - void childSetActionTextbox(const std::string& id, void(*function)(void*)); + void childSetActionTextbox(const std::string& id, void(*function)(void*), void* value = NULL); void childSetControlName(const std::string& id, const std::string& control_name); // Error reporting diff --git a/linden/indra/llui/lltextbox.cpp b/linden/indra/llui/lltextbox.cpp index f43b7d2..e45f97b 100644 --- a/linden/indra/llui/lltextbox.cpp +++ b/linden/indra/llui/lltextbox.cpp @@ -33,6 +33,7 @@ #include "lltextbox.h" #include "lluictrlfactory.h" #include "llfocusmgr.h" +#include "llwindow.h" static LLRegisterWidget r("text"); @@ -193,12 +194,14 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) { + BOOL handled = LLView::handleHover(x,y,mask); if(mHoverActive) { mHasHover = TRUE; // This should be set every frame during a hover. - return TRUE; + getWindow()->setCursor(UI_CURSOR_ARROW); } - return LLView::handleHover(x,y,mask); + + return (handled || mHasHover); } void LLTextBox::setText(const LLStringExplicit& text) diff --git a/linden/indra/llui/lltextbox.h b/linden/indra/llui/lltextbox.h index 83e4a9b..aac5344 100644 --- a/linden/indra/llui/lltextbox.h +++ b/linden/indra/llui/lltextbox.h @@ -88,8 +88,7 @@ public: void setVPad(S32 pixels) { mVPad = pixels; } void setRightAlign() { mHAlign = LLFontGL::RIGHT; } void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } - void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button - void setCallbackUserData( void* data ) { mCallbackUserData = data; } + void setClickedCallback( void (*cb)(void *data), void* data = NULL ){ mClickedCallback = cb; mCallbackUserData = data; } // mouse down and up within button const LLFontGL* getFont() const { return mFontGL; } diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 95cce60..8fa253a 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -3605,13 +3605,13 @@ void LLTextEditor::appendColoredText(const std::string &new_text, style->setVisible(true); style->setColor(color); style->setFontName(font_name); - appendStyledText(new_text, allow_undo, prepend_newline, &style); + appendStyledText(new_text, allow_undo, prepend_newline, style); } void LLTextEditor::appendStyledText(const std::string &new_text, - bool allow_undo, + bool allow_undo, bool prepend_newline, - const LLStyleSP *stylep) + const LLStyleSP stylep) { if(mParseHTML) { @@ -3626,14 +3626,14 @@ void LLTextEditor::appendStyledText(const std::string &new_text, html->setColor(mLinkColor); if (stylep) { - html->setFontName((*stylep)->getFontString()); + html->setFontName(stylep->getFontString()); } html->mUnderline = TRUE; if (start > 0) appendText(text.substr(0,start),allow_undo, prepend_newline, stylep); html->setLinkHREF(text.substr(start,end-start)); - appendText(text.substr(start, end-start),allow_undo, prepend_newline, &html); - if (end < (S32)text.length()) + appendText(text.substr(start, end-start),allow_undo, prepend_newline, html); + if (end < (S32)text.length()) { text = text.substr(end,text.length() - end); end=0; @@ -3653,7 +3653,7 @@ void LLTextEditor::appendStyledText(const std::string &new_text, // Appends new text to end of document void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool prepend_newline, - const LLStyleSP *stylep) + const LLStyleSP stylep) { // Save old state BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); @@ -3685,7 +3685,7 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { S32 segment_start = old_length; S32 segment_end = getLength(); - LLTextSegment* segment = new LLTextSegment(*stylep, segment_start, segment_end ); + LLTextSegment* segment = new LLTextSegment(stylep, segment_start, segment_end ); mSegments.push_back(segment); } diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h index 0777e5f..7e93de1 100644 --- a/linden/indra/llui/lltexteditor.h +++ b/linden/indra/llui/lltexteditor.h @@ -146,16 +146,16 @@ public: void insertText(const std::string &text); // appends text at end void appendText(const std::string &wtext, bool allow_undo, bool prepend_newline, - const LLStyleSP *stylep = NULL); + const LLStyleSP stylep = NULL); - void appendColoredText(const std::string &wtext, bool allow_undo, + void appendColoredText(const std::string &wtext, bool allow_undo, bool prepend_newline, const LLColor4 &color, const std::string& font_name = LLStringUtil::null); // if styled text starts a line, you need to prepend a newline. - void appendStyledText(const std::string &new_text, bool allow_undo, + void appendStyledText(const std::string &new_text, bool allow_undo, bool prepend_newline, - const LLStyleSP *stylep = NULL); + const LLStyleSP stylep = NULL); // Removes text from the end of document // Does not change highlight or cursor position. diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 78bf168..e3652b7 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -85,7 +85,8 @@ LLView::LLView() : mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -102,7 +103,8 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) : mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -123,7 +125,8 @@ LLView::LLView( mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -657,7 +660,7 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask) if( !handled && blockMouseEvent(x, y) ) { - LLUI::sWindow->setCursor(UI_CURSOR_ARROW); + LLUI::sWindow->setCursor(mHoverCursor); lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; handled = TRUE; } @@ -2622,7 +2625,14 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent) node->getAttributeBOOL("visible", visible); setVisible(visible); } - + + if (node->hasAttribute("hover_cursor")) + { + std::string cursor_string; + node->getAttributeString("hover_cursor", cursor_string); + mHoverCursor = getCursorFromString(cursor_string); + } + node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect); node->getAttributeBOOL("mouse_opaque", mMouseOpaque); diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h index da7f164..df34a3e 100644 --- a/linden/indra/llui/llview.h +++ b/linden/indra/llui/llview.h @@ -51,6 +51,7 @@ #include "llxmlnode.h" #include "stdenums.h" #include "lluistring.h" +#include "llcursortypes.h" const U32 FOLLOWS_NONE = 0x00; const U32 FOLLOWS_LEFT = 0x01; @@ -653,7 +654,9 @@ private: mutable dummy_widget_map_t mDummyWidgets; boost::signals::connection mControlConnection; - + + ECursorType mHoverCursor; + public: static BOOL sDebugRects; // Draw debug rects behind everything. static BOOL sDebugKeys; diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index 821de2f..0acbcb9 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h @@ -35,48 +35,7 @@ #include "llrect.h" #include "llcoord.h" #include "llstring.h" - - -enum ECursorType { - UI_CURSOR_ARROW, - UI_CURSOR_WAIT, - UI_CURSOR_HAND, - UI_CURSOR_IBEAM, - UI_CURSOR_CROSS, - UI_CURSOR_SIZENWSE, - UI_CURSOR_SIZENESW, - UI_CURSOR_SIZEWE, - UI_CURSOR_SIZENS, - UI_CURSOR_NO, - UI_CURSOR_WORKING, - UI_CURSOR_TOOLGRAB, - UI_CURSOR_TOOLLAND, - UI_CURSOR_TOOLFOCUS, - UI_CURSOR_TOOLCREATE, - UI_CURSOR_ARROWDRAG, - UI_CURSOR_ARROWCOPY, // drag with copy - UI_CURSOR_ARROWDRAGMULTI, - UI_CURSOR_ARROWCOPYMULTI, // drag with copy - UI_CURSOR_NOLOCKED, - UI_CURSOR_ARROWLOCKED, - UI_CURSOR_GRABLOCKED, - UI_CURSOR_TOOLTRANSLATE, - UI_CURSOR_TOOLROTATE, - UI_CURSOR_TOOLSCALE, - UI_CURSOR_TOOLCAMERA, - UI_CURSOR_TOOLPAN, - UI_CURSOR_TOOLZOOMIN, - UI_CURSOR_TOOLPICKOBJECT3, - UI_CURSOR_TOOLSIT, - UI_CURSOR_TOOLBUY, - UI_CURSOR_TOOLPAY, - UI_CURSOR_TOOLOPEN, - UI_CURSOR_TOOLPLAY, - UI_CURSOR_TOOLPAUSE, - UI_CURSOR_TOOLMEDIAOPEN, - UI_CURSOR_PIPETTE, - UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) -}; +#include "llcursortypes.h" class LLSplashScreen; diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 2f2bdd1..6f54a41 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -168,6 +168,7 @@ set(viewer_SOURCE_FILES llfloatermute.cpp llfloaternamedesc.cpp llfloaternewim.cpp + llfloaterobjectiminfo.cpp llfloateropenobject.cpp llfloaterparcel.cpp llfloaterpermissionsmgr.cpp @@ -566,6 +567,7 @@ set(viewer_HEADER_FILES llfloatermute.h llfloaternamedesc.h llfloaternewim.h + llfloaterobjectiminfo.h llfloateropenobject.h llfloaterparcel.h llfloaterpermissionsmgr.h @@ -1086,6 +1088,7 @@ set(viewer_XUI_FILES skins/default/xui/en-us/floater_name_description.xml skins/default/xui/en-us/floater_new_im.xml skins/default/xui/en-us/floater_new_outfit_dialog.xml + skins/default/xui/en-us/floater_object_im_info.xml skins/default/xui/en-us/floater_openobject.xml skins/default/xui/en-us/floater_pay_object.xml skins/default/xui/en-us/floater_pay.xml diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 39b482b..f8a5d71 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -3117,7 +3117,24 @@ 0 - FloaterOpenObjectRect + + FloaterObjectIMInfo + + Comment + Rectangle for floater object im info windows + Persist + 1 + Type + Rect + Value + + 0 + 300 + 300 + 0 + + + FloaterOpenObjectRect Comment Rectangle for Open Object window diff --git a/linden/indra/newview/llfloaterabout.cpp b/linden/indra/newview/llfloaterabout.cpp index 37e9c54..0954a70 100644 --- a/linden/indra/newview/llfloaterabout.cpp +++ b/linden/indra/newview/llfloaterabout.cpp @@ -119,7 +119,7 @@ LLFloaterAbout::LLFloaterAbout() __DATE__, __TIME__); support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); - support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), FALSE, FALSE, &viewer_link_style); + support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style); std::string support; support.append("\n\n"); @@ -155,7 +155,7 @@ LLFloaterAbout::LLFloaterAbout() support.append("\n"); support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); - support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), FALSE, FALSE, &server_link_style); + support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); support = "\n\n"; } diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index f624ec3..d0713bc 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp @@ -189,7 +189,7 @@ void LLFloaterChat::updateConsoleVisibility() || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? } -void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LLColor4& color) +void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& color) { std::string line = chat.mText; bool prepend_newline = true; @@ -199,16 +199,22 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LL prepend_newline = false; } - // If the msg is not from an agent (not yourself though), + // If the msg is from an agent (not yourself though), // extract out the sender name and replace it with the hotlinked name. if (chat.mSourceType == CHAT_SOURCE_AGENT && - chat.mFromID != LLUUID::null && - (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0)) + chat.mFromID != LLUUID::null) + { + chat.mURL = llformat("secondlife:///app/agent/%s/about",chat.mFromID.asString().c_str()); + } + + // If the chat line has an associated url, link it up to the name. + if (!chat.mURL.empty() + && (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0)) { std::string start_line = line.substr(0, chat.mFromName.length() + 1); line = line.substr(chat.mFromName.length() + 1); - const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID); - edit->appendStyledText(start_line, false, prepend_newline, &sourceStyle); + const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID,chat.mURL); + edit->appendStyledText(start_line, false, prepend_newline, sourceStyle); prepend_newline = false; } edit->appendColoredText(line, false, prepend_newline, color); diff --git a/linden/indra/newview/llfloaterobjectiminfo.cpp b/linden/indra/newview/llfloaterobjectiminfo.cpp new file mode 100644 index 0000000..6cbc4e2 --- /dev/null +++ b/linden/indra/newview/llfloaterobjectiminfo.cpp @@ -0,0 +1,204 @@ +/** + * @file llfloaterobjectiminfo.cpp + * @brief A floater with information about an object that sent an IM. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterobjectiminfo.h" + +#include "llagentdata.h" +#include "llcachename.h" +#include "llcommandhandler.h" +#include "llfloater.h" +#include "llfloateravatarinfo.h" +#include "llfloatergroupinfo.h" +#include "llfloatermute.h" +#include "llmutelist.h" +#include "llsdutil.h" +#include "lluictrlfactory.h" +#include "llurldispatcher.h" +#include "llviewercontrol.h" + +//////////////////////////////////////////////////////////////////////////// +// LLFloaterObjectIMInfo +class LLFloaterObjectIMInfo : public LLFloater, public LLFloaterSingleton +{ +public: + LLFloaterObjectIMInfo(const LLSD& sd); + virtual ~LLFloaterObjectIMInfo() { }; + + BOOL postBuild(void); + + void update(const LLUUID& id, const std::string& name, const std::string& slurl, const LLUUID& owner, bool owner_is_group); + + // UI Handlers + static void onClickMap(void* data); + static void onClickOwner(void* data); + static void onClickMute(void* data); + + static void nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data); + +private: + LLUUID mObjectID; + std::string mObjectName; + std::string mSlurl; + LLUUID mOwnerID; + std::string mOwnerName; + bool mOwnerIsGroup; +}; + +LLFloaterObjectIMInfo::LLFloaterObjectIMInfo(const LLSD& seed) +: mObjectID(), mObjectName(), mSlurl(), mOwnerID(), mOwnerName(), mOwnerIsGroup(false) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_im_info.xml"); + + if (getRect().mLeft == 0 + && getRect().mBottom == 0) + { + center(); + } +} + +BOOL LLFloaterObjectIMInfo::postBuild(void) +{ + childSetAction("Mute",onClickMute,this); + childSetActionTextbox("OwnerName",onClickOwner, this); + childSetActionTextbox("Slurl",onClickMap, this); + + return true; +} + +void LLFloaterObjectIMInfo::update(const LLUUID& object_id, const std::string& name, const std::string& slurl, const LLUUID& owner_id, bool owner_is_group) +{ + // When talking to an old region we won't have a slurl. + // The object id isn't really the object id either but we don't use it so who cares. + bool have_slurl = !slurl.empty(); + childSetVisible("Unknown_Slurl",!have_slurl); + childSetVisible("Slurl",have_slurl); + + childSetText("ObjectName",name); + childSetText("Slurl",slurl); + childSetText("OwnerName",std::string("")); + + bool my_object = (owner_id == gAgentID); + childSetEnabled("Mute",!my_object); + + mObjectID = object_id; + mObjectName = name; + mSlurl = slurl; + mOwnerID = owner_id; + mOwnerIsGroup = owner_is_group; + + if (gCacheName) gCacheName->get(owner_id,owner_is_group,nameCallback,this); +} + +//static +void LLFloaterObjectIMInfo::onClickMap(void* data) +{ + LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; + + std::ostringstream link; + link << "secondlife://" << self->mSlurl; + LLURLDispatcher::dispatch(link.str(),false); +} + +//static +void LLFloaterObjectIMInfo::onClickOwner(void* data) +{ + LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; + if (self->mOwnerIsGroup) + { + LLFloaterGroupInfo::showFromUUID(self->mOwnerID); + } + else + { + LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + } +} + +//static +void LLFloaterObjectIMInfo::onClickMute(void* data) +{ + LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; + + LLMute::EType mute_type = (self->mOwnerIsGroup) ? LLMute::GROUP : LLMute::AGENT; + LLMute mute(self->mOwnerID, self->mOwnerName, mute_type); + LLMuteList::getInstance()->add(mute); + LLFloaterMute::showInstance(); + self->close(); +} + +//static +void LLFloaterObjectIMInfo::nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) +{ + LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; + self->mOwnerName = first; + if (!last.empty()) + { + self->mOwnerName += " " + last; + } + + self->childSetText("OwnerName",self->mOwnerName); +} + +//////////////////////////////////////////////////////////////////////////// +// LLObjectIMInfo +void LLObjectIMInfo::show(const LLUUID &object_id, const std::string &name, const std::string &location, const LLUUID &owner_id, bool owner_is_group) +{ + LLFloaterObjectIMInfo* im_info_floater = LLFloaterObjectIMInfo::showInstance(); + im_info_floater->update(object_id,name,location,owner_id,owner_is_group); +} + +//////////////////////////////////////////////////////////////////////////// +// LLObjectIMInfoHandler +class LLObjectIMInfoHandler : public LLCommandHandler +{ +public: + LLObjectIMInfoHandler() : LLCommandHandler("objectim", false) { } + + bool handle(const LLSD& tokens, const LLSD& query_map); +}; + +// Creating the object registers with the dispatcher. +LLObjectIMInfoHandler gObjectIMHandler; + +// ex. secondlife:///app/objectim/9426adfc-9c17-8765-5f09-fdf19957d003?owner=a112d245-9095-4e9c-ace4-ffa31717f934&groupowned=true&slurl=ahern/123/123/123&name=Object +bool LLObjectIMInfoHandler::handle(const LLSD &tokens, const LLSD &query_map) +{ + LLUUID task_id = tokens[0].asUUID(); + std::string name = query_map["name"].asString(); + std::string slurl = query_map["slurl"].asString(); + LLUUID owner = query_map["owner"].asUUID(); + bool group_owned = query_map.has("groupowned"); + + LLObjectIMInfo::show(task_id,name,slurl,owner,group_owned); + + return true; +} diff --git a/linden/indra/newview/llfloaterobjectiminfo.h b/linden/indra/newview/llfloaterobjectiminfo.h new file mode 100644 index 0000000..0564c3e --- /dev/null +++ b/linden/indra/newview/llfloaterobjectiminfo.h @@ -0,0 +1,45 @@ +/** + * @file llfloaterobjectiminfo.h + * @brief Shows a dialog with information about an object. + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATEROBJECTIMINFO_H +#define LL_LLFLOATEROBJECTIMINFO_H + +namespace LLObjectIMInfo +{ + // Show an LLFloaterObjectIMInfo for this object. + static void show(const LLUUID& object_id, + const std::string& name, + const std::string& location, + const LLUUID& owner_id, + bool owner_is_group); +}; + +#endif // LL_LLFLOATERURLDISPLAY_H diff --git a/linden/indra/newview/llgroupnotify.cpp b/linden/indra/newview/llgroupnotify.cpp index 37897eb..2f8e838 100644 --- a/linden/indra/newview/llgroupnotify.cpp +++ b/linden/indra/newview/llgroupnotify.cpp @@ -220,8 +220,8 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); - text->appendStyledText(subject,false,false,&headerstyle); - text->appendStyledText(time_buf,false,false,&datestyle); + text->appendStyledText(subject,false,false,headerstyle); + text->appendStyledText(time_buf,false,false,datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index f30ae8c..16b0388 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp @@ -1543,8 +1543,8 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 else { // Convert the name to a hotlink and add to message. - const LLStyleSP &source_style = LLStyleMap::instance().lookup(source); - mHistoryEditor->appendStyledText(name,false,prepend_newline,&source_style); + const LLStyleSP &source_style = LLStyleMap::instance().lookupAgent(source); + mHistoryEditor->appendStyledText(name,false,prepend_newline,source_style); } prepend_newline = false; } diff --git a/linden/indra/newview/llstylemap.cpp b/linden/indra/newview/llstylemap.cpp index 6a3415f..e3bd3cd 100644 --- a/linden/indra/newview/llstylemap.cpp +++ b/linden/indra/newview/llstylemap.cpp @@ -47,13 +47,13 @@ LLStyleMap::~LLStyleMap() LLStyleMap &LLStyleMap::instance() { - static LLStyleMap mStyleMap; - return mStyleMap; + static LLStyleMap style_map; + return style_map; } // This is similar to the [] accessor except that if the entry doesn't already exist, // then this will create the entry. -const LLStyleSP &LLStyleMap::lookup(const LLUUID &source) +const LLStyleSP &LLStyleMap::lookupAgent(const LLUUID &source) { // Find this style in the map or add it if not. This map holds links to residents' profiles. if (find(source) == end()) @@ -77,6 +77,37 @@ const LLStyleSP &LLStyleMap::lookup(const LLUUID &source) return (*this)[source]; } +// This is similar to lookupAgent for any generic URL encoded style. +const LLStyleSP &LLStyleMap::lookup(const LLUUID& id, const std::string& link) +{ + // Find this style in the map or add it if not. + iterator iter = find(id); + if (iter == end()) + { + LLStyleSP style(new LLStyle); + style->setVisible(true); + style->setFontName(LLStringUtil::null); + if (id != LLUUID::null && !link.empty()) + { + style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + style->setLinkHREF(link); + } + else + style->setColor(LLColor4::white); + (*this)[id] = style; + } + else + { + LLStyleSP style = (*iter).second; + if ( style->getLinkHREF() != link ) + { + style->setLinkHREF(link); + } + } + + return (*this)[id]; +} + void LLStyleMap::update() { for (style_map_t::iterator iter = begin(); iter != end(); ++iter) diff --git a/linden/indra/newview/llstylemap.h b/linden/indra/newview/llstylemap.h index a38d253..f1eada9 100644 --- a/linden/indra/newview/llstylemap.h +++ b/linden/indra/newview/llstylemap.h @@ -47,7 +47,8 @@ public: LLStyleMap(); ~LLStyleMap(); // Just like the [] accessor but it will add the entry in if it doesn't exist. - const LLStyleSP &lookup(const LLUUID &source); + const LLStyleSP &lookupAgent(const LLUUID &source); + const LLStyleSP &lookup(const LLUUID &source, const std::string& link); static LLStyleMap &instance(); // Forces refresh of the entries, call when something changes (e.g. link color). diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 3fb8e9a..26dd86c 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -1802,15 +1802,51 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) break; case IM_FROM_TASK: - if (is_busy && !is_owned_by_me) { - return; + if (is_busy && !is_owned_by_me) + { + return; + } + chat.mText = name + separator_string + message.substr(message_offset); + chat.mFromName = name; + + // Build a link to open the object IM info window. + std::string location = ll_safe_string((char*)binary_bucket,binary_bucket_size); + + LLSD query_string; + query_string["owner"] = from_id; + query_string["slurl"] = location.c_str(); + query_string["name"] = name; + if (from_group) + { + query_string["groupowned"] = "true"; + } + + if (session_id.notNull()) + { + chat.mFromID = session_id; + } + else + { + // This message originated on a region without the updated code for task id and slurl information. + // We just need a unique ID for this object that isn't the owner ID. + // If it is the owner ID it will overwrite the style that contains the link to that owner's profile. + // This isn't ideal - it will make 1 style for all objects owned by the the same person/group. + // This works because the only thing we can really do in this case is show the owner name and link to their profile. + chat.mFromID = from_id ^ gAgent.getSessionID(); + } + + std::ostringstream link; + link << "secondlife:///app/objectim/" << session_id + << LLURI::mapToQueryString(query_string); + + chat.mURL = link.str(); + + // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because + // IMs from objcts don't open IM sessions. + chat.mSourceType = CHAT_SOURCE_OBJECT; + LLFloaterChat::addChat(chat, FALSE, FALSE); } - chat.mText = name + separator_string + message.substr(message_offset); - // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because - // IMs from objcts don't open IM sessions. - chat.mSourceType = CHAT_SOURCE_OBJECT; - LLFloaterChat::addChat(chat, FALSE, FALSE); break; case IM_FROM_TASK_AS_ALERT: if (is_busy && !is_owned_by_me) diff --git a/linden/indra/newview/skins/default/colors_base.xml b/linden/indra/newview/skins/default/colors_base.xml index 42cb0ac..d0f1049 100644 --- a/linden/indra/newview/skins/default/colors_base.xml +++ b/linden/indra/newview/skins/default/colors_base.xml @@ -69,7 +69,9 @@ - + + + diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_object_im_info.xml b/linden/indra/newview/skins/default/xui/en-us/floater_object_im_info.xml new file mode 100644 index 0000000..615b7d1 --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/floater_object_im_info.xml @@ -0,0 +1,54 @@ + + + + + Object: + + + + + Location: + + + + + + (Location Info Not Available) + + + + Owner: + + + +