summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp87
-rw-r--r--indra/llui/llfloater.h7
-rw-r--r--indra/llui/llmenugl.cpp114
-rw-r--r--indra/llui/llmenugl.h41
-rw-r--r--indra/llui/llnotifications.cpp5
-rw-r--r--indra/llui/llnotifications.h1
-rw-r--r--indra/llui/llresizebar.cpp55
-rw-r--r--indra/llui/llresizehandle.cpp58
-rw-r--r--indra/llui/lltexteditor.cpp80
-rw-r--r--indra/llui/lltexteditor.h6
-rw-r--r--indra/llui/lltoggleablemenu.cpp5
-rw-r--r--indra/llui/lltoggleablemenu.h2
-rw-r--r--indra/llui/lltoolbar.cpp10
-rw-r--r--indra/llui/lltoolbar.h3
-rw-r--r--indra/llui/lltooltip.cpp18
-rw-r--r--indra/llui/lltooltip.h4
16 files changed, 330 insertions, 166 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 054b9173d3..1594be2512 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1105,17 +1105,26 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
const LLRect old_rect = getRect();
LLView::handleReshape(new_rect, by_user);
- if (by_user && !isMinimized())
+ if (by_user && !getHost())
{
- storeRectControl();
- mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
- LLRect screen_rect = calcScreenRect();
- mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+ static_cast<LLFloaterView*>(getParent())->adjustToFitScreen(this, !isMinimized());
}
// if not minimized, adjust all snapped dependents to new shape
if (!isMinimized())
{
+ if (by_user)
+ {
+ if (isDocked())
+ {
+ setDocked( false, false);
+ }
+ storeRectControl();
+ mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+ LLRect screen_rect = calcScreenRect();
+ mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+ }
+
// gather all snapped dependents
for(handle_set_iter_t dependent_it = mDependents.begin();
dependent_it != mDependents.end(); ++dependent_it)
@@ -1711,56 +1720,10 @@ void LLFloater::onClickHelp( LLFloater* self )
}
}
-// static
-LLFloater* LLFloater::getClosableFloaterFromFocus()
-{
- LLFloater* focused_floater = NULL;
- LLInstanceTracker<LLFloater>::instance_iter it = beginInstances();
- LLInstanceTracker<LLFloater>::instance_iter end_it = endInstances();
- for (; it != end_it; ++it)
- {
- if (it->hasFocus())
- {
- LLFloater& floater = *it;
- focused_floater = &floater;
- break;
- }
- }
-
- if (it == endInstances())
- {
- // nothing found, return
- return NULL;
- }
-
- // The focused floater may not be closable,
- // Find and close a parental floater that is closeable, if any.
- LLFloater* prev_floater = NULL;
- for(LLFloater* floater_to_close = focused_floater;
- NULL != floater_to_close;
- floater_to_close = gFloaterView->getParentFloater(floater_to_close))
- {
- if(floater_to_close->isCloseable())
- {
- return floater_to_close;
- }
-
- // If floater has as parent root view
- // gFloaterView->getParentFloater(floater_to_close) returns
- // the same floater_to_close, so we need to check this.
- if (prev_floater == floater_to_close) {
- break;
- }
- prev_floater = floater_to_close;
- }
-
- return NULL;
-}
-
// static
-void LLFloater::closeFocusedFloater()
+void LLFloater::closeFrontmostFloater()
{
- LLFloater* floater_to_close = LLFloater::getClosableFloaterFromFocus();
+ LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater();
if(floater_to_close)
{
floater_to_close->closeFloater();
@@ -2478,6 +2441,24 @@ void LLFloaterView::highlightFocusedFloater()
}
}
+LLFloater* LLFloaterView::getFrontmostClosableFloater()
+{
+ child_list_const_iter_t child_it;
+ LLFloater* frontmost_floater = NULL;
+
+ for ( child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
+ {
+ frontmost_floater = (LLFloater *)(*child_it);
+
+ if (frontmost_floater->isInVisibleChain() && frontmost_floater->isCloseable())
+ {
+ return frontmost_floater;
+ }
+ }
+
+ return NULL;
+}
+
void LLFloaterView::unhighlightFocusedFloater()
{
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index e64b6d04d3..aef63bcf93 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -325,12 +325,10 @@ public:
virtual void setTornOff(bool torn_off) { mTornOff = torn_off; }
- // Return a closeable floater, if any, given the current focus.
- static LLFloater* getClosableFloaterFromFocus();
- // Close the floater returned by getClosableFloaterFromFocus() and
+ // Close the floater returned by getFrontmostClosableFloater() and
// handle refocusing.
- static void closeFocusedFloater();
+ static void closeFrontmostFloater();
// LLNotification::Params contextualNotification(const std::string& name)
// {
@@ -559,6 +557,7 @@ public:
S32 getZOrder(LLFloater* child);
void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; }
+ LLFloater* getFrontmostClosableFloater();
private:
void hiddenFloaterClosed(LLFloater* floater);
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index efb9848a90..cd6cc6a75e 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1764,6 +1764,25 @@ bool LLMenuGL::addChild(LLView* view, S32 tab_group)
return false;
}
+// Used in LLContextMenu and in LLTogleableMenu
+// to add an item of context menu branch
+bool LLMenuGL::addContextChild(LLView* view, S32 tab_group)
+{
+ LLContextMenu* context = dynamic_cast<LLContextMenu*>(view);
+ if (context)
+ return appendContextSubMenu(context);
+
+ LLMenuItemSeparatorGL* separator = dynamic_cast<LLMenuItemSeparatorGL*>(view);
+ if (separator)
+ return append(separator);
+
+ LLMenuItemGL* item = dynamic_cast<LLMenuItemGL*>(view);
+ if (item)
+ return append(item);
+
+ return false;
+}
+
void LLMenuGL::removeChild( LLView* ctrl)
{
// previously a dynamic_cast with if statement to check validity
@@ -2501,6 +2520,30 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu )
return success;
}
+// add a context menu branch
+BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu)
+{
+ if (menu == this)
+ {
+ llerrs << "Can't attach a context menu to itself" << llendl;
+ }
+
+ LLContextMenuBranch *item;
+ LLContextMenuBranch::Params p;
+ p.name = menu->getName();
+ p.label = menu->getLabel();
+ p.branch = (LLContextMenu *)menu;
+ p.enabled_color=LLUIColorTable::instance().getColor("MenuItemEnabledColor");
+ p.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
+ p.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
+ p.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
+
+ item = LLUICtrlFactory::create<LLContextMenuBranch>(p);
+ LLMenuGL::sMenuContainer->addChild(item->getBranch());
+
+ return append( item );
+}
+
void LLMenuGL::setEnabledSubMenus(BOOL enable)
{
setEnabled(enable);
@@ -3725,39 +3768,6 @@ void LLTearOffMenu::closeTearOff()
mMenu->setDropShadowed(TRUE);
}
-
-//-----------------------------------------------------------------------------
-// class LLContextMenuBranch
-// A branch to another context menu
-//-----------------------------------------------------------------------------
-class LLContextMenuBranch : public LLMenuItemGL
-{
-public:
- struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params>
- {
- Mandatory<LLContextMenu*> branch;
- };
-
- LLContextMenuBranch(const Params&);
-
- virtual ~LLContextMenuBranch()
- {}
-
- // called to rebuild the draw label
- virtual void buildDrawLabel( void );
-
- // onCommit() - do the primary funcationality of the menu item.
- virtual void onCommit( void );
-
- LLContextMenu* getBranch() { return mBranch.get(); }
- void setHighlight( BOOL highlight );
-
-protected:
- void showSubMenu();
-
- LLHandle<LLContextMenu> mBranch;
-};
-
LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p)
: LLMenuItemGL(p),
mBranch( p.branch()->getHandle() )
@@ -4034,44 +4044,8 @@ void LLContextMenu::draw()
LLMenuGL::draw();
}
-BOOL LLContextMenu::appendContextSubMenu(LLContextMenu *menu)
-{
-
- if (menu == this)
- {
- llerrs << "Can't attach a context menu to itself" << llendl;
- }
-
- LLContextMenuBranch *item;
- LLContextMenuBranch::Params p;
- p.name = menu->getName();
- p.label = menu->getLabel();
- p.branch = menu;
- p.enabled_color=LLUIColorTable::instance().getColor("MenuItemEnabledColor");
- p.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
- p.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
- p.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
-
- item = LLUICtrlFactory::create<LLContextMenuBranch>(p);
- LLMenuGL::sMenuContainer->addChild(item->getBranch());
-
- return append( item );
-}
-
bool LLContextMenu::addChild(LLView* view, S32 tab_group)
{
- LLContextMenu* context = dynamic_cast<LLContextMenu*>(view);
- if (context)
- return appendContextSubMenu(context);
-
- LLMenuItemSeparatorGL* separator = dynamic_cast<LLMenuItemSeparatorGL*>(view);
- if (separator)
- return append(separator);
-
- LLMenuItemGL* item = dynamic_cast<LLMenuItemGL*>(view);
- if (item)
- return append(item);
-
- return false;
+ return addContextChild(view, tab_group);
}
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 67b3e1fbe6..00899020bc 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -519,6 +519,9 @@ public:
void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; }
bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; }
+ // add a context menu branch
+ BOOL appendContextSubMenu(LLMenuGL *menu);
+
protected:
void createSpilloverBranch();
void cleanupSpilloverBranch();
@@ -528,6 +531,10 @@ protected:
// add a menu - this will create a cascading menu
virtual BOOL appendMenu( LLMenuGL* menu );
+ // Used in LLContextMenu and in LLTogleableMenu
+ // to add an item of context menu branch
+ bool addContextChild(LLView* view, S32 tab_group);
+
// TODO: create accessor methods for these?
typedef std::list< LLMenuItemGL* > item_list_t;
item_list_t mItems;
@@ -679,8 +686,6 @@ public:
virtual bool addChild (LLView* view, S32 tab_group = 0);
- BOOL appendContextSubMenu(LLContextMenu *menu);
-
LLHandle<LLContextMenu> getHandle() { return getDerivedHandle<LLContextMenu>(); }
LLView* getSpawningView() const { return mSpawningViewHandle.get(); }
@@ -694,6 +699,38 @@ protected:
};
+//-----------------------------------------------------------------------------
+// class LLContextMenuBranch
+// A branch to another context menu
+//-----------------------------------------------------------------------------
+class LLContextMenuBranch : public LLMenuItemGL
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params>
+ {
+ Mandatory<LLContextMenu*> branch;
+ };
+
+ LLContextMenuBranch(const Params&);
+
+ virtual ~LLContextMenuBranch()
+ {}
+
+ // called to rebuild the draw label
+ virtual void buildDrawLabel( void );
+
+ // onCommit() - do the primary funcationality of the menu item.
+ virtual void onCommit( void );
+
+ LLContextMenu* getBranch() { return mBranch.get(); }
+ void setHighlight( BOOL highlight );
+
+protected:
+ void showSubMenu();
+
+ LLHandle<LLContextMenu> mBranch;
+};
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLMenuBarGL
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 210a320f41..2bf88532c6 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1116,6 +1116,11 @@ bool LLNotificationChannel::isEmpty() const
return mItems.empty();
}
+S32 LLNotificationChannel::size() const
+{
+ return mItems.size();
+}
+
LLNotificationChannel::Iterator LLNotificationChannel::begin()
{
return mItems.begin();
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 4ae02b943f..d7534c416d 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -813,6 +813,7 @@ public:
std::string getParentChannelName() { return mParent; }
bool isEmpty() const;
+ S32 size() const;
Iterator begin();
Iterator end();
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index 87aeb4d7a7..ba90fa5e0c 100644
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -139,13 +139,6 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
if( valid_rect.localPointInRect( screen_x, screen_y ) && mResizingView )
{
- // undock floater when user resize it
- LLFloater* parent = dynamic_cast<LLFloater*>( getParent());
- if (parent && parent->isDocked())
- {
- parent->setDocked( false, false);
- }
-
// Resize the parent
LLRect orig_rect = mResizingView->getRect();
LLRect scaled_rect = orig_rect;
@@ -219,20 +212,66 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
// update last valid mouse cursor position based on resized view's actual size
LLRect new_rect = mResizingView->getRect();
+
switch(mSide)
{
case LEFT:
- mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft;
+ {
+ S32 actual_delta_x = new_rect.mLeft - orig_rect.mLeft;
+ if (actual_delta_x != delta_x)
+ {
+ // restore everything by left
+ new_rect.mBottom = orig_rect.mBottom;
+ new_rect.mTop = orig_rect.mTop;
+ new_rect.mRight = orig_rect.mRight;
+ mResizingView->setShape(new_rect, true);
+ }
+ mDragLastScreenX += actual_delta_x;
+
break;
+ }
case RIGHT:
+ {
+ S32 actual_delta_x = new_rect.mRight - orig_rect.mRight;
+ if (actual_delta_x != delta_x)
+ {
+ // restore everything by left
+ new_rect.mBottom = orig_rect.mBottom;
+ new_rect.mTop = orig_rect.mTop;
+ new_rect.mLeft = orig_rect.mLeft;
+ mResizingView->setShape(new_rect, true);
+ }
mDragLastScreenX += new_rect.mRight - orig_rect.mRight;
break;
+ }
case TOP:
+ {
+ S32 actual_delta_y = new_rect.mTop - orig_rect.mTop;
+ if (actual_delta_y != delta_y)
+ {
+ // restore everything by left
+ new_rect.mBottom = orig_rect.mBottom;
+ new_rect.mLeft = orig_rect.mLeft;
+ new_rect.mRight = orig_rect.mRight;
+ mResizingView->setShape(new_rect, true);
+ }
mDragLastScreenY += new_rect.mTop - orig_rect.mTop;
break;
+ }
case BOTTOM:
+ {
+ S32 actual_delta_y = new_rect.mBottom - orig_rect.mBottom;
+ if (actual_delta_y != delta_y)
+ {
+ // restore everything by left
+ new_rect.mTop = orig_rect.mTop;
+ new_rect.mLeft = orig_rect.mLeft;
+ new_rect.mRight = orig_rect.mRight;
+ mResizingView->setShape(new_rect, true);
+ }
mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom;
break;
+ }
default:
break;
}
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index c3a51c36c9..24794305ac 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -257,23 +257,65 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
// update last valid mouse cursor position based on resized view's actual size
LLRect new_rect = resizing_view->getRect();
+ S32 actual_delta_x = 0;
+ S32 actual_delta_y = 0;
switch(mCorner)
{
case LEFT_TOP:
- mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft;
- mDragLastScreenY += new_rect.mTop - orig_rect.mTop;
+ actual_delta_x = new_rect.mLeft - orig_rect.mLeft;
+ actual_delta_y = new_rect.mTop - orig_rect.mTop;
+ if (actual_delta_x != delta_x
+ || actual_delta_y != delta_y)
+ {
+ new_rect.mRight = orig_rect.mRight;
+ new_rect.mBottom = orig_rect.mBottom;
+ resizing_view->setShape(new_rect, true);
+ }
+
+ mDragLastScreenX += actual_delta_x;
+ mDragLastScreenY += actual_delta_y;
break;
case LEFT_BOTTOM:
- mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft;
- mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom;
+ actual_delta_x = new_rect.mLeft - orig_rect.mLeft;
+ actual_delta_y = new_rect.mBottom - orig_rect.mBottom;
+ if (actual_delta_x != delta_x
+ || actual_delta_y != delta_y)
+ {
+ new_rect.mRight = orig_rect.mRight;
+ new_rect.mTop = orig_rect.mTop;
+ resizing_view->setShape(new_rect, true);
+ }
+
+ mDragLastScreenX += actual_delta_x;
+ mDragLastScreenY += actual_delta_y;
break;
case RIGHT_TOP:
- mDragLastScreenX += new_rect.mRight - orig_rect.mRight;
- mDragLastScreenY += new_rect.mTop - orig_rect.mTop;
+ actual_delta_x = new_rect.mRight - orig_rect.mRight;
+ actual_delta_y = new_rect.mTop - orig_rect.mTop;
+ if (actual_delta_x != delta_x
+ || actual_delta_y != delta_y)
+ {
+ new_rect.mLeft = orig_rect.mLeft;
+ new_rect.mBottom = orig_rect.mBottom;
+ resizing_view->setShape(new_rect, true);
+ }
+
+ mDragLastScreenX += actual_delta_x;
+ mDragLastScreenY += actual_delta_y;
break;
case RIGHT_BOTTOM:
- mDragLastScreenX += new_rect.mRight - orig_rect.mRight;
- mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom;
+ actual_delta_x = new_rect.mRight - orig_rect.mRight;
+ actual_delta_y = new_rect.mBottom - orig_rect.mBottom;
+ if (actual_delta_x != delta_x
+ || actual_delta_y != delta_y)
+ {
+ new_rect.mLeft = orig_rect.mLeft;
+ new_rect.mTop = orig_rect.mTop;
+ resizing_view->setShape(new_rect, true);
+ }
+
+ mDragLastScreenX += actual_delta_x;
+ mDragLastScreenY += actual_delta_y;
break;
default:
break;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 144b6960a1..46fbd1e6a0 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -239,7 +239,8 @@ LLTextEditor::Params::Params()
show_line_numbers("show_line_numbers", false),
default_color("default_color"),
commit_on_focus_lost("commit_on_focus_lost", false),
- show_context_menu("show_context_menu")
+ show_context_menu("show_context_menu"),
+ enable_tooltip_paste("enable_tooltip_paste")
{
addSynonym(prevalidate_callback, "text_type");
}
@@ -258,7 +259,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mTabsToNextField(p.ignore_tab),
mPrevalidateFunc(p.prevalidate_callback()),
mContextMenu(NULL),
- mShowContextMenu(p.show_context_menu)
+ mShowContextMenu(p.show_context_menu),
+ mEnableTooltipPaste(p.enable_tooltip_paste)
{
mSourceID.generate();
@@ -1411,6 +1413,23 @@ void LLTextEditor::pasteHelper(bool is_primary)
// Clean up string (replace tabs and remove characters that our fonts don't support).
LLWString clean_string(paste);
+ cleanStringForPaste(clean_string);
+
+ // Insert the new text into the existing text.
+
+ //paste text with linebreaks.
+ pasteTextWithLinebreaks(clean_string);
+
+ deselect();
+
+ onKeyStroke();
+ mParseOnTheFly = TRUE;
+}
+
+
+// Clean up string (replace tabs and remove characters that our fonts don't support).
+void LLTextEditor::cleanStringForPaste(LLWString & clean_string)
+{
LLWStringUtil::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB);
if( mAllowEmbeddedItems )
{
@@ -1429,10 +1448,11 @@ void LLTextEditor::pasteHelper(bool is_primary)
}
}
}
+}
- // Insert the new text into the existing text.
- //paste text with linebreaks.
+void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string)
+{
std::basic_string<llwchar>::size_type start = 0;
std::basic_string<llwchar>::size_type pos = clean_string.find('\n',start);
@@ -1451,15 +1471,8 @@ void LLTextEditor::pasteHelper(bool is_primary)
std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,clean_string.length()-start);
setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr()));
-
- deselect();
-
- onKeyStroke();
- mParseOnTheFly = TRUE;
}
-
-
// copy selection to primary
void LLTextEditor::copyPrimary()
{
@@ -1680,19 +1693,50 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
return FALSE;
}
-
+
if (mReadOnly && mScroller)
{
handled = (mScroller && mScroller->handleKeyHere( key, mask ))
|| handleSelectionKey(key, mask)
|| handleControlKey(key, mask);
+ }
+ else
+ {
+ if (mEnableTooltipPaste &&
+ LLToolTipMgr::instance().toolTipVisible() &&
+ KEY_TAB == key)
+ { // Paste the first line of a tooltip into the editor
+ std::string message;
+ LLToolTipMgr::instance().getToolTipMessage(message);
+ LLWString tool_tip_text(utf8str_to_wstring(message));
+
+ if (tool_tip_text.size() > 0)
+ {
+ // Delete any selected characters (the tooltip text replaces them)
+ if(hasSelection())
+ {
+ deleteSelection(TRUE);
+ }
+
+ std::basic_string<llwchar>::size_type pos = tool_tip_text.find('\n',0);
+ if (pos != -1)
+ { // Extract the first line of the tooltip
+ tool_tip_text = std::basic_string<llwchar>(tool_tip_text, 0, pos);
+ }
+
+ // Add the text
+ cleanStringForPaste(tool_tip_text);
+ pasteTextWithLinebreaks(tool_tip_text);
+ handled = TRUE;
+ }
+ }
+ else
+ { // Normal key handling
+ handled = handleNavigationKey( key, mask )
+ || handleSelectionKey(key, mask)
+ || handleControlKey(key, mask)
+ || handleSpecialKey(key, mask);
}
- else
- {
- handled = handleNavigationKey( key, mask )
- || handleSelectionKey(key, mask)
- || handleControlKey(key, mask)
- || handleSpecialKey(key, mask);
}
if( handled )
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 40821ae9fb..e60fe03e58 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -64,7 +64,8 @@ public:
ignore_tab,
show_line_numbers,
commit_on_focus_lost,
- show_context_menu;
+ show_context_menu,
+ enable_tooltip_paste;
//colors
Optional<LLUIColor> default_color;
@@ -288,6 +289,8 @@ private:
// Methods
//
void pasteHelper(bool is_primary);
+ void cleanStringForPaste(LLWString & clean_string);
+ void pasteTextWithLinebreaks(LLWString & clean_string);
void drawLineNumbers();
@@ -321,6 +324,7 @@ private:
BOOL mAllowEmbeddedItems;
bool mShowContextMenu;
bool mParseOnTheFly;
+ bool mEnableTooltipPaste;
LLUUID mSourceID;
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp
index e4d1a37569..00d52fe10d 100644
--- a/indra/llui/lltoggleablemenu.cpp
+++ b/indra/llui/lltoggleablemenu.cpp
@@ -101,3 +101,8 @@ bool LLToggleableMenu::toggleVisibility()
return true;
}
+
+bool LLToggleableMenu::addChild(LLView* view, S32 tab_group)
+{
+ return addContextChild(view, tab_group);
+}
diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h
index 2094bd776f..4717b0d0ba 100644
--- a/indra/llui/lltoggleablemenu.h
+++ b/indra/llui/lltoggleablemenu.h
@@ -47,6 +47,8 @@ public:
virtual void handleVisibilityChange (BOOL curVisibilityIn);
+ virtual bool addChild (LLView* view, S32 tab_group = 0);
+
const LLRect& getButtonRect() const { return mButtonRect; }
// Converts the given local button rect to a screen rect
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 81ea0ebf0c..63b7e452d2 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -117,7 +117,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mButtonEnterSignal(NULL),
mButtonLeaveSignal(NULL),
mButtonRemoveSignal(NULL),
- mDragAndDropTarget(false)
+ mDragAndDropTarget(false),
+ mCaretIcon(NULL)
{
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon;
@@ -830,7 +831,12 @@ void LLToolBar::draw()
LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
// Position the caret
- LLIconCtrl* caret = getChild<LLIconCtrl>("caret");
+ if (!mCaretIcon)
+ {
+ mCaretIcon = getChild<LLIconCtrl>("caret");
+ }
+
+ LLIconCtrl* caret = mCaretIcon;
caret->setVisible(FALSE);
if (mDragAndDropTarget && !mButtonCommands.empty())
{
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index a50c60282c..31424a36d4 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -37,6 +37,7 @@
class LLToolBar;
class LLToolBarButton;
+class LLIconCtrl;
typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t;
typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t;
@@ -284,6 +285,8 @@ private:
button_signal_t* mButtonRemoveSignal;
std::string mButtonTooltipSuffix;
+
+ LLIconCtrl* mCaretIcon;
};
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index f737d48abf..7f1566d64a 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -390,6 +390,15 @@ bool LLToolTip::hasClickCallback()
return mHasClickCallback;
}
+void LLToolTip::getToolTipMessage(std::string & message)
+{
+ if (mTextBox)
+ {
+ message = mTextBox->getText();
+ }
+}
+
+
//
// LLToolTipMgr
@@ -594,5 +603,14 @@ void LLToolTipMgr::updateToolTipVisibility()
}
+// Return the current tooltip text
+void LLToolTipMgr::getToolTipMessage(std::string & message)
+{
+ if (toolTipVisible())
+ {
+ mToolTip->getToolTipMessage(message);
+ }
+}
+
// EOF
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index d71a944c3d..fad127fc4c 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -105,6 +105,8 @@ public:
LLToolTip(const Params& p);
void initFromParams(const LLToolTip::Params& params);
+ void getToolTipMessage(std::string & message);
+
private:
class LLTextBox* mTextBox;
class LLButton* mInfoButton;
@@ -142,6 +144,8 @@ public:
LLRect getMouseNearRect();
void updateToolTipVisibility();
+ void getToolTipMessage(std::string & message);
+
private:
void createToolTip(const LLToolTip::Params& params);