diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.cpp | 15 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.h | 4 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.cpp | 62 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 4 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llkeywords.cpp | 81 | ||||
-rw-r--r-- | indra/llui/llkeywords.h | 33 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 2 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 122 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 23 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 32 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llview.h | 2 |
16 files changed, 315 insertions, 87 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 aea58be12a..0fcd937361 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -239,8 +239,21 @@ void LLDockableFloater::setDockControl(LLDockControl* dockControl) setDocked(isDocked()); } -const LLUIImagePtr& LLDockableFloater::getDockTongue() +const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_side) { + switch(dock_side) + { + case LLDockControl::LEFT: + mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png"); + break; + case LLDockControl::RIGHT: + mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png"); + break; + default: + mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + break; + } + return mDockTongue; } diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 8deb6c1159..89c9852f4a 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -113,6 +113,8 @@ public: bool getUniqueDocking() { return mUniqueDocking; } bool getUseTongue() { return mUseTongue; } + + void setUseTongue(bool use_tongue) { mUseTongue = use_tongue;} private: /** * Provides unique of dockable floater. @@ -122,7 +124,7 @@ private: protected: void setDockControl(LLDockControl* dockControl); - const LLUIImagePtr& getDockTongue(); + const LLUIImagePtr& getDockTongue(LLDockControl::DocAt dock_side = LLDockControl::TOP); // Checks if docking should be forced. // It may be useful e.g. if floater created in mouselook mode (see EXT-5609) diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 6397bbd0de..af39e41fa6 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -100,12 +100,16 @@ void LLDockControl::repositionDockable() if (!mDockWidget) return; LLRect dockRect = mDockWidget->calcScreenRect(); LLRect rootRect; + LLRect floater_rect = mDockableFloater->calcScreenRect(); mGetAllowedRectCallback(rootRect); - // recalculate dockable position if dock position changed, dock visibility changed, - // root view rect changed or recalculation is forced - if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible() - || mRootRect != rootRect || mRecalculateDocablePosition) + // recalculate dockable position if: + if (mPrevDockRect != dockRect //dock position changed + || mDockWidgetVisible != isDockVisible() //dock visibility changed + || mRootRect != rootRect //root view rect changed + || mFloaterRect != floater_rect //floater rect changed + || mRecalculateDockablePosition //recalculation is forced + ) { // undock dockable and off() if dock not visible if (!isDockVisible()) @@ -136,7 +140,8 @@ void LLDockControl::repositionDockable() mPrevDockRect = dockRect; mRootRect = rootRect; - mRecalculateDocablePosition = false; + mFloaterRect = floater_rect; + mRecalculateDockablePosition = false; mDockWidgetVisible = isDockVisible(); } } @@ -203,21 +208,33 @@ void LLDockControl::moveDockable() switch (mDockAt) { case LEFT: - x = dockRect.mLeft; - y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); - // check is dockable inside root view rect - if (x < rootRect.mLeft) + + x = dockRect.mLeft - dockableRect.getWidth(); + y = dockRect.getCenterY() + dockableRect.getHeight() / 2; + + if (use_tongue) { - x = rootRect.mLeft; + x -= mDockTongue->getWidth(); } - if (x + dockableRect.getWidth() > rootRect.mRight) + + mDockTongueX = dockableRect.mRight; + mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2; + + break; + + case RIGHT: + + x = dockRect.mRight; + y = dockRect.getCenterY() + dockableRect.getHeight() / 2; + + if (use_tongue) { - x = rootRect.mRight - dockableRect.getWidth(); + x += mDockTongue->getWidth(); } - - mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2; - - mDockTongueY = dockRect.mTop; + + mDockTongueX = dockRect.mRight; + mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2; + break; case TOP: @@ -315,13 +332,12 @@ void LLDockControl::moveDockable() dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), dockableRect.getHeight()); } + LLRect localDocableParentRect; - mDockableFloater->getParent()->screenRectToLocal(dockableRect, - &localDocableParentRect); - mDockableFloater->setRect(localDocableParentRect); - mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, - &mDockTongueX, &mDockTongueY); + mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect); + mDockableFloater->setRect(localDocableParentRect); + mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY); } @@ -330,7 +346,7 @@ void LLDockControl::on() if (isDockVisible()) { mEnabled = true; - mRecalculateDocablePosition = true; + mRecalculateDockablePosition = true; } } @@ -341,7 +357,7 @@ void LLDockControl::off() void LLDockControl::forceRecalculatePosition() { - mRecalculateDocablePosition = true; + mRecalculateDockablePosition = true; } void LLDockControl::drawToungue() diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 2e7359245f..c9602011f6 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -43,6 +43,7 @@ public: { TOP, LEFT, + RIGHT, BOTTOM }; @@ -79,12 +80,13 @@ private: private: get_allowed_rect_callback_t mGetAllowedRectCallback; bool mEnabled; - bool mRecalculateDocablePosition; + bool mRecalculateDockablePosition; bool mDockWidgetVisible; DocAt mDockAt; LLView* mDockWidget; LLRect mPrevDockRect; LLRect mRootRect; + LLRect mFloaterRect; LLFloater* mDockableFloater; LLUIImagePtr mDockTongue; S32 mDockTongueX; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 7100ea13a7..432397d3e9 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: case LLFloaterEnums::OPEN_POSITIONING_CASCADING: - if (other != NULL) + if (other != NULL && other != this) { stackWith(*other); } @@ -1070,7 +1070,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) const LLRect old_rect = getRect(); LLView::handleReshape(new_rect, by_user); - if (by_user) + if (by_user && !isMinimized()) { storeRectControl(); mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE; diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index ceec9c7eb1..c1cd04186b 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -57,6 +57,22 @@ LLKeywords::LLKeywords() : mLoaded(FALSE) { } +inline BOOL LLKeywordToken::isTail(const llwchar* s) const +{ + BOOL res = TRUE; + const llwchar* t = mDelimiter.c_str(); + S32 len = mDelimiter.size(); + for (S32 i=0; i<len; i++) + { + if (s[i] != t[i]) + { + res = FALSE; + break; + } + } + return res; +} + LLKeywords::~LLKeywords() { std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer()); @@ -106,6 +122,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) std::string SOL_LINE("[line "); std::string SOL_ONE_SIDED_DELIMITER("[one_sided_delimiter "); std::string SOL_TWO_SIDED_DELIMITER("[two_sided_delimiter "); + std::string SOL_DOUBLE_QUOTATION_MARKS("[double_quotation_marks "); LLColor3 cur_color( 1, 0, 0 ); LLKeywordToken::TOKEN_TYPE cur_type = LLKeywordToken::WORD; @@ -137,6 +154,12 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) cur_type = LLKeywordToken::TWO_SIDED_DELIMITER; continue; } + else if( line.find(SOL_DOUBLE_QUOTATION_MARKS) == 0 ) + { + cur_color = readColor( line.substr(SOL_DOUBLE_QUOTATION_MARKS.size()) ); + cur_type = LLKeywordToken::DOUBLE_QUOTATION_MARKS; + continue; + } else if( line.find(SOL_ONE_SIDED_DELIMITER) == 0 ) { cur_color = readColor( line.substr(SOL_ONE_SIDED_DELIMITER.size()) ); @@ -154,10 +177,26 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) if( !token_buffer.empty() && token_word_iter != word_tokens.end() ) { - // first word is keyword + // first word is the keyword or a left delimiter std::string keyword = (*token_word_iter); LLStringUtil::trim(keyword); + // second word may be a right delimiter + std::string delimiter; + if (cur_type == LLKeywordToken::TWO_SIDED_DELIMITER) + { + while (delimiter.length() == 0 && ++token_word_iter != word_tokens.end()) + { + delimiter = *token_word_iter; + LLStringUtil::trim(delimiter); + } + } + else if (cur_type == LLKeywordToken::DOUBLE_QUOTATION_MARKS) + { + // Closing delimiter is identical to the opening one. + delimiter = keyword; + } + // following words are tooltip std::string tool_tip; while (++token_word_iter != word_tokens.end()) @@ -170,11 +209,11 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) { // Replace : with \n for multi-line tool tips. LLStringUtil::replaceChar( tool_tip, ':', '\n' ); - addToken(cur_type, keyword, cur_color, tool_tip ); + addToken(cur_type, keyword, cur_color, tool_tip, delimiter ); } else { - addToken(cur_type, keyword, cur_color, LLStringUtil::null ); + addToken(cur_type, keyword, cur_color, LLStringUtil::null, delimiter ); } } } @@ -189,23 +228,26 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type, const std::string& key_in, const LLColor3& color, - const std::string& tool_tip_in ) + const std::string& tool_tip_in, + const std::string& delimiter_in) { LLWString key = utf8str_to_wstring(key_in); LLWString tool_tip = utf8str_to_wstring(tool_tip_in); + LLWString delimiter = utf8str_to_wstring(delimiter_in); switch(type) { case LLKeywordToken::WORD: - mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip); + mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null); break; case LLKeywordToken::LINE: - mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip)); + mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null)); break; case LLKeywordToken::TWO_SIDED_DELIMITER: + case LLKeywordToken::DOUBLE_QUOTATION_MARKS: case LLKeywordToken::ONE_SIDED_DELIMITER: - mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip)); + mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, delimiter)); break; default: @@ -357,7 +399,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW } // cur is now at the first non-whitespace character of a new line - + // Line start tokens { BOOL line_done = FALSE; @@ -418,14 +460,15 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW S32 seg_end = 0; seg_start = cur - base; - cur += cur_delimiter->getLength(); + cur += cur_delimiter->getLengthHead(); - if( cur_delimiter->getType() == LLKeywordToken::TWO_SIDED_DELIMITER ) + LLKeywordToken::TOKEN_TYPE type = cur_delimiter->getType(); + if( type == LLKeywordToken::TWO_SIDED_DELIMITER || type == LLKeywordToken::DOUBLE_QUOTATION_MARKS ) { - while( *cur && !cur_delimiter->isHead(cur)) + while( *cur && !cur_delimiter->isTail(cur)) { // Check for an escape sequence. - if (*cur == '\\') + if (type == LLKeywordToken::DOUBLE_QUOTATION_MARKS && *cur == '\\') { // Count the number of backslashes. S32 num_backslashes = 0; @@ -435,10 +478,10 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW between_delimiters++; cur++; } - // Is the next character the end delimiter? - if (cur_delimiter->isHead(cur)) + // If the next character is the end delimiter? + if (cur_delimiter->isTail(cur)) { - // Is there was an odd number of backslashes, then this delimiter + // If there was an odd number of backslashes, then this delimiter // does not end the sequence. if (num_backslashes % 2 == 1) { @@ -461,13 +504,13 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW if( *cur ) { - cur += cur_delimiter->getLength(); - seg_end = seg_start + between_delimiters + 2 * cur_delimiter->getLength(); + cur += cur_delimiter->getLengthHead(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead() + cur_delimiter->getLengthTail(); } else { // eof - seg_end = seg_start + between_delimiters + cur_delimiter->getLength(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead(); } } else @@ -479,7 +522,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW between_delimiters++; cur++; } - seg_end = seg_start + between_delimiters + cur_delimiter->getLength(); + seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead(); } insertSegments(wtext, *seg_list,cur_delimiter, text_len, seg_start, seg_end, defaultColor, editor); diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index f6d75b7e75..d050cd7d7c 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -41,23 +41,44 @@ typedef LLPointer<LLTextSegment> LLTextSegmentPtr; class LLKeywordToken { public: - enum TOKEN_TYPE { WORD, LINE, TWO_SIDED_DELIMITER, ONE_SIDED_DELIMITER }; + /** + * @brief Types of tokens/delimters being parsed. + * + * @desc Tokens/delimiters that need to be identified/highlighted. All are terminated if an EOF is encountered. + * - WORD are keywords in the normal sense, i.e. constants, events, etc. + * - LINE are for entire lines (currently only flow control labels use this). + * - ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL. + * - 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 + { + WORD, + LINE, + TWO_SIDED_DELIMITER, + ONE_SIDED_DELIMITER, + DOUBLE_QUOTATION_MARKS + }; - LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip ) + LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) : mType( type ), mToken( token ), mColor( color ), - mToolTip( tool_tip ) + mToolTip( tool_tip ), + mDelimiter( delimiter ) // right delimiter { } - S32 getLength() const { return mToken.size(); } + S32 getLengthHead() const { return mToken.size(); } + S32 getLengthTail() const { return mDelimiter.size(); } BOOL isHead(const llwchar* s) const; + BOOL isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor3& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } const LLWString& getToolTip() const { return mToolTip; } + const LLWString& getDelimiter() const { return mDelimiter; } #ifdef _DEBUG void dump(); @@ -68,6 +89,7 @@ private: LLWString mToken; LLColor3 mColor; LLWString mToolTip; + LLWString mDelimiter; }; class LLKeywords @@ -85,7 +107,8 @@ public: void addToken(LLKeywordToken::TOKEN_TYPE type, const std::string& key, const LLColor3& color, - const std::string& tool_tip = LLStringUtil::null); + const std::string& tool_tip = LLStringUtil::null, + const std::string& delimiter = LLStringUtil::null); // This class is here as a performance optimization. // The word token map used to be defined as std::map<LLWString, LLKeywordToken*>. 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/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 515605200e..287e3e2b41 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -112,6 +112,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mStartDragItemCallback(NULL), mHandleDragItemCallback(NULL), mHandleDropCallback(NULL), + mButtonAddSignal(NULL), + mButtonEnterSignal(NULL), + mButtonLeaveSignal(NULL), + mButtonRemoveSignal(NULL), mDragAndDropTarget(false) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; @@ -121,6 +125,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) LLToolBar::~LLToolBar() { delete mPopupMenuHandle.get(); + delete mButtonAddSignal; + delete mButtonEnterSignal; + delete mButtonLeaveSignal; + delete mButtonRemoveSignal; } void LLToolBar::createContextMenu() @@ -212,7 +220,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) mButtonPanel->addChild(button); mButtonMap.insert(std::make_pair(commandId.uuid(), button)); - // Insert the command and button in the right place in their respective lists if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE)) { @@ -238,6 +245,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) mNeedsLayout = true; + updateLayoutAsNeeded(); + + + if (mButtonAddSignal) + { + (*mButtonAddSignal)(button); + } + return true; } @@ -264,6 +279,11 @@ int LLToolBar::removeCommand(const LLCommandId& commandId) ++rank; } + if (mButtonRemoveSignal) + { + (*mButtonRemoveSignal)(*it_button); + } + // Delete the button and erase the command and button records delete (*it_button); mButtonCommands.erase(it_command); @@ -352,6 +372,23 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) return (command_button != NULL); } +bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash) +{ + LLButton * command_button = NULL; + + if (commandId != LLCommandId::null) + { + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); + if (it != mButtonMap.end()) + { + command_button = it->second; + command_button->setFlashing(flash ? TRUE : FALSE); + } + } + + return (command_button != NULL); +} + BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLRect button_panel_rect; @@ -790,6 +827,11 @@ void LLToolBar::createButtons() { BOOST_FOREACH(LLToolBarButton* button, mButtons) { + if (mButtonRemoveSignal) + { + (*mButtonRemoveSignal)(button); + } + delete button; } mButtons.clear(); @@ -801,6 +843,11 @@ void LLToolBar::createButtons() mButtons.push_back(button); mButtonPanel->addChild(button); mButtonMap.insert(std::make_pair(command_id.uuid(), button)); + + if (mButtonAddSignal) + { + (*mButtonAddSignal)(button); + } } mNeedsLayout = true; } @@ -870,8 +917,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) button->setCommitCallback(executeParam); } - - + // Set up "is running" query callback const std::string& isRunningFunction = commandp->isRunningFunctionName(); if (isRunningFunction.length() > 0) { @@ -898,6 +944,36 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) return button; } +boost::signals2::connection connectSignal(LLToolBar::button_signal_t*& signal, const LLToolBar::button_signal_t::slot_type& cb) +{ + if (!signal) + { + signal = new LLToolBar::button_signal_t(); + } + + return signal->connect(cb); +} + +boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb) +{ + return connectSignal(mButtonAddSignal, cb); +} + +boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb) +{ + return connectSignal(mButtonEnterSignal, cb); +} + +boost::signals2::connection LLToolBar::setButtonLeaveCallback(const button_signal_t::slot_type& cb) +{ + return connectSignal(mButtonLeaveSignal, cb); +} + +boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_signal_t::slot_type& cb) +{ + return connectSignal(mButtonRemoveSignal, cb); +} + BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, @@ -969,8 +1045,6 @@ LLToolBarButton::LLToolBarButton(const Params& p) mOriginalImageOverlayColor(p.image_overlay_color), mOriginalImageOverlaySelectedColor(p.image_overlay_selected_color) { - mButtonFlashRate = 0.0; - mButtonFlashCount = 0; } LLToolBarButton::~LLToolBarButton() @@ -1012,6 +1086,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { handled = LLButton::handleHover(x, y, mask); } + return handled; } @@ -1024,6 +1099,23 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask) { mNeedsHighlight = TRUE; } + + LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); + if (parent_toolbar && parent_toolbar->mButtonEnterSignal) + { + (*(parent_toolbar->mButtonEnterSignal))(this); + } +} + +void LLToolBarButton::onMouseLeave(S32 x, S32 y, MASK mask) +{ + LLButton::onMouseLeave(x, y, mask); + + LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); + if (parent_toolbar && parent_toolbar->mButtonLeaveSignal) + { + (*(parent_toolbar->mButtonLeaveSignal))(this); + } } void LLToolBarButton::onMouseCaptureLost() @@ -1072,25 +1164,25 @@ void LLToolBarButton::setEnabled(BOOL enabled) } } - const std::string LLToolBarButton::getToolTip() const { std::string tooltip; + if (labelIsTruncated() || getCurrentLabel().empty()) { - return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip(); + tooltip = LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip(); } else { - return LLView::getToolTip(); + tooltip = LLView::getToolTip(); } -} - - - - - - + LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); + if (parent_toolbar && parent_toolbar->mButtonTooltipSuffix.length() > 0) + { + tooltip = tooltip + "\n(" + parent_toolbar->mButtonTooltipSuffix + ")"; + } + return tooltip; +} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index e634e57f93..f10f39adc3 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -71,6 +71,7 @@ public: void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void onMouseEnter(S32 x, S32 y, MASK mask); + void onMouseLeave(S32 x, S32 y, MASK mask); void onMouseCaptureLost(); void onCommit(); @@ -120,6 +121,8 @@ namespace LLToolBarEnums SIDE_RIGHT, SIDE_TOP, }; + + LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType); } // NOTE: This needs to occur before Param block declaration for proper compilation. @@ -142,6 +145,7 @@ namespace LLInitParam class LLToolBar : public LLUICtrl { + friend class LLToolBarButton; public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -187,6 +191,7 @@ public: 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); void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } @@ -195,6 +200,15 @@ public: LLToolBarButton* createButton(const LLCommandId& id); + typedef boost::signals2::signal<void (LLView* button)> button_signal_t; + boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb); + boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb); + 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; } + + LLToolBarEnums::SideType getSideType() const { return mSideType; } bool hasButtons() const { return !mButtons.empty(); } bool isModified() const { return mModified; } @@ -254,7 +268,14 @@ private: LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; - LLHandle<class LLContextMenu> mPopupMenuHandle; + LLHandle<class LLContextMenu> mPopupMenuHandle; + + button_signal_t* mButtonAddSignal; + button_signal_t* mButtonEnterSignal; + button_signal_t* mButtonLeaveSignal; + button_signal_t* mButtonRemoveSignal; + + std::string mButtonTooltipSuffix; }; 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/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; |