diff options
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/llfloater.cpp | 31 | ||||
-rwxr-xr-x | indra/llui/llfloater.h | 6 | ||||
-rwxr-xr-x | indra/llui/llscrolllistctrl.cpp | 2 | ||||
-rwxr-xr-x | indra/llui/lltextbase.cpp | 4 | ||||
-rwxr-xr-x | indra/llui/lltextbase.h | 5 | ||||
-rwxr-xr-x | indra/llui/lltexteditor.cpp | 2 | ||||
-rwxr-xr-x | indra/llui/lltoolbar.cpp | 26 | ||||
-rwxr-xr-x | indra/llui/lltoolbar.h | 39 | ||||
-rwxr-xr-x | indra/llui/llurlaction.cpp | 6 | ||||
-rwxr-xr-x | indra/llui/llurlaction.h | 4 | ||||
-rwxr-xr-x | indra/llui/llurlentry.cpp | 3 | ||||
-rwxr-xr-x | indra/llui/llview.cpp | 20 | ||||
-rw-r--r-- | indra/llui/llviewereventrecorder.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llviewereventrecorder.h | 2 |
14 files changed, 125 insertions, 27 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 6e6bcd6ab5..c1f8a077b5 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2742,8 +2742,6 @@ void LLFloaterView::refresh() } } -const S32 FLOATER_MIN_VISIBLE_PIXELS = 16; - void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars/* = false*/) { if (floater->getParent() != this) @@ -2796,11 +2794,32 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out } } + const LLRect& left_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_LEFT]; + const LLRect& bottom_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_BOTTOM]; + const LLRect& right_toolbar_rect = mToolbarRects[LLToolBarEnums::TOOLBAR_RIGHT]; + const LLRect& floater_rect = floater->getRect(); + + S32 delta_left = left_toolbar_rect.notEmpty() ? left_toolbar_rect.mRight - floater_rect.mRight : 0; + S32 delta_bottom = bottom_toolbar_rect.notEmpty() ? bottom_toolbar_rect.mTop - floater_rect.mTop : 0; + S32 delta_right = right_toolbar_rect.notEmpty() ? right_toolbar_rect.mLeft - floater_rect.mLeft : 0; + // move window fully onscreen if (floater->translateIntoRect( snap_in_toolbars ? getSnapRect() : gFloaterView->getRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX )) { floater->clearSnapTarget(); } + else if (delta_left > 0 && floater_rect.mTop < left_toolbar_rect.mTop && floater_rect.mBottom > left_toolbar_rect.mBottom) + { + floater->translate(delta_left, 0); + } + else if (delta_bottom > 0 && floater_rect.mLeft > bottom_toolbar_rect.mLeft && floater_rect.mRight < bottom_toolbar_rect.mRight) + { + floater->translate(0, delta_bottom); + } + else if (delta_right < 0 && floater_rect.mTop < right_toolbar_rect.mTop && floater_rect.mBottom > right_toolbar_rect.mBottom) + { + floater->translate(delta_right, 0); + } } void LLFloaterView::draw() @@ -3000,6 +3019,14 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) LLFloaterReg::blockShowFloaters(false); } +void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect) +{ + if (tb < LLToolBarEnums::TOOLBAR_COUNT) + { + mToolbarRects[tb] = toolbar_rect; + } +} + void LLFloater::setInstanceName(const std::string& name) { if (name != mInstanceName) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 75715ef296..ccaae1d02b 100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -32,6 +32,7 @@ #define LL_FLOATER_H #include "llpanel.h" +#include "lltoolbar.h" #include "lluuid.h" //#include "llnotificationsutil.h" #include <set> @@ -514,6 +515,8 @@ private: // LLFloaterView // Parent of all floating panels +const S32 FLOATER_MIN_VISIBLE_PIXELS = 16; + class LLFloaterView : public LLUICtrl { public: @@ -572,10 +575,13 @@ public: void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; } LLFloater* getFrontmostClosableFloater(); + void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect); + private: void hiddenFloaterClosed(LLFloater* floater); LLRect mLastSnapRect; + LLRect mToolbarRects[LLToolBarEnums::TOOLBAR_COUNT]; LLHandle<LLView> mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 6e03f604a2..594e1e150b 100755 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1855,7 +1855,7 @@ void LLScrollListCtrl::showNameDetails(std::string id, bool is_group) // open the resident's details or the group details std::string sltype = is_group ? "group" : "agent"; std::string slurl = "secondlife:///app/" + sltype + "/" + id + "/about"; - LLUrlAction::clickAction(slurl); + LLUrlAction::clickAction(slurl, true); } void LLScrollListCtrl::copyNameToClipboard(std::string id, bool is_group) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 5ec4cf4fe5..4144a42fd6 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -167,6 +167,7 @@ LLTextBase::Params::Params() max_text_length("max_length", 255), font_shadow("font_shadow"), wrap("wrap"), + trusted_content("trusted_content", true), use_ellipses("use_ellipses", false), parse_urls("parse_urls", false), parse_highlights("parse_highlights", false) @@ -211,6 +212,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mLineSpacingPixels(p.line_spacing.pixels), mClip(p.clip), mClipPartial(p.clip_partial && !p.allow_scroll), + mTrustedContent(p.trusted_content), mTrackEnd( p.track_end ), mScrollIndex(-1), mSelectionStart( 0 ), @@ -3164,7 +3166,7 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) // Only process the click if it's actually in this segment, not to the right of the end-of-line. if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { - LLUrlAction::clickAction(getStyle()->getLinkHREF()); + LLUrlAction::clickAction(getStyle()->getLinkHREF(), mEditor.isContentTrusted()); return TRUE; } } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index a74e97cac8..3603f55c3f 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -291,7 +291,8 @@ public: parse_urls, parse_highlights, clip, - clip_partial; + clip_partial, + trusted_content; Optional<S32> v_pad, h_pad; @@ -361,6 +362,7 @@ public: bool getWordWrap() { return mWordWrap; } bool getUseEllipses() { return mUseEllipses; } bool truncate(); // returns true of truncation occurred + bool isContentTrusted() {return mTrustedContent;} // TODO: move into LLTextSegment? void createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url @@ -634,6 +636,7 @@ protected: bool mBGVisible; // render background? bool mClip; // clip text to widget rect bool mClipPartial; // false if we show lines that are partially inside bounding rect + bool mTrustedContent; // if false, does not allow to execute SURL links from this editor bool mPlainText; // didn't use Image or Icon segments bool mAutoIndent; S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 62140dd9d6..81d9fd1ec9 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1620,7 +1620,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) } } - if (handled) + if (handled && !gFocusMgr.getMouseCapture()) { updatePrimary(); } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 6bfe113933..e692d9847a 100755 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -118,7 +118,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mButtonLeaveSignal(NULL), mButtonRemoveSignal(NULL), mDragAndDropTarget(false), - mCaretIcon(NULL) + mCaretIcon(NULL), + mCenterPanel(NULL) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; @@ -200,14 +201,15 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) center_panel_p.auto_resize = false; center_panel_p.user_resize = false; center_panel_p.mouse_opaque = false; - LLLayoutPanel* center_panel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p); - mCenteringStack->addChild(center_panel); + mCenterPanel = LLUICtrlFactory::create<LLCenterLayoutPanel>(center_panel_p); + mCenteringStack->addChild(mCenterPanel); LLPanel::Params button_panel_p(p.button_panel); - button_panel_p.rect = center_panel->getLocalRect(); - button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; + button_panel_p.rect = mCenterPanel->getLocalRect(); + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p); - center_panel->addChild(mButtonPanel); + mCenterPanel->setButtonPanel(mButtonPanel); + mCenterPanel->addChild(mButtonPanel); mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); @@ -1244,3 +1246,15 @@ const std::string LLToolBarButton::getToolTip() const return tooltip; } +void LLToolBar::LLCenterLayoutPanel::handleReshape(const LLRect& rect, bool by_user) +{ + LLLayoutPanel::handleReshape(rect, by_user); + + if (!mReshapeCallback.empty()) + { + LLRect r; + localRectToOtherView(mButtonPanel->getRect(), &r, gFloaterView); + r.stretch(FLOATER_MIN_VISIBLE_PIXELS); + mReshapeCallback(mLocationId, r); + } +} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 743951a41f..9e17eaed8b 100755 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -125,6 +125,19 @@ namespace LLToolBarEnums SIDE_TOP, }; + enum EToolBarLocation + { + TOOLBAR_NONE = 0, + TOOLBAR_LEFT, + TOOLBAR_RIGHT, + TOOLBAR_BOTTOM, + + TOOLBAR_COUNT, + + TOOLBAR_FIRST = TOOLBAR_LEFT, + TOOLBAR_LAST = TOOLBAR_BOTTOM, + }; + LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType); } @@ -150,6 +163,30 @@ class LLToolBar { friend class LLToolBarButton; public: + + class LLCenterLayoutPanel : public LLLayoutPanel + { + public: + typedef struct LLLayoutPanel::Params Params; + typedef boost::function<void(LLToolBarEnums::EToolBarLocation tb, const LLRect& rect)> reshape_callback_t; + + virtual ~LLCenterLayoutPanel() {} + /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); + + void setLocationId(LLToolBarEnums::EToolBarLocation id) { mLocationId = id; } + void setReshapeCallback(reshape_callback_t cb) { mReshapeCallback = cb; } + void setButtonPanel(LLPanel * panel) { mButtonPanel = panel; } + + protected: + friend class LLUICtrlFactory; + LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {} + + private: + reshape_callback_t mReshapeCallback; + LLToolBarEnums::EToolBarLocation mLocationId; + LLPanel * mButtonPanel; + }; + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { Mandatory<LLToolBarEnums::ButtonType> button_display_mode; @@ -198,6 +235,7 @@ public: void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } bool isReadOnly() const { return mReadOnly; } + LLCenterLayoutPanel * getCenterLayoutPanel() const { return mCenterPanel; } LLToolBarButton* createButton(const LLCommandId& id); @@ -270,6 +308,7 @@ private: // related widgets LLLayoutStack* mCenteringStack; + LLCenterLayoutPanel* mCenterPanel; LLPanel* mButtonPanel; LLHandle<class LLContextMenu> mPopupMenuHandle; LLHandle<class LLView> mRemoveButtonHandle; diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index 23e574cb74..12537d9dd1 100755 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -87,14 +87,14 @@ void LLUrlAction::executeSLURL(std::string url) { if (sExecuteSLURLCallback) { - sExecuteSLURLCallback(url); + sExecuteSLURLCallback(url ,true); } } -void LLUrlAction::clickAction(std::string url) +void LLUrlAction::clickAction(std::string url, bool trusted_content) { // Try to handle as SLURL first, then http Url - if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url) ) + if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url, trusted_content) ) { if (sOpenURLCallback) { diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index e731376b95..5f3626490c 100755 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -66,7 +66,7 @@ public: static void showLocationOnMap(std::string url); /// perform the appropriate action for left-clicking on a Url - static void clickAction(std::string url); + static void clickAction(std::string url, bool trusted_content); /// copy the label for a Url to the clipboard static void copyLabelToClipboard(std::string url); @@ -86,7 +86,7 @@ public: /// specify the callbacks to enable this class's functionality typedef boost::function<void (const std::string&)> url_callback_t; - typedef boost::function<bool(const std::string& url)> execute_url_callback_t; + typedef boost::function<bool(const std::string& url, bool trusted_content)> execute_url_callback_t; static void setOpenURLCallback(url_callback_t cb); static void setOpenURLInternalCallback(url_callback_t cb); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b1cc502c4b..840f67968d 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -1067,7 +1067,8 @@ LLUrlEntrySLLabel::LLUrlEntrySLLabel() std::string LLUrlEntrySLLabel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - return getLabelFromWikiLink(url); + std::string label = getLabelFromWikiLink(url); + return (!LLUrlRegistry::instance().hasUrl(label)) ? label : getUrl(url); } std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 20015dca1a..9cc8c951d5 100755 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -645,14 +645,18 @@ void LLView::setVisible(BOOL visible) void LLView::handleVisibilityChange ( BOOL new_visibility ) { BOOL old_visibility; + BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); BOOST_FOREACH(LLView* viewp, mChildList) { // only views that are themselves visible will have their overall visibility affected by their ancestors old_visibility=viewp->getVisible(); - if (old_visibility!=new_visibility) + if(log_visibility_change) { - LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); + if (old_visibility!=new_visibility) + { + LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); + } } if (old_visibility) @@ -660,11 +664,13 @@ void LLView::handleVisibilityChange ( BOOL new_visibility ) viewp->handleVisibilityChange ( new_visibility ); } - // Consider changing returns to confirm success and know which widget grabbed it - // For now assume success and log at highest xui possible - // NOTE we log actual state - which may differ if it somehow failed to set visibility - lldebugs << "LLView::handleVisibilityChange - now: " << getVisible() << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << llendl; - + if(log_visibility_change) + { + // Consider changing returns to confirm success and know which widget grabbed it + // For now assume success and log at highest xui possible + // NOTE we log actual state - which may differ if it somehow failed to set visibility + lldebugs << "LLView::handleVisibilityChange - now: " << getVisible() << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << llendl; + } } } diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index a352f621eb..546a0f5866 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -31,7 +31,7 @@ LLViewerEventRecorder::LLViewerEventRecorder() { clear(UNDEFINED); - + logEvents = false; // Remove any previous event log file std::string old_log_ui_events_to_llsd_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife_Events_log.old"); LLFile::remove(old_log_ui_events_to_llsd_file); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 72ca643ced..375efcc3de 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -65,7 +65,7 @@ class LLViewerEventRecorder : public LLSingleton<LLViewerEventRecorder> std::string get_xui(); void update_xui(std::string xui); - bool getLoggingStatus(); + bool getLoggingStatus(){return logEvents;}; void setEventLoggingOn(); void setEventLoggingOff(); |