diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llkeywords.h | 2 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 4 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llsdparam.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llsdparam.h | 7 | ||||
-rw-r--r-- | indra/llui/llspinctrl.h | 3 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 2 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 47 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 89 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 32 | ||||
-rw-r--r-- | indra/llui/llurlaction.cpp | 28 | ||||
-rw-r--r-- | indra/llui/llurlaction.h | 21 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llview.h | 2 |
18 files changed, 171 insertions, 99 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 4b0b7c561d..7a5f9f9fd6 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -973,7 +973,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect)) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f); diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 0fcd937361..3396213f1c 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -82,7 +82,7 @@ BOOL LLDockableFloater::postBuild() mForceDocking = true; } - mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + mDockTongue = LLUI::getUIImage("Flyout_Pointer"); LLFloater::setDocked(true); return LLView::postBuild(); } @@ -244,13 +244,13 @@ const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_s switch(dock_side) { case LLDockControl::LEFT: - mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png"); + mDockTongue = LLUI::getUIImage("Flyout_Left"); break; case LLDockControl::RIGHT: - mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png"); + mDockTongue = LLUI::getUIImage("Flyout_Right"); break; default: - mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + mDockTongue = LLUI::getUIImage("Flyout_Pointer"); break; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index d050cd7d7c..ac34015393 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -51,7 +51,7 @@ public: * - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with. * - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close. */ - typedef enum TOKEN_TYPE + enum TOKEN_TYPE { WORD, LINE, diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 3ef8d8ff35..cb237fca7c 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1686,7 +1686,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mSpilloverMenu(NULL), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), - mNeedsArrange(FALSE), + mNeedsArrange(FALSE), + mResetScrollPositionOnShow(true), mShortcutPad(p.shortcut_pad) { typedef boost::tokenizer<boost::char_separator<char> > tokenizer; @@ -3043,7 +3044,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) S32 mouse_x, mouse_y; // Resetting scrolling position - if (menu->isScrollable()) + if (menu->isScrollable() && menu->isScrollPositionOnShowReset()) { menu->mFirstVisibleItem = NULL; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 77db588390..bdae899933 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -516,6 +516,9 @@ public: static class LLMenuHolderGL* sMenuContainer; + void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; } + bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; } + protected: void createSpilloverBranch(); void cleanupSpilloverBranch(); @@ -565,6 +568,7 @@ private: KEY mJumpKey; BOOL mCreateJumpKeys; S32 mShortcutPad; + bool mResetScrollPositionOnShow; }; // end class LLMenuGL diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 8f7025a9a6..d232e27ef2 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1624,7 +1624,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) LLNotificationSet::iterator it=mItems.find(target); if (it == mItems.end()) { - llwarns << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; + LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; return LLNotificationPtr((LLNotification*)NULL); } else diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 6fa90933a4..0e29873bb0 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -36,6 +36,8 @@ static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; static const LLSD NO_VALUE_MARKER; +LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion"); + // // LLParamSDParser // diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index c1cfa98399..3dfc6d020e 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -91,6 +91,8 @@ private: LLSD* mCurWriteSD; }; + +extern LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR; template<typename T> class LLSDParamAdapter : public T { @@ -98,8 +100,11 @@ public: LLSDParamAdapter() {} LLSDParamAdapter(const LLSD& sd) { + LLFastTimer _(FTM_SD_PARAM_ADAPTOR); LLParamSDParser parser; - parser.readSD(sd, *this); + // don't spam for implicit parsing of LLSD, as we want to allow arbitrary freeform data and ignore most of it + bool parse_silently = true; + parser.readSD(sd, *this, parse_silently); } operator LLSD() const diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index d197084e38..87814f838e 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -96,6 +96,9 @@ public: void onUpBtn(const LLSD& data); void onDownBtn(const LLSD& data); + + const LLColor4& getEnabledTextColor() const { return mTextEnabledColor.get(); } + const LLColor4& getDisabledTextColor() const { return mTextDisabledColor.get(); } private: void updateLabelColor(); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 919364be63..3b768166f1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2518,7 +2518,11 @@ BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; } BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; } BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; } BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; } -std::string LLTextSegment::getName() const { return ""; } +const std::string& LLTextSegment::getName() const +{ + static std::string empty_string(""); + return empty_string; +} void LLTextSegment::onMouseCaptureLost() {} void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {} void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {} diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 384d9116fc..b699601908 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -84,7 +84,7 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ std::string getName() const; + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 287e3e2b41..e7642ae190 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -109,6 +109,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadBetween(p.pad_between), mMinGirth(p.min_girth), mPopupMenuHandle(), + mRightMouseTargetButton(NULL), mStartDragItemCallback(NULL), mHandleDragItemCallback(NULL), mHandleDropCallback(NULL), @@ -139,6 +140,7 @@ void LLToolBar::createContextMenu() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit_reg; commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); + commit_reg.add("Toolbars.RemoveSelectedCommand", boost::bind(&LLToolBar::onRemoveSelectedCommand, this)); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_reg; enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); @@ -397,6 +399,20 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) if (handle_it_here) { + // Determine which button the mouse was over during the click in case the context menu action + // is intended to affect the button. + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { + LLRect button_rect; + button->localRectToOtherView(button->getLocalRect(), &button_rect, this); + + if (button_rect.pointInRect(x, y)) + { + mRightMouseTargetButton = button; + break; + } + } + createContextMenu(); LLContextMenu * menu = (LLContextMenu *) mPopupMenuHandle.get(); @@ -446,6 +462,18 @@ void LLToolBar::onSettingEnable(const LLSD& userdata) } } +void LLToolBar::onRemoveSelectedCommand() +{ + llassert(!mReadOnly); + + if (mRightMouseTargetButton) + { + removeCommand(mRightMouseTargetButton->getCommandId()); + + mRightMouseTargetButton = NULL; + } +} + void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type) { bool regenerate_buttons = (mButtonType != button_type); @@ -524,11 +552,11 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) S32 mid_point = (button_rect.mRight + button_rect.mLeft) / 2; if (button_panel_x < mid_point) { - mDragx = button_rect.mLeft - mPadLeft; - mDragy = button_rect.mTop + mPadTop; - } - else - { + mDragx = button_rect.mLeft - mPadLeft; + mDragy = button_rect.mTop + mPadTop; + } + else + { rank++; mDragx = button_rect.mRight + mPadRight - 1; mDragy = button_rect.mTop + mPadTop; @@ -555,12 +583,12 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) { // We hit passed the end of the list so put the insertion point at the end if (orientation == LLLayoutStack::HORIZONTAL) - { + { mDragx = button_rect.mRight + mPadRight; mDragy = button_rect.mTop + mPadTop; - } - else - { + } + else + { mDragx = button_rect.mLeft - mPadLeft; mDragy = button_rect.mBottom - mPadBottom; } @@ -836,6 +864,7 @@ void LLToolBar::createButtons() } mButtons.clear(); mButtonMap.clear(); + mRightMouseTargetButton = NULL; BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index f10f39adc3..51fe23ddd1 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -63,9 +63,11 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); + void reshape(S32 width, S32 height, BOOL called_from_parent = true); void setEnabled(BOOL enabled); void setCommandId(const LLCommandId& id) { mId = id; } + LLCommandId getCommandId() { return mId; } void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } @@ -164,7 +166,8 @@ public: pad_bottom, pad_between, min_girth; - // get rid of this + + // default command set Multiple<LLCommandId::Params> commands; Optional<LLPanel::Params> button_panel; @@ -175,8 +178,6 @@ public: // virtuals void draw(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - int getRankFromPosition(S32 x, S32 y); - int getRankFromPosition(const LLCommandId& id); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -185,15 +186,14 @@ public: std::string& tooltip_msg); static const int RANK_NONE = -1; - bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE); int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found - bool hasCommand(const LLCommandId& commandId) const; - bool enableCommand(const LLCommandId& commandId, bool enabled); - bool stopCommandInProgress(const LLCommandId& commandId); - bool flashCommand(const LLCommandId& commandId, bool flash); + bool hasCommand(const LLCommandId& commandId) const; // is this command bound to a button in this toolbar + bool enableCommand(const LLCommandId& commandId, bool enabled); // enable/disable button bound to the specified command, if it exists in this toolbar + bool stopCommandInProgress(const LLCommandId& commandId); // stop command if it is currently active + bool flashCommand(const LLCommandId& commandId, bool flash); // flash button associated with given command, if in this toolbar - void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } // connects drag and drop behavior to external logic void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } bool isReadOnly() const { return mReadOnly; } @@ -206,69 +206,76 @@ public: boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb); boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb); - void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } + // append the specified string to end of tooltip + void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } LLToolBarEnums::SideType getSideType() const { return mSideType; } bool hasButtons() const { return !mButtons.empty(); } bool isModified() const { return mModified; } -protected: - friend class LLUICtrlFactory; - LLToolBar(const Params&); - ~LLToolBar(); - - void initFromParams(const Params&); - tool_startdrag_callback_t mStartDragItemCallback; - tool_handledrag_callback_t mHandleDragItemCallback; - tool_handledrop_callback_t mHandleDropCallback; - bool mDragAndDropTarget; - int mDragRank; - S32 mDragx, - mDragy, - mDragGirth; + int getRankFromPosition(S32 x, S32 y); + int getRankFromPosition(const LLCommandId& id); -public: // Methods used in loading and saving toolbar settings void setButtonType(LLToolBarEnums::ButtonType button_type); LLToolBarEnums::ButtonType getButtonType() { return mButtonType; } command_id_list_t& getCommandsList() { return mButtonCommands; } void clearCommandsList(); - + private: + friend class LLUICtrlFactory; + LLToolBar(const Params&); + ~LLToolBar(); + + void initFromParams(const Params&); void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); + void onRemoveSelectedCommand(); +private: + // static layout state const bool mReadOnly; + const LLToolBarEnums::SideType mSideType; + const bool mWrap; + const S32 mPadLeft, + mPadRight, + mPadTop, + mPadBottom, + mPadBetween, + mMinGirth; + + // drag and drop state + tool_startdrag_callback_t mStartDragItemCallback; + tool_handledrag_callback_t mHandleDragItemCallback; + tool_handledrop_callback_t mHandleDropCallback; + bool mDragAndDropTarget; + int mDragRank; + S32 mDragx, + mDragy, + mDragGirth; typedef std::list<LLToolBarButton*> toolbar_button_list; + typedef std::map<LLUUID, LLToolBarButton*> command_id_map; toolbar_button_list mButtons; command_id_list_t mButtonCommands; - typedef std::map<LLUUID, LLToolBarButton*> command_id_map; command_id_map mButtonMap; LLToolBarEnums::ButtonType mButtonType; + LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; + + // related widgets LLLayoutStack* mCenteringStack; - LLLayoutStack* mWrapStack; LLPanel* mButtonPanel; - LLToolBarEnums::SideType mSideType; - - bool mWrap; - bool mNeedsLayout; - bool mModified; - S32 mPadLeft, - mPadRight, - mPadTop, - mPadBottom, - mPadBetween, - mMinGirth; + LLHandle<class LLContextMenu> mPopupMenuHandle; - LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; + LLToolBarButton* mRightMouseTargetButton; - LLHandle<class LLContextMenu> mPopupMenuHandle; + bool mNeedsLayout; + bool mModified; button_signal_t* mButtonAddSignal; button_signal_t* mButtonEnterSignal; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 79ad99a770..33bc247987 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -153,11 +153,11 @@ void gl_state_for_2d(S32 width, S32 height) F32 window_width = (F32) width;//gViewerWindow->getWindowWidth(); F32 window_height = (F32) height;//gViewerWindow->getWindowHeight(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); + gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadIdentity(); stop_glerror(); } @@ -537,7 +537,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } } - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); @@ -735,7 +735,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); @@ -788,7 +788,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); @@ -955,10 +955,12 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor if( render_center ) { gGL.color4fv(center_color.mV); + gGL.diffuseColor4fv(center_color.mV); gl_deep_circle( radius, width, steps ); } else { + gGL.diffuseColor4fv(side_color.mV); gl_washer_2d(radius, radius - width, steps, side_color, side_color); gGL.translateUI(0.f, 0.f, width); gl_washer_2d(radius - width, radius, steps, side_color, side_color); @@ -995,10 +997,18 @@ void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha) // ...gray squares gGL.color4f( .7f, .7f, .7f, alpha ); gGL.flush(); - glPolygonStipple( checkerboard ); - LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); - gl_rect_2d(rect); + if (!LLGLSLShader::sNoFixedFunction) + { //polygon stipple is deprecated + glPolygonStipple( checkerboard ); + + LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); + gl_rect_2d(rect); + } + else + { + gl_rect_2d(rect); + } gGL.flush(); } diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index 42b779bd28..fd9b3d9a6d 100644 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -33,28 +33,28 @@ #include "llurlregistry.h" // global state for the callback functions -void (*LLUrlAction::sOpenURLCallback) (const std::string& url) = NULL; -void (*LLUrlAction::sOpenURLInternalCallback) (const std::string& url) = NULL; -void (*LLUrlAction::sOpenURLExternalCallback) (const std::string& url) = NULL; -bool (*LLUrlAction::sExecuteSLURLCallback) (const std::string& url) = NULL; +LLUrlAction::url_callback_t LLUrlAction::sOpenURLCallback; +LLUrlAction::url_callback_t LLUrlAction::sOpenURLInternalCallback; +LLUrlAction::url_callback_t LLUrlAction::sOpenURLExternalCallback; +LLUrlAction::execute_url_callback_t LLUrlAction::sExecuteSLURLCallback; -void LLUrlAction::setOpenURLCallback(void (*cb) (const std::string& url)) +void LLUrlAction::setOpenURLCallback(url_callback_t cb) { sOpenURLCallback = cb; } -void LLUrlAction::setOpenURLInternalCallback(void (*cb) (const std::string& url)) +void LLUrlAction::setOpenURLInternalCallback(url_callback_t cb) { sOpenURLInternalCallback = cb; } -void LLUrlAction::setOpenURLExternalCallback(void (*cb) (const std::string& url)) +void LLUrlAction::setOpenURLExternalCallback(url_callback_t cb) { sOpenURLExternalCallback = cb; } -void LLUrlAction::setExecuteSLURLCallback(bool (*cb) (const std::string& url)) +void LLUrlAction::setExecuteSLURLCallback(execute_url_callback_t cb) { sExecuteSLURLCallback = cb; } @@ -63,7 +63,7 @@ void LLUrlAction::openURL(std::string url) { if (sOpenURLCallback) { - (*sOpenURLCallback)(url); + sOpenURLCallback(url); } } @@ -71,7 +71,7 @@ void LLUrlAction::openURLInternal(std::string url) { if (sOpenURLInternalCallback) { - (*sOpenURLInternalCallback)(url); + sOpenURLInternalCallback(url); } } @@ -79,7 +79,7 @@ void LLUrlAction::openURLExternal(std::string url) { if (sOpenURLExternalCallback) { - (*sOpenURLExternalCallback)(url); + sOpenURLExternalCallback(url); } } @@ -87,18 +87,18 @@ void LLUrlAction::executeSLURL(std::string url) { if (sExecuteSLURLCallback) { - (*sExecuteSLURLCallback)(url); + sExecuteSLURLCallback(url); } } void LLUrlAction::clickAction(std::string url) { // Try to handle as SLURL first, then http Url - if ( (sExecuteSLURLCallback) && !(*sExecuteSLURLCallback)(url) ) + if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url) ) { if (sOpenURLCallback) { - (*sOpenURLCallback)(url); + sOpenURLCallback(url); } } } diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 0132dbaaf0..c34960b826 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -29,6 +29,7 @@ #define LL_LLURLACTION_H #include <string> +#include <boost/function.hpp> /// /// The LLUrlAction class provides a number of static functions that @@ -77,17 +78,21 @@ public: static void showProfile(std::string url); /// specify the callbacks to enable this class's functionality - static void setOpenURLCallback(void (*cb) (const std::string& url)); - static void setOpenURLInternalCallback(void (*cb) (const std::string& url)); - static void setOpenURLExternalCallback(void (*cb) (const std::string& url)); - static void setExecuteSLURLCallback(bool (*cb) (const std::string& url)); + typedef boost::function<void (const std::string&)> url_callback_t; + typedef boost::function<bool(const std::string& url)> execute_url_callback_t; + + static void setOpenURLCallback(url_callback_t cb); + static void setOpenURLInternalCallback(url_callback_t cb); + static void setOpenURLExternalCallback(url_callback_t cb); + static void setExecuteSLURLCallback(execute_url_callback_t cb); private: // callbacks for operations we can perform on Urls - static void (*sOpenURLCallback) (const std::string& url); - static void (*sOpenURLInternalCallback) (const std::string& url); - static void (*sOpenURLExternalCallback) (const std::string& url); - static bool (*sExecuteSLURLCallback) (const std::string& url); + static url_callback_t sOpenURLCallback; + static url_callback_t sOpenURLInternalCallback; + static url_callback_t sOpenURLExternalCallback; + + static execute_url_callback_t sExecuteSLURLCallback; }; #endif diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 3fd7e48428..486babb0ab 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -225,9 +225,11 @@ BOOL LLView::getUseBoundingRect() const } // virtual -std::string LLView::getName() const +const std::string& LLView::getName() const { - return mName.empty() ? std::string("(no name)") : mName; + static std::string no_name("(no name)"); + + return mName.empty() ? no_name : mName; } void LLView::sendChildToFront(LLView* child) @@ -1215,7 +1217,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr if ((childp->getVisible() && childp->getRect().isValid()) || force_draw) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f); diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 08828e55e6..ec7f8e385d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -431,7 +431,7 @@ public: /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ std::string getName() const; + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ BOOL hasMouseCapture(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; |